Skip to content
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

Datetime indices don't match between old and new versions of ACCESS-OM2 #86

Closed
aidanheerdegen opened this issue Jun 22, 2018 · 0 comments

Comments

@aidanheerdegen
Copy link
Collaborator

Since the update to yatm and libaccessom2 the dates in the data files are no longer consistent.

With the older data files you could access them through the cookbook like so:

expt =  '025deg_jra55v13_ryf8485_KDS75'
variable = 'ke_tot'
darray = cc.get_nc_variable(expt,
                             'ocean_scalar.nc',
                             variable,
                             time_units='days since 1900-01-01')

In the data file the time axis is actually days since 0001-01-01 00:00:00, and the origin of the time axis was the same: dates started in year 0001. By specifying time_units='days since 1900-01-01' the time axis is remapped to start at a time that is within the limits of pandas time stamps.

The new data files have their time axis specified as days since 0001-01-01 00:00:00 but the values in the time dimension in the first file are 693150.5, which means they start at year 1900. The workaround for this is to not specify time_units in the call to get_nc_variable (or set it to None). Then no date/time shift is performed and it works fine.

The issue comes with convenience routines like cc.plots.annual_scalar, which take multiple experiments as arguments and try to plot them together.

Some possible solutions:

  1. Move all time series to an arbitrary date and then say they are “years since start of run”
  2. Check for origin and apply shift only to those that need it

There is an additional hurdle/wrinkle. xarray now supports arbitrary dates and unusual calendars by using the cftime library and and creating a CFTimeIndex

http://xarray.pydata.org/en/stable/time-series.html#non-standard-calendars-and-dates-outside-the-timestamp-valid-range

This needs to be explicitly "turned on" with an xarray option (until v0.11 is released) and there is currently no support for resampling, which is how the annual mean is calculated internally in cc.plots.annual_scalar:

https://github.com/OceansAus/cosima-cookbook/blob/master/cosima_cookbook/diagnostics/simple.py#L20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants