-
Notifications
You must be signed in to change notification settings - Fork 2
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
cdutil.ANNUALCYCLE.climatology fails with "months since *" time axis #20
Comments
Can you try with other units than "months since"? I think it is the problem. "months since" is not cf-1 compliant. |
@dnadeau4 it seems I will have to impose a new time axis, but it would be great if the code either reported out the issue to a user, or even better, attempted to regenerate a valid time axis, threw a warning to a user and calculated the result anyway |
I think the difficulties with months since are "bounds" in the timeSlicer which are very difficult to handle especially in climatology. @doutriaux1 knows a lot about the timeSlicer. |
@dnadeau4 as an FYI, the file in question doesn't include bounds, but I assume the code would need to generate these |
@durack1 that is your issue, no bounds, it used to throw a nicer error message. |
@doutriaux1 fair enough, it would be useful to catch these |
months since is not the issue. It's valid and very useful actually in this context when you want to weight every months the same in a season. |
@doutriaux1 ok a question, if you believe these are valid, then if I inject a |
no. It's actually why we stop generating month automatically. The bounds will be generated half way between the values so half december to half jan and you will end up with wrong results. What you really want is |
@doutriaux1 @dnadeau4 ok so it works! Nice! In [4]: import cdms2, cdutil, os
...: os.chdir('/export/duro/tmp')
...: f = 'argo_2005-2017_grd.nc'
...: fH = cdms2.open(f)
...: t = fH('PTEMP',time=('2005','2017'))
...: # Set time bounds to monthly
...: cdutil.setTimeBoundsMonthly(t)
...: # Calculate annualCycle climatology
...: tAnClim = cdutil.ANNUALCYCLE.climatology(t)
In [5]: t.shape
Out[5]: (145, 27, 180, 360)
In [6]: tAnClim.shape
Out[6]: (12, 27, 180, 360) I wonder if |
Can you print a warning and stop, when the units are "months since *" and there are no time bounds? The warning just has to tell the user that the bounds are missing in the file, but that they can be generated by hand with cdutil.setTimeBoundsMonthly What's the default for setAutoBounds this days? Is it on or off by default? I used to get this |
@jypeter that's what i believed it used to di. I have to see why it's not raising a warning when bounds are missing any longer. |
Marking issue as stale, since there has been no activity in 30 days. Unless the issue is updated or the 'stale' tag is removed, this issue will be closed in 7 days. |
@jasonb5 this could be solved if cdtime better dealt with this non-CF (http://cfconventions.org/cf-conventions/cf-conventions.html) time axis. At minimum an error or warning being thrown noting the time axis is does not conform to standards would be a usability improvement |
Marking issue as stale, since there has been no activity in 30 days. Unless the issue is updated or the 'stale' tag is removed, this issue will be closed in 7 days. |
In a file that I downloaded, the time axis looks like:
When attempting to use
cdutil.ANNUALCYCLE.climatology
I get the following error:@dnadeau4 @doutriaux1
The text was updated successfully, but these errors were encountered: