pytroll / pyresample

Geospatial image resampling in Python
http://pyresample.readthedocs.org
GNU Lesser General Public License v3.0
346 stars 94 forks source link

Fix bbox creation for SwathDefinitions with NaNs #479

Closed djhoese closed 1 year ago

djhoese commented 1 year ago

I ran into this with some VIIRS data and some AVHRR data. In one case I had a couple rows/scans of data that had NaNs in them so some of the bbox coordinates were NaN. This resulted in bbox coordinates being returned, but being invalid (had NaNs). In another case the top couple scans of the swath were all NaNs so you'd get some hard to decipher error about NaN values. Sometimes these only made themselves obvious when you made a Boundary/Polygon and tried to do some calculation with them.

This PR fixes these cases or improves the error messages by removing any bbox points that have NaN for one of the coordinates.

CC @ghiggi

codecov[bot] commented 1 year ago

Codecov Report

Merging #479 (ac45d86) into main (80aeb8e) will increase coverage by 0.01%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #479      +/-   ##
==========================================
+ Coverage   94.31%   94.32%   +0.01%     
==========================================
  Files          74       74              
  Lines       12855    12890      +35     
==========================================
+ Hits        12124    12159      +35     
  Misses        731      731              
Flag Coverage Δ
unittests 94.32% <100.00%> (+0.01%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pyresample/geometry.py 87.50% <100.00%> (+0.10%) :arrow_up:
pyresample/test/test_geometry.py 99.54% <100.00%> (+<0.01%) :arrow_up:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

coveralls commented 1 year ago

Coverage Status

Coverage increased (+0.02%) to 93.851% when pulling ac45d860c399866b227136eec1b34f575fb716cd on djhoese:bugfix-swath-bbox-nans into 80aeb8e648d1043a8f193d6930ed3ee6404be4d7 on pytroll:main.