lesommer / oocgcm

oocgcm is a python library for the analysis of large gridded geophysical dataset.
http://oocgcm.rtfd.io
Apache License 2.0
39 stars 11 forks source link

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

Open lesommer opened 8 years ago

lesommer commented 8 years ago

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 commented 8 years ago

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

see also this thread

lesommer commented 8 years ago

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

serazing commented 8 years ago

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