Loading UM .pp data with 360_day calendar

29 views
Skip to first unread message

Max Coleman

unread,
Aug 12, 2021, 10:27:01 AM8/12/21
to SciTools (iris, cartopy, cf_units, etc.) - https://github.com/scitools
Hi everyone,

I'm struggling to get some output from UM runs in .pp format, with a 360_day calendar, to load in iris. I want to load a file that has hourly output for one model year (2014) of a single diagnostic, but using iris.load (or load_cube or load_cubes) I get the error: 
'ValueError: invalid day number provided in cftime.datetime(2014, 2, 29, 0, 0, 0, 0, calendar='gregorian')'

I've tried constraining the loading using a datetime interval iris.Constraint to get values on 29th Feb in the hope iris will then expect this date, but still returns the same error. I've also tried constraining to select a date permitted by a gregorian calendar (e.g. 28th Feb) but still get the same error. I haven't tried using a callback in the load function as I'm not familiar with their use, but guessing it also operates after the load function initially reads the file so will probably return the same error?

Having downloaded just a smaller portion of data (just first two days of Jan), which does load okay, I've checked and it confirms the data definitely should have a 360_day calendar: running print(cube.coord('time')) returns, among the other details, calendar = '360_day'

I assume there is some way to specify the calendar you are expecting the file to have, or that Iris should identify it automatically. I can't find in the documentation a way to specify the expected calendar of the file, but maybe I have missed something. I've tried following advice in related previous posts on here and on NCAS CMS helpdesk, but also no luck. I'm thinking i'm either missing something very obvious or something is not working as it's supposed to.

Thanks for any help you can give :)
Max


Max Coleman

unread,
Aug 12, 2021, 11:09:48 AM8/12/21
to SciTools (iris, cartopy, cf_units, etc.) - https://github.com/scitools
Just discovered that on a different version: iris 2.0.0 (on python 2.7.15) it does work fine. I have been using iris 2.4.0 (on python 3.8.8) when I encountered the above error. 

If anyone did know of a solution to the problem on iris 2.4.0 would still be appreciated though, as would avoid having to deal with issues trying to get my code to run on python2.7!

Thanks,
Max

RuthC

unread,
Aug 17, 2021, 8:32:54 AM8/17/21
to SciTools (iris, cartopy, cf_units, etc.) - https://github.com/scitools
Hi Max,

what versions of Iris and cftime are you using?  Iris versions up to v3.0.3 required an older cftime version (<1.3).  The latest Iris release is v3.0.4 and works with the latest cftime (v1.5).

Ruth

Max Coleman

unread,
Aug 23, 2021, 9:45:07 AM8/23/21
to SciTools (iris, cartopy, cf_units, etc.) - https://github.com/scitools
Hi Ruth,

Thanks, I think that might be it - currently have cftime 1.4.1 but iris 2.4.0 

Was using an environment recommended for Iris on my uni's computing cluster, so looks like I'll have to make my own *gulp*. Will bear the cftime version number in mind, thanks :)

Max
Reply all
Reply to author
Forward
0 new messages