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

Use a proper datetime-like datatype in our output #258

Open
spencerahill opened this issue Mar 21, 2018 · 1 comment
Open

Use a proper datetime-like datatype in our output #258

spencerahill opened this issue Mar 21, 2018 · 1 comment

Comments

@spencerahill
Copy link
Owner

spencerahill commented Mar 21, 2018

Currently, the time dimension of aospy output is simply 'year' and an integer. E.g. data outputted from our tutorial:

In [40]: xr.open_dataset('~/Dropbox/py/aospy/aospy/examples/example-output/example_proj/example_model/example_run/precip_total/precip_total.ann.reg.ts.from_m
    ...: onthly_ts.example_model.example_run.0004-0006.nc')
Out[40]:
<xarray.Dataset>
Dimensions:              (year: 3)
Coordinates:
  * year                 (year) int32 1678 1679 1680
...

As we have discussed regarding custom reduction methods (#208), this indexing by year is too restrictive. I think we should replace it with a proper datetime object. This would enable using resample and groupby.

This is probably worth waiting until the cftime/netcdftime fixes upstream get incorporated. But I wanted to have this issue as a marker to make sure we don't forget this aspect of the output time types. @spencerkclark, any thoughts?

@spencerkclark
Copy link
Collaborator

I think this will largely be handled by adding functionality for custom reductions. Perhaps the default time reduction should be no reduction, as in #252 (which would maintain datetimes in the time coordinate in aospy output)?

Right now we always use groupby internally to convert data to a time series of annual means (this results in the 'year' coordinate of integer values), which is a totally valid reduction type, but perhaps not the most intuitive one for a default.

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

No branches or pull requests

2 participants