Skip to content

Commit

Permalink
CI: Reorganized the list of data files for caching as a workaround fo…
Browse files Browse the repository at this point in the history
…r issue #3170
  • Loading branch information
seisman committed Apr 15, 2024
1 parent 70d666e commit e23d438
Showing 1 changed file with 58 additions and 61 deletions.
119 changes: 58 additions & 61 deletions pygmt/helpers/caching.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,89 +9,80 @@ def cache_data():
"""
Download GMT remote data files used in PyGMT tests and docs to cache folder.
"""
# List of datasets to download
# List of GMT remote datasets.
datasets = [
# Earth relief grids
"@earth_age_01d_g",
"@earth_day_01d_p",
"@earth_faa_01d_g",
"@earth_gebco_01d_g",
"@earth_gebcosi_01d_g",
"@earth_gebcosi_15m_p",
"@earth_relief_01d_p",
"@earth_relief_01d_g",
"@earth_relief_30m_p",
"@earth_relief_30m_g",
"@earth_relief_10m_p",
"@earth_relief_10m_g",
"@earth_relief_05m_p",
"@earth_relief_05m_g",
"@earth_synbath_01d_g",
# List of tiles of 03s srtm data.
# Names like @N35E135.earth_relief_03s_g.nc are for internal use only.
# The naming scheme may change. DO NOT USE IT IN YOUR SCRIPTS.
"@N30W120.earth_relief_15s_p.nc",
"@N35E135.earth_relief_03s_g.nc",
"@N37W120.earth_relief_03s_g.nc",
"@N00W090.earth_relief_03m_p.nc",
"@N00E135.earth_relief_30s_g.nc",
"@N00W010.earth_relief_15s_p.nc", # Specific grid for 15s test
"@N04W010.earth_relief_03s_g.nc", # Specific grid for 03s test
# Earth synbath relief grid
"@S15W105.earth_synbath_30s_p.nc",
# Earth seafloor age grids
"@earth_age_01d_g",
"@N00W030.earth_age_01m_g.nc", # Specific grid for 01m test
# Earth geoid grids
"@earth_geoid_01d_g",
"@N00W030.earth_geoid_01m_g.nc", # Specific grid for 01m test
# Earth magnetic anomaly grids
"@earth_mag_01d_g",
"@S30W060.earth_mag_02m_p.nc", # Specific grid for 02m test
"@earth_mag4km_01d_g",
"@S30W120.earth_mag4km_02m_p.nc", # Specific grid for 02m test
# Earth mask grid
"@earth_mag_01d_g",
"@earth_mask_01d_g",
# Earth free-air anomaly grids
"@earth_faa_01d_g",
"@N00W030.earth_faa_01m_p.nc", # Specific grid for 01m test
# Earth vertical gravity gradient grids
"@earth_relief_01d_g",
"@earth_relief_01d_p",
"@earth_relief_10m_g",
"@earth_relief_10m_p",
"@earth_relief_30m_g",
"@earth_relief_30m_p",
"@earth_synbath_01d_g",
"@earth_vgg_01d_g",
"@N00W030.earth_vgg_01m_p.nc", # Specific grid for 01m test
# Earth WDMAM grids
"@earth_wdmam_01d_g",
"@S90E000.earth_wdmam_03m_g.nc", # Specific grid for 03m test
# Earth day/night images
"@earth_day_01d_p",
# Mars relief grids
"@mars_relief_01d_g",
"@N00W030.mars_relief_01m_g.nc", # Specific grid for 01m tes
# Mercury relief grids
"@mercury_relief_01d_g",
"@N00W030.mercury_relief_01m_p.nc", # Specific grid for 01m test
# Moon relief grids
"@moon_relief_01d_g",
"@N00W030.moon_relief_01m_p.nc", # Specific grid for 01m test
# Pluto relief grids
"@pluto_relief_01d_g",
"@N00W030.pluto_relief_01m_p.nc", # Specific grid for 01m test
# Venus relief grids
"@venus_relief_01d_g",
"@N00W030.venus_relief_01m_g.nc", # Specific grid for 01m test
# Other cache files
"@capitals.gmt",
"@circuit.png",
"@earth_relief_20m_holes.grd",
]

# List of tiled remote datasets.
# Names like @N35E135.earth_relief_03s_g.nc are for internal use only. The naming
# scheme may change. DO NOT USE IT IN YOUR SCRIPTS.
tiles = [

Check warning on line 43 in pygmt/helpers/caching.py

View check run for this annotation

Codecov / codecov/patch

pygmt/helpers/caching.py#L43

Added line #L43 was not covered by tests
"@N00W030.earth_age_01m_g.nc",
"@N00W030.earth_faa_01m_p.nc",
"@N00W030.earth_geoid_01m_g.nc",
"@S30W060.earth_mag_02m_p.nc",
"@S30W120.earth_mag4km_02m_p.nc",
"@earth_relief_05m_g", # All tiles are requested for earth_relief_05m dataset.
"@earth_relief_05m_p",
"@N00W090.earth_relief_03m_p.nc",
"@N00E135.earth_relief_30s_g.nc",
"@N00W010.earth_relief_15s_p.nc",
"@N30W120.earth_relief_15s_p.nc",
"@N04W010.earth_relief_03s_g.nc",
"@N35E135.earth_relief_03s_g.nc",
"@N37W120.earth_relief_03s_g.nc",
"@S15W105.earth_synbath_30s_p.nc",
"@S90E000.earth_wdmam_03m_g.nc",
"@N00W030.earth_vgg_01m_p.nc",
"@N00W030.mars_relief_01m_g.nc",
"@N00W030.mercury_relief_01m_p.nc",
"@N00W030.moon_relief_01m_p.nc",
"@N00W030.pluto_relief_01m_p.nc",
"@N00W030.venus_relief_01m_g.nc",
]

# List of cache files to download.
caches = [

Check warning on line 69 in pygmt/helpers/caching.py

View check run for this annotation

Codecov / codecov/patch

pygmt/helpers/caching.py#L69

Added line #L69 was not covered by tests
"@EGM96_to_36.txt",
"@MaunaLoa_CO2.txt",
"@RidgeTest.shp",
"@RidgeTest.shx",
"@RidgeTest.dbf",
"@RidgeTest.prj",
"@RidgeTest.shp",
"@RidgeTest.shx",
"@Table_5_11.txt",
"@Table_5_11_mean.xyz",
"@capitals.gmt",
"@circuit.png",
"@earth_relief_20m_holes.grd",
"@fractures_06.txt",
"@hotspots.txt",
"@ridge.txt",
"@mars370d.txt",
"@srtm_tiles.nc", # needed for 03s and 01s relief data
"@ridge.txt",
"@srtm_tiles.nc",
"@static_earth_relief.nc",
"@ternary.txt",
"@test.dat.nc",
Expand All @@ -100,4 +91,10 @@ def cache_data():
"@tut_ship.xyz",
"@usgs_quakes_22.txt",
]
which(fname=datasets, download="a")

which(fname=datasets + caches, download="a")

Check warning on line 95 in pygmt/helpers/caching.py

View check run for this annotation

Codecov / codecov/patch

pygmt/helpers/caching.py#L95

Added line #L95 was not covered by tests

# We can't download a list of tiled grids due to bug reported in
# https://github.com/GenericMappingTools/pygmt/issues/3170
for tile in tiles:
which(fname=tile, download="a")

Check warning on line 100 in pygmt/helpers/caching.py

View check run for this annotation

Codecov / codecov/patch

pygmt/helpers/caching.py#L99-L100

Added lines #L99 - L100 were not covered by tests

0 comments on commit e23d438

Please sign in to comment.