-
Notifications
You must be signed in to change notification settings - Fork 301
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
Fix/supress warnings in reader tests #2689
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #2689 +/- ##
==========================================
+ Coverage 95.32% 95.34% +0.02%
==========================================
Files 371 371
Lines 52441 52379 -62
==========================================
- Hits 49988 49943 -45
+ Misses 2453 2436 -17
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Pull Request Test Coverage Report for Build 7212382784Warning: This coverage report may be inaccurate.We've detected an issue with your CI configuration that might affect the accuracy of this pull request's coverage report.
💛 - Coveralls |
Before this PR there were 472 warnings triggered by the reader tests, now there are 68:
I'll remove the one |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work, just one comment about alleviating some of the pyproj warnings. Otherwise LGTM.
with warnings.catch_warnings(): | ||
warnings.filterwarnings("ignore", | ||
message=r"You will likely lose important projection information", | ||
category=UserWarning) | ||
proj_dict = area_def.proj_dict |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the warning would disappear if the crs was passed instead of the proj dict, as proj4_radius_parameters
accepts also CRSs: https://github.com/pytroll/pyresample/blob/main/pyresample/utils/proj4.py#L76-L91
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I'll have a look.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems I could get all the tested things from area_def.crs.to_cf()
apart from the units
. There is LENGTHUNIT["metre",...]
in crs_wkt
, but checking for that seems like a cludge. So it's either using proj_dict
or doing "metre" in area_def.crs.to_cf()['crs_wkt']
🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe crs.axis_info[0].unit_name
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But how about creating an expected crs instead, and comparing it to area_def.crs?
eg:
expected_crs = CRS.from_dict(dict(a=6378137.0, b=6356752.3, h=35785863.0, lon_0=140.7, proj="geos", units="m"))
assert area_def.crs == expected_crs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Too simple 🙈 Adjusted in 24422ad
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I didn't comment on the other ones, but there are a bunch other places where this could be used instead of suppressing the warning...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to go the "do not suppress" route, but evidently I missed this way. I'll start combing through the changes for these.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the proj_dict
usages to CRS
as much as possible. The remaining are used either because the original projection needs to be modified (in nwcsaf_nc
) and the dict is just too simple not to be used, or because the CRS objects differ even if the proj dicts are identical (oceancolorcci_l3_nc
).
This PR fixes and/or suppresses a bunch of warnings emitted by the Satpy reader tests.