ssec / polar2grid

Tools for reading, remapping, and writing satellite instrument data.
http://www.ssec.wisc.edu/software/polar2grid/
GNU General Public License v3.0
71 stars 33 forks source link

Anti-meridian crossing problems #605

Closed kathys closed 9 months ago

kathys commented 1 year ago

After adding the Honolulu Hawaii antenna data to my operational processing stream, I could see that the add_coastlines.sh script was not handling the crossing of the anti-meridian correctly. The image looked complete, but the overlaid map not only showed the Southeast Asian coast on the right but it was also reversed.

Dave suggested that I try this option in the P2G commands that create the GeoTIFFS:

--antimeridian-mode modify_extents but that did not work, but ended up with an image that was cut off at the anti-meridian and still resulted in the wrong overlaid map.

data here--> bumi:/data/users/kathys/test_data/viirs_honolulu

djhoese commented 1 year ago

So I've done a little debugging and I have an idea what is going on here. I think pycoast (the library drawing the coastlines) assumes that any geographic (meaning lon/lat) projection is the same generic prime-meridian-0 projection. These "adjusted" projections in the cases you're running into are not this projection so calculations and assumptions are just wrong.

I know you were concerned about certain people in Alaska or Hawaii running into this and in the case of the default wgs84_fit this is a valid (likely) concern. But if these users are using any of the polar_alaska_X or merc_pacific_X or some other region-specific grid, they'll be fine since these have their reference longitudes shifted near the anti-meridian. The antimeridian_mode in Polar2Grid (pyresample) is only used for lon/lat projections currently. So if people were using a mercator projection for example with reference longitude at 0 where they would then see issues over the anti-meridian, the extents of the grid get set to the limits (-180 and 180 in longitude terms) of the projection. So you get one big wide image, but coastlines work fine.

So what I'm trying to say is that this likely isn't as big of an issue for as many people as we were worried about. I'll still see if I can figure out the lon/lat stuff in pycoast.

djhoese commented 1 year ago

Fixed by https://github.com/pytroll/pycoast/pull/98

kathys commented 1 year ago

Nicely done Dave. I did do a lot of testing with VIIRS/MODIS data in Alaska, so I was surprised when this turned out to be a problem for Honolulu. But your explained in nicely.

djhoese commented 9 months ago

I'm going to close this. As mentioned above, the main issues in pycoast have been resolved. There still might be issues of lines going across anti-meridians but I think those issues should be described in a separate issue with specific cases as it is now hard to say what versions are causing what output...at least until we get a P2G 3.1 or G2G 1.2 released.