GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||
GeezerVison is showing github.com — Add function to load Black Marble dataset by weiji14 · Pull Request #3469 · GenericMappingTools/pygmt Conversation
|
| # If rioxarray is installed, set the coordinate reference system | ||
| if hasattr(image, "rio"): | ||
| image = image.rio.write_crs(input_crs="OGC:CRS84") |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This line is not covered by a unit test. Should I add one, or we can ignore it?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
It should be covered when rioxarray is installed, right?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Or do we have to import rioxarray to register the rio accessor
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The equivalent line in load_blue_marble is covered here in test_grdimage_image.py which has an import rioxarray at the top of the file:
pygmt/pygmt/tests/test_grdimage_image.py
Line 18 in 66f258a
| xr_image = load_blue_marble(resolution="01d") |
We don't test load_black_marble anywhere else except in test_datasets_earth_night.py, and since rioxarray is not imported in that file, this line isn't covered because there is no rio accessor.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can cover this line in the test_grdcut_image.py file at https://github.com/GenericMappingTools/pygmt/pull/3115/files#r1780370539?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
since
rioxarrayis not imported in that file, this line isn't covered because there is norioaccessor.
This is not ideal. So even if rioxarray is installed, the rio accessor may still not exist because users don't import the rioxarray package.
I think we should add the following lines to this file (and any other files that try to access the rio accessor):
pygmt/pygmt/datasets/tile_map.py
Lines 21 to 23 in 66f258a
| with contextlib.suppress(ImportError): | |
| # rioxarray is needed to register the rio accessor | |
| import rioxarray # noqa: F401 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
xref: #3323
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Ok, done at commit 66183ed. I've also applied this to pygmt/datasets/earth_day.py, hopefully you don't mind.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Alos need to add |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Function to load NASA Blue and Black marble mosaic images
There was an error while loading. Please reload this page.