-
Notifications
You must be signed in to change notification settings - Fork 225
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
load_earth_relief() failed to find earth relief files #972
Comments
👋 Thanks for opening your first issue here! Please make sure you filled out the template with as much detail as possible. You might also want to take a look at our contributing guidelines and code of conduct. |
Could you please post the output of
|
|
It's weird. I don't see anything wrong in the output. |
@PaulWessel Do you have any idea why |
On the face of it, no. But if I delete my copy and run that command I get the same error. I think you need -G if you want to download a file via gmt which though. |
@core-man Is it possible that the earth_relief_01d_p.grd file is not complete due to unstable internet connections? Could you check the file size and md5sum? |
Download earth relief grid via $ python
>>> from pygmt.datasets import load_earth_relief
>>> grid = load_earth_relief()
gmtwhich [NOTICE]: Remote data courtesy of GMT data server OCEANIA [https://oceania.generic-mapping-tools.org]
gmtwhich [NOTICE]: Earth Relief at 1x1 arc degrees from Gaussian Cartesian filtering (111 km fullwidth) of SRTM15+V2.1 [Tozer et al., 2019].
gmtwhich [NOTICE]: -> Download grid file [115K]: earth_relief_01d_p.grd
gmtwhich [ERROR]: File earth_relief_01d_p.grd not found!
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/core-man/src/pygmt/pygmt/helpers/decorators.py", line 425, in new_module
return module_func(*args, **kwargs)
File "/home/core-man/src/pygmt/pygmt/datasets/earth_relief.py", line 111, in load_earth_relief
fname = which(f"@earth_relief_{resolution}{reg}", download="a")
File "/home/core-man/src/pygmt/pygmt/helpers/decorators.py", line 281, in new_module
return module_func(*args, **kwargs)
File "/home/core-man/src/pygmt/pygmt/src/which.py", line 55, in which
raise FileNotFoundError("File '{}' not found.".format(fname))
FileNotFoundError: File '@earth_relief_01d' not found. Rename the grid to be $ ls ~/.gmt/server/earth/earth_relief/
earth_relief_01d_p.grd
$ mv ~/.gmt/server/earth/earth_relief/earth_relief_01d_p.grd ~/.gmt/server/earth/earth_relief/earth_relief_01d_p_load.grd
$ ls ~/.gmt/server/earth/earth_relief/
earth_relief_01d_p_load.grd Then I can use the import pygmt
fig = pygmt.Figure()
fig.grdimage(grid="@earth_relief_01d")
fig.show() $ ls ~/.gmt/server/earth/earth_relief/
earth_relief_01d_p.grd earth_relief_01d_p_load.grd The two grids are the same. $ du -h ~/.gmt/server/earth/earth_relief/*
116K /home/core-man/.gmt/server/earth/earth_relief/earth_relief_01d_p.grd
116K /home/core-man/.gmt/server/earth/earth_relief/earth_relief_01d_p_load.grd
$ diff ~/.gmt/server/earth/earth_relief/earth_relief_01d_p.grd ~/.gmt/server/earth/earth_relief/earth_relief_01d_p_load.grd
$ md5sum ~/.gmt/server/earth/earth_relief/earth_relief_01d_p.grd ~/.gmt/server/earth/earth_relief/earth_relief_01d_p_load.grd
74a884c902015dda516d17605f317efe /home/core-man/.gmt/server/earth/earth_relief/earth_relief_01d_p.grd
74a884c902015dda516d17605f317efe /home/core-man/.gmt/server/earth/earth_relief/earth_relief_01d_p_load.grd |
@seisman @PaulWessel
However, there could still exist some bugs. A strange thing occurred. If the grid is the current folder is deleted and the grid in # I am still in ~/workspace
$ ls
earth_relief_01d_p.grd
$ ls ~/.gmt/server/earth/earth_relief/
earth_relief_01d_p.grd
# remove the grid in the current folder
$ rm ./earth_relief_01d_p.grd
# gmt which cannot work
$ gmt which -Gl @earth_relief_01d_p
gmtwhich [ERROR]: File earth_relief_01d_p.grd not found!
$ gmt which -Ga @earth_relief_01d_p
gmtwhich [ERROR]: File earth_relief_01d_p.grd not found! I removed
Finally, I removed the grids in the current folder and # I am still in ~/workspace
$ rm earth_relief_01d_p.grd ~/.gmt/server/earth/earth_relief/earth_relief_01d_p.grd
$ gmt which @earth_relief_01d_p
gmtwhich [ERROR]: File earth_relief_01d_p.grd not found!
$ ls
$ ls ~/.gmt/server/earth/earth_relief/
$ gmt which -Ga @earth_relief_01d_p
gmtwhich [NOTICE]: Remote data courtesy of GMT data server OCEANIA [https://oceania.generic-mapping-tools.org]
gmtwhich [NOTICE]: Earth Relief at 1x1 arc degrees from Gaussian Cartesian filtering (111 km fullwidth) of SRTM15+V2.1 [Tozer et al., 2019].
gmtwhich [NOTICE]: -> Download grid file [115K]: earth_relief_01d_p.grd
gmtwhich [ERROR]: File earth_relief_01d_p.grd not found!
$ ls
$ ls ~/.gmt/server/earth/earth_relief/
earth_relief_01d_p.grd
$ gmt which @earth_relief_01d_p
gmtwhich [ERROR]: File earth_relief_01d_p.grd not found!
$ gmt which -Gl @earth_relief_01d_p
gmtwhich [ERROR]: File earth_relief_01d_p.grd not found!
$ ls In summary:
|
Thanks for the detailed reports. However, I followed your steps but still can't reproduce your issue. I'm using GMT 6.1.1 (installed using conda) on macOS. |
I use GMT 6.1.1 (installed using conda) CentOS7. I don't have this issue on my macOS either. |
I just tried GMT 6.1.1 on CentOS 7.8. Still can't reproduce your issue. |
I use CentOS 7.5. I also use the GMT built from the source code (6.2.0_416e03f_2020.08.18) instead of conda and it also has the same bug. If only I have the bug, it should be okay cause I also work on macOS. Maybe it is caused by an unknown/strange thing in my CentOS. Shall we close this issue or open it until someone also have this issue? |
I will close this one. Feel free to reopen it if someone else can reproduce the issue or have a clue why it doesn't work. |
I don't have a way to reproduce the issue, but I wanted to point out that this seems similar in some ways to an issue that I had earlier which could not be reproduced by other users: GenericMappingTools/gmt#4522. So, it could be related to the specific user environment rather than the OS. |
Description of the problem
As I am working on #966, I first ran the examples on pygmt.datasets.load_earth_relief. However, it seems that
load_earth_relief()
may have a bug to find low-resolution earth relief files, which seems to be related towhich
.Full code that generated the error
Full error message
I also tested high-resolution earth relief.
load_earth_relief()
usesgrdcut
to handle it instead ofwhich
.Both high- and low-resolution earth relief files have been downloaded.
Then I used
gmt which
command in the terminal to check those files:System information
Please paste the output of
python -c "import pygmt; pygmt.show_versions()"
:The text was updated successfully, but these errors were encountered: