Open durack1 opened 7 years ago
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. And NO cdat will NEVER/EVER "fix" the data for the user. All we do is let the user know about the software being unable to go forward with the data as is and we thrive to provide a suggestion of what could be done about it. Obviously fail here.
@doutriaux1 fair enough, it would be useful to catch these months since *
cases generically then, and throw an error saying this non-CF compliant time unit cannot be processed. I've now generated a workaround, so could throw that back to your for a bug fix problem data
section of the website
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 cdms2.setAutoBounds(1)
should this work?
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 cdutil.setTimeBoundsMonthly(data)
@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 time:units = "months since *
, if you try cdutil.setTimeBoundsMonthly(data)
as a first pass to attempt to process things for the user?
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 'NoneType' object has no attribute '__getitem__'
error when using cdutil.averager on data that had no lon and lat bounds (when setAutoBounds was off by default). I knew what to do in that case, but my users were usually lost. Can somebody check if cdutil.averager will now print a useful warning as well?
@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