You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Refactor tests to use a more stable grid instead of earth_relief #505
A lot of our unit tests are dependent on the earth relief grids, and we keep having to change them every so often (see e.g. #350, #401, #452), and probably soon again (see GenericMappingTools/gmtserver-admin#72)! We can keep a few tests for load_earth_relief grid, but I'd like to propose that we test the other functions on a more stable grid. Specifically, these functions:
Store the earth_relief_01d_p and earth_relief_01d_g in the tests/data directory. These two files are only ~115 Kb each.
This is quite tempting, but I'm not so sure about this. It'll be strange having 'out of date' information in the future.
Add the two files to the GMT cache and never change them again (of course, need to change them to other names)
It would be nice if we could have a data versioning scheme, but that might be too much of an ask. I did look at the Earth Day/Night images, but wasn't sure if they get updated often?
Yet another option is to generate a random synthetic grid and use it for our tests. Maybe we could use Liam's "Ackley function" grid 😄
Closing as this isn't relevant anymore. We're now using check_figures_equal (see #555) to directly compare baseline and test images, i.e. changes to the earth_relief grid shouldn't break the tests anymore.
Activity
seisman commentedon Jul 7, 2020
That's only for the 03s and 01s earth relief data. Lower resolution (>=15s) are derived from the SRTM15+V2.1 data (https://doi.org/10.1029/2019EA000658), but of course it may also get some updates in the future.
seisman commentedon Jul 7, 2020
Besides what you propose, we have a few more choices:
tests/datadirectory. These two files are only ~115 Kb each.weiji14 commentedon Jul 7, 2020
This is quite tempting, but I'm not so sure about this. It'll be strange having 'out of date' information in the future.
It would be nice if we could have a data versioning scheme, but that might be too much of an ask. I did look at the Earth Day/Night images, but wasn't sure if they get updated often?
Yet another option is to generate a random synthetic grid and use it for our tests. Maybe we could use Liam's "Ackley function" grid 😄
weiji14 commentedon Jul 8, 2020
How about using
@tut_bathy.nc(11KB) and/or@tut_relief.nc(397KB)? They're used in Session 3 and Session 4 of the GMT Tutorials. These are thegrdinfofor it:Even if they do change in the future, we could pull them from Github at https://github.com/GenericMappingTools/gmtserver-admin instead of the GMT Data Server for the tests.
weiji14 commentedon Jul 8, 2020
Hmm, I just remembered that
xarrayhas a coolxr.tutorial.open_datasetfunction that can load a bunch of example datasets from https://github.com/pydata/xarray-data, but we can also point it to our GMT one at https://github.com/GenericMappingTools/gmtserver-admin.Perhaps we could add the low resolution
earth_relief_01d_*grids to https://github.com/GenericMappingTools/gmtserver-admin, and create tags at every release (e.g.6.1,6.1.1) as a basic data versioning scheme. If they change in the future, we'll just usexr.tutorial.open_datasetto point to the old version. Not to sure how sustainable/future-proof this would be though.Alternatively, we could have a function like
pygmt.dataset.open_dataset()that wraps aroundxr.tutorial.open_dataset, but which points to https://github.com/GenericMappingTools/gmtserver-admin instead of https://github.com/pydata/xarray-data. This would be similar to GMTwhich, except it relies on Github instead of the GMT servers, which may or may not be a good thing.weiji14 commentedon Jul 8, 2020
Ok bad idea, maybe don't wrap around
xr.tutorial.open_dataset, because it requires each tutorial file to have a.md5file hash (see https://github.com/pydata/xarray/blob/v0.15.1/xarray/tutorial.py#L85-L93). What we could learn fromxr.tutorial.open_datasetis to makepygmt.whichrecognize alternative sources/mirrors like https://github.com/GenericMappingTools/gmtserver-admin, but that's another chore for another day.weiji14 commentedon Sep 12, 2020
Closing as this isn't relevant anymore. We're now using
check_figures_equal(see #555) to directly compare baseline and test images, i.e. changes to the earth_relief grid shouldn't break the tests anymore.