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: Support for xarray #3

Closed
jklenzing opened this issue Sep 18, 2019 · 3 comments · Fixed by #30
Closed

ENH: Support for xarray #3

jklenzing opened this issue Sep 18, 2019 · 3 comments · Fixed by #30
Labels
enhancement New feature or request
Milestone

Comments

@jklenzing
Copy link
Member

Linked from pysat/pysat#47.

Current seasonal routines assume pandas data. This needs to be generalized to accept xarray data.

@jklenzing jklenzing changed the title Support for xarray ENH: Support for xarray Sep 18, 2019
@jklenzing jklenzing added the enhancement New feature or request label Sep 18, 2019
@jklenzing jklenzing added this to the 0.2.0 release milestone Sep 21, 2019
@jklenzing
Copy link
Member Author

Once generalized, xarray can be used to replace Panel, addressing #4.

@jklenzing
Copy link
Member Author

Proof of concept:

import pysat
import numpy as np
lats = np.linspace(-90, 90, 20)
test_inst = pysat.Instrument('pysat', 'testing_xarray')
test_inst.load(2009, 1)
test_inst.data['latitude'].groupby_bins(test_inst.data['latitude'], lats).mean('time')

produces

<xarray.DataArray 'latitude' (latitude_bins: 19)>
array([-8.68204547e+01, -7.60356830e+01, -6.64236810e+01, -5.68964574e+01,
       -4.74291039e+01, -3.79554216e+01, -2.84429217e+01, -1.89403821e+01,
       -9.45146641e+00, -1.50410421e-15,  9.45146641e+00,  1.89403821e+01,
        2.84429217e+01,  3.79554216e+01,  4.74092899e+01,  5.68964574e+01,
        6.64236810e+01,  7.60356830e+01,  8.68242926e+01])
Coordinates:
  * latitude_bins  (latitude_bins) object (-90.0, -80.526] ... (80.526, 90.0]

Needs to be generalized for N dimensions. Looking through old stack overflows, this is not yet supported in xarray, but we may need to dig through the more recent documentation.

https://stackoverflow.com/questions/40465026/groupby-bins-on-two-variables

@rstoneback
Copy link
Collaborator

I have a potential method that scales to ND over in #22. I'm planning on including these very topics in the upcoming proposal to NASA.

@rstoneback rstoneback mentioned this issue Nov 19, 2021
10 tasks
@rstoneback rstoneback linked a pull request Feb 24, 2022 that will close this issue
18 tasks
@rstoneback rstoneback mentioned this issue Feb 25, 2022
18 tasks
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

Successfully merging a pull request may close this issue.

2 participants