Skip to content
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

Improve the load_earth_relief and load_earth_age functions #2225

Closed
Tracked by #2244
seisman opened this issue Dec 5, 2022 · 2 comments · Fixed by #2281
Closed
Tracked by #2244

Improve the load_earth_relief and load_earth_age functions #2225

seisman opened this issue Dec 5, 2022 · 2 comments · Fixed by #2281
Labels
enhancement Improving an existing feature
Milestone

Comments

@seisman
Copy link
Member

seisman commented Dec 5, 2022

Here are some issues that I found when I review the new codes. I think these issues can be addressed in separate PRs after this PR is merged.

For the load_earth_relief function:

  1. Add from pygmt.datasets import load_earth_relief at the beginning of the examples, so that users can copy and run these examples (load_earth_relief: Add import statement to inline examples #2229)
  2. In the function definition, I think it makes more sense to put data_source before use_srtm, because use_srtm is less commonly used and use_srtm only works for data_source="igpp". (load_earth_relief: Move parameter use_srtm after data_source #2230)
  3. In the docstrings, need to explain what earth_relief_type means. (load_earth_relief: Add earth_relief_type explanation to docstrings #2231)
  4. The code says synbath, gebco and gebcosi are not available for GMT 6.3.0. I haven't tested it, but if I remember it correctly, synbath should work with GMT 6.3.0

For the load_earth_age function:

Originally posted by @seisman in #2200 (comment)

@seisman
Copy link
Member Author

seisman commented Dec 7, 2022

4. The code says synbath, gebco and gebcosi are not available for GMT 6.3.0. I haven't tested it, but if I remember it correctly, synbath should work with GMT 6.3.0

Just installed GMT 6.3.0 and tested different datasets. For GMT 6.3.0, earth_relief and earth_synbath work, but earth_gebco and earth_gebcosi fail.

$ gmt grdinfo @earth_relief_01d -C                                                                             /home/seisman/.gmt/server/earth/earth_relief/earth_relief_01d_p.grd	-180	180	-90	90	-8190.5	5651.511	360	180	1	1

$ gmt grdinfo @earth_synbath_01d -C
grdinfo [NOTICE]: Remote data courtesy of GMT data server oceania [http://oceania.generic-mapping-tools.org]

grdinfo [NOTICE]: SYNBATH Earth Relief at 1x1 arc degrees reduced by Gaussian Cartesian filtering (111.2 km fullwidth) [Sandwell et al., 2022].
grdinfo [NOTICE]:   -> Download grid file [114K]: earth_synbath_01d_p.grd
/home/seisman/.gmt/server/earth/earth_synbath/earth_synbath_01d_p.grd	-180	180	-90	90	-8190.5	5651.5	1	1	360	180	1	1


$ gmt grdinfo @earth_gebco_01d -C 
grdinfo [NOTICE]: Remote data courtesy of GMT data server oceania [http://oceania.generic-mapping-tools.org]

grdinfo [NOTICE]: GEBCO Earth Relief at 1x1 arc degrees reduced by Gaussian Cartesian filtering (111.2 km fullwidth) [GEBCO Compilation Group, 2021 GEBCO 2021 Grid].
grdinfo [NOTICE]:   -> Download grid file [105K]: earth_gebco_01d_g.grd
grdinfo [ERROR]: Libcurl Error: HTTP response code said error
grdinfo [WARNING]: You can turn remote file download off by setting GMT_DATA_UPDATE_INTERVAL to "off"
grdinfo [ERROR]: File /home/seisman/.gmt/cache/earth_gebco_01d.grd was not found
grdinfo [ERROR]: Cannot find file /home/seisman/.gmt/cache/earth_gebco_01d.grd
grdinfo [ERROR]: File /home/seisman/.gmt/cache/earth_gebco_01d.grd was not found
grdinfo [ERROR]: Cannot find file /home/seisman/.gmt/cache/earth_gebco_01d.grd
grdinfo [ERROR]: File /home/seisman/.gmt/cache/earth_gebco_01d.grd not found
[Session gmt (0)]: Error returned from GMT API: GMT_FILE_NOT_FOUND (16)

$ gmt grdinfo @earth_gebcosi_01d -C
grdinfo [NOTICE]: Remote data courtesy of GMT data server oceania [http://oceania.generic-mapping-tools.org]

grdinfo [NOTICE]: GEBCO Sub-Ice Earth Relief at 1x1 arc degrees reduced by Gaussian Cartesian filtering (111.2 km fullwidth) [GEBCO Compilation Group, 2021 GEBCO 2021 Grid].
grdinfo [NOTICE]:   -> Download grid file [106K]: earth_gebcosi_01d_p.grd
grdinfo [ERROR]: Libcurl Error: HTTP response code said error
grdinfo [WARNING]: You can turn remote file download off by setting GMT_DATA_UPDATE_INTERVAL to "off"
grdinfo [ERROR]: File /home/seisman/.gmt/cache/earth_gebcosi_01d.grd was not found
grdinfo [ERROR]: Cannot find file /home/seisman/.gmt/cache/earth_gebcosi_01d.grd
grdinfo [ERROR]: File /home/seisman/.gmt/cache/earth_gebcosi_01d.grd was not found
grdinfo [ERROR]: Cannot find file /home/seisman/.gmt/cache/earth_gebcosi_01d.grd
grdinfo [ERROR]: File /home/seisman/.gmt/cache/earth_gebcosi_01d.grd not found
[Session gmt (0)]: Error returned from GMT API: GMT_FILE_NOT_FOUND (16)

I can't find the exact issue reports or PRs in the GMT repository, but I think in GMT 6.3.0, GMT was confused by the substring _g in the dataset name earth_gebco and incorrectly parsed as gridline registration. Actually, the following two commands work:

$ gmt grdinfo @earth_gebco_01d_g -C
$ gmt grdinfo @earth_gebco_01d_p -C

@seisman
Copy link
Member Author

seisman commented Dec 7, 2022

Following the discussions in #1929, if we decide to return gridline-registered grids by default, then we will always append _g or _p to the dataset prefix (e.g., earth_gebco_01d_g) to the GMT C API, then data_source like gebco and gebcosi should also work. So, I think we should address #1929 first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improving an existing feature
Projects
None yet
1 participant