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

ENH: xarray support in CDF interface #92

Closed
jklenzing opened this issue Oct 20, 2021 · 7 comments
Closed

ENH: xarray support in CDF interface #92

jklenzing opened this issue Oct 20, 2021 · 7 comments
Labels
enhancement New feature or request
Milestone

Comments

@jklenzing
Copy link
Member

Is your feature request related to a problem? Please describe.
Currently, only pandas objects are supported.

Describe the solution you'd like
xarray support needs to be added to the CDF interface to better support data products.

Describe alternatives you've considered
😿

Additional context
precursor to #14

This was referenced Oct 20, 2021
@jklenzing
Copy link
Member Author

jklenzing commented Oct 21, 2021

Poking around in the CDF code, it might be cleanest to assume the xarray is the default throughout, then export to pandas if pandas_format is True at the end of the to_pysat method. @rstoneback @JonathonMSmith any thoughts?

@rstoneback
Copy link
Collaborator

I think that's ok. I'm using that technique in the cosmic data so I really don't have any room to say no. Speaking of.... I still need to work on that pull.

@jklenzing jklenzing added this to the 0.1.0 Release milestone Dec 23, 2021
@jklenzing jklenzing added the enhancement New feature or request label Feb 24, 2022
@jklenzing
Copy link
Member Author

cdflib 0.4 includes xarray support. Need to test this.

@JonathonMSmith
Copy link
Collaborator

I'd like to work on this but I need some guidance on how we want this to look.
Currently, some instruments hard code the "pandas_format" variable that specifies that they always use xarray for the data.
Is "pandas_format" something we want to be a kwarg when you instantiate a new instrument object?
Will pysatCDF get xarray support in the near future?

another thought...
If pysat were to use xarray completely, could the xarray attrs and varibale attrs completely replace the meta object?

@jklenzing
Copy link
Member Author

jklenzing commented May 17, 2022

My thought is that the cdf functions would look similar to the load_netcdf function in the core package. It would accept the pandas_format kwarg, which stems from info hard-wired in each instrument depending on dimensionality. Depending on the kwarg, the load statement decides whether to use existing code (pandas) or the to-be-added xarray code. Note that if pandas_format is not specified in an instrument, it is assumed to be True upon instantiation by the core code.

We've talked about potentially allowing a user to load a pandas set as an xarray set with optional kwargs. Not sure if this is on the roadmap or just a possibility.

I don't think we want to migrate completely to xarray just yet. I've thought about this, but I think this is well out in the future if we decide to go that route. In theory, this could replace the meta object, but that's above my pay grade.

@rstoneback
Copy link
Collaborator

As @jklenzing noted there is keyword argument support in load_netcdf. pysat_netcdf general instrument also has pandas_format keyword, which is passed to load_netcdf, to support loading into pandas or xarray.

I'd like to add xarray in the near future but I need to generate more funding so I need to hold off on doing it ahead of time. Current thinking is to apply to the new tools version of HDEE, with open submission deadlines, to add xarray support to pysatCDF. As you know, that all takes time. Was thinking of introducing this at next pysat meeting but topic came up :)

@JonathonMSmith JonathonMSmith mentioned this issue May 20, 2022
9 tasks
@jklenzing
Copy link
Member Author

Closing with merge of #120

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

No branches or pull requests

3 participants