JiaweiZhuang / xESMF

Universal Regridder for Geospatial Data
http://xesmf.readthedocs.io/
MIT License
269 stars 49 forks source link

Retrieve regridding coverage #76

Closed jorgsk closed 4 years ago

jorgsk commented 4 years ago

I have a use-case where I'm regridding quantities that change geographically with time (e.g. a pollution plume in the atmosphere or in the ocean) from a finer to a coarser grid. If regridding for example 4 grid cells to 1, in the first timestep there might be 4 cells in the original grid that had a non nan/masked quantitiy, while in the second timestep only 1 cell has a non nan/masked quantitiy.

I would like to find a way to report a "coverage" for each timestep in the coarser grid. In the first timestep it should be 100 % for the mentioned cell, while in the second timestep it should be 25 %.

Is there a way to obtain this information?

JiaweiZhuang commented 4 years ago

If I understand correctly, you can set valid values to 1, and setnan values to 0. Then, the conservative averaging result should be the fraction you want?

jorgsk commented 4 years ago

If I understand correctly, you can set valid values to 1, and setnan values to 0. Then, the conservative averaging result should be the fraction you want?

That should work. Thanks!