-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Investigate / document CDAT-xCDAT spatial differences (again) #500
Comments
For a subset of models and domains, the CDAT-xCDAT differences were traced to CDAT dropping the model's latitude bounds (and then replacing the bounds with its own calculated bounds). This resulted in different weights and small differences in the area averages (see table at bottom). First – an example of incorrect bounds: Excerpt of
These appear to match the bounds in cdscan. But they are different from those loaded using cdms2: fn = '/p/user_pub/xclim/CMIP5/CMIP/historical/atmos/mon/tas/CMIP5.CMIP.historical.BNU.BNU-ESM.r1i1p1.mon.tas.atmos.glb-z1-gu.1.0000000.0.xml'
f = cdms2.open(fn)
tas = f('tas')
print(tas.getLatitude().getBounds())
If I drop the
|
In another small set of cases (see table below), small differences seem to be introduced by the precision of the axis information. For example: The If I cast the In the past (and repeated here), this issue had been resolved with my own averaging calculations. We could not figure out why my calculations differed from
|
One set of cases that I don't fully understand is with CESM2-WACCM (see differences). The bounds and weights appear to be identical in CDAT and xCDAT. The differences are "all close" if I either a) manually calculate the spatial average (10-5 differences), b) reverse the axis order when averaging in xcdat (10-3 differences), or drop and recompute the latitude bounds (and weights) (10-7 differences). Unlike with IPSL data (above) the axes seem to be stored (and opened) with If we accept this as an explanation, this resolves 4/28 differences (3/28 left to figure out).
|
The final set of differences (see table below) appear to be related to incorrect longitude weights assigned by CDAT in rare instances. For example, for the Sahel domain (
It correctly adjusts the bound of the lat grid cell (from 9.375 : 11.25 to 9.375 : 10.), but it drops weight from the grid cell spanning (-11.25 : -9.375) [it isn't listed]. xCDAT does weight this grid cell:
Note the partial weights in the first and last grid cells. I don't know why CDAT doesn't provide the correct weights in these rare instances. This resolves the final 3 CDAT / xCDAT discrepancies.
|
The issue that prompted the PR has to do with an E3SM dataset with unusual bounds. The first set of bounds span 359.6484375 to 0.3515625. This appears to be inconsistent with CF-conventions (see, e.g., here) which states that bounds should be increasing. We don't have examples of bounds like this in the CMIP archive. If bounds wrap around the prime meridian they are stored in increasing order, e.g., The weird E3SM bounds are not handled correctly by the spatial averager in |
Thanks for documenting the 28 cases where you found differences in the spatial averaging results between CDAT and xCDAT. I was able to follow your findings for these cases and am satisfied with the explanations.
As mentioned in this comment, we found that CDAT incorrectly type casts weights to |
I am also happy with where things are. I think this can be closed with #495. |
A recent issue prompted me to look through (and update) the spatial averaging routine.
I validated this PR by looking at monthly CMIP5/6 historical tas files (1 per model for 117 climate models) and 21 averaging domains (I skipped NAFM due to this discussion).
In validating the proposed changes, I have (again) come across CDAT-xCDAT differences. In 28 cases of 2415 cases (1.1%) the spatial averages are different (as judged by
np.allclose()
). The monthly differences are mostly below 0.01 K, but exceed 0.1 (in rare cases). These results apply to both the current release v0.5.0 and the proposed PR.I plan to summarize the reasons for the differences in this issue.
The text was updated successfully, but these errors were encountered: