unifhy-org / unifhy

A Unified Framework for Hydrology
https://unifhy-org.github.io/unifhy
BSD 3-Clause "New" or "Revised" License
12 stars 5 forks source link

Review remapping approach #43

Closed ThibHlln closed 3 years ago

ThibHlln commented 3 years ago

At the moment, the remapping is done by using the two underlying cf.Field of the components' SpaceDomain and the regrids method between the source and destination components' fields. This results in recalculating the remapping weights for every single iteration, which is extremely slow and unnecessary because the geometries do not change between timesteps.

I have raised an issue on the cf-python repository (https://github.com/NCAS-CMS/cf-python/issues/222) to see if they can find a way to cache the weights if repeatedly doing the remapping from already used geometries. This appears to be a limitation of what is offered by esmpy. If this cannot be resolved internally to cf-python, we would need to work on an alternative.

Alternatives I can think of include:

ThibHlln commented 3 years ago

cf-python can now return a RegridOperator from regrids/regridc so that the expensive remapping weights generation can be done once and re-used in regrids/regridc in place of destination field. This new feature will be available in cf-python==3.10.0.