Skip to content

WIP: convert to/from cdms2 variables #236

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

Merged
merged 2 commits into from
Dec 19, 2014
Merged

WIP: convert to/from cdms2 variables #236

merged 2 commits into from
Dec 19, 2014

Conversation

shoyer
Copy link
Member

@shoyer shoyer commented Sep 22, 2014

Fixes #133

@DamienIrving am I missing anything obvious here?

@DamienIrving
Copy link

Your approach looks good to me. All people need to be able to do is move to and from cdms2 transient variables and then they'll have access to all the convenience functions defined in cdat-lite libraries like cdutil and genutil.

@shoyer
Copy link
Member Author

shoyer commented Sep 22, 2014

So I understand cdat uses masked arrays for missing values. How does it handle dates?

On Mon, Sep 22, 2014 at 3:13 PM, Damien Irving [email protected]
wrote:

Your approach looks good to me. All people need to be able to do is move to and from cdms2 transient variables and then they'll have access to all the convenience functions defined in cdat-lite libraries like cdutil and genutil.

Reply to this email directly or view it on GitHub:
#236 (comment)

@DamienIrving
Copy link

I'm not sure exactly how it handles dates under the hood, however as a user before using a convenience function from the cdutil library to calculate a seasonal climatology or something, you have to use cdutil.setTimeBounds() to specify the time bounds of your data (i.e. whether it is daily, monthly, etc).

To view the time axis of a cdms2 transient variable in a convenient YYYY-MM-DD HH:MM:SS format (e.g. let's say that variable's name is data), you can use data.getTime().asComponentTime().

Does that help?

@shoyer
Copy link
Member Author

shoyer commented Sep 26, 2014

@DamienIrving Yes, that does help.

The main thing is I'm pretty sure CDAT's climatological related functions can't handle dates in the form of a np.datetime64 array (which xray uses), so we'll probably need to convert back into CF conventions style "days since YYYY-MM-DD".

@shoyer shoyer force-pushed the cdms2 branch 6 times, most recently from 0cb1836 to e919aaa Compare December 19, 2014 08:54
@shoyer shoyer added this to the 0.3.2 milestone Dec 19, 2014
@shoyer
Copy link
Member Author

shoyer commented Dec 19, 2014

@DamienIrving I'm going to merge this now. I did add support for encoding/decoding time information, but you should probably still consider this experimental for now. Please do let me know how it works for you when you get the chance to try it out.

I'll be releasing v0.3.2 with this within the next few days.

shoyer added a commit that referenced this pull request Dec 19, 2014
WIP: convert to/from cdms2 variables
@shoyer shoyer merged commit dc4422e into pydata:master Dec 19, 2014
@shoyer shoyer deleted the cdms2 branch December 19, 2014 09:11
@shoyer shoyer mentioned this pull request Oct 12, 2015
@nparley nparley mentioned this pull request Apr 1, 2016
keewis pushed a commit to keewis/xarray that referenced this pull request Jan 17, 2024
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Tom Nicholas <[email protected]>
Co-authored-by: Anderson Banihirwe <[email protected]>
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

Successfully merging this pull request may close these issues.

Functions for converting to and from CDAT cdms2 variables
2 participants