Skip to content

Improve the load_earth_relief and load_earth_age functions #2225

Closed

Description

@seisman

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)

Activity

  1. added
    enhancement
    on Dec 5, 2022
  2. added this to the 0.8.0 milestone on Dec 5, 2022
  3. seisman commented on Dec 7, 2022

    @seisman
    MemberAuthor

    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
    
  4. seisman commented on Dec 7, 2022

    @seisman
    MemberAuthor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions