ecmwf / earthkit-regrid

2 stars 0 forks source link

Use remote matrices #3

Closed sandorkertesz closed 10 months ago

sandorkertesz commented 11 months ago

The pre-generated interpolation matrices and the index json file describing them are now hosted under: https://get.ecmwf.int/repository/earthkit/regrid/matrices including the following input and output grids:


gg_res = [1280, 1024, 640, 512, 400, 320, 256, 200, 160, 128, 96, 80, 64, 48, 32]
in_grids_O_gg = [2560] + gg_res # octahedral GG
in_grids_N_gg = gg_res  # reduced GG

# latlon
out_grids_ll = [0.1, 0.15, 0.2,  0.25, 0.3,0.4,  0.5, 0.6, 0.7, 0.75, 0.8, 0.9, 
      1, 1.2, 1.25, 1.4, 1.5, 1.6, 1.8, 2, 2.5, 5, 10,]

The git repo itself does not contain the json index file and any of the matrices. All of these are downloaded on demand and stored in a cache on disk. To implement this I took the caching code from earthkit-data. However, the settings code was not taken and the cache is simply controlled by a hard-coded settings dict.

For testing purposes it is possible to use an index json file and matrices stored at a user defined path. This can be initiated by using the earthkit.regrid.db._use_local_index context manager. The tests in tests/test_local.py are using this technique to work with the index+matrix data stored in tests/data/local.

I added proper checks for the input and output gridspecs, e.g. sub-areas are now recognised and rejected. I had to reuse some gridspec code from the earthkit-data/feature/gridspec branch to implement this.

A notebook example is available at: https://earthkit-regrid.readthedocs.io/en/feature-remote-matrices/examples/interpolation.html

TODO

sandorkertesz commented 10 months ago

TODO: