Skip to content

Fix VIIRS EDR using the wrong geolocation arrays #2842

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 27, 2024

Conversation

djhoese
Copy link
Member

@djhoese djhoese commented Jun 27, 2024

The VIIRS EDR CloudHeight files includes not only normal lon/lat arrays but a parallax corrected lon/lat. These parallax lon/lats don't include proper metadata (ex. _FillValue) so loading them causes fill values to remain like -999.9 instead of NaN. My previous code in this reader was rather naive and basically said if a variable name contained "longitude" or "latitude" then we should use it as the geolocation for our data arrays. This code was picking up the parallax corrected lon/lats instead of the "standard" ones. This PR is an attempt at making the reader smarter at choosing the right lon/lat arrays.

CC @kathys

  • Closes #xxxx
  • Tests added
  • Fully documented
  • Add your name to AUTHORS.md if not there already

Copy link

codecov bot commented Jun 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.94%. Comparing base (834f45d) to head (fc95ee1).
Report is 332 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2842   +/-   ##
=======================================
  Coverage   95.94%   95.94%           
=======================================
  Files         366      366           
  Lines       53561    53584   +23     
=======================================
+ Hits        51389    51412   +23     
  Misses       2172     2172           
Flag Coverage Δ
behaviourtests 4.04% <0.00%> (-0.01%) ⬇️
unittests 96.04% <100.00%> (+<0.01%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@pnuu pnuu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one question. Seems a bit magicky.

# "standard" geolocation coordinate (assume shorter variable name is "better")
new_name = (m_lon_name if res == 750 else i_lon_name) if is_lon else (
m_lat_name if res == 750 else i_lat_name)
if new_name not in coords or len(var_name) < len(coords[new_name]["file_key"]):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be better to check explicitly for the parallax correction in the variable name? Or are there multiple of these that have "longitude" in the name? This name-length check would fail if they decided to add lon and lat as the "normal" coordinate arrays and the reader would need to adapted for them.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. You're right that the more explicit/specific solution would be to just check for the exact case I'm solving for. However, these parallax correction versions only show up (as far as I can find) in the "CloudHeight" files. Since this reader is supposed to be generic and potentially able to handle any VIIRS EDR file I'm worried about a hardcoded solution like that being not useful for these cases.

Side note: The SurfRefl files have multiple lon/lat arrays for the different resolutions of VIIRS, but I had to do some other customizations for these data files so they are hardcoded in the YAML.

@coveralls
Copy link

coveralls commented Jun 27, 2024

Pull Request Test Coverage Report for Build 9700068663

Details

  • 27 of 27 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.008%) to 96.045%

Totals Coverage Status
Change from base Build 9687731633: 0.008%
Covered Lines: 51634
Relevant Lines: 53760

💛 - Coveralls

@simonrp84
Copy link
Member

Is there a way for the user to select which one is used? I can think of many circumstances in which the parallax corrected versions would be preferred (despite the metadata issues).

@djhoese
Copy link
Member Author

djhoese commented Jun 27, 2024

@simonrp84 At the moment, no. It would make sense, but maybe we save that for another PR if someone really wants it. Right now, besides this cloud height file, there are no other lon/lats available in the EDR files that I'm familiar with. We could either do a kwarg-style choice for users or there is (technically) the ability to customize the YAML right now and describe all the products you want and their specific lon/lats.

@djhoese
Copy link
Member Author

djhoese commented Jun 27, 2024

I got the "good enough" signal from Panu on slack. Merging...thanks for the reviews.

@djhoese djhoese merged commit 9070f29 into pytroll:main Jun 27, 2024
18 of 19 checks passed
@djhoese djhoese deleted the ci-tiepoints-conda branch June 27, 2024 20:11
@coveralls
Copy link

coveralls commented Jun 27, 2024

Pull Request Test Coverage Report for Build 9702660698

Details

  • 45 of 45 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.009%) to 96.046%

Totals Coverage Status
Change from base Build 9687731633: 0.009%
Covered Lines: 51641
Relevant Lines: 53767

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants