-
Notifications
You must be signed in to change notification settings - Fork 11
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
How to reimplement grid coarsening and statistics-in-boxes in oocgcm ? #25
Comments
would xarray future multidimensional groupby operator be useful for this ? |
would cab-lab be useful for this ? |
Definitely could be done, but if your coarse graining is very regular (i.e. coarsen the grid by a specific factor, e.g. x2, x4, etc.) there is a faster implementation In this gist, I have an implementation of coarse-graining using dask's |
Here is just the aggregation function on its own: |
thanks for the suggestion and for sharing your code. Wrapping a function designed for numpy arrays is probably a good way to proceed. Do you have an idea of how efficient is building a list of sliced arrays for large arrays ?
with GriddedData.py mentionned above, I paid attention to avoid iterating on list of chunks. In practice I am using only numpy.reshape and numpy.swapaxes (see here) |
Another question is how to implement the possibility to reorganize lazily the data so that you can reshape it from say (Nx,Ny) in to (Nx/nx, Ny/ny, nx,ny) which can be usefull for building more advanced descriptive statistics than just variance and means in boxes. |
This discussion thread is probably relevant to the current issue. See also this discussion about stack/unstack on xarray. |
The functionnality available in GriddedData.py for coarsening a 2d field or reorganizing an array for building statistics out from values in a box would be a neat feature for oocgcm. But the current method works only for 2d numpy array. how to proceed ?
The text was updated successfully, but these errors were encountered: