geoschem / integrated_methane_inversion

Integrated Methane Inversion workflow repository.
https://imi.readthedocs.org
MIT License
26 stars 23 forks source link

Ensuring we find all GEOS-Chem grid cells that intersect a TROPOMI pixel #110

Closed nicholasbalasus closed 1 year ago

nicholasbalasus commented 1 year ago

What institution are you from?

Harvard University

Description of the problem

The GEOS-Chem grid is continuous in time and space, so a TROPOMI observation should always be able to find a matching GEOS-Chem simulated atmosphere. This means code like this should never be true. Theoretically, sum(overlap_area) == polygon_tropomi.area should always be true (at least for a global simulation). I suggest we add a test for this.

Description of troubleshooting performed

I will implement this eventually, just noting it here since others might run into it if running a global simulation. For a global simulation, we could simply add assert sum(overlap_area) == polygon_tropomi.area. For a nested-grid simulation, we could do the same, but would need to not check this for TROPOMI pixels that interest the boundaries of the simulation (since the simulation will not be available for the entire TROPOMI pixel area in this case).

Adding this test will reveal some issues with how we find GEOS-Chem pixels that intersect a TROPOMI pixel. nearest_loc, as currently implemented, searches for GEOS-Chem pixels within a 0.5 degree threshold of the TROPOMI pixel corners. This threshold will need to be changed to be dynamic (maybe something like the max of the width/height of the TROPOMI pixel and the width/height of the GEOS-Chem pixels to account for coarse simulations and TROPOMI pixels that are large such as > 1 degree in width).

IMI version

1.1.0

Description of modifications

None yet, but I will implement this soon as:

  1. Add test to ensure overlapping area of TROPOMI and GC is equal to the area of the TROPOMI pixel (unless the pixel intersects the boundaries of a nested-grid simulation).
  2. Adjust nearest_loc as necessary for the situations the test fails under. Adjust filter_tropomi as necessary (to filter out pixels that cross the anti-meridian, for example, where this will fail because we can't construct the polygon correctly).
nicholasbalasus commented 1 year ago

Tested for the global simulation, closed by #156