Giter Site home page Giter Site logo

Comments (7)

lesommer avatar lesommer commented on June 14, 2024

would xarray future multidimensional groupby operator be useful for this ?

from oocgcm.

lesommer avatar lesommer commented on June 14, 2024

would cab-lab be useful for this ?

from oocgcm.

rabernat avatar rabernat commented on June 14, 2024

would xarray future multidimensional groupby operator 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 map_blocks
https://gist.github.com/rabernat/10029776541cfe018905

from oocgcm.

rabernat avatar rabernat commented on June 14, 2024

Here is just the aggregation function on its own:
https://gist.github.com/rabernat/cb4f97be6289ffd8fa9b

from oocgcm.

lesommer avatar lesommer commented on June 14, 2024

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 ?

result = reduce(np.add, [data[sl] for sl in slices])

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)

from oocgcm.

lesommer avatar lesommer commented on June 14, 2024

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.

from oocgcm.

lesommer avatar lesommer commented on June 14, 2024

This discussion thread is probably relevant to the current issue. See also this discussion about stack/unstack on xarray.

from oocgcm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.