-
Notifications
You must be signed in to change notification settings - Fork 224
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
Add earth_relief_holes to load_sample_data() #1921
Conversation
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 @willschlitzer! Do you also want to add @earth_relief_20m_holes
to the cache list at
pygmt/pygmt/helpers/testing.py
Lines 153 to 155 in 951d30a
# List of datasets to download | |
datasets = [ | |
# Earth relief grids |
Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com>
pygmt/datasets/samples.py
Outdated
@@ -343,3 +346,18 @@ def load_mars_shape(**kwargs): | |||
fname, sep="\t", header=None, names=["longitude", "latitude", "radius(m)"] | |||
) | |||
return data | |||
|
|||
|
|||
def _load_earth_relief_holes(**kwargs): |
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.
Pylint reports the following warning.
pygmt/datasets/samples.py:351:0: W0613: Unused argument 'kwargs' (unused-argument)
I think we don't need kwagrs
for new datasets.
def _load_earth_relief_holes(**kwargs): | |
def _load_earth_relief_holes(): |
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'll check again to confirm after I rewrite the tests, but I think it needs **kwargs
because of data = load_func[name](suppress_warning=True)
. It was getting passed a value for suppress_warning
but wasn't expecting any arguments.
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 received TypeError: _load_earth_relief_holes() got an unexpected keyword argument 'suppress_warning'
when I tried running it without **kwargs
.
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.
The suppress_warning
parameter (or **kwargs
) was added so that users who call the deprecated, old load_xxx
functions can silent the deprecation warnings by passing suppress_warning=True
. Thus, **kwargs
is NOT required for new private _load_xxx
functions.
Do you think we should rewrite the code to call the old and new load_xxx functions in different ways:
# old public load functions for backward compatibility
load_func_old = {
"bathymetry": load_sample_bathymetry,
"fractures": load_fractures_compilation,
"hotspots": load_hotspots,
"japan_quakes": load_japan_quakes,
"mars_shape": load_mars_shape,
"ocean_ridge_points": load_ocean_ridge_points,
"usgs_quakes": load_usgs_quakes,
}
# new private load functions
load_func = {
"earth_relief_holes": _load_earth_relief_holes,
}
if name in load_func_old:
data = load_func[name](suppress_warning=True)
else:
data = load_func[name]
return data
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 that's a good idea. I think this should be a separate PR; does that work? I'm happy to do it (admittedly copying the code above) but won't be able to get to it until tomorrow.
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.
A separate PR is OK to me.
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
@GenericMappingTools/pygmt-admin It looks like this is failing some tests because of the change to gridline registration for |
xref: the grid file registration was changed in GenericMappingTools/gmtserver-admin#156 |
Yes, it's now stable so the baseline images can be updated. |
Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com> Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
This adds a function to load the remote dataset
@earth_relief_20m_holes.grd
for use with the in-line example forgrdfill
.Reminders
make format
andmake check
to make sure the code follows the style guide.doc/api/index.rst
.Slash Commands
You can write slash commands (
/command
) in the first line of a comment to performspecific operations. Supported slash commands are:
/format
: automatically format and lint the code/test-gmt-dev
: run full tests on the latest GMT development version