ecmwf / atlas

A library for numerical weather prediction and climate modelling
https://sites.ecmwf.int/docs/atlas
Apache License 2.0
107 stars 41 forks source link

implement a procedure to carry out a regridding from high to low resolution (binning) #191

Closed mo-lormi closed 3 months ago

mo-lormi commented 4 months ago


Description


This PR is intended to extend the group of the interpolation operations, in particular to:

Rigridding from high to low resolution via binning ...

method: binning binning matrix: B = N A^T W area weights matrix: W interpolation matrix: A normalization factor matrix: N

Acceptance Criteria (Definition of Done)

All the tests pass.

mo-lormi commented 4 months ago

@wdeconinck , @odlomax This PR covers the implementation of the regridding procedure (from high to low resolution). At this stage, I implemented a simple test associated with the procedure to generate data in Gmsh format for data visualization. Further tests will be added.

odlomax commented 4 months ago

Thanks, @mo-lormi

Could you add some of the outputs to this PR so we can easily have a look?

mo-lormi commented 4 months ago

The following plots refer to two fields: 1) field: field_01_s ; regridding type: high to low; source grid: CS-LFR-100 2) field: field_01_t ; regridding type: high to low; target grid: CS-LFR-50

regridding_h2l_field_s regridding_h2l_field_t

twsearle commented 4 months ago

This looks very nice! I am curious as a bystander why you haven't used the interpolation elements. Perhaps if you had it would have worked for any grid? https://github.com/ecmwf/atlas/blob/develop/src/atlas/interpolation/element/Quad2D.h

Maybe out of scope though!

mo-lormi commented 4 months ago


I carried out further testing. The procedure also works for a different type of grid (function space: StructuredColumns).

The following plots refer to two fields: 1) field: field_02_s ; regridding type: high to low; source grid: O32 2) field: field_02_t ; regridding type: high to low; target grid: O16

(note -- It seems that a set of contiguous cells is missing in both plots. Thus, further investigation is needed)

regridding_h2l_field02_s regridding_h2l_field02_t

wdeconinck commented 4 months ago

@mo-lormi concerning the "missing" part in the Gmsh plot, is nothing to worry about. That's because the StructuredColumns fields are unlike NodeColumns and don't have extra duplicated nodes at 360 degrees.

mo-lormi commented 4 months ago

@mo-lormi concerning the "missing" part in the Gmsh plot, is nothing to worry about. That's because the StructuredColumns fields are unlike NodeColumns and don't have extra duplicated nodes at 360 degrees.

@wdeconinck thanks for this info ... To take into account this point, I will need to update the procedure.

mo-lormi commented 3 months ago


@wdeconinck thanks again for the comments and suggestions. I re-implemented the procedure to evaluate the areas of the grid cells based on your proposal. Thanks also to @odlomax for helping to identify the cause of a segmentation fault failure.

mo-lormi commented 3 months ago

Thanks so much for this contribution and addressing all my suggestions. 🙏

@wdeconinck thanks again.

wdeconinck commented 3 months ago

This will be released in 0.38.0 some time this week.