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

Subclassing DataArray to create a GriddedArray structure that refers to the grid ? #19

Open
lesommer opened this issue May 10, 2016 · 3 comments
Labels

Comments

@lesommer
Copy link
Owner

In the long term, it might be more pythonic for methods related to e.g. a scalar field (eg : its gradient, smoothing etc...) to be attributes of the dataArray itself.

grd = oocgcm.oceanmodels.nemo.grids.nemo_2d_grid(...)
ssh = oocgcm.oceanmodels.nemo.io.GriddedScalarArray('filessh.nc',grid=grd,grid_location='t')
ssh[0].gradient().divergence().plot() # plots the laplacian of ssh

@lesommer
Copy link
Owner Author

a discussion on how to subclass xarray datasets or xarray dataarrays can be found here.

see also this thread

@lesommer
Copy link
Owner Author

I should investigate whether the new decorator for registering accessor fits the need : see here

@serazing
Copy link
Collaborator

See also last updates of xarray and the documentation on xarray internals.

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

No branches or pull requests

2 participants