You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
Move all time series to an arbitrary date and then say they are “years since start of run”
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
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:
Since the update to
yatm
andlibaccessom2
the dates in the data files are no longer consistent.With the older data files you could access them through the cookbook like so:
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 year0001
. By specifyingtime_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 thetime
dimension in the first file are693150.5
, which means they start at year1900
. The workaround for this is to not specifytime_units
in the call toget_nc_variable
(or set it toNone
). 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:
There is an additional hurdle/wrinkle.
xarray
now supports arbitrary dates and unusual calendars by using thecftime
library and and creating aCFTimeIndex
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 (untilv0.11
is released) and there is currently no support for resampling, which is how the annual mean is calculated internally incc.plots.annual_scalar
:https://github.com/OceansAus/cosima-cookbook/blob/master/cosima_cookbook/diagnostics/simple.py#L20
The text was updated successfully, but these errors were encountered: