Isca icon indicating copy to clipboard operation
Isca copied to clipboard

utime no longer a class in cftime

Open RuthG opened this issue 1 year ago • 0 comments

I'm putting together some new SST input files and found that in recent cftime installations the utime class is not supported. This seems to be quite an old update, and breaks src/python/extra/scripts/calendar_calc.py in my current environment. I found I can get the code running with the below, based on cftime's docs & noting its updates say that utime is defunct. As I'm not clear on what utime originally should have done I thought I'd raise this as an issue rather than immediately changing anything.

If/when I do amend this, I'll try to add some comments to the code as well to make it easier to navigate/see how files interrelate.


def day_number_to_datetime_array(time_in, calendar_type, units_in):

    #cdftime = utime(units_in, calendar = calendar_type)

    date_out = cftime.num2date(time_in, units_in, calendar = calendar_type)

    return date_out

RuthG avatar May 02 '23 12:05 RuthG