Closed ThibHlln closed 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
.
At the moment, the remapping is done by using the two underlying
cf.Field
of the components'SpaceDomain
and theregrids
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 byesmpy
. If this cannot be resolved internally tocf-python
, we would need to work on an alternative.Alternatives I can think of include:
esmpy
directly incm4twc
to dynamically generate the weights file depending on the components' resolutions, and then hold on to this weight file to do the remapping withesmpy
rather thancf-python
for each time stepesmpy
(or any other remapping software) to generate the weights file offline (for a limited number of resolutions, those for Hydro-JULES) and read in this file incm4twc
to do the remapping withesmpy
for each time step