jhardenberg / smmregrid

A compact regridder using sparse matrix multiplication
Apache License 2.0
8 stars 0 forks source link

Refactoring of the grid handling to possibly support more complex data structures #33

Open oloapinivad opened 1 month ago

oloapinivad commented 1 month ago

A first tests of GridInspector() class and some gridtype based operation as discussed in #32 Target is still far but the idea is in place.

oloapinivad commented 1 month ago

🚀 🚀 🚀

oloapinivad commented 1 month ago

After all this machinery, everything is now working as it was originally, meaning that the Gridtype introduction allow for backward compatibility, at least with the current testing strategy

A lot of things must be still improved:

Long terms ideas

oloapinivad commented 1 month ago

@jhardenberg @mnurisso this can be considered ready to me. I will move the remaining issues (e.g. the creation of a class for generation of weights) to new issues and possibly develop this in the future.

It will be interesting to see which of the features of AQUA should be moved here for a cleaner operativity. For example, now all the dimensions guessing is done inside smmregrid so it should be completely redundant what is done in AQUA. Also, given the properties of the tool, also the grid are generator can be moved here as a specific class (or a twin object of the generation of weights).

oloapinivad commented 1 month ago

I spotted a couple of cases that slipped through the tests, most importantly the one when the time dimension has been dropped. We could make a bit of discussion on the implementation of the GridType class in order to see if there are better possible definitions. Now everything should be back in place.

oloapinivad commented 1 month ago

Trying to address #34, first tests are positive. We need to extract more information from the CDO weights, since there are data structure details on which we can build

oloapinivad commented 1 month ago

I created a new class CdoGenerate() which has two exposed method, one is weights() and the other is areas() so that it can produce both weights and areas and easily port them to python.

I tried to divide the many options available in order that the ones CDO-related all fill into the class while the other goes into the method. Feel free to suggest improvements. I still need to write some tests to check everything works as expected, but it is quite straightforward since I am using direct cdo calls.

In the future, we could expand it with a Generate()class that divide in CdoGenerate(), MirGenerate() or whatever tool we want to support

oloapinivad commented 1 month ago

Added supplementary testing, everything seems in place. Consolidation might be required but it would be great if this is done upon review (taggin @jhardenberg for this)