From 0b3b9f17a6bcc842d465525f22770f3b5a86af02 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Wed, 7 Feb 2024 21:23:05 +0100 Subject: [PATCH 01/51] Remove title and make key and name consistent --- pygmt/datasets/load_remote_dataset.py | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/pygmt/datasets/load_remote_dataset.py b/pygmt/datasets/load_remote_dataset.py index 73c7d46dcf7..af385e7c133 100644 --- a/pygmt/datasets/load_remote_dataset.py +++ b/pygmt/datasets/load_remote_dataset.py @@ -64,8 +64,7 @@ class GMTRemoteDataset(NamedTuple): datasets = { "earth_age": GMTRemoteDataset( - title="seafloor age", - name="seafloor_age", + name="earth_age", long_name="age of seafloor crust", units="Myr", extra_attributes={"horizontal_datum": "WGS84"}, @@ -83,9 +82,8 @@ class GMTRemoteDataset(NamedTuple): "01m": Resolution("01m", registrations=["gridline"], tiled=True), }, ), - "earth_free_air_anomaly": GMTRemoteDataset( - title="free air anomaly", - name="free_air_anomaly", + "earth_faa": GMTRemoteDataset( + name="earth_faa", long_name="IGPP Earth Free-Air Anomaly", units="mGal", extra_attributes={"horizontal_datum": "WGS84"}, @@ -104,7 +102,6 @@ class GMTRemoteDataset(NamedTuple): }, ), "earth_geoid": GMTRemoteDataset( - title="Earth geoid", name="earth_geoid", long_name="EGM2008 Earth Geoid", units="m", @@ -123,9 +120,8 @@ class GMTRemoteDataset(NamedTuple): "01m": Resolution("01m", registrations=["gridline"], tiled=True), }, ), - "earth_magnetic_anomaly": GMTRemoteDataset( - title="Earth magnetic anomaly", - name="magnetic_anomaly", + "earth_emag": GMTRemoteDataset( + name="earth_emag", long_name="Earth magnetic anomaly", units="nT", extra_attributes={"horizontal_datum": "WGS84"}, @@ -143,7 +139,6 @@ class GMTRemoteDataset(NamedTuple): }, ), "earth_mask": GMTRemoteDataset( - title="Earth mask", name="earth_mask", long_name="Mask of land and water features", units=None, @@ -165,8 +160,7 @@ class GMTRemoteDataset(NamedTuple): }, ), "earth_relief": GMTRemoteDataset( - title="Earth relief", - name="elevation", + name="earth_relief", long_name="Earth elevation relative to the geoid", units="meters", extra_attributes={"vertical_datum": "EGM96", "horizontal_datum": "WGS84"}, @@ -189,7 +183,6 @@ class GMTRemoteDataset(NamedTuple): }, ), "earth_vgg": GMTRemoteDataset( - title="Earth vertical gravity gradient", name="earth_vgg", long_name="IGPP Earth Vertical Gravity Gradient", units="Eotvos", @@ -209,8 +202,7 @@ class GMTRemoteDataset(NamedTuple): }, ), "earth_wdmam": GMTRemoteDataset( - title="WDMAM magnetic anomaly", - name="wdmam", + name="earth_wdmam", long_name="World Digital Magnetic Anomaly Map", units="nT", extra_attributes={"horizontal_datum": "WGS84"}, @@ -227,7 +219,6 @@ class GMTRemoteDataset(NamedTuple): }, ), "mars_relief": GMTRemoteDataset( - title="Mars relief", name="mars_relief", long_name="NASA Mars (MOLA) relief", units="meters", @@ -250,7 +241,6 @@ class GMTRemoteDataset(NamedTuple): }, ), "moon_relief": GMTRemoteDataset( - title="Moon relief", name="moon_relief", long_name="USGS Moon (LOLA) relief", units="meters", @@ -273,7 +263,6 @@ class GMTRemoteDataset(NamedTuple): }, ), "mercury_relief": GMTRemoteDataset( - title="Mercury relief", name="mercury_relief", long_name="USGS Mercury relief", units="meters", @@ -294,7 +283,6 @@ class GMTRemoteDataset(NamedTuple): }, ), "pluto_relief": GMTRemoteDataset( - title="Pluto relief", name="pluto_relief", long_name="USGS Pluto relief", units="meters", @@ -315,7 +303,6 @@ class GMTRemoteDataset(NamedTuple): }, ), "venus_relief": GMTRemoteDataset( - title="Venus relief", name="venus_relief", long_name="NASA Magellan Venus relief", units="meters", From 5342d89eef9d860d23b178b5b344ce0c77fd502d Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Wed, 7 Feb 2024 21:29:36 +0100 Subject: [PATCH 02/51] Adjust load functions --- pygmt/datasets/earth_free_air_anomaly.py | 2 +- pygmt/datasets/earth_magnetic_anomaly.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pygmt/datasets/earth_free_air_anomaly.py b/pygmt/datasets/earth_free_air_anomaly.py index ef9a9d61947..26038bb4fd4 100644 --- a/pygmt/datasets/earth_free_air_anomaly.py +++ b/pygmt/datasets/earth_free_air_anomaly.py @@ -101,7 +101,7 @@ def load_earth_free_air_anomaly( ... ) """ grid = _load_remote_dataset( - dataset_name="earth_free_air_anomaly", + dataset_name="earth_faa", dataset_prefix="earth_faa_", resolution=resolution, region=region, diff --git a/pygmt/datasets/earth_magnetic_anomaly.py b/pygmt/datasets/earth_magnetic_anomaly.py index c36b9a673b2..a0ea618b808 100644 --- a/pygmt/datasets/earth_magnetic_anomaly.py +++ b/pygmt/datasets/earth_magnetic_anomaly.py @@ -146,7 +146,7 @@ def load_earth_magnetic_anomaly( "Valid values are 'emag2', 'emag2_4km', and 'wdmam'." ) dataset_prefix = magnetic_anomaly_sources[data_source] - dataset_name = "earth_wdmam" if data_source == "wdmam" else "earth_magnetic_anomaly" + dataset_name = "earth_wdmam" if data_source == "wdmam" else "earth_emag" grid = _load_remote_dataset( dataset_name=dataset_name, dataset_prefix=dataset_prefix, From 6f37e0161513642d89f1470ec4497d452569cf87 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Wed, 7 Feb 2024 21:31:53 +0100 Subject: [PATCH 03/51] Adjust error message --- pygmt/datasets/load_remote_dataset.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pygmt/datasets/load_remote_dataset.py b/pygmt/datasets/load_remote_dataset.py index af385e7c133..5b422cb9eb8 100644 --- a/pygmt/datasets/load_remote_dataset.py +++ b/pygmt/datasets/load_remote_dataset.py @@ -368,7 +368,7 @@ def _load_remote_dataset( if resolution not in dataset.resolutions: raise GMTInvalidInput( - f"Invalid resolution '{resolution}' for {dataset.title} dataset. " + f"Invalid resolution '{resolution}' for {dataset.name} dataset. " f"Available resolutions are: {', '.join(dataset.resolutions)}." ) @@ -381,7 +381,7 @@ def _load_remote_dataset( if registration not in valid_registrations: raise GMTInvalidInput( f"{registration} registration is not available for the " - f"{resolution} {dataset.title} dataset. Only " + f"{resolution} {dataset.name} dataset. Only " f"{valid_registrations[0]} registration is available." ) else: @@ -398,7 +398,7 @@ def _load_remote_dataset( if region is None: if dataset.resolutions[resolution].tiled: raise GMTInvalidInput( - f"'region' is required for {dataset.title} resolution '{resolution}'." + f"'region' is required for {dataset.name} resolution '{resolution}'." ) fname = which(f"@{dataset_prefix}{resolution}{reg}", download="a") grid = load_dataarray(fname, engine="netcdf4") From 7d4569556f765cbf4b9800e383ac9557436a6566 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Wed, 7 Feb 2024 21:32:57 +0100 Subject: [PATCH 04/51] Adjust documentation --- pygmt/datasets/load_remote_dataset.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pygmt/datasets/load_remote_dataset.py b/pygmt/datasets/load_remote_dataset.py index 5b422cb9eb8..00fcef3bd37 100644 --- a/pygmt/datasets/load_remote_dataset.py +++ b/pygmt/datasets/load_remote_dataset.py @@ -40,10 +40,8 @@ class GMTRemoteDataset(NamedTuple): Attributes ---------- - title : str - The title of the dataset, used in error messages. name : str - The name assigned as an attribute to the DataArray. + The name assigned as an attribute to the DataArray and used in error messages. long_name : str The long name assigned as an attribute to the DataArray. units : str @@ -54,7 +52,6 @@ class GMTRemoteDataset(NamedTuple): A dictionary of extra or unique attributes of the dataset. """ - title: str name: str long_name: str units: str | None From 178c6f38314cfb4102c926a50b44e74cfa2f6737 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Wed, 7 Feb 2024 21:45:35 +0100 Subject: [PATCH 05/51] Make documentation and long_name consistent --- pygmt/datasets/earth_free_air_anomaly.py | 6 +++--- pygmt/datasets/earth_geoid.py | 6 +++--- pygmt/datasets/earth_mask.py | 4 ++-- .../datasets/earth_vertical_gravity_gradient.py | 6 +++--- pygmt/datasets/load_remote_dataset.py | 16 ++++++++-------- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/pygmt/datasets/earth_free_air_anomaly.py b/pygmt/datasets/earth_free_air_anomaly.py index 26038bb4fd4..b7b7a4410f7 100644 --- a/pygmt/datasets/earth_free_air_anomaly.py +++ b/pygmt/datasets/earth_free_air_anomaly.py @@ -1,5 +1,5 @@ """ -Function to download the IGPP Earth Free-Air Anomaly dataset from the GMT data server, +Function to download the IGPP Earth free-air anomaly dataset from the GMT data server, and load as :class:`xarray.DataArray`. The grids are available in various resolutions. @@ -19,13 +19,13 @@ def load_earth_free_air_anomaly( registration: Literal["gridline", "pixel", None] = None, ): r""" - Load the IGPP Earth Free-Air Anomaly dataset in various resolutions. + Load the IGPP Earth free-air anomaly dataset in various resolutions. .. figure:: https://www.generic-mapping-tools.org/remote-datasets/_images/GMT_earth_faa.jpg :width: 80 % :align: center - IGPP Earth Free-Air Anomaly dataset. + IGPP Earth free-air anomaly dataset. The grids are downloaded to a user data directory (usually ``~/.gmt/server/earth/earth_faa/``) the first time you invoke diff --git a/pygmt/datasets/earth_geoid.py b/pygmt/datasets/earth_geoid.py index 46c44661c4f..85ac6815112 100644 --- a/pygmt/datasets/earth_geoid.py +++ b/pygmt/datasets/earth_geoid.py @@ -1,5 +1,5 @@ """ -Function to download the EGM2008 Earth Geoid dataset from the GMT data server, and load +Function to download the EGM2008 Earth geoid dataset from the GMT data server, and load as :class:`xarray.DataArray`. The grids are available in various resolutions. @@ -19,13 +19,13 @@ def load_earth_geoid( registration: Literal["gridline", "pixel"] = "gridline", ): r""" - Load the EGM2008 Earth Geoid dataset in various resolutions. + Load the EGM2008 Earth geoid dataset in various resolutions. .. figure:: https://www.generic-mapping-tools.org/remote-datasets/_images/GMT_earth_geoid.jpg :width: 80 % :align: center - EGM2008 Earth Geoid dataset. + EGM2008 Earth geoid dataset. The grids are downloaded to a user data directory (usually ``~/.gmt/server/earth/earth_geoid/``) the first time you invoke diff --git a/pygmt/datasets/earth_mask.py b/pygmt/datasets/earth_mask.py index e49c451ca70..2aea8ffe1f4 100644 --- a/pygmt/datasets/earth_mask.py +++ b/pygmt/datasets/earth_mask.py @@ -19,13 +19,13 @@ def load_earth_mask( registration: Literal["gridline", "pixel"] = "gridline", ): r""" - Load the GSHHG Earth Mask dataset in various resolutions. + Load the GSHHG Earth mask dataset in various resolutions. .. figure:: https://www.generic-mapping-tools.org/remote-datasets/_images/GMT_earth_mask.jpg :width: 80 % :align: center - GSHHG Earth Mask dataset. + GSHHG Earth mask dataset. The grids are downloaded to a user data directory (usually ``~/.gmt/server/earth/earth_mask/``) the first time you invoke diff --git a/pygmt/datasets/earth_vertical_gravity_gradient.py b/pygmt/datasets/earth_vertical_gravity_gradient.py index 5f46da77a01..c8406387b19 100644 --- a/pygmt/datasets/earth_vertical_gravity_gradient.py +++ b/pygmt/datasets/earth_vertical_gravity_gradient.py @@ -1,5 +1,5 @@ """ -Function to download the IGPP Earth Vertical Gravity Gradient dataset from the GMT data +Function to download the IGPP Earth gertical gravity gradient dataset from the GMT data server, and load as :class:`xarray.DataArray`. The grids are available in various resolutions. @@ -19,13 +19,13 @@ def load_earth_vertical_gravity_gradient( registration: Literal["gridline", "pixel", None] = None, ): r""" - Load the IGPP Earth Vertical Gravity Gradient dataset in various resolutions. + Load the IGPP Earth vertical gravity gradient dataset in various resolutions. .. figure:: https://www.generic-mapping-tools.org/remote-datasets/_images/GMT_earth_vgg.jpg :width: 80 % :align: center - IGPP Earth Vertical Gravity Gradient dataset. + IGPP Earth vertical gravity gradient dataset. The grids are downloaded to a user data directory (usually ``~/.gmt/server/earth/earth_vgg/``) the first time you invoke diff --git a/pygmt/datasets/load_remote_dataset.py b/pygmt/datasets/load_remote_dataset.py index 00fcef3bd37..020ea8fa819 100644 --- a/pygmt/datasets/load_remote_dataset.py +++ b/pygmt/datasets/load_remote_dataset.py @@ -62,7 +62,7 @@ class GMTRemoteDataset(NamedTuple): datasets = { "earth_age": GMTRemoteDataset( name="earth_age", - long_name="age of seafloor crust", + long_name="EarthByte Earth seafloor crustal age", units="Myr", extra_attributes={"horizontal_datum": "WGS84"}, resolutions={ @@ -81,7 +81,7 @@ class GMTRemoteDataset(NamedTuple): ), "earth_faa": GMTRemoteDataset( name="earth_faa", - long_name="IGPP Earth Free-Air Anomaly", + long_name="IGPP Earth free-fir anomaly", units="mGal", extra_attributes={"horizontal_datum": "WGS84"}, resolutions={ @@ -100,7 +100,7 @@ class GMTRemoteDataset(NamedTuple): ), "earth_geoid": GMTRemoteDataset( name="earth_geoid", - long_name="EGM2008 Earth Geoid", + long_name="EGM2008 Earth geoid", units="m", extra_attributes={"horizontal_datum": "WGS84"}, resolutions={ @@ -119,7 +119,7 @@ class GMTRemoteDataset(NamedTuple): ), "earth_emag": GMTRemoteDataset( name="earth_emag", - long_name="Earth magnetic anomaly", + long_name="Earth Magnetic Anomaly Model (EMAG2)", units="nT", extra_attributes={"horizontal_datum": "WGS84"}, resolutions={ @@ -137,7 +137,7 @@ class GMTRemoteDataset(NamedTuple): ), "earth_mask": GMTRemoteDataset( name="earth_mask", - long_name="Mask of land and water features", + long_name="GSHHG Earth mask", units=None, extra_attributes={"horizontal_datum": "WGS84"}, resolutions={ @@ -158,7 +158,7 @@ class GMTRemoteDataset(NamedTuple): ), "earth_relief": GMTRemoteDataset( name="earth_relief", - long_name="Earth elevation relative to the geoid", + long_name="IGPP and GEBCO Earth reliefs", units="meters", extra_attributes={"vertical_datum": "EGM96", "horizontal_datum": "WGS84"}, resolutions={ @@ -181,7 +181,7 @@ class GMTRemoteDataset(NamedTuple): ), "earth_vgg": GMTRemoteDataset( name="earth_vgg", - long_name="IGPP Earth Vertical Gravity Gradient", + long_name="IGPP Earth vertical gravity gradient", units="Eotvos", extra_attributes={"horizontal_datum": "WGS84"}, resolutions={ @@ -200,7 +200,7 @@ class GMTRemoteDataset(NamedTuple): ), "earth_wdmam": GMTRemoteDataset( name="earth_wdmam", - long_name="World Digital Magnetic Anomaly Map", + long_name="World Digital Magnetic Anomaly Map (WDMAM)", units="nT", extra_attributes={"horizontal_datum": "WGS84"}, resolutions={ From 16926f3662dc29f175031495430fdbff40273d9a Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Wed, 7 Feb 2024 22:19:05 +0100 Subject: [PATCH 06/51] Adjust tests --- pygmt/tests/test_datasets_earth_free_air_anomaly.py | 4 ++-- pygmt/tests/test_datasets_earth_geoid.py | 2 +- pygmt/tests/test_datasets_earth_magnetic_anomaly.py | 12 ++++++------ pygmt/tests/test_datasets_earth_mask.py | 2 +- pygmt/tests/test_datasets_earth_relief.py | 9 +++++---- .../test_datasets_earth_vertical_gravity_gradient.py | 2 +- 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/pygmt/tests/test_datasets_earth_free_air_anomaly.py b/pygmt/tests/test_datasets_earth_free_air_anomaly.py index f8bb13b6c53..89794b3bae1 100644 --- a/pygmt/tests/test_datasets_earth_free_air_anomaly.py +++ b/pygmt/tests/test_datasets_earth_free_air_anomaly.py @@ -11,8 +11,8 @@ def test_earth_faa_01d(): Test some properties of the free air anomaly 01d data. """ data = load_earth_free_air_anomaly(resolution="01d") - assert data.name == "free_air_anomaly" - assert data.attrs["long_name"] == "IGPP Earth Free-Air Anomaly" + assert data.name == "earth_faa" + assert data.attrs["long_name"] == "IGPP Earth free-air anomaly" assert data.attrs["units"] == "mGal" assert data.attrs["horizontal_datum"] == "WGS84" assert data.shape == (181, 361) diff --git a/pygmt/tests/test_datasets_earth_geoid.py b/pygmt/tests/test_datasets_earth_geoid.py index 1dbab676407..54ea0a85067 100644 --- a/pygmt/tests/test_datasets_earth_geoid.py +++ b/pygmt/tests/test_datasets_earth_geoid.py @@ -13,7 +13,7 @@ def test_earth_geoid_01d(): data = load_earth_geoid(resolution="01d") assert data.name == "earth_geoid" assert data.attrs["units"] == "m" - assert data.attrs["long_name"] == "EGM2008 Earth Geoid" + assert data.attrs["long_name"] == "EGM2008 Earth geoid" assert data.attrs["horizontal_datum"] == "WGS84" assert data.shape == (181, 361) assert data.gmt.registration == 0 diff --git a/pygmt/tests/test_datasets_earth_magnetic_anomaly.py b/pygmt/tests/test_datasets_earth_magnetic_anomaly.py index f84cd44c006..3ef49b38c4a 100644 --- a/pygmt/tests/test_datasets_earth_magnetic_anomaly.py +++ b/pygmt/tests/test_datasets_earth_magnetic_anomaly.py @@ -13,8 +13,8 @@ def test_earth_mag_01d(): Test some properties of the magnetic anomaly 01d data. """ data = load_earth_magnetic_anomaly(resolution="01d") - assert data.name == "magnetic_anomaly" - assert data.attrs["long_name"] == "Earth magnetic anomaly" + assert data.name == "earth_emag" + assert data.attrs["long_name"] == "Earth Magnetic Anomaly Model (EMAG2)" assert data.attrs["units"] == "nT" assert data.attrs["horizontal_datum"] == "WGS84" assert data.shape == (181, 361) @@ -59,8 +59,8 @@ def test_earth_mag4km_01d(): Test some properties of the magnetic anomaly 4km 01d data. """ data = load_earth_magnetic_anomaly(resolution="01d", data_source="emag2_4km") - assert data.name == "magnetic_anomaly" - assert data.attrs["long_name"] == "Earth magnetic anomaly" + assert data.name == "earth_emag" + assert data.attrs["long_name"] == "Earth Magnetic Anomaly Model (EMAG2)" assert data.attrs["units"] == "nT" assert data.attrs["horizontal_datum"] == "WGS84" assert data.shape == (181, 361) @@ -115,8 +115,8 @@ def test_earth_mag_01d_wdmam(): data = load_earth_magnetic_anomaly( resolution="01d", registration="gridline", data_source="wdmam" ) - assert data.name == "wdmam" - assert data.attrs["long_name"] == "World Digital Magnetic Anomaly Map" + assert data.name == "earth_wdmam" + assert data.attrs["long_name"] == "World Digital Magnetic Anomaly Map (WDMAM)" assert data.attrs["units"] == "nT" assert data.attrs["horizontal_datum"] == "WGS84" assert data.shape == (181, 361) diff --git a/pygmt/tests/test_datasets_earth_mask.py b/pygmt/tests/test_datasets_earth_mask.py index 0ecb7697488..d6eff4d0db6 100644 --- a/pygmt/tests/test_datasets_earth_mask.py +++ b/pygmt/tests/test_datasets_earth_mask.py @@ -12,7 +12,7 @@ def test_earth_mask_01d(): """ data = load_earth_mask(resolution="01d") assert data.name == "earth_mask" - assert data.attrs["long_name"] == "Mask of land and water features" + assert data.attrs["long_name"] == "GSHHG Earth mask" assert data.attrs["horizontal_datum"] == "WGS84" assert data.shape == (181, 361) assert data.gmt.registration == 0 diff --git a/pygmt/tests/test_datasets_earth_relief.py b/pygmt/tests/test_datasets_earth_relief.py index c8c63050a63..2cf34609932 100644 --- a/pygmt/tests/test_datasets_earth_relief.py +++ b/pygmt/tests/test_datasets_earth_relief.py @@ -17,13 +17,13 @@ def test_earth_relief_01d_igpp_synbath(data_source): Test some properties of the earth relief 01d data with IGPP and SYNBATH data. """ data = load_earth_relief(resolution="01d", data_source=data_source) - assert data.name == "elevation" + assert data.name == "earth_relief" assert data.attrs["units"] == "meters" - assert data.attrs["long_name"] == "Earth elevation relative to the geoid" + assert data.attrs["long_name"] == "IGPP and GEBCO Earth reliefs" assert data.attrs["vertical_datum"] == "EGM96" assert data.attrs["horizontal_datum"] == "WGS84" - assert data.gmt.registration == 0 assert data.shape == (181, 361) + assert data.gmt.registration == 0 npt.assert_allclose(data.lat, np.arange(-90, 91, 1)) npt.assert_allclose(data.lon, np.arange(-180, 181, 1)) npt.assert_allclose(data.min(), -7174.0, atol=0.5) @@ -36,8 +36,9 @@ def test_earth_relief_01d_gebco(data_source): Test some properties of the earth relief 01d data with GEBCO and GEBOCSI data. """ data = load_earth_relief(resolution="01d", data_source=data_source) + assert data.name == "earth_relief" assert data.attrs["units"] == "meters" - assert data.attrs["long_name"] == "Earth elevation relative to the geoid" + assert data.attrs["long_name"] == "IGPP and GEBCO Earth reliefs" assert data.attrs["vertical_datum"] == "EGM96" assert data.attrs["horizontal_datum"] == "WGS84" assert data.shape == (181, 361) diff --git a/pygmt/tests/test_datasets_earth_vertical_gravity_gradient.py b/pygmt/tests/test_datasets_earth_vertical_gravity_gradient.py index ad142f15a23..8e67fc83df1 100644 --- a/pygmt/tests/test_datasets_earth_vertical_gravity_gradient.py +++ b/pygmt/tests/test_datasets_earth_vertical_gravity_gradient.py @@ -13,7 +13,7 @@ def test_earth_vertical_gravity_gradient_01d(): data = load_earth_vertical_gravity_gradient(resolution="01d") assert data.name == "earth_vgg" assert data.attrs["units"] == "Eotvos" - assert data.attrs["long_name"] == "IGPP Earth Vertical Gravity Gradient" + assert data.attrs["long_name"] == "IGPP Earth vertical gravity gradient" assert data.attrs["horizontal_datum"] == "WGS84" assert data.shape == (181, 361) assert data.gmt.registration == 0 From b38635f3958649bc7d6c09398513db258a9d5e8b Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Wed, 7 Feb 2024 22:30:14 +0100 Subject: [PATCH 07/51] Adjust tutorial 'grid_equalization.py' --- examples/tutorials/advanced/grid_equalization.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/advanced/grid_equalization.py b/examples/tutorials/advanced/grid_equalization.py index b631fe49834..92bbf5fec55 100644 --- a/examples/tutorials/advanced/grid_equalization.py +++ b/examples/tutorials/advanced/grid_equalization.py @@ -20,7 +20,7 @@ grid = pygmt.datasets.load_earth_relief( resolution="03s", region=[-119.825, -119.4, 37.6, 37.825] ) -grid_dist = pygmt.grd2xyz(grid=grid, output_type="pandas")["elevation"] +grid_dist = pygmt.grd2xyz(grid=grid, output_type="pandas")["earth_relief"] # %% From 57be08db36e232a3b97163c8006dcced413f2cff Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Wed, 7 Feb 2024 22:40:04 +0100 Subject: [PATCH 08/51] Adjust earth_age test --- pygmt/tests/test_datasets_earth_age.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pygmt/tests/test_datasets_earth_age.py b/pygmt/tests/test_datasets_earth_age.py index 0288d333656..22f00d56796 100644 --- a/pygmt/tests/test_datasets_earth_age.py +++ b/pygmt/tests/test_datasets_earth_age.py @@ -11,9 +11,9 @@ def test_earth_age_01d(): Test some properties of the earth age 01d data. """ data = load_earth_age(resolution="01d") - assert data.name == "seafloor_age" + assert data.name == "earth_age" assert data.attrs["units"] == "Myr" - assert data.attrs["long_name"] == "age of seafloor crust" + assert data.attrs["long_name"] == "EarthByte Earth seafloor crustal age" assert data.attrs["horizontal_datum"] == "WGS84" assert data.shape == (181, 361) assert data.gmt.registration == 0 From 28df44863d399248c22cff2d1c90427384b1be1e Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Wed, 7 Feb 2024 22:40:20 +0100 Subject: [PATCH 09/51] Fix typo --- pygmt/datasets/load_remote_dataset.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/datasets/load_remote_dataset.py b/pygmt/datasets/load_remote_dataset.py index 020ea8fa819..991dd8e5479 100644 --- a/pygmt/datasets/load_remote_dataset.py +++ b/pygmt/datasets/load_remote_dataset.py @@ -81,7 +81,7 @@ class GMTRemoteDataset(NamedTuple): ), "earth_faa": GMTRemoteDataset( name="earth_faa", - long_name="IGPP Earth free-fir anomaly", + long_name="IGPP Earth free-air anomaly", units="mGal", extra_attributes={"horizontal_datum": "WGS84"}, resolutions={ From bfd447b12da64d3f99f8eccee78a349ee2ad755a Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Wed, 7 Feb 2024 22:47:02 +0100 Subject: [PATCH 10/51] Adjust test 'load_remote_datasets' --- pygmt/tests/test_datasets_load_remote_datasets.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pygmt/tests/test_datasets_load_remote_datasets.py b/pygmt/tests/test_datasets_load_remote_datasets.py index 3d68518f18d..1837020960c 100644 --- a/pygmt/tests/test_datasets_load_remote_datasets.py +++ b/pygmt/tests/test_datasets_load_remote_datasets.py @@ -27,8 +27,8 @@ def test_load_remote_dataset_benchmark_with_region(): Benchmark loading a remote dataset with 'region'. """ data = load_remote_dataset_wrapper(resolution="01d", region=[-10, 10, -5, 5]) - assert data.name == "seafloor_age" - assert data.attrs["long_name"] == "age of seafloor crust" + assert data.name == "earth_age" + assert data.attrs["long_name"] == "EarthByte Earth seafloor crustal age" assert data.attrs["units"] == "Myr" assert data.attrs["horizontal_datum"] == "WGS84" assert data.gmt.registration == 0 From 74d9bc8808fbbbee5e6505eebab6ddb818adb2f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= <94163266+yvonnefroehlich@users.noreply.github.com> Date: Fri, 1 Mar 2024 16:04:01 +0100 Subject: [PATCH 11/51] Fix typo Co-authored-by: Dongdong Tian --- pygmt/datasets/earth_vertical_gravity_gradient.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/datasets/earth_vertical_gravity_gradient.py b/pygmt/datasets/earth_vertical_gravity_gradient.py index c8406387b19..007d90df024 100644 --- a/pygmt/datasets/earth_vertical_gravity_gradient.py +++ b/pygmt/datasets/earth_vertical_gravity_gradient.py @@ -1,5 +1,5 @@ """ -Function to download the IGPP Earth gertical gravity gradient dataset from the GMT data +Function to download the IGPP Earth vertical gravity gradient dataset from the GMT data server, and load as :class:`xarray.DataArray`. The grids are available in various resolutions. From 15f42b72064deba77870b627d93a17c98a879996 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Mon, 4 Mar 2024 21:14:36 +0100 Subject: [PATCH 12/51] Separte Earth relief dataset in 'igpp' and 'gebco' --- pygmt/datasets/earth_relief.py | 8 ++++++-- pygmt/datasets/load_remote_dataset.py | 27 +++++++++++++++++++++++++-- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/pygmt/datasets/earth_relief.py b/pygmt/datasets/earth_relief.py index ee1059a21b9..1142bead49e 100644 --- a/pygmt/datasets/earth_relief.py +++ b/pygmt/datasets/earth_relief.py @@ -160,9 +160,13 @@ def load_earth_relief( ) else: dataset_prefix = earth_relief_sources[data_source] - + # Choose earth relief dataset + if data_source in ["igpp", "synbath"]: + dataset_name = "earth_igpp" + else if data_sourcce in ["gebco", "gebcosi"]: + dataset_name = "earth_gebco" grid = _load_remote_dataset( - dataset_name="earth_relief", + dataset_name=dataset_name, dataset_prefix=dataset_prefix, resolution=resolution, region=region, diff --git a/pygmt/datasets/load_remote_dataset.py b/pygmt/datasets/load_remote_dataset.py index 991dd8e5479..548b50ec1bc 100644 --- a/pygmt/datasets/load_remote_dataset.py +++ b/pygmt/datasets/load_remote_dataset.py @@ -156,9 +156,32 @@ class GMTRemoteDataset(NamedTuple): "15s": Resolution("15s"), }, ), - "earth_relief": GMTRemoteDataset( + "earth_igpp": GMTRemoteDataset( name="earth_relief", - long_name="IGPP and GEBCO Earth reliefs", + long_name="IGPP Earth relief", + units="meters", + extra_attributes={"vertical_datum": "EGM96", "horizontal_datum": "WGS84"}, + resolutions={ + "01d": Resolution("01d"), + "30m": Resolution("30m"), + "20m": Resolution("20m"), + "15m": Resolution("15m"), + "10m": Resolution("10m"), + "06m": Resolution("06m"), + "05m": Resolution("05m", tiled=True), + "04m": Resolution("04m", tiled=True), + "03m": Resolution("03m", tiled=True), + "02m": Resolution("02m", tiled=True), + "01m": Resolution("01m", tiled=True), + "30s": Resolution("30s", tiled=True), + "15s": Resolution("15s", registrations=["pixel"], tiled=True), + "03s": Resolution("03s", registrations=["gridline"], tiled=True), + "01s": Resolution("01s", registrations=["gridline"], tiled=True), + }, + ), + "earth_gebco": GMTRemoteDataset( + name="earth_relief", + long_name="GEBCO Earth relief", units="meters", extra_attributes={"vertical_datum": "EGM96", "horizontal_datum": "WGS84"}, resolutions={ From 3b999e7376f81580bbb655d4ae29ff5a55f3ddd2 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Mon, 4 Mar 2024 21:18:10 +0100 Subject: [PATCH 13/51] Sort alphabetically --- pygmt/datasets/load_remote_dataset.py | 86 +++++++++++++-------------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/pygmt/datasets/load_remote_dataset.py b/pygmt/datasets/load_remote_dataset.py index 548b50ec1bc..2b7cee4b445 100644 --- a/pygmt/datasets/load_remote_dataset.py +++ b/pygmt/datasets/load_remote_dataset.py @@ -79,10 +79,10 @@ class GMTRemoteDataset(NamedTuple): "01m": Resolution("01m", registrations=["gridline"], tiled=True), }, ), - "earth_faa": GMTRemoteDataset( - name="earth_faa", - long_name="IGPP Earth free-air anomaly", - units="mGal", + "earth_emag": GMTRemoteDataset( + name="earth_emag", + long_name="Earth Magnetic Anomaly Model (EMAG2)", + units="nT", extra_attributes={"horizontal_datum": "WGS84"}, resolutions={ "01d": Resolution("01d"), @@ -94,14 +94,13 @@ class GMTRemoteDataset(NamedTuple): "05m": Resolution("05m", tiled=True), "04m": Resolution("04m", tiled=True), "03m": Resolution("03m", tiled=True), - "02m": Resolution("02m", tiled=True), - "01m": Resolution("01m", registrations=["pixel"], tiled=True), + "02m": Resolution("02m", registrations=["pixel"], tiled=True), }, ), - "earth_geoid": GMTRemoteDataset( - name="earth_geoid", - long_name="EGM2008 Earth geoid", - units="m", + "earth_faa": GMTRemoteDataset( + name="earth_faa", + long_name="IGPP Earth free-air anomaly", + units="mGal", extra_attributes={"horizontal_datum": "WGS84"}, resolutions={ "01d": Resolution("01d"), @@ -114,14 +113,14 @@ class GMTRemoteDataset(NamedTuple): "04m": Resolution("04m", tiled=True), "03m": Resolution("03m", tiled=True), "02m": Resolution("02m", tiled=True), - "01m": Resolution("01m", registrations=["gridline"], tiled=True), + "01m": Resolution("01m", registrations=["pixel"], tiled=True), }, ), - "earth_emag": GMTRemoteDataset( - name="earth_emag", - long_name="Earth Magnetic Anomaly Model (EMAG2)", - units="nT", - extra_attributes={"horizontal_datum": "WGS84"}, + "earth_gebco": GMTRemoteDataset( + name="earth_gebco", + long_name="GEBCO Earth relief", + units="meters", + extra_attributes={"vertical_datum": "EGM96", "horizontal_datum": "WGS84"}, resolutions={ "01d": Resolution("01d"), "30m": Resolution("30m"), @@ -132,13 +131,18 @@ class GMTRemoteDataset(NamedTuple): "05m": Resolution("05m", tiled=True), "04m": Resolution("04m", tiled=True), "03m": Resolution("03m", tiled=True), - "02m": Resolution("02m", registrations=["pixel"], tiled=True), + "02m": Resolution("02m", tiled=True), + "01m": Resolution("01m", tiled=True), + "30s": Resolution("30s", tiled=True), + "15s": Resolution("15s", registrations=["pixel"], tiled=True), + "03s": Resolution("03s", registrations=["gridline"], tiled=True), + "01s": Resolution("01s", registrations=["gridline"], tiled=True), }, ), - "earth_mask": GMTRemoteDataset( - name="earth_mask", - long_name="GSHHG Earth mask", - units=None, + "earth_geoid": GMTRemoteDataset( + name="earth_geoid", + long_name="EGM2008 Earth geoid", + units="m", extra_attributes={"horizontal_datum": "WGS84"}, resolutions={ "01d": Resolution("01d"), @@ -147,17 +151,15 @@ class GMTRemoteDataset(NamedTuple): "15m": Resolution("15m"), "10m": Resolution("10m"), "06m": Resolution("06m"), - "05m": Resolution("05m"), - "04m": Resolution("04m"), - "03m": Resolution("03m"), - "02m": Resolution("02m"), - "01m": Resolution("01m"), - "30s": Resolution("30s"), - "15s": Resolution("15s"), + "05m": Resolution("05m", tiled=True), + "04m": Resolution("04m", tiled=True), + "03m": Resolution("03m", tiled=True), + "02m": Resolution("02m", tiled=True), + "01m": Resolution("01m", registrations=["gridline"], tiled=True), }, ), "earth_igpp": GMTRemoteDataset( - name="earth_relief", + name="earth_igpp", long_name="IGPP Earth relief", units="meters", extra_attributes={"vertical_datum": "EGM96", "horizontal_datum": "WGS84"}, @@ -179,11 +181,11 @@ class GMTRemoteDataset(NamedTuple): "01s": Resolution("01s", registrations=["gridline"], tiled=True), }, ), - "earth_gebco": GMTRemoteDataset( - name="earth_relief", - long_name="GEBCO Earth relief", - units="meters", - extra_attributes={"vertical_datum": "EGM96", "horizontal_datum": "WGS84"}, + "earth_mask": GMTRemoteDataset( + name="earth_mask", + long_name="GSHHG Earth mask", + units=None, + extra_attributes={"horizontal_datum": "WGS84"}, resolutions={ "01d": Resolution("01d"), "30m": Resolution("30m"), @@ -191,15 +193,13 @@ class GMTRemoteDataset(NamedTuple): "15m": Resolution("15m"), "10m": Resolution("10m"), "06m": Resolution("06m"), - "05m": Resolution("05m", tiled=True), - "04m": Resolution("04m", tiled=True), - "03m": Resolution("03m", tiled=True), - "02m": Resolution("02m", tiled=True), - "01m": Resolution("01m", tiled=True), - "30s": Resolution("30s", tiled=True), - "15s": Resolution("15s", registrations=["pixel"], tiled=True), - "03s": Resolution("03s", registrations=["gridline"], tiled=True), - "01s": Resolution("01s", registrations=["gridline"], tiled=True), + "05m": Resolution("05m"), + "04m": Resolution("04m"), + "03m": Resolution("03m"), + "02m": Resolution("02m"), + "01m": Resolution("01m"), + "30s": Resolution("30s"), + "15s": Resolution("15s"), }, ), "earth_vgg": GMTRemoteDataset( From 582235ceded59217cde5b1a19def48f416e2e4f0 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Mon, 4 Mar 2024 21:25:32 +0100 Subject: [PATCH 14/51] Adjust tests --- pygmt/tests/test_datasets_earth_relief.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pygmt/tests/test_datasets_earth_relief.py b/pygmt/tests/test_datasets_earth_relief.py index 2cf34609932..9882150dfa1 100644 --- a/pygmt/tests/test_datasets_earth_relief.py +++ b/pygmt/tests/test_datasets_earth_relief.py @@ -17,9 +17,9 @@ def test_earth_relief_01d_igpp_synbath(data_source): Test some properties of the earth relief 01d data with IGPP and SYNBATH data. """ data = load_earth_relief(resolution="01d", data_source=data_source) - assert data.name == "earth_relief" + assert data.name == "earth_igpp" assert data.attrs["units"] == "meters" - assert data.attrs["long_name"] == "IGPP and GEBCO Earth reliefs" + assert data.attrs["long_name"] == "IGPP Earth relief" assert data.attrs["vertical_datum"] == "EGM96" assert data.attrs["horizontal_datum"] == "WGS84" assert data.shape == (181, 361) @@ -36,9 +36,9 @@ def test_earth_relief_01d_gebco(data_source): Test some properties of the earth relief 01d data with GEBCO and GEBOCSI data. """ data = load_earth_relief(resolution="01d", data_source=data_source) - assert data.name == "earth_relief" + assert data.name == "earth_gebco" assert data.attrs["units"] == "meters" - assert data.attrs["long_name"] == "IGPP and GEBCO Earth reliefs" + assert data.attrs["long_name"] == "GEBCO Earth relief" assert data.attrs["vertical_datum"] == "EGM96" assert data.attrs["horizontal_datum"] == "WGS84" assert data.shape == (181, 361) From 3ca6f323f11545695b8a54b59cc3f80fbee94b98 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Mon, 4 Mar 2024 21:27:39 +0100 Subject: [PATCH 15/51] Fix programming language --- pygmt/datasets/earth_relief.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/datasets/earth_relief.py b/pygmt/datasets/earth_relief.py index 1142bead49e..118f98b1e71 100644 --- a/pygmt/datasets/earth_relief.py +++ b/pygmt/datasets/earth_relief.py @@ -163,7 +163,7 @@ def load_earth_relief( # Choose earth relief dataset if data_source in ["igpp", "synbath"]: dataset_name = "earth_igpp" - else if data_sourcce in ["gebco", "gebcosi"]: + elif data_sourcce in ["gebco", "gebcosi"]: dataset_name = "earth_gebco" grid = _load_remote_dataset( dataset_name=dataset_name, From 098b45a1a96c63ac8426143db0c7be37a73a17c7 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Mon, 4 Mar 2024 21:28:46 +0100 Subject: [PATCH 16/51] Fix typo --- pygmt/datasets/earth_relief.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/datasets/earth_relief.py b/pygmt/datasets/earth_relief.py index 118f98b1e71..18578e49af5 100644 --- a/pygmt/datasets/earth_relief.py +++ b/pygmt/datasets/earth_relief.py @@ -163,7 +163,7 @@ def load_earth_relief( # Choose earth relief dataset if data_source in ["igpp", "synbath"]: dataset_name = "earth_igpp" - elif data_sourcce in ["gebco", "gebcosi"]: + elif data_source in ["gebco", "gebcosi"]: dataset_name = "earth_gebco" grid = _load_remote_dataset( dataset_name=dataset_name, From 2393ec4794aef3bbc6419eb14be9b7fe6a02518f Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Mon, 4 Mar 2024 22:00:30 +0100 Subject: [PATCH 17/51] Fix tutorial --- examples/tutorials/advanced/grid_equalization.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/advanced/grid_equalization.py b/examples/tutorials/advanced/grid_equalization.py index 92bbf5fec55..b631fe49834 100644 --- a/examples/tutorials/advanced/grid_equalization.py +++ b/examples/tutorials/advanced/grid_equalization.py @@ -20,7 +20,7 @@ grid = pygmt.datasets.load_earth_relief( resolution="03s", region=[-119.825, -119.4, 37.6, 37.825] ) -grid_dist = pygmt.grd2xyz(grid=grid, output_type="pandas")["earth_relief"] +grid_dist = pygmt.grd2xyz(grid=grid, output_type="pandas")["elevation"] # %% From d2b2c4312487e7abb1f2fb11b2432a3de1c59ccc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= <94163266+yvonnefroehlich@users.noreply.github.com> Date: Sat, 9 Mar 2024 20:38:37 +0100 Subject: [PATCH 18/51] Shorten documentation Co-authored-by: Dongdong Tian --- pygmt/datasets/load_remote_dataset.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/datasets/load_remote_dataset.py b/pygmt/datasets/load_remote_dataset.py index 2b7cee4b445..ea4986d982e 100644 --- a/pygmt/datasets/load_remote_dataset.py +++ b/pygmt/datasets/load_remote_dataset.py @@ -41,7 +41,7 @@ class GMTRemoteDataset(NamedTuple): Attributes ---------- name : str - The name assigned as an attribute to the DataArray and used in error messages. + The name assigned as an attribute to the DataArray. long_name : str The long name assigned as an attribute to the DataArray. units : str From 02cc0181822dd22b15eaf80b7d03e0a6d7312468 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= <94163266+yvonnefroehlich@users.noreply.github.com> Date: Sat, 9 Mar 2024 20:40:16 +0100 Subject: [PATCH 19/51] Use 'earth_mag' instead of 'earth_emag' Co-authored-by: Dongdong Tian --- pygmt/datasets/load_remote_dataset.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pygmt/datasets/load_remote_dataset.py b/pygmt/datasets/load_remote_dataset.py index ea4986d982e..c9da97ebeb6 100644 --- a/pygmt/datasets/load_remote_dataset.py +++ b/pygmt/datasets/load_remote_dataset.py @@ -79,8 +79,8 @@ class GMTRemoteDataset(NamedTuple): "01m": Resolution("01m", registrations=["gridline"], tiled=True), }, ), - "earth_emag": GMTRemoteDataset( - name="earth_emag", + "earth_mag": GMTRemoteDataset( + name="earth_mag", long_name="Earth Magnetic Anomaly Model (EMAG2)", units="nT", extra_attributes={"horizontal_datum": "WGS84"}, From d09db24aa63edf468d5bc2357d9995dfab06292c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= <94163266+yvonnefroehlich@users.noreply.github.com> Date: Sat, 9 Mar 2024 20:40:44 +0100 Subject: [PATCH 20/51] Use 'earth_mag' instead of 'earth_emag' Co-authored-by: Dongdong Tian --- pygmt/datasets/earth_magnetic_anomaly.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/datasets/earth_magnetic_anomaly.py b/pygmt/datasets/earth_magnetic_anomaly.py index a0ea618b808..55ba594be41 100644 --- a/pygmt/datasets/earth_magnetic_anomaly.py +++ b/pygmt/datasets/earth_magnetic_anomaly.py @@ -146,7 +146,7 @@ def load_earth_magnetic_anomaly( "Valid values are 'emag2', 'emag2_4km', and 'wdmam'." ) dataset_prefix = magnetic_anomaly_sources[data_source] - dataset_name = "earth_wdmam" if data_source == "wdmam" else "earth_emag" + dataset_name = "earth_wdmam" if data_source == "wdmam" else "earth_mag" grid = _load_remote_dataset( dataset_name=dataset_name, dataset_prefix=dataset_prefix, From 36cf851ec0a7493b6808e1bd6cf0d8ab0d86e17d Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Sat, 9 Mar 2024 20:46:42 +0100 Subject: [PATCH 21/51] Adjust test --- pygmt/tests/test_datasets_earth_magnetic_anomaly.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pygmt/tests/test_datasets_earth_magnetic_anomaly.py b/pygmt/tests/test_datasets_earth_magnetic_anomaly.py index 3ef49b38c4a..1afef151680 100644 --- a/pygmt/tests/test_datasets_earth_magnetic_anomaly.py +++ b/pygmt/tests/test_datasets_earth_magnetic_anomaly.py @@ -13,7 +13,7 @@ def test_earth_mag_01d(): Test some properties of the magnetic anomaly 01d data. """ data = load_earth_magnetic_anomaly(resolution="01d") - assert data.name == "earth_emag" + assert data.name == "earth_mag" assert data.attrs["long_name"] == "Earth Magnetic Anomaly Model (EMAG2)" assert data.attrs["units"] == "nT" assert data.attrs["horizontal_datum"] == "WGS84" @@ -59,7 +59,7 @@ def test_earth_mag4km_01d(): Test some properties of the magnetic anomaly 4km 01d data. """ data = load_earth_magnetic_anomaly(resolution="01d", data_source="emag2_4km") - assert data.name == "earth_emag" + assert data.name == "earth_mag" assert data.attrs["long_name"] == "Earth Magnetic Anomaly Model (EMAG2)" assert data.attrs["units"] == "nT" assert data.attrs["horizontal_datum"] == "WGS84" From fabae4c5bcb0c2f3bc0746f4cbf803cbdbe6be37 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Sat, 9 Mar 2024 21:47:55 +0100 Subject: [PATCH 22/51] TEST - Change keyword --- examples/tutorials/advanced/grid_equalization.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/advanced/grid_equalization.py b/examples/tutorials/advanced/grid_equalization.py index b631fe49834..143b90001c9 100644 --- a/examples/tutorials/advanced/grid_equalization.py +++ b/examples/tutorials/advanced/grid_equalization.py @@ -20,7 +20,7 @@ grid = pygmt.datasets.load_earth_relief( resolution="03s", region=[-119.825, -119.4, 37.6, 37.825] ) -grid_dist = pygmt.grd2xyz(grid=grid, output_type="pandas")["elevation"] +grid_dist = pygmt.grd2xyz(grid=grid, output_type="pandas")["elvation"] # %% From 4d160fce0483ce10fcbac19d793d71e80a6ad5e0 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Sat, 9 Mar 2024 21:48:31 +0100 Subject: [PATCH 23/51] TEST - Change keyword back --- examples/tutorials/advanced/grid_equalization.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/advanced/grid_equalization.py b/examples/tutorials/advanced/grid_equalization.py index 143b90001c9..b631fe49834 100644 --- a/examples/tutorials/advanced/grid_equalization.py +++ b/examples/tutorials/advanced/grid_equalization.py @@ -20,7 +20,7 @@ grid = pygmt.datasets.load_earth_relief( resolution="03s", region=[-119.825, -119.4, 37.6, 37.825] ) -grid_dist = pygmt.grd2xyz(grid=grid, output_type="pandas")["elvation"] +grid_dist = pygmt.grd2xyz(grid=grid, output_type="pandas")["elevation"] # %% From 39085c7c5b76f146f58ef9091e925f1ccea9b631 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Sun, 10 Mar 2024 07:34:26 +0100 Subject: [PATCH 24/51] TEST - Remove 'grid_equalization' tutorial --- .../tutorials/advanced/grid_equalization.py | 245 ------------------ 1 file changed, 245 deletions(-) delete mode 100644 examples/tutorials/advanced/grid_equalization.py diff --git a/examples/tutorials/advanced/grid_equalization.py b/examples/tutorials/advanced/grid_equalization.py deleted file mode 100644 index b631fe49834..00000000000 --- a/examples/tutorials/advanced/grid_equalization.py +++ /dev/null @@ -1,245 +0,0 @@ -""" -Performing grid histogram equalization -====================================== - -The :meth:`pygmt.grdhisteq.equalize_grid` method creates a grid using -statistics based on a cumulative distribution function. -""" - -# %% -import pygmt - -# %% -# Load sample data -# ---------------- -# -# Load the sample Earth relief data for a region around Yosemite Valley -# and use :func:`pygmt.grd2xyz` to create a :class:`pandas.Series` with the -# z-values. - -grid = pygmt.datasets.load_earth_relief( - resolution="03s", region=[-119.825, -119.4, 37.6, 37.825] -) -grid_dist = pygmt.grd2xyz(grid=grid, output_type="pandas")["elevation"] - - -# %% -# Plot the original digital elevation model and data distribution -# --------------------------------------------------------------- -# -# For comparison, we will create a map of the original digital elevation -# model and a histogram showing the distribution of elevation data values. - -# Create an instance of the Figure class -fig = pygmt.Figure() -# Define figure configuration -pygmt.config(FORMAT_GEO_MAP="ddd.x", MAP_FRAME_TYPE="plain") -# Define the colormap for the figure -pygmt.makecpt(series=[500, 3540], cmap="turku") -# Setup subplots with two panels -with fig.subplot( - nrows=1, ncols=2, figsize=("13.5c", "4c"), title="Digital Elevation Model" -): - # Plot the original digital elevation model in the first panel - with fig.set_panel(panel=0): - fig.grdimage(grid=grid, projection="M?", frame="WSne", cmap=True) - # Plot a histogram showing the z-value distribution in the original digital - # elevation model - with fig.set_panel(panel=1): - fig.histogram( - data=grid_dist, - projection="X?", - region=[500, 3600, 0, 20], - series=[500, 3600, 100], - frame=["wnSE", "xaf+lElevation (m)", "yaf+lPercent frequency"], - cmap=True, - histtype=1, - pen="1p,black", - ) - fig.colorbar(position="JMR+o1.5c/0c+w3c/0.3c", frame=True) -fig.show() - - -# %% -# Equalize grid based on a linear distribution -# -------------------------------------------- -# -# The :meth:`pygmt.grdhisteq.equalize_grid` method creates a new grid with the -# z-values representing the position of the original z-values in a given -# cumulative distribution. By default, it computes the position in a linear -# distribution. Here, we equalize the grid into nine divisions based on a -# linear distribution and produce a :class:`pandas.Series` with the z-values -# for the new grid. - -divisions = 9 -linear = pygmt.grdhisteq.equalize_grid(grid=grid, divisions=divisions) -linear_dist = pygmt.grd2xyz(grid=linear, output_type="pandas")["z"] - - -# %% -# Calculate the bins used for data transformation -# ----------------------------------------------- -# -# The :meth:`pygmt.grdhisteq.compute_bins` method reports statistics about the -# grid equalization. Here, we report the bins that would linearly divide the -# original data into 9 divisions with equal area. In our new grid produced by -# :meth:`pygmt.grdhisteq.equalize_grid`, all the grid cells with values between -# ``start`` and ``stop`` of ``bin_id=0`` are assigned the value 0, all grid -# cells with values between ``start`` and ``stop`` of ``bin_id=1`` are assigned -# the value 1, and so on. - -pygmt.grdhisteq.compute_bins(grid=grid, divisions=divisions) - - -# %% -# Plot the equally distributed data -# --------------------------------- -# -# Here we create a map showing the grid that has been transformed to -# have a linear distribution with nine divisions and a histogram of the data -# values. - -# Create an instance of the Figure class -fig = pygmt.Figure() -# Define figure configuration -pygmt.config(FORMAT_GEO_MAP="ddd.x", MAP_FRAME_TYPE="plain") -# Define the colormap for the figure -pygmt.makecpt(series=[0, divisions, 1], cmap="lajolla") -# Setup subplots with two panels -with fig.subplot( - nrows=1, ncols=2, figsize=("13.5c", "4c"), title="Linear distribution" -): - # Plot the grid with a linear distribution in the first panel - with fig.set_panel(panel=0): - fig.grdimage(grid=linear, projection="M?", frame="WSne", cmap=True) - # Plot a histogram showing the linear z-value distribution - with fig.set_panel(panel=1): - fig.histogram( - data=linear_dist, - projection="X?", - region=[-1, divisions, 0, 40], - series=[0, divisions, 1], - frame=["wnSE", "xaf+lRelative elevation", "yaf+lPercent frequency"], - cmap=True, - histtype=1, - pen="1p,black", - center=True, - ) - fig.colorbar(position="JMR+o1.5c/0c+w3c/0.3c", frame=True) -fig.show() - - -# %% -# Transform grid based on a normal distribution -# --------------------------------------------- -# -# The ``gaussian`` parameter of :meth:`pygmt.grdhisteq.equalize_grid` can be -# used to transform the z-values relative to their position in a normal -# distribution rather than a linear distribution. In this case, the output -# data are continuous rather than discrete. - -normal = pygmt.grdhisteq.equalize_grid(grid=grid, gaussian=True) -normal_dist = pygmt.grd2xyz(grid=normal, output_type="pandas")["z"] - - -# %% -# Plot the normally distributed data -# ---------------------------------- -# -# Here we create a map showing the grid that has been transformed to have -# a normal distribution and a histogram of the data values. - -# Create an instance of the Figure class -fig = pygmt.Figure() -# Define figure configuration -pygmt.config(FORMAT_GEO_MAP="ddd.x", MAP_FRAME_TYPE="plain") -# Define the colormap for the figure -pygmt.makecpt(series=[-4.5, 4.5], cmap="vik") -# Setup subplots with two panels -with fig.subplot( - nrows=1, ncols=2, figsize=("13.5c", "4c"), title="Normal distribution" -): - # Plot the grid with a normal distribution in the first panel - with fig.set_panel(panel=0): - fig.grdimage(grid=normal, projection="M?", frame="WSne", cmap=True) - # Plot a histogram showing the normal z-value distribution - with fig.set_panel(panel=1): - fig.histogram( - data=normal_dist, - projection="X?", - region=[-4.5, 4.5, 0, 20], - series=[-4.5, 4.5, 0.2], - frame=["wnSE", "xaf+lRelative elevation", "yaf+lPercent frequency"], - cmap=True, - histtype=1, - pen="1p,black", - ) - fig.colorbar(position="JMR+o1.5c/0c+w3c/0.3c", frame=True) -fig.show() - - -# %% -# Equalize grid based on a quadratic distribution -# ----------------------------------------------- -# -# The ``quadratic`` parameter of :meth:`pygmt.grdhisteq.equalize_grid` can be -# used to transform the z-values relative to their position in a quadratic -# distribution rather than a linear distribution. Here, we equalize the grid -# into nine divisions based on a quadratic distribution and produce a -# :class:`pandas.Series` with the z-values for the new grid. - -quadratic = pygmt.grdhisteq.equalize_grid( - grid=grid, quadratic=True, divisions=divisions -) -quadratic_dist = pygmt.grd2xyz(grid=quadratic, output_type="pandas")["z"] - - -# %% -# Calculate the bins used for data transformation -# ----------------------------------------------- -# -# We can also use the ``quadratic`` parameter of -# :meth:`pygmt.grdhisteq.compute_bins` to report the bins used for dividing -# the grid into 9 divisions based on their position in a quadratic -# distribution. - -pygmt.grdhisteq.compute_bins(grid=grid, divisions=divisions, quadratic=True) - - -# %% -# Plot the quadratic distribution of data -# --------------------------------------- -# -# Here we create a map showing the grid that has been transformed to have -# a quadratic distribution and a histogram of the data values. - -# Create an instance of the Figure class -fig = pygmt.Figure() -# Define figure configuration -pygmt.config(FORMAT_GEO_MAP="ddd.x", MAP_FRAME_TYPE="plain") -# Define the colormap for the figure -pygmt.makecpt(series=[0, divisions, 1], cmap="lajolla") -# Setup subplots with two panels -with fig.subplot( - nrows=1, ncols=2, figsize=("13.5c", "4c"), title="Quadratic distribution" -): - # Plot the grid with a quadratic distribution in the first panel - with fig.set_panel(panel=0): - fig.grdimage(grid=quadratic, projection="M?", frame="WSne", cmap=True) - # Plot a histogram showing the quadratic z-value distribution - with fig.set_panel(panel=1): - fig.histogram( - data=quadratic_dist, - projection="X?", - region=[-1, divisions, 0, 40], - series=[0, divisions, 1], - frame=["wnSE", "xaf+lRelative elevation", "yaf+lPercent frequency"], - cmap=True, - histtype=1, - pen="1p,black", - center=True, - ) - fig.colorbar(position="JMR+o1.5c/0c+w3c/0.3c", frame=True) -fig.show() - -# sphinx_gallery_thumbnail_number = 3 From 48608f207d6009e715f7afb67da0b239d4150c71 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Sun, 10 Mar 2024 11:33:07 +0100 Subject: [PATCH 25/51] Revert "TEST - Remove 'grid_equalization' tutorial" This reverts commit 39085c7c5b76f146f58ef9091e925f1ccea9b631. --- .../tutorials/advanced/grid_equalization.py | 245 ++++++++++++++++++ 1 file changed, 245 insertions(+) create mode 100644 examples/tutorials/advanced/grid_equalization.py diff --git a/examples/tutorials/advanced/grid_equalization.py b/examples/tutorials/advanced/grid_equalization.py new file mode 100644 index 00000000000..b631fe49834 --- /dev/null +++ b/examples/tutorials/advanced/grid_equalization.py @@ -0,0 +1,245 @@ +""" +Performing grid histogram equalization +====================================== + +The :meth:`pygmt.grdhisteq.equalize_grid` method creates a grid using +statistics based on a cumulative distribution function. +""" + +# %% +import pygmt + +# %% +# Load sample data +# ---------------- +# +# Load the sample Earth relief data for a region around Yosemite Valley +# and use :func:`pygmt.grd2xyz` to create a :class:`pandas.Series` with the +# z-values. + +grid = pygmt.datasets.load_earth_relief( + resolution="03s", region=[-119.825, -119.4, 37.6, 37.825] +) +grid_dist = pygmt.grd2xyz(grid=grid, output_type="pandas")["elevation"] + + +# %% +# Plot the original digital elevation model and data distribution +# --------------------------------------------------------------- +# +# For comparison, we will create a map of the original digital elevation +# model and a histogram showing the distribution of elevation data values. + +# Create an instance of the Figure class +fig = pygmt.Figure() +# Define figure configuration +pygmt.config(FORMAT_GEO_MAP="ddd.x", MAP_FRAME_TYPE="plain") +# Define the colormap for the figure +pygmt.makecpt(series=[500, 3540], cmap="turku") +# Setup subplots with two panels +with fig.subplot( + nrows=1, ncols=2, figsize=("13.5c", "4c"), title="Digital Elevation Model" +): + # Plot the original digital elevation model in the first panel + with fig.set_panel(panel=0): + fig.grdimage(grid=grid, projection="M?", frame="WSne", cmap=True) + # Plot a histogram showing the z-value distribution in the original digital + # elevation model + with fig.set_panel(panel=1): + fig.histogram( + data=grid_dist, + projection="X?", + region=[500, 3600, 0, 20], + series=[500, 3600, 100], + frame=["wnSE", "xaf+lElevation (m)", "yaf+lPercent frequency"], + cmap=True, + histtype=1, + pen="1p,black", + ) + fig.colorbar(position="JMR+o1.5c/0c+w3c/0.3c", frame=True) +fig.show() + + +# %% +# Equalize grid based on a linear distribution +# -------------------------------------------- +# +# The :meth:`pygmt.grdhisteq.equalize_grid` method creates a new grid with the +# z-values representing the position of the original z-values in a given +# cumulative distribution. By default, it computes the position in a linear +# distribution. Here, we equalize the grid into nine divisions based on a +# linear distribution and produce a :class:`pandas.Series` with the z-values +# for the new grid. + +divisions = 9 +linear = pygmt.grdhisteq.equalize_grid(grid=grid, divisions=divisions) +linear_dist = pygmt.grd2xyz(grid=linear, output_type="pandas")["z"] + + +# %% +# Calculate the bins used for data transformation +# ----------------------------------------------- +# +# The :meth:`pygmt.grdhisteq.compute_bins` method reports statistics about the +# grid equalization. Here, we report the bins that would linearly divide the +# original data into 9 divisions with equal area. In our new grid produced by +# :meth:`pygmt.grdhisteq.equalize_grid`, all the grid cells with values between +# ``start`` and ``stop`` of ``bin_id=0`` are assigned the value 0, all grid +# cells with values between ``start`` and ``stop`` of ``bin_id=1`` are assigned +# the value 1, and so on. + +pygmt.grdhisteq.compute_bins(grid=grid, divisions=divisions) + + +# %% +# Plot the equally distributed data +# --------------------------------- +# +# Here we create a map showing the grid that has been transformed to +# have a linear distribution with nine divisions and a histogram of the data +# values. + +# Create an instance of the Figure class +fig = pygmt.Figure() +# Define figure configuration +pygmt.config(FORMAT_GEO_MAP="ddd.x", MAP_FRAME_TYPE="plain") +# Define the colormap for the figure +pygmt.makecpt(series=[0, divisions, 1], cmap="lajolla") +# Setup subplots with two panels +with fig.subplot( + nrows=1, ncols=2, figsize=("13.5c", "4c"), title="Linear distribution" +): + # Plot the grid with a linear distribution in the first panel + with fig.set_panel(panel=0): + fig.grdimage(grid=linear, projection="M?", frame="WSne", cmap=True) + # Plot a histogram showing the linear z-value distribution + with fig.set_panel(panel=1): + fig.histogram( + data=linear_dist, + projection="X?", + region=[-1, divisions, 0, 40], + series=[0, divisions, 1], + frame=["wnSE", "xaf+lRelative elevation", "yaf+lPercent frequency"], + cmap=True, + histtype=1, + pen="1p,black", + center=True, + ) + fig.colorbar(position="JMR+o1.5c/0c+w3c/0.3c", frame=True) +fig.show() + + +# %% +# Transform grid based on a normal distribution +# --------------------------------------------- +# +# The ``gaussian`` parameter of :meth:`pygmt.grdhisteq.equalize_grid` can be +# used to transform the z-values relative to their position in a normal +# distribution rather than a linear distribution. In this case, the output +# data are continuous rather than discrete. + +normal = pygmt.grdhisteq.equalize_grid(grid=grid, gaussian=True) +normal_dist = pygmt.grd2xyz(grid=normal, output_type="pandas")["z"] + + +# %% +# Plot the normally distributed data +# ---------------------------------- +# +# Here we create a map showing the grid that has been transformed to have +# a normal distribution and a histogram of the data values. + +# Create an instance of the Figure class +fig = pygmt.Figure() +# Define figure configuration +pygmt.config(FORMAT_GEO_MAP="ddd.x", MAP_FRAME_TYPE="plain") +# Define the colormap for the figure +pygmt.makecpt(series=[-4.5, 4.5], cmap="vik") +# Setup subplots with two panels +with fig.subplot( + nrows=1, ncols=2, figsize=("13.5c", "4c"), title="Normal distribution" +): + # Plot the grid with a normal distribution in the first panel + with fig.set_panel(panel=0): + fig.grdimage(grid=normal, projection="M?", frame="WSne", cmap=True) + # Plot a histogram showing the normal z-value distribution + with fig.set_panel(panel=1): + fig.histogram( + data=normal_dist, + projection="X?", + region=[-4.5, 4.5, 0, 20], + series=[-4.5, 4.5, 0.2], + frame=["wnSE", "xaf+lRelative elevation", "yaf+lPercent frequency"], + cmap=True, + histtype=1, + pen="1p,black", + ) + fig.colorbar(position="JMR+o1.5c/0c+w3c/0.3c", frame=True) +fig.show() + + +# %% +# Equalize grid based on a quadratic distribution +# ----------------------------------------------- +# +# The ``quadratic`` parameter of :meth:`pygmt.grdhisteq.equalize_grid` can be +# used to transform the z-values relative to their position in a quadratic +# distribution rather than a linear distribution. Here, we equalize the grid +# into nine divisions based on a quadratic distribution and produce a +# :class:`pandas.Series` with the z-values for the new grid. + +quadratic = pygmt.grdhisteq.equalize_grid( + grid=grid, quadratic=True, divisions=divisions +) +quadratic_dist = pygmt.grd2xyz(grid=quadratic, output_type="pandas")["z"] + + +# %% +# Calculate the bins used for data transformation +# ----------------------------------------------- +# +# We can also use the ``quadratic`` parameter of +# :meth:`pygmt.grdhisteq.compute_bins` to report the bins used for dividing +# the grid into 9 divisions based on their position in a quadratic +# distribution. + +pygmt.grdhisteq.compute_bins(grid=grid, divisions=divisions, quadratic=True) + + +# %% +# Plot the quadratic distribution of data +# --------------------------------------- +# +# Here we create a map showing the grid that has been transformed to have +# a quadratic distribution and a histogram of the data values. + +# Create an instance of the Figure class +fig = pygmt.Figure() +# Define figure configuration +pygmt.config(FORMAT_GEO_MAP="ddd.x", MAP_FRAME_TYPE="plain") +# Define the colormap for the figure +pygmt.makecpt(series=[0, divisions, 1], cmap="lajolla") +# Setup subplots with two panels +with fig.subplot( + nrows=1, ncols=2, figsize=("13.5c", "4c"), title="Quadratic distribution" +): + # Plot the grid with a quadratic distribution in the first panel + with fig.set_panel(panel=0): + fig.grdimage(grid=quadratic, projection="M?", frame="WSne", cmap=True) + # Plot a histogram showing the quadratic z-value distribution + with fig.set_panel(panel=1): + fig.histogram( + data=quadratic_dist, + projection="X?", + region=[-1, divisions, 0, 40], + series=[0, divisions, 1], + frame=["wnSE", "xaf+lRelative elevation", "yaf+lPercent frequency"], + cmap=True, + histtype=1, + pen="1p,black", + center=True, + ) + fig.colorbar(position="JMR+o1.5c/0c+w3c/0.3c", frame=True) +fig.show() + +# sphinx_gallery_thumbnail_number = 3 From 6aa8e7492b39a13bf3a535f77a2851ffb5e866d6 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Sun, 10 Mar 2024 11:36:09 +0100 Subject: [PATCH 26/51] Adjust keyword --- examples/tutorials/advanced/grid_equalization.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/advanced/grid_equalization.py b/examples/tutorials/advanced/grid_equalization.py index b631fe49834..400519473e8 100644 --- a/examples/tutorials/advanced/grid_equalization.py +++ b/examples/tutorials/advanced/grid_equalization.py @@ -20,7 +20,7 @@ grid = pygmt.datasets.load_earth_relief( resolution="03s", region=[-119.825, -119.4, 37.6, 37.825] ) -grid_dist = pygmt.grd2xyz(grid=grid, output_type="pandas")["elevation"] +grid_dist = pygmt.grd2xyz(grid=grid, output_type="pandas")["earth_igpp"] # %% From 9b6b8ffa3d4a4dea34a3efa5ca438d6a8ed9133e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= <94163266+yvonnefroehlich@users.noreply.github.com> Date: Mon, 11 Mar 2024 08:10:39 +0100 Subject: [PATCH 27/51] Adjust name for emag2 dataset Co-authored-by: Dongdong Tian --- pygmt/datasets/load_remote_dataset.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/datasets/load_remote_dataset.py b/pygmt/datasets/load_remote_dataset.py index c4039f37a54..5e607db2178 100644 --- a/pygmt/datasets/load_remote_dataset.py +++ b/pygmt/datasets/load_remote_dataset.py @@ -82,7 +82,7 @@ class GMTRemoteDataset(NamedTuple): ), "earth_mag": GMTRemoteDataset( name="earth_mag", - long_name="Earth Magnetic Anomaly Model (EMAG2)", + long_name="EMAG2 Earth magnetic anomaly model", units="nT", extra_attributes={"horizontal_datum": "WGS84"}, resolutions={ From 7a592504282aa4fa4af3b836227b2cc61a06c19a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= <94163266+yvonnefroehlich@users.noreply.github.com> Date: Mon, 11 Mar 2024 08:11:09 +0100 Subject: [PATCH 28/51] Adjust name for wdmam dataset Co-authored-by: Dongdong Tian --- pygmt/datasets/load_remote_dataset.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/datasets/load_remote_dataset.py b/pygmt/datasets/load_remote_dataset.py index 5e607db2178..3bf9551847f 100644 --- a/pygmt/datasets/load_remote_dataset.py +++ b/pygmt/datasets/load_remote_dataset.py @@ -224,7 +224,7 @@ class GMTRemoteDataset(NamedTuple): ), "earth_wdmam": GMTRemoteDataset( name="earth_wdmam", - long_name="World Digital Magnetic Anomaly Map (WDMAM)", + long_name="WDMAM world digital magnetic anomaly map", units="nT", extra_attributes={"horizontal_datum": "WGS84"}, resolutions={ From ab00c939bcb6ae21b972a52efefea6337e33d5d6 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Mon, 11 Mar 2024 08:24:56 +0100 Subject: [PATCH 29/51] Sort alphabeticaly --- pygmt/datasets/load_remote_dataset.py | 36 +++++++++++++-------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/pygmt/datasets/load_remote_dataset.py b/pygmt/datasets/load_remote_dataset.py index 3bf9551847f..36d3d356c0e 100644 --- a/pygmt/datasets/load_remote_dataset.py +++ b/pygmt/datasets/load_remote_dataset.py @@ -80,24 +80,6 @@ class GMTRemoteDataset(NamedTuple): "01m": Resolution("01m", registrations=["gridline"], tiled=True), }, ), - "earth_mag": GMTRemoteDataset( - name="earth_mag", - long_name="EMAG2 Earth magnetic anomaly model", - units="nT", - extra_attributes={"horizontal_datum": "WGS84"}, - resolutions={ - "01d": Resolution("01d"), - "30m": Resolution("30m"), - "20m": Resolution("20m"), - "15m": Resolution("15m"), - "10m": Resolution("10m"), - "06m": Resolution("06m"), - "05m": Resolution("05m", tiled=True), - "04m": Resolution("04m", tiled=True), - "03m": Resolution("03m", tiled=True), - "02m": Resolution("02m", registrations=["pixel"], tiled=True), - }, - ), "earth_faa": GMTRemoteDataset( name="earth_faa", long_name="IGPP Earth free-air anomaly", @@ -182,6 +164,24 @@ class GMTRemoteDataset(NamedTuple): "01s": Resolution("01s", registrations=["gridline"], tiled=True), }, ), + "earth_mag": GMTRemoteDataset( + name="earth_mag", + long_name="EMAG2 Earth magnetic anomaly model", + units="nT", + extra_attributes={"horizontal_datum": "WGS84"}, + resolutions={ + "01d": Resolution("01d"), + "30m": Resolution("30m"), + "20m": Resolution("20m"), + "15m": Resolution("15m"), + "10m": Resolution("10m"), + "06m": Resolution("06m"), + "05m": Resolution("05m", tiled=True), + "04m": Resolution("04m", tiled=True), + "03m": Resolution("03m", tiled=True), + "02m": Resolution("02m", registrations=["pixel"], tiled=True), + }, + ), "earth_mask": GMTRemoteDataset( name="earth_mask", long_name="GSHHG Earth mask", From 4636eb037e61fd6ce4ea36f83b6f42c6af915ce0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= <94163266+yvonnefroehlich@users.noreply.github.com> Date: Mon, 11 Mar 2024 12:40:47 +0100 Subject: [PATCH 30/51] Adjust tests --- pygmt/tests/test_datasets_earth_magnetic_anomaly.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pygmt/tests/test_datasets_earth_magnetic_anomaly.py b/pygmt/tests/test_datasets_earth_magnetic_anomaly.py index 57480c603fc..beede93e75f 100644 --- a/pygmt/tests/test_datasets_earth_magnetic_anomaly.py +++ b/pygmt/tests/test_datasets_earth_magnetic_anomaly.py @@ -15,7 +15,7 @@ def test_earth_mag_01d(): """ data = load_earth_magnetic_anomaly(resolution="01d") assert data.name == "earth_mag" - assert data.attrs["long_name"] == "Earth Magnetic Anomaly Model (EMAG2)" + assert data.attrs["long_name"] == "EMAG2 Earth Magnetic Anomaly Model" assert data.attrs["units"] == "nT" assert data.attrs["horizontal_datum"] == "WGS84" assert data.shape == (181, 361) @@ -61,7 +61,7 @@ def test_earth_mag4km_01d(): """ data = load_earth_magnetic_anomaly(resolution="01d", data_source="emag2_4km") assert data.name == "earth_mag" - assert data.attrs["long_name"] == "Earth Magnetic Anomaly Model (EMAG2)" + assert data.attrs["long_name"] == "EMAG2 Earth Magnetic Anomaly Model" assert data.attrs["units"] == "nT" assert data.attrs["horizontal_datum"] == "WGS84" assert data.shape == (181, 361) @@ -117,7 +117,7 @@ def test_earth_mag_01d_wdmam(): resolution="01d", registration="gridline", data_source="wdmam" ) assert data.name == "earth_wdmam" - assert data.attrs["long_name"] == "World Digital Magnetic Anomaly Map (WDMAM)" + assert data.attrs["long_name"] == "WDMAM World Digital Magnetic Anomaly Map" assert data.attrs["units"] == "nT" assert data.attrs["horizontal_datum"] == "WGS84" assert data.shape == (181, 361) From 36a8efedc4b3df4a3e37061c485221d38ffc4ba9 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Mon, 11 Mar 2024 18:48:41 +0100 Subject: [PATCH 31/51] Fix tests, names | Use upper case letters related to shortcut --- pygmt/datasets/load_remote_dataset.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pygmt/datasets/load_remote_dataset.py b/pygmt/datasets/load_remote_dataset.py index 36d3d356c0e..ed1df8d88f2 100644 --- a/pygmt/datasets/load_remote_dataset.py +++ b/pygmt/datasets/load_remote_dataset.py @@ -166,7 +166,7 @@ class GMTRemoteDataset(NamedTuple): ), "earth_mag": GMTRemoteDataset( name="earth_mag", - long_name="EMAG2 Earth magnetic anomaly model", + long_name="EMAG2 Earth Magnetic Anomaly Model", units="nT", extra_attributes={"horizontal_datum": "WGS84"}, resolutions={ @@ -224,7 +224,7 @@ class GMTRemoteDataset(NamedTuple): ), "earth_wdmam": GMTRemoteDataset( name="earth_wdmam", - long_name="WDMAM world digital magnetic anomaly map", + long_name="WDMAM World Digital Magnetic Anomaly Map", units="nT", extra_attributes={"horizontal_datum": "WGS84"}, resolutions={ From 8a7e31737811b90d7ce2b41a7bdae3e304e33fff Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Sun, 21 Apr 2024 18:22:26 +0200 Subject: [PATCH 32/51] Use 'z' as 'name' and 'quanity_unit' as 'long_name' attributes --- .../tutorials/advanced/grid_equalization.py | 2 +- pygmt/datasets/earth_age.py | 2 +- pygmt/datasets/earth_free_air_anomaly.py | 2 +- pygmt/datasets/earth_geoid.py | 2 +- pygmt/datasets/earth_magnetic_anomaly.py | 4 +- pygmt/datasets/earth_mask.py | 2 +- pygmt/datasets/earth_relief.py | 10 +-- .../earth_vertical_gravity_gradient.py | 2 +- pygmt/datasets/load_remote_dataset.py | 70 +++++++++++-------- pygmt/datasets/mars_relief.py | 2 +- pygmt/datasets/mercury_relief.py | 2 +- pygmt/datasets/moon_relief.py | 2 +- pygmt/datasets/pluto_relief.py | 2 +- pygmt/datasets/venus_relief.py | 2 +- pygmt/tests/test_datasets_earth_age.py | 5 +- .../test_datasets_earth_free_air_anomaly.py | 5 +- pygmt/tests/test_datasets_earth_geoid.py | 5 +- .../test_datasets_earth_magnetic_anomaly.py | 15 ++-- pygmt/tests/test_datasets_earth_mask.py | 4 +- pygmt/tests/test_datasets_earth_relief.py | 10 +-- ...atasets_earth_vertical_gravity_gradient.py | 5 +- pygmt/tests/test_datasets_mars_relief.py | 5 +- pygmt/tests/test_datasets_mercury_relief.py | 5 +- pygmt/tests/test_datasets_moon_relief.py | 5 +- pygmt/tests/test_datasets_pluto_relief.py | 5 +- pygmt/tests/test_datasets_venus_relief.py | 5 +- 26 files changed, 104 insertions(+), 76 deletions(-) diff --git a/examples/tutorials/advanced/grid_equalization.py b/examples/tutorials/advanced/grid_equalization.py index 400519473e8..b631fe49834 100644 --- a/examples/tutorials/advanced/grid_equalization.py +++ b/examples/tutorials/advanced/grid_equalization.py @@ -20,7 +20,7 @@ grid = pygmt.datasets.load_earth_relief( resolution="03s", region=[-119.825, -119.4, 37.6, 37.825] ) -grid_dist = pygmt.grd2xyz(grid=grid, output_type="pandas")["earth_igpp"] +grid_dist = pygmt.grd2xyz(grid=grid, output_type="pandas")["elevation"] # %% diff --git a/pygmt/datasets/earth_age.py b/pygmt/datasets/earth_age.py index 702129826c8..0d88a3d6522 100644 --- a/pygmt/datasets/earth_age.py +++ b/pygmt/datasets/earth_age.py @@ -100,7 +100,7 @@ def load_earth_age( ... ) """ grid = _load_remote_dataset( - dataset_name="earth_age", + dataset_name="z", dataset_prefix="earth_age_", resolution=resolution, region=region, diff --git a/pygmt/datasets/earth_free_air_anomaly.py b/pygmt/datasets/earth_free_air_anomaly.py index 9beae54ef1a..8e31a9838c7 100644 --- a/pygmt/datasets/earth_free_air_anomaly.py +++ b/pygmt/datasets/earth_free_air_anomaly.py @@ -102,7 +102,7 @@ def load_earth_free_air_anomaly( ... ) """ grid = _load_remote_dataset( - dataset_name="earth_faa", + dataset_name="z", dataset_prefix="earth_faa_", resolution=resolution, region=region, diff --git a/pygmt/datasets/earth_geoid.py b/pygmt/datasets/earth_geoid.py index 8965e06857d..ce6e3c0a246 100644 --- a/pygmt/datasets/earth_geoid.py +++ b/pygmt/datasets/earth_geoid.py @@ -93,7 +93,7 @@ def load_earth_geoid( ... ) """ grid = _load_remote_dataset( - dataset_name="earth_geoid", + dataset_name="z", dataset_prefix="earth_geoid_", resolution=resolution, region=region, diff --git a/pygmt/datasets/earth_magnetic_anomaly.py b/pygmt/datasets/earth_magnetic_anomaly.py index e8d7afe1684..488e6167551 100644 --- a/pygmt/datasets/earth_magnetic_anomaly.py +++ b/pygmt/datasets/earth_magnetic_anomaly.py @@ -147,9 +147,9 @@ def load_earth_magnetic_anomaly( "Valid values are 'emag2', 'emag2_4km', and 'wdmam'." ) dataset_prefix = magnetic_anomaly_sources[data_source] - dataset_name = "earth_wdmam" if data_source == "wdmam" else "earth_mag" + # dataset_name = "earth_wdmam" if data_source == "wdmam" else "earth_mag" grid = _load_remote_dataset( - dataset_name=dataset_name, + dataset_name="z", dataset_prefix=dataset_prefix, resolution=resolution, region=region, diff --git a/pygmt/datasets/earth_mask.py b/pygmt/datasets/earth_mask.py index 1c439ec32d5..c6997407b10 100644 --- a/pygmt/datasets/earth_mask.py +++ b/pygmt/datasets/earth_mask.py @@ -97,7 +97,7 @@ def load_earth_mask( array(0, dtype=int8) """ grid = _load_remote_dataset( - dataset_name="earth_mask", + dataset_name="z", dataset_prefix="earth_mask_", resolution=resolution, region=region, diff --git a/pygmt/datasets/earth_relief.py b/pygmt/datasets/earth_relief.py index 4006e7ccd31..7992c0fd7a8 100644 --- a/pygmt/datasets/earth_relief.py +++ b/pygmt/datasets/earth_relief.py @@ -162,12 +162,12 @@ def load_earth_relief( else: dataset_prefix = earth_relief_sources[data_source] # Choose earth relief dataset - if data_source in ["igpp", "synbath"]: - dataset_name = "earth_igpp" - elif data_source in ["gebco", "gebcosi"]: - dataset_name = "earth_gebco" +# if data_source in ["igpp", "synbath"]: +# dataset_name = "earth_igpp" +# elif data_source in ["gebco", "gebcosi"]: +# dataset_name = "earth_gebco" grid = _load_remote_dataset( - dataset_name=dataset_name, + dataset_name="z", #dataset_name, dataset_prefix=dataset_prefix, resolution=resolution, region=region, diff --git a/pygmt/datasets/earth_vertical_gravity_gradient.py b/pygmt/datasets/earth_vertical_gravity_gradient.py index 53e11e229c1..725e30c2529 100644 --- a/pygmt/datasets/earth_vertical_gravity_gradient.py +++ b/pygmt/datasets/earth_vertical_gravity_gradient.py @@ -104,7 +104,7 @@ def load_earth_vertical_gravity_gradient( ... ) """ grid = _load_remote_dataset( - dataset_name="earth_vgg", + dataset_name="z", dataset_prefix="earth_vgg_", resolution=resolution, region=region, diff --git a/pygmt/datasets/load_remote_dataset.py b/pygmt/datasets/load_remote_dataset.py index ed1df8d88f2..4986cdb2c7b 100644 --- a/pygmt/datasets/load_remote_dataset.py +++ b/pygmt/datasets/load_remote_dataset.py @@ -62,8 +62,9 @@ class GMTRemoteDataset(NamedTuple): datasets = { "earth_age": GMTRemoteDataset( - name="earth_age", - long_name="EarthByte Earth seafloor crustal age", + name="z", + long_name="age_Myr", + description="EarthByte Earth seafloor crustal age", units="Myr", extra_attributes={"horizontal_datum": "WGS84"}, resolutions={ @@ -81,8 +82,9 @@ class GMTRemoteDataset(NamedTuple): }, ), "earth_faa": GMTRemoteDataset( - name="earth_faa", - long_name="IGPP Earth free-air anomaly", + name="z", + long_name="gravity_mGal", + description="IGPP Earth free-air anomaly", units="mGal", extra_attributes={"horizontal_datum": "WGS84"}, resolutions={ @@ -100,8 +102,9 @@ class GMTRemoteDataset(NamedTuple): }, ), "earth_gebco": GMTRemoteDataset( - name="earth_gebco", - long_name="GEBCO Earth relief", + name="z", + long_name="elevation_m", + description="GEBCO Earth relief", units="meters", extra_attributes={"vertical_datum": "EGM96", "horizontal_datum": "WGS84"}, resolutions={ @@ -123,8 +126,9 @@ class GMTRemoteDataset(NamedTuple): }, ), "earth_geoid": GMTRemoteDataset( - name="earth_geoid", - long_name="EGM2008 Earth geoid", + name="z", + long_name="elevation_m", + description="EGM2008 Earth geoid", units="m", extra_attributes={"horizontal_datum": "WGS84"}, resolutions={ @@ -142,8 +146,9 @@ class GMTRemoteDataset(NamedTuple): }, ), "earth_igpp": GMTRemoteDataset( - name="earth_igpp", - long_name="IGPP Earth relief", + name="z", + long_name="elevation_m", + description="IGPP Earth relief", units="meters", extra_attributes={"vertical_datum": "EGM96", "horizontal_datum": "WGS84"}, resolutions={ @@ -165,8 +170,9 @@ class GMTRemoteDataset(NamedTuple): }, ), "earth_mag": GMTRemoteDataset( - name="earth_mag", - long_name="EMAG2 Earth Magnetic Anomaly Model", + name="z", + long_name="magntic_field_nT", + description="EMAG2 Earth Magnetic Anomaly Model", units="nT", extra_attributes={"horizontal_datum": "WGS84"}, resolutions={ @@ -183,8 +189,9 @@ class GMTRemoteDataset(NamedTuple): }, ), "earth_mask": GMTRemoteDataset( - name="earth_mask", - long_name="GSHHG Earth mask", + name="z", + long_name=None, + description="GSHHG Earth mask", units=None, extra_attributes={"horizontal_datum": "WGS84"}, resolutions={ @@ -204,8 +211,9 @@ class GMTRemoteDataset(NamedTuple): }, ), "earth_vgg": GMTRemoteDataset( - name="earth_vgg", - long_name="IGPP Earth vertical gravity gradient", + name="z", + long_name="gravity_gradient_E", + description="IGPP Earth vertical gravity gradient", units="Eotvos", extra_attributes={"horizontal_datum": "WGS84"}, resolutions={ @@ -223,8 +231,9 @@ class GMTRemoteDataset(NamedTuple): }, ), "earth_wdmam": GMTRemoteDataset( - name="earth_wdmam", - long_name="WDMAM World Digital Magnetic Anomaly Map", + name="z", + long_name="magnetic_field_nT", + description="WDMAM World Digital Magnetic Anomaly Map", units="nT", extra_attributes={"horizontal_datum": "WGS84"}, resolutions={ @@ -240,8 +249,9 @@ class GMTRemoteDataset(NamedTuple): }, ), "mars_relief": GMTRemoteDataset( - name="mars_relief", - long_name="NASA Mars (MOLA) relief", + name="z", + long_name="elevation_m", + description="NASA Mars (MOLA) relief", units="meters", extra_attributes={}, resolutions={ @@ -262,8 +272,9 @@ class GMTRemoteDataset(NamedTuple): }, ), "moon_relief": GMTRemoteDataset( - name="moon_relief", - long_name="USGS Moon (LOLA) relief", + name="z", + long_name="elevation_m", + description="USGS Moon (LOLA) relief", units="meters", extra_attributes={}, resolutions={ @@ -284,8 +295,9 @@ class GMTRemoteDataset(NamedTuple): }, ), "mercury_relief": GMTRemoteDataset( - name="mercury_relief", - long_name="USGS Mercury relief", + name="z", + long_name="elevation_m", + description="USGS Mercury relief", units="meters", extra_attributes={}, resolutions={ @@ -304,8 +316,9 @@ class GMTRemoteDataset(NamedTuple): }, ), "pluto_relief": GMTRemoteDataset( - name="pluto_relief", - long_name="USGS Pluto relief", + name="z", + long_name="elevation_m", + description="USGS Pluto relief", units="meters", extra_attributes={}, resolutions={ @@ -324,8 +337,9 @@ class GMTRemoteDataset(NamedTuple): }, ), "venus_relief": GMTRemoteDataset( - name="venus_relief", - long_name="NASA Magellan Venus relief", + name="z", + long_name="elevation_m", + description="NASA Magellan Venus relief", units="meters", extra_attributes={}, resolutions={ diff --git a/pygmt/datasets/mars_relief.py b/pygmt/datasets/mars_relief.py index a8106513a79..bb97ef745f3 100644 --- a/pygmt/datasets/mars_relief.py +++ b/pygmt/datasets/mars_relief.py @@ -96,7 +96,7 @@ def load_mars_relief( ... ) """ grid = _load_remote_dataset( - dataset_name="mars_relief", + dataset_name="z", dataset_prefix="mars_relief_", resolution=resolution, region=region, diff --git a/pygmt/datasets/mercury_relief.py b/pygmt/datasets/mercury_relief.py index 956a41ed145..62c3b5e3372 100644 --- a/pygmt/datasets/mercury_relief.py +++ b/pygmt/datasets/mercury_relief.py @@ -96,7 +96,7 @@ def load_mercury_relief( ... ) """ grid = _load_remote_dataset( - dataset_name="mercury_relief", + dataset_name="z", dataset_prefix="mercury_relief_", resolution=resolution, region=region, diff --git a/pygmt/datasets/moon_relief.py b/pygmt/datasets/moon_relief.py index 5681fb7becb..ebb37c705ab 100644 --- a/pygmt/datasets/moon_relief.py +++ b/pygmt/datasets/moon_relief.py @@ -96,7 +96,7 @@ def load_moon_relief( ... ) """ grid = _load_remote_dataset( - dataset_name="moon_relief", + dataset_name="z", dataset_prefix="moon_relief_", resolution=resolution, region=region, diff --git a/pygmt/datasets/pluto_relief.py b/pygmt/datasets/pluto_relief.py index 72de0c9c593..d75299a2936 100644 --- a/pygmt/datasets/pluto_relief.py +++ b/pygmt/datasets/pluto_relief.py @@ -96,7 +96,7 @@ def load_pluto_relief( ... ) """ grid = _load_remote_dataset( - dataset_name="pluto_relief", + dataset_name="z", dataset_prefix="pluto_relief_", resolution=resolution, region=region, diff --git a/pygmt/datasets/venus_relief.py b/pygmt/datasets/venus_relief.py index 0bf52f7b611..24105c16d18 100644 --- a/pygmt/datasets/venus_relief.py +++ b/pygmt/datasets/venus_relief.py @@ -93,7 +93,7 @@ def load_venus_relief( ... ) """ grid = _load_remote_dataset( - dataset_name="venus_relief", + dataset_name="z", dataset_prefix="venus_relief_", resolution=resolution, region=region, diff --git a/pygmt/tests/test_datasets_earth_age.py b/pygmt/tests/test_datasets_earth_age.py index 3c2992d1773..49a9dcc4a38 100644 --- a/pygmt/tests/test_datasets_earth_age.py +++ b/pygmt/tests/test_datasets_earth_age.py @@ -12,9 +12,10 @@ def test_earth_age_01d(): Test some properties of the earth age 01d data. """ data = load_earth_age(resolution="01d") - assert data.name == "earth_age" + assert data.name == "z" + assert data.attrs["long_name"] == "age_Myr" + assert data.attrs["description"] == "EarthByte Earth seafloor crustal age" assert data.attrs["units"] == "Myr" - assert data.attrs["long_name"] == "EarthByte Earth seafloor crustal age" assert data.attrs["horizontal_datum"] == "WGS84" assert data.shape == (181, 361) assert data.gmt.registration == 0 diff --git a/pygmt/tests/test_datasets_earth_free_air_anomaly.py b/pygmt/tests/test_datasets_earth_free_air_anomaly.py index b247f1bb9aa..ed450fa728d 100644 --- a/pygmt/tests/test_datasets_earth_free_air_anomaly.py +++ b/pygmt/tests/test_datasets_earth_free_air_anomaly.py @@ -12,8 +12,9 @@ def test_earth_faa_01d(): Test some properties of the free air anomaly 01d data. """ data = load_earth_free_air_anomaly(resolution="01d") - assert data.name == "earth_faa" - assert data.attrs["long_name"] == "IGPP Earth free-air anomaly" + assert data.name == "z" + assert data.attrs["long_name"] == "gravity_mGal" + assert data.attrs["description"] == "IGPP Earth free-air anomaly" assert data.attrs["units"] == "mGal" assert data.attrs["horizontal_datum"] == "WGS84" assert data.shape == (181, 361) diff --git a/pygmt/tests/test_datasets_earth_geoid.py b/pygmt/tests/test_datasets_earth_geoid.py index 6726f37d166..68daa449d7f 100644 --- a/pygmt/tests/test_datasets_earth_geoid.py +++ b/pygmt/tests/test_datasets_earth_geoid.py @@ -12,9 +12,10 @@ def test_earth_geoid_01d(): Test some properties of the earth geoid 01d data. """ data = load_earth_geoid(resolution="01d") - assert data.name == "earth_geoid" + assert data.name == "z" + assert data.attrs["long_name"] == "elevation_m" + assert data.attrs["description"] == "EGM2008 Earth geoid" assert data.attrs["units"] == "m" - assert data.attrs["long_name"] == "EGM2008 Earth geoid" assert data.attrs["horizontal_datum"] == "WGS84" assert data.shape == (181, 361) assert data.gmt.registration == 0 diff --git a/pygmt/tests/test_datasets_earth_magnetic_anomaly.py b/pygmt/tests/test_datasets_earth_magnetic_anomaly.py index beede93e75f..c8c870fa8ef 100644 --- a/pygmt/tests/test_datasets_earth_magnetic_anomaly.py +++ b/pygmt/tests/test_datasets_earth_magnetic_anomaly.py @@ -14,8 +14,9 @@ def test_earth_mag_01d(): Test some properties of the magnetic anomaly 01d data. """ data = load_earth_magnetic_anomaly(resolution="01d") - assert data.name == "earth_mag" - assert data.attrs["long_name"] == "EMAG2 Earth Magnetic Anomaly Model" + assert data.name == "z" + assert data.attrs["long_name"] == "magntic_field_nT" + assert data.attrs["description"] == "EMAG2 Earth Magnetic Anomaly Model" assert data.attrs["units"] == "nT" assert data.attrs["horizontal_datum"] == "WGS84" assert data.shape == (181, 361) @@ -60,8 +61,9 @@ def test_earth_mag4km_01d(): Test some properties of the magnetic anomaly 4km 01d data. """ data = load_earth_magnetic_anomaly(resolution="01d", data_source="emag2_4km") - assert data.name == "earth_mag" - assert data.attrs["long_name"] == "EMAG2 Earth Magnetic Anomaly Model" + assert data.name == "z" + assert data.attrs["long_name"] == "magntic_field_nT" + assert data.attrs["description"] == "EMAG2 Earth Magnetic Anomaly Model" assert data.attrs["units"] == "nT" assert data.attrs["horizontal_datum"] == "WGS84" assert data.shape == (181, 361) @@ -116,8 +118,9 @@ def test_earth_mag_01d_wdmam(): data = load_earth_magnetic_anomaly( resolution="01d", registration="gridline", data_source="wdmam" ) - assert data.name == "earth_wdmam" - assert data.attrs["long_name"] == "WDMAM World Digital Magnetic Anomaly Map" + assert data.name == "z" + assert data.attrs["long_name"] == "magnetic_field_nT" + assert data.attrs["description"] == "WDMAM World Digital Magnetic Anomaly Map" assert data.attrs["units"] == "nT" assert data.attrs["horizontal_datum"] == "WGS84" assert data.shape == (181, 361) diff --git a/pygmt/tests/test_datasets_earth_mask.py b/pygmt/tests/test_datasets_earth_mask.py index 544702f98d6..c449e1a79a7 100644 --- a/pygmt/tests/test_datasets_earth_mask.py +++ b/pygmt/tests/test_datasets_earth_mask.py @@ -12,8 +12,8 @@ def test_earth_mask_01d(): Test some properties of the Earth mask 01d data. """ data = load_earth_mask(resolution="01d") - assert data.name == "earth_mask" - assert data.attrs["long_name"] == "GSHHG Earth mask" + assert data.name == "z" + assert data.attrs["description"] == "GSHHG Earth mask" assert data.attrs["horizontal_datum"] == "WGS84" assert data.shape == (181, 361) assert data.gmt.registration == 0 diff --git a/pygmt/tests/test_datasets_earth_relief.py b/pygmt/tests/test_datasets_earth_relief.py index 7585381dbb5..958db58d666 100644 --- a/pygmt/tests/test_datasets_earth_relief.py +++ b/pygmt/tests/test_datasets_earth_relief.py @@ -18,9 +18,10 @@ def test_earth_relief_01d_igpp_synbath(data_source): Test some properties of the earth relief 01d data with IGPP and SYNBATH data. """ data = load_earth_relief(resolution="01d", data_source=data_source) - assert data.name == "earth_igpp" + assert data.name == "z" + assert data.attrs["long_name"] == "elevation_m" + assert data.attrs["description"] == "IGPP Earth relief" assert data.attrs["units"] == "meters" - assert data.attrs["long_name"] == "IGPP Earth relief" assert data.attrs["vertical_datum"] == "EGM96" assert data.attrs["horizontal_datum"] == "WGS84" assert data.shape == (181, 361) @@ -37,9 +38,10 @@ def test_earth_relief_01d_gebco(data_source): Test some properties of the earth relief 01d data with GEBCO and GEBOCSI data. """ data = load_earth_relief(resolution="01d", data_source=data_source) - assert data.name == "earth_gebco" + assert data.name == "z" + assert data.attrs["long_name"] == "elevation_m" + assert data.attrs["description"] == "GEBCO Earth relief" assert data.attrs["units"] == "meters" - assert data.attrs["long_name"] == "GEBCO Earth relief" assert data.attrs["vertical_datum"] == "EGM96" assert data.attrs["horizontal_datum"] == "WGS84" assert data.shape == (181, 361) diff --git a/pygmt/tests/test_datasets_earth_vertical_gravity_gradient.py b/pygmt/tests/test_datasets_earth_vertical_gravity_gradient.py index 889d9c782e9..eae0b152106 100644 --- a/pygmt/tests/test_datasets_earth_vertical_gravity_gradient.py +++ b/pygmt/tests/test_datasets_earth_vertical_gravity_gradient.py @@ -12,9 +12,10 @@ def test_earth_vertical_gravity_gradient_01d(): Test some properties of the earth vgg 01d data. """ data = load_earth_vertical_gravity_gradient(resolution="01d") - assert data.name == "earth_vgg" + assert data.name == "z" + assert data.attrs["long_name"] == "gravity_gradient_E" + assert data.attrs["description"] == "IGPP Earth vertical gravity gradient" assert data.attrs["units"] == "Eotvos" - assert data.attrs["long_name"] == "IGPP Earth vertical gravity gradient" assert data.attrs["horizontal_datum"] == "WGS84" assert data.shape == (181, 361) assert data.gmt.registration == 0 diff --git a/pygmt/tests/test_datasets_mars_relief.py b/pygmt/tests/test_datasets_mars_relief.py index 7a8ed0993b1..a2035d4a5ac 100644 --- a/pygmt/tests/test_datasets_mars_relief.py +++ b/pygmt/tests/test_datasets_mars_relief.py @@ -12,9 +12,10 @@ def test_mars_relief_01d(): Test some properties of the Mars relief 01d data. """ data = load_mars_relief(resolution="01d") - assert data.name == "mars_relief" + assert data.name == "z" + assert data.attrs["long_name"] == "elevation_m" + assert data.attrs["description"] == "NASA Mars (MOLA) relief" assert data.attrs["units"] == "meters" - assert data.attrs["long_name"] == "NASA Mars (MOLA) relief" assert data.shape == (181, 361) assert data.gmt.registration == 0 npt.assert_allclose(data.lat, np.arange(-90, 91, 1)) diff --git a/pygmt/tests/test_datasets_mercury_relief.py b/pygmt/tests/test_datasets_mercury_relief.py index e51ef7c0dc1..70c1954f9c4 100644 --- a/pygmt/tests/test_datasets_mercury_relief.py +++ b/pygmt/tests/test_datasets_mercury_relief.py @@ -12,9 +12,10 @@ def test_mercury_relief_01d(): Test some properties of the Mercury relief 01d data. """ data = load_mercury_relief(resolution="01d") - assert data.name == "mercury_relief" + assert data.name == "z" + assert data.attrs["long_name"] == "elevation_m" + assert data.attrs["description"] == "USGS Mercury relief" assert data.attrs["units"] == "meters" - assert data.attrs["long_name"] == "USGS Mercury relief" assert data.shape == (181, 361) assert data.gmt.registration == 0 npt.assert_allclose(data.lat, np.arange(-90, 91, 1)) diff --git a/pygmt/tests/test_datasets_moon_relief.py b/pygmt/tests/test_datasets_moon_relief.py index 5aa801d792d..125208f935b 100644 --- a/pygmt/tests/test_datasets_moon_relief.py +++ b/pygmt/tests/test_datasets_moon_relief.py @@ -12,9 +12,10 @@ def test_moon_relief_01d(): Test some properties of the Moon relief 01d data. """ data = load_moon_relief(resolution="01d") - assert data.name == "moon_relief" + assert data.name == "z" + assert data.attrs["long_name"] == "elevation_m" + assert data.attrs["description"] == "USGS Moon (LOLA) relief" assert data.attrs["units"] == "meters" - assert data.attrs["long_name"] == "USGS Moon (LOLA) relief" assert data.shape == (181, 361) assert data.gmt.registration == 0 npt.assert_allclose(data.lat, np.arange(-90, 91, 1)) diff --git a/pygmt/tests/test_datasets_pluto_relief.py b/pygmt/tests/test_datasets_pluto_relief.py index ad5a046d528..6d56d71c3ed 100644 --- a/pygmt/tests/test_datasets_pluto_relief.py +++ b/pygmt/tests/test_datasets_pluto_relief.py @@ -12,9 +12,10 @@ def test_pluto_relief_01d(): Test some properties of the Pluto relief 01d data. """ data = load_pluto_relief(resolution="01d") - assert data.name == "pluto_relief" + assert data.name == "m" + assert data.attrs["long_name"] == "elevation_m" + assert data.attrs["description"] == "USGS Pluto relief" assert data.attrs["units"] == "meters" - assert data.attrs["long_name"] == "USGS Pluto relief" assert data.shape == (181, 361) assert data.gmt.registration == 0 npt.assert_allclose(data.lat, np.arange(-90, 91, 1)) diff --git a/pygmt/tests/test_datasets_venus_relief.py b/pygmt/tests/test_datasets_venus_relief.py index f411ff2069c..f1603155381 100644 --- a/pygmt/tests/test_datasets_venus_relief.py +++ b/pygmt/tests/test_datasets_venus_relief.py @@ -12,9 +12,10 @@ def test_venus_relief_01d(): Test some properties of the Venus relief 01d data. """ data = load_venus_relief(resolution="01d") - assert data.name == "venus_relief" + assert data.name == "z" + assert data.attrs["long_name"] == "elevation_m" + assert data.attrs["description"] == "NASA Magellan Venus relief" assert data.attrs["units"] == "meters" - assert data.attrs["long_name"] == "NASA Magellan Venus relief" assert data.shape == (181, 361) assert data.gmt.registration == 0 npt.assert_allclose(data.lat, np.arange(-90, 91, 1)) From a39f44afd01722c2c0a8d8a994408c3ec45dbe4d Mon Sep 17 00:00:00 2001 From: actions-bot <58130806+actions-bot@users.noreply.github.com> Date: Sun, 21 Apr 2024 16:25:43 +0000 Subject: [PATCH 33/51] [format-command] fixes --- pygmt/datasets/earth_relief.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pygmt/datasets/earth_relief.py b/pygmt/datasets/earth_relief.py index 7992c0fd7a8..b7816c06076 100644 --- a/pygmt/datasets/earth_relief.py +++ b/pygmt/datasets/earth_relief.py @@ -162,12 +162,12 @@ def load_earth_relief( else: dataset_prefix = earth_relief_sources[data_source] # Choose earth relief dataset -# if data_source in ["igpp", "synbath"]: -# dataset_name = "earth_igpp" -# elif data_source in ["gebco", "gebcosi"]: -# dataset_name = "earth_gebco" + # if data_source in ["igpp", "synbath"]: + # dataset_name = "earth_igpp" + # elif data_source in ["gebco", "gebcosi"]: + # dataset_name = "earth_gebco" grid = _load_remote_dataset( - dataset_name="z", #dataset_name, + dataset_name="z", # dataset_name, dataset_prefix=dataset_prefix, resolution=resolution, region=region, From d3857163a93274995e294c7517ef591774cdaa08 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Sun, 21 Apr 2024 18:54:59 +0200 Subject: [PATCH 34/51] Fix --- examples/tutorials/advanced/grid_equalization.py | 2 +- pygmt/datasets/earth_age.py | 2 +- pygmt/datasets/earth_free_air_anomaly.py | 2 +- pygmt/datasets/earth_geoid.py | 2 +- pygmt/datasets/earth_magnetic_anomaly.py | 4 ++-- pygmt/datasets/earth_mask.py | 2 +- pygmt/datasets/earth_relief.py | 10 +++++----- pygmt/datasets/earth_vertical_gravity_gradient.py | 2 +- pygmt/datasets/load_remote_dataset.py | 4 ++-- pygmt/datasets/mars_relief.py | 2 +- pygmt/datasets/mercury_relief.py | 2 +- pygmt/datasets/moon_relief.py | 2 +- pygmt/datasets/pluto_relief.py | 2 +- pygmt/datasets/venus_relief.py | 2 +- 14 files changed, 20 insertions(+), 20 deletions(-) diff --git a/examples/tutorials/advanced/grid_equalization.py b/examples/tutorials/advanced/grid_equalization.py index b631fe49834..1370ff3ab3e 100644 --- a/examples/tutorials/advanced/grid_equalization.py +++ b/examples/tutorials/advanced/grid_equalization.py @@ -20,7 +20,7 @@ grid = pygmt.datasets.load_earth_relief( resolution="03s", region=[-119.825, -119.4, 37.6, 37.825] ) -grid_dist = pygmt.grd2xyz(grid=grid, output_type="pandas")["elevation"] +grid_dist = pygmt.grd2xyz(grid=grid, output_type="pandas")["z"] # %% diff --git a/pygmt/datasets/earth_age.py b/pygmt/datasets/earth_age.py index 0d88a3d6522..702129826c8 100644 --- a/pygmt/datasets/earth_age.py +++ b/pygmt/datasets/earth_age.py @@ -100,7 +100,7 @@ def load_earth_age( ... ) """ grid = _load_remote_dataset( - dataset_name="z", + dataset_name="earth_age", dataset_prefix="earth_age_", resolution=resolution, region=region, diff --git a/pygmt/datasets/earth_free_air_anomaly.py b/pygmt/datasets/earth_free_air_anomaly.py index 8e31a9838c7..9beae54ef1a 100644 --- a/pygmt/datasets/earth_free_air_anomaly.py +++ b/pygmt/datasets/earth_free_air_anomaly.py @@ -102,7 +102,7 @@ def load_earth_free_air_anomaly( ... ) """ grid = _load_remote_dataset( - dataset_name="z", + dataset_name="earth_faa", dataset_prefix="earth_faa_", resolution=resolution, region=region, diff --git a/pygmt/datasets/earth_geoid.py b/pygmt/datasets/earth_geoid.py index ce6e3c0a246..8965e06857d 100644 --- a/pygmt/datasets/earth_geoid.py +++ b/pygmt/datasets/earth_geoid.py @@ -93,7 +93,7 @@ def load_earth_geoid( ... ) """ grid = _load_remote_dataset( - dataset_name="z", + dataset_name="earth_geoid", dataset_prefix="earth_geoid_", resolution=resolution, region=region, diff --git a/pygmt/datasets/earth_magnetic_anomaly.py b/pygmt/datasets/earth_magnetic_anomaly.py index 488e6167551..e8d7afe1684 100644 --- a/pygmt/datasets/earth_magnetic_anomaly.py +++ b/pygmt/datasets/earth_magnetic_anomaly.py @@ -147,9 +147,9 @@ def load_earth_magnetic_anomaly( "Valid values are 'emag2', 'emag2_4km', and 'wdmam'." ) dataset_prefix = magnetic_anomaly_sources[data_source] - # dataset_name = "earth_wdmam" if data_source == "wdmam" else "earth_mag" + dataset_name = "earth_wdmam" if data_source == "wdmam" else "earth_mag" grid = _load_remote_dataset( - dataset_name="z", + dataset_name=dataset_name, dataset_prefix=dataset_prefix, resolution=resolution, region=region, diff --git a/pygmt/datasets/earth_mask.py b/pygmt/datasets/earth_mask.py index c6997407b10..1c439ec32d5 100644 --- a/pygmt/datasets/earth_mask.py +++ b/pygmt/datasets/earth_mask.py @@ -97,7 +97,7 @@ def load_earth_mask( array(0, dtype=int8) """ grid = _load_remote_dataset( - dataset_name="z", + dataset_name="earth_mask", dataset_prefix="earth_mask_", resolution=resolution, region=region, diff --git a/pygmt/datasets/earth_relief.py b/pygmt/datasets/earth_relief.py index b7816c06076..9c26dae8aac 100644 --- a/pygmt/datasets/earth_relief.py +++ b/pygmt/datasets/earth_relief.py @@ -162,12 +162,12 @@ def load_earth_relief( else: dataset_prefix = earth_relief_sources[data_source] # Choose earth relief dataset - # if data_source in ["igpp", "synbath"]: - # dataset_name = "earth_igpp" - # elif data_source in ["gebco", "gebcosi"]: - # dataset_name = "earth_gebco" + if data_source in ["igpp", "synbath"]: + dataset_name = "earth_igpp" + elif data_source in ["gebco", "gebcosi"]: + dataset_name = "earth_gebco" grid = _load_remote_dataset( - dataset_name="z", # dataset_name, + dataset_name=dataset_name, dataset_prefix=dataset_prefix, resolution=resolution, region=region, diff --git a/pygmt/datasets/earth_vertical_gravity_gradient.py b/pygmt/datasets/earth_vertical_gravity_gradient.py index 725e30c2529..53e11e229c1 100644 --- a/pygmt/datasets/earth_vertical_gravity_gradient.py +++ b/pygmt/datasets/earth_vertical_gravity_gradient.py @@ -104,7 +104,7 @@ def load_earth_vertical_gravity_gradient( ... ) """ grid = _load_remote_dataset( - dataset_name="z", + dataset_name="earth_vgg", dataset_prefix="earth_vgg_", resolution=resolution, region=region, diff --git a/pygmt/datasets/load_remote_dataset.py b/pygmt/datasets/load_remote_dataset.py index 4986cdb2c7b..006a658cde6 100644 --- a/pygmt/datasets/load_remote_dataset.py +++ b/pygmt/datasets/load_remote_dataset.py @@ -190,7 +190,7 @@ class GMTRemoteDataset(NamedTuple): ), "earth_mask": GMTRemoteDataset( name="z", - long_name=None, + long_name="", description="GSHHG Earth mask", units=None, extra_attributes={"horizontal_datum": "WGS84"}, @@ -403,7 +403,7 @@ def _load_remote_dataset( if resolution not in dataset.resolutions: raise GMTInvalidInput( - f"Invalid resolution '{resolution}' for {dataset.name} dataset. " + f"Invalid resolution '{resolution}' for {dataset.description} dataset. " f"Available resolutions are: {', '.join(dataset.resolutions)}." ) diff --git a/pygmt/datasets/mars_relief.py b/pygmt/datasets/mars_relief.py index bb97ef745f3..a8106513a79 100644 --- a/pygmt/datasets/mars_relief.py +++ b/pygmt/datasets/mars_relief.py @@ -96,7 +96,7 @@ def load_mars_relief( ... ) """ grid = _load_remote_dataset( - dataset_name="z", + dataset_name="mars_relief", dataset_prefix="mars_relief_", resolution=resolution, region=region, diff --git a/pygmt/datasets/mercury_relief.py b/pygmt/datasets/mercury_relief.py index 62c3b5e3372..956a41ed145 100644 --- a/pygmt/datasets/mercury_relief.py +++ b/pygmt/datasets/mercury_relief.py @@ -96,7 +96,7 @@ def load_mercury_relief( ... ) """ grid = _load_remote_dataset( - dataset_name="z", + dataset_name="mercury_relief", dataset_prefix="mercury_relief_", resolution=resolution, region=region, diff --git a/pygmt/datasets/moon_relief.py b/pygmt/datasets/moon_relief.py index ebb37c705ab..5681fb7becb 100644 --- a/pygmt/datasets/moon_relief.py +++ b/pygmt/datasets/moon_relief.py @@ -96,7 +96,7 @@ def load_moon_relief( ... ) """ grid = _load_remote_dataset( - dataset_name="z", + dataset_name="moon_relief", dataset_prefix="moon_relief_", resolution=resolution, region=region, diff --git a/pygmt/datasets/pluto_relief.py b/pygmt/datasets/pluto_relief.py index d75299a2936..72de0c9c593 100644 --- a/pygmt/datasets/pluto_relief.py +++ b/pygmt/datasets/pluto_relief.py @@ -96,7 +96,7 @@ def load_pluto_relief( ... ) """ grid = _load_remote_dataset( - dataset_name="z", + dataset_name="pluto_relief", dataset_prefix="pluto_relief_", resolution=resolution, region=region, diff --git a/pygmt/datasets/venus_relief.py b/pygmt/datasets/venus_relief.py index 24105c16d18..0bf52f7b611 100644 --- a/pygmt/datasets/venus_relief.py +++ b/pygmt/datasets/venus_relief.py @@ -93,7 +93,7 @@ def load_venus_relief( ... ) """ grid = _load_remote_dataset( - dataset_name="z", + dataset_name="venus_relief", dataset_prefix="venus_relief_", resolution=resolution, region=region, From 3d07d7a2c7ac071c6acc55747095047e7a553af4 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Sun, 21 Apr 2024 18:57:07 +0200 Subject: [PATCH 35/51] Fix coding style --- pygmt/datasets/earth_relief.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/datasets/earth_relief.py b/pygmt/datasets/earth_relief.py index 9c26dae8aac..ef540550ce6 100644 --- a/pygmt/datasets/earth_relief.py +++ b/pygmt/datasets/earth_relief.py @@ -161,7 +161,7 @@ def load_earth_relief( ) else: dataset_prefix = earth_relief_sources[data_source] - # Choose earth relief dataset + # Choose earth relief dataset if data_source in ["igpp", "synbath"]: dataset_name = "earth_igpp" elif data_source in ["gebco", "gebcosi"]: From 93119719a5f6956faf3017a580968c836a3074d4 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Sun, 21 Apr 2024 19:24:06 +0200 Subject: [PATCH 36/51] Fix --- pygmt/datasets/load_remote_dataset.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pygmt/datasets/load_remote_dataset.py b/pygmt/datasets/load_remote_dataset.py index 006a658cde6..a6f2cc7f214 100644 --- a/pygmt/datasets/load_remote_dataset.py +++ b/pygmt/datasets/load_remote_dataset.py @@ -42,10 +42,12 @@ class GMTRemoteDataset(NamedTuple): Attributes ---------- name : str - The name assigned as an attribute to the DataArray. + Always ``"z"``. long_name : str The long name assigned as an attribute to the DataArray. - units : str + description : str, None + The name assigned as an attribute to the DataArray. + units : str, None The units of the values in the DataArray. resolutions : dict Dictionary of available resolution as keys and Resolution objects as values. @@ -55,6 +57,7 @@ class GMTRemoteDataset(NamedTuple): name: str long_name: str + description: str | None units: str | None resolutions: dict[str, Resolution] extra_attributes: dict @@ -190,7 +193,7 @@ class GMTRemoteDataset(NamedTuple): ), "earth_mask": GMTRemoteDataset( name="z", - long_name="", + long_name=None, description="GSHHG Earth mask", units=None, extra_attributes={"horizontal_datum": "WGS84"}, From 4add8584c41fd718476e1770acce149705222a01 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Sun, 21 Apr 2024 19:33:48 +0200 Subject: [PATCH 37/51] Fix input data type --- pygmt/datasets/load_remote_dataset.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pygmt/datasets/load_remote_dataset.py b/pygmt/datasets/load_remote_dataset.py index a6f2cc7f214..2d0032286b1 100644 --- a/pygmt/datasets/load_remote_dataset.py +++ b/pygmt/datasets/load_remote_dataset.py @@ -43,9 +43,9 @@ class GMTRemoteDataset(NamedTuple): ---------- name : str Always ``"z"``. - long_name : str + long_name : str, None The long name assigned as an attribute to the DataArray. - description : str, None + description : str The name assigned as an attribute to the DataArray. units : str, None The units of the values in the DataArray. @@ -56,8 +56,8 @@ class GMTRemoteDataset(NamedTuple): """ name: str - long_name: str - description: str | None + long_name: str | None + description: str units: str | None resolutions: dict[str, Resolution] extra_attributes: dict From ae29f760c5299657946c606eefed7f65f1dad420 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Sun, 21 Apr 2024 19:46:22 +0200 Subject: [PATCH 38/51] Fix --- pygmt/datasets/earth_relief.py | 10 +++++----- pygmt/tests/test_datasets_earth_age.py | 2 +- pygmt/tests/test_datasets_earth_free_air_anomaly.py | 2 +- pygmt/tests/test_datasets_earth_geoid.py | 2 +- pygmt/tests/test_datasets_earth_magnetic_anomaly.py | 2 +- pygmt/tests/test_datasets_earth_mask.py | 2 +- pygmt/tests/test_datasets_earth_relief.py | 4 ++-- .../test_datasets_earth_vertical_gravity_gradient.py | 2 +- pygmt/tests/test_datasets_mars_relief.py | 2 +- pygmt/tests/test_datasets_mercury_relief.py | 2 +- pygmt/tests/test_datasets_moon_relief.py | 2 +- pygmt/tests/test_datasets_pluto_relief.py | 4 ++-- pygmt/tests/test_datasets_venus_relief.py | 2 +- 13 files changed, 19 insertions(+), 19 deletions(-) diff --git a/pygmt/datasets/earth_relief.py b/pygmt/datasets/earth_relief.py index ef540550ce6..4006e7ccd31 100644 --- a/pygmt/datasets/earth_relief.py +++ b/pygmt/datasets/earth_relief.py @@ -161,11 +161,11 @@ def load_earth_relief( ) else: dataset_prefix = earth_relief_sources[data_source] - # Choose earth relief dataset - if data_source in ["igpp", "synbath"]: - dataset_name = "earth_igpp" - elif data_source in ["gebco", "gebcosi"]: - dataset_name = "earth_gebco" + # Choose earth relief dataset + if data_source in ["igpp", "synbath"]: + dataset_name = "earth_igpp" + elif data_source in ["gebco", "gebcosi"]: + dataset_name = "earth_gebco" grid = _load_remote_dataset( dataset_name=dataset_name, dataset_prefix=dataset_prefix, diff --git a/pygmt/tests/test_datasets_earth_age.py b/pygmt/tests/test_datasets_earth_age.py index 49a9dcc4a38..d2262645526 100644 --- a/pygmt/tests/test_datasets_earth_age.py +++ b/pygmt/tests/test_datasets_earth_age.py @@ -14,7 +14,7 @@ def test_earth_age_01d(): data = load_earth_age(resolution="01d") assert data.name == "z" assert data.attrs["long_name"] == "age_Myr" - assert data.attrs["description"] == "EarthByte Earth seafloor crustal age" + # assert data.attrs["description"] == "EarthByte Earth seafloor crustal age" assert data.attrs["units"] == "Myr" assert data.attrs["horizontal_datum"] == "WGS84" assert data.shape == (181, 361) diff --git a/pygmt/tests/test_datasets_earth_free_air_anomaly.py b/pygmt/tests/test_datasets_earth_free_air_anomaly.py index ed450fa728d..ac1167124eb 100644 --- a/pygmt/tests/test_datasets_earth_free_air_anomaly.py +++ b/pygmt/tests/test_datasets_earth_free_air_anomaly.py @@ -14,7 +14,7 @@ def test_earth_faa_01d(): data = load_earth_free_air_anomaly(resolution="01d") assert data.name == "z" assert data.attrs["long_name"] == "gravity_mGal" - assert data.attrs["description"] == "IGPP Earth free-air anomaly" + # assert data.attrs["description"] == "IGPP Earth free-air anomaly" assert data.attrs["units"] == "mGal" assert data.attrs["horizontal_datum"] == "WGS84" assert data.shape == (181, 361) diff --git a/pygmt/tests/test_datasets_earth_geoid.py b/pygmt/tests/test_datasets_earth_geoid.py index 68daa449d7f..44bb42feb11 100644 --- a/pygmt/tests/test_datasets_earth_geoid.py +++ b/pygmt/tests/test_datasets_earth_geoid.py @@ -14,7 +14,7 @@ def test_earth_geoid_01d(): data = load_earth_geoid(resolution="01d") assert data.name == "z" assert data.attrs["long_name"] == "elevation_m" - assert data.attrs["description"] == "EGM2008 Earth geoid" + # assert data.attrs["description"] == "EGM2008 Earth geoid" assert data.attrs["units"] == "m" assert data.attrs["horizontal_datum"] == "WGS84" assert data.shape == (181, 361) diff --git a/pygmt/tests/test_datasets_earth_magnetic_anomaly.py b/pygmt/tests/test_datasets_earth_magnetic_anomaly.py index c8c870fa8ef..f770ff92069 100644 --- a/pygmt/tests/test_datasets_earth_magnetic_anomaly.py +++ b/pygmt/tests/test_datasets_earth_magnetic_anomaly.py @@ -16,7 +16,7 @@ def test_earth_mag_01d(): data = load_earth_magnetic_anomaly(resolution="01d") assert data.name == "z" assert data.attrs["long_name"] == "magntic_field_nT" - assert data.attrs["description"] == "EMAG2 Earth Magnetic Anomaly Model" + # assert data.attrs["description"] == "EMAG2 Earth Magnetic Anomaly Model" assert data.attrs["units"] == "nT" assert data.attrs["horizontal_datum"] == "WGS84" assert data.shape == (181, 361) diff --git a/pygmt/tests/test_datasets_earth_mask.py b/pygmt/tests/test_datasets_earth_mask.py index c449e1a79a7..59c5da96caf 100644 --- a/pygmt/tests/test_datasets_earth_mask.py +++ b/pygmt/tests/test_datasets_earth_mask.py @@ -13,7 +13,7 @@ def test_earth_mask_01d(): """ data = load_earth_mask(resolution="01d") assert data.name == "z" - assert data.attrs["description"] == "GSHHG Earth mask" + # assert data.attrs["description"] == "GSHHG Earth mask" assert data.attrs["horizontal_datum"] == "WGS84" assert data.shape == (181, 361) assert data.gmt.registration == 0 diff --git a/pygmt/tests/test_datasets_earth_relief.py b/pygmt/tests/test_datasets_earth_relief.py index 958db58d666..031213eb476 100644 --- a/pygmt/tests/test_datasets_earth_relief.py +++ b/pygmt/tests/test_datasets_earth_relief.py @@ -20,7 +20,7 @@ def test_earth_relief_01d_igpp_synbath(data_source): data = load_earth_relief(resolution="01d", data_source=data_source) assert data.name == "z" assert data.attrs["long_name"] == "elevation_m" - assert data.attrs["description"] == "IGPP Earth relief" + # assert data.attrs["description"] == "IGPP Earth relief" assert data.attrs["units"] == "meters" assert data.attrs["vertical_datum"] == "EGM96" assert data.attrs["horizontal_datum"] == "WGS84" @@ -40,7 +40,7 @@ def test_earth_relief_01d_gebco(data_source): data = load_earth_relief(resolution="01d", data_source=data_source) assert data.name == "z" assert data.attrs["long_name"] == "elevation_m" - assert data.attrs["description"] == "GEBCO Earth relief" + # assert data.attrs["description"] == "GEBCO Earth relief" assert data.attrs["units"] == "meters" assert data.attrs["vertical_datum"] == "EGM96" assert data.attrs["horizontal_datum"] == "WGS84" diff --git a/pygmt/tests/test_datasets_earth_vertical_gravity_gradient.py b/pygmt/tests/test_datasets_earth_vertical_gravity_gradient.py index eae0b152106..808847e1bf6 100644 --- a/pygmt/tests/test_datasets_earth_vertical_gravity_gradient.py +++ b/pygmt/tests/test_datasets_earth_vertical_gravity_gradient.py @@ -14,7 +14,7 @@ def test_earth_vertical_gravity_gradient_01d(): data = load_earth_vertical_gravity_gradient(resolution="01d") assert data.name == "z" assert data.attrs["long_name"] == "gravity_gradient_E" - assert data.attrs["description"] == "IGPP Earth vertical gravity gradient" + # assert data.attrs["description"] == "IGPP Earth vertical gravity gradient" assert data.attrs["units"] == "Eotvos" assert data.attrs["horizontal_datum"] == "WGS84" assert data.shape == (181, 361) diff --git a/pygmt/tests/test_datasets_mars_relief.py b/pygmt/tests/test_datasets_mars_relief.py index a2035d4a5ac..fa73932d1bc 100644 --- a/pygmt/tests/test_datasets_mars_relief.py +++ b/pygmt/tests/test_datasets_mars_relief.py @@ -14,7 +14,7 @@ def test_mars_relief_01d(): data = load_mars_relief(resolution="01d") assert data.name == "z" assert data.attrs["long_name"] == "elevation_m" - assert data.attrs["description"] == "NASA Mars (MOLA) relief" + # assert data.attrs["description"] == "NASA Mars (MOLA) relief" assert data.attrs["units"] == "meters" assert data.shape == (181, 361) assert data.gmt.registration == 0 diff --git a/pygmt/tests/test_datasets_mercury_relief.py b/pygmt/tests/test_datasets_mercury_relief.py index 70c1954f9c4..1f2a18a51a7 100644 --- a/pygmt/tests/test_datasets_mercury_relief.py +++ b/pygmt/tests/test_datasets_mercury_relief.py @@ -14,7 +14,7 @@ def test_mercury_relief_01d(): data = load_mercury_relief(resolution="01d") assert data.name == "z" assert data.attrs["long_name"] == "elevation_m" - assert data.attrs["description"] == "USGS Mercury relief" + # assert data.attrs["description"] == "USGS Mercury relief" assert data.attrs["units"] == "meters" assert data.shape == (181, 361) assert data.gmt.registration == 0 diff --git a/pygmt/tests/test_datasets_moon_relief.py b/pygmt/tests/test_datasets_moon_relief.py index 125208f935b..78f03feafaf 100644 --- a/pygmt/tests/test_datasets_moon_relief.py +++ b/pygmt/tests/test_datasets_moon_relief.py @@ -14,7 +14,7 @@ def test_moon_relief_01d(): data = load_moon_relief(resolution="01d") assert data.name == "z" assert data.attrs["long_name"] == "elevation_m" - assert data.attrs["description"] == "USGS Moon (LOLA) relief" + # assert data.attrs["description"] == "USGS Moon (LOLA) relief" assert data.attrs["units"] == "meters" assert data.shape == (181, 361) assert data.gmt.registration == 0 diff --git a/pygmt/tests/test_datasets_pluto_relief.py b/pygmt/tests/test_datasets_pluto_relief.py index 6d56d71c3ed..b01247c7de4 100644 --- a/pygmt/tests/test_datasets_pluto_relief.py +++ b/pygmt/tests/test_datasets_pluto_relief.py @@ -12,9 +12,9 @@ def test_pluto_relief_01d(): Test some properties of the Pluto relief 01d data. """ data = load_pluto_relief(resolution="01d") - assert data.name == "m" + assert data.name == "z" assert data.attrs["long_name"] == "elevation_m" - assert data.attrs["description"] == "USGS Pluto relief" + # assert data.attrs["description"] == "USGS Pluto relief" assert data.attrs["units"] == "meters" assert data.shape == (181, 361) assert data.gmt.registration == 0 diff --git a/pygmt/tests/test_datasets_venus_relief.py b/pygmt/tests/test_datasets_venus_relief.py index f1603155381..296cecbbd00 100644 --- a/pygmt/tests/test_datasets_venus_relief.py +++ b/pygmt/tests/test_datasets_venus_relief.py @@ -14,7 +14,7 @@ def test_venus_relief_01d(): data = load_venus_relief(resolution="01d") assert data.name == "z" assert data.attrs["long_name"] == "elevation_m" - assert data.attrs["description"] == "NASA Magellan Venus relief" + # assert data.attrs["description"] == "NASA Magellan Venus relief" assert data.attrs["units"] == "meters" assert data.shape == (181, 361) assert data.gmt.registration == 0 From 9f2b7475466fed77d1e51e206cc78a8b26cfff89 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Sun, 21 Apr 2024 19:56:10 +0200 Subject: [PATCH 39/51] Fix --- pygmt/tests/test_datasets_earth_magnetic_anomaly.py | 4 ++-- pygmt/tests/test_datasets_load_remote_datasets.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pygmt/tests/test_datasets_earth_magnetic_anomaly.py b/pygmt/tests/test_datasets_earth_magnetic_anomaly.py index f770ff92069..36c179279c6 100644 --- a/pygmt/tests/test_datasets_earth_magnetic_anomaly.py +++ b/pygmt/tests/test_datasets_earth_magnetic_anomaly.py @@ -63,7 +63,7 @@ def test_earth_mag4km_01d(): data = load_earth_magnetic_anomaly(resolution="01d", data_source="emag2_4km") assert data.name == "z" assert data.attrs["long_name"] == "magntic_field_nT" - assert data.attrs["description"] == "EMAG2 Earth Magnetic Anomaly Model" + # assert data.attrs["description"] == "EMAG2 Earth Magnetic Anomaly Model" assert data.attrs["units"] == "nT" assert data.attrs["horizontal_datum"] == "WGS84" assert data.shape == (181, 361) @@ -120,7 +120,7 @@ def test_earth_mag_01d_wdmam(): ) assert data.name == "z" assert data.attrs["long_name"] == "magnetic_field_nT" - assert data.attrs["description"] == "WDMAM World Digital Magnetic Anomaly Map" + # assert data.attrs["description"] == "WDMAM World Digital Magnetic Anomaly Map" assert data.attrs["units"] == "nT" assert data.attrs["horizontal_datum"] == "WGS84" assert data.shape == (181, 361) diff --git a/pygmt/tests/test_datasets_load_remote_datasets.py b/pygmt/tests/test_datasets_load_remote_datasets.py index c18e28d21e7..9556ed4fe83 100644 --- a/pygmt/tests/test_datasets_load_remote_datasets.py +++ b/pygmt/tests/test_datasets_load_remote_datasets.py @@ -26,8 +26,8 @@ def test_load_remote_dataset_benchmark_with_region(): Benchmark loading a remote dataset with 'region'. """ data = load_remote_dataset_wrapper(resolution="01d", region=[-10, 10, -5, 5]) - assert data.name == "earth_age" - assert data.attrs["long_name"] == "EarthByte Earth seafloor crustal age" + assert data.name == "z" + assert data.attrs["long_name"] == "age_Myr" assert data.attrs["units"] == "Myr" assert data.attrs["horizontal_datum"] == "WGS84" assert data.gmt.registration == 0 From 1df4324d760574a99ca3649f6270b095267e402a Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Sun, 21 Apr 2024 20:09:22 +0200 Subject: [PATCH 40/51] Test testing 'description' attribut --- pygmt/tests/test_datasets_earth_magnetic_anomaly.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/tests/test_datasets_earth_magnetic_anomaly.py b/pygmt/tests/test_datasets_earth_magnetic_anomaly.py index 36c179279c6..6bc5f6cbace 100644 --- a/pygmt/tests/test_datasets_earth_magnetic_anomaly.py +++ b/pygmt/tests/test_datasets_earth_magnetic_anomaly.py @@ -16,7 +16,7 @@ def test_earth_mag_01d(): data = load_earth_magnetic_anomaly(resolution="01d") assert data.name == "z" assert data.attrs["long_name"] == "magntic_field_nT" - # assert data.attrs["description"] == "EMAG2 Earth Magnetic Anomaly Model" + assert data.attrs["description"] == "EMAG2 Earth Magnetic Anomaly Model" assert data.attrs["units"] == "nT" assert data.attrs["horizontal_datum"] == "WGS84" assert data.shape == (181, 361) From eec68ec3b9d0417e00c8fa2b4209df6c24fe786a Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Sun, 21 Apr 2024 20:33:14 +0200 Subject: [PATCH 41/51] Move 'description' attribut to 'extra_attributes' --- pygmt/datasets/load_remote_dataset.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pygmt/datasets/load_remote_dataset.py b/pygmt/datasets/load_remote_dataset.py index 2d0032286b1..0d0ed412e1e 100644 --- a/pygmt/datasets/load_remote_dataset.py +++ b/pygmt/datasets/load_remote_dataset.py @@ -175,9 +175,11 @@ class GMTRemoteDataset(NamedTuple): "earth_mag": GMTRemoteDataset( name="z", long_name="magntic_field_nT", - description="EMAG2 Earth Magnetic Anomaly Model", units="nT", - extra_attributes={"horizontal_datum": "WGS84"}, + extra_attributes={ + "horizontal_datum": "WGS84", + "description": "EMAG2 Earth Magnetic Anomaly Model", + }, resolutions={ "01d": Resolution("01d"), "30m": Resolution("30m"), @@ -236,9 +238,11 @@ class GMTRemoteDataset(NamedTuple): "earth_wdmam": GMTRemoteDataset( name="z", long_name="magnetic_field_nT", - description="WDMAM World Digital Magnetic Anomaly Map", units="nT", - extra_attributes={"horizontal_datum": "WGS84"}, + extra_attributes={ + "horizontal_datum": "WGS84", + "description": "WDMAM World Digital Magnetic Anomaly Map", + }, resolutions={ "01d": Resolution("01d"), "30m": Resolution("30m"), From e75a6d1d2194c7bed977c60cfb467fba87f0d387 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Sun, 21 Apr 2024 20:38:14 +0200 Subject: [PATCH 42/51] Revert changes --- pygmt/datasets/load_remote_dataset.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/pygmt/datasets/load_remote_dataset.py b/pygmt/datasets/load_remote_dataset.py index 0d0ed412e1e..2d0032286b1 100644 --- a/pygmt/datasets/load_remote_dataset.py +++ b/pygmt/datasets/load_remote_dataset.py @@ -175,11 +175,9 @@ class GMTRemoteDataset(NamedTuple): "earth_mag": GMTRemoteDataset( name="z", long_name="magntic_field_nT", + description="EMAG2 Earth Magnetic Anomaly Model", units="nT", - extra_attributes={ - "horizontal_datum": "WGS84", - "description": "EMAG2 Earth Magnetic Anomaly Model", - }, + extra_attributes={"horizontal_datum": "WGS84"}, resolutions={ "01d": Resolution("01d"), "30m": Resolution("30m"), @@ -238,11 +236,9 @@ class GMTRemoteDataset(NamedTuple): "earth_wdmam": GMTRemoteDataset( name="z", long_name="magnetic_field_nT", + description="WDMAM World Digital Magnetic Anomaly Map", units="nT", - extra_attributes={ - "horizontal_datum": "WGS84", - "description": "WDMAM World Digital Magnetic Anomaly Map", - }, + extra_attributes={"horizontal_datum": "WGS84"}, resolutions={ "01d": Resolution("01d"), "30m": Resolution("30m"), From d4541ad4ec5edbc37c12c56dd6912fd4489cec28 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Sun, 21 Apr 2024 20:44:56 +0200 Subject: [PATCH 43/51] Revert changes --- pygmt/tests/test_datasets_earth_magnetic_anomaly.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/tests/test_datasets_earth_magnetic_anomaly.py b/pygmt/tests/test_datasets_earth_magnetic_anomaly.py index 6bc5f6cbace..36c179279c6 100644 --- a/pygmt/tests/test_datasets_earth_magnetic_anomaly.py +++ b/pygmt/tests/test_datasets_earth_magnetic_anomaly.py @@ -16,7 +16,7 @@ def test_earth_mag_01d(): data = load_earth_magnetic_anomaly(resolution="01d") assert data.name == "z" assert data.attrs["long_name"] == "magntic_field_nT" - assert data.attrs["description"] == "EMAG2 Earth Magnetic Anomaly Model" + # assert data.attrs["description"] == "EMAG2 Earth Magnetic Anomaly Model" assert data.attrs["units"] == "nT" assert data.attrs["horizontal_datum"] == "WGS84" assert data.shape == (181, 361) From 5f508dbbf36cddc2e956f38c270367fe4554c9af Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Sun, 21 Apr 2024 22:10:35 +0200 Subject: [PATCH 44/51] Add 'description attribut --- pygmt/datasets/load_remote_dataset.py | 8 +++++--- pygmt/tests/test_datasets_earth_age.py | 2 +- pygmt/tests/test_datasets_earth_free_air_anomaly.py | 2 +- pygmt/tests/test_datasets_earth_geoid.py | 2 +- pygmt/tests/test_datasets_earth_magnetic_anomaly.py | 6 +++--- pygmt/tests/test_datasets_earth_mask.py | 2 +- pygmt/tests/test_datasets_earth_relief.py | 4 ++-- .../test_datasets_earth_vertical_gravity_gradient.py | 2 +- pygmt/tests/test_datasets_mars_relief.py | 2 +- pygmt/tests/test_datasets_mercury_relief.py | 2 +- pygmt/tests/test_datasets_moon_relief.py | 2 +- pygmt/tests/test_datasets_pluto_relief.py | 2 +- pygmt/tests/test_datasets_venus_relief.py | 2 +- 13 files changed, 20 insertions(+), 18 deletions(-) diff --git a/pygmt/datasets/load_remote_dataset.py b/pygmt/datasets/load_remote_dataset.py index 2d0032286b1..97e28c4f200 100644 --- a/pygmt/datasets/load_remote_dataset.py +++ b/pygmt/datasets/load_remote_dataset.py @@ -419,7 +419,7 @@ def _load_remote_dataset( if registration not in valid_registrations: raise GMTInvalidInput( f"{registration} registration is not available for the " - f"{resolution} {dataset.name} dataset. Only " + f"{resolution} {dataset.description} dataset. Only " f"{valid_registrations[0]} registration is available." ) else: @@ -436,7 +436,7 @@ def _load_remote_dataset( if region is None: if dataset.resolutions[resolution].tiled: raise GMTInvalidInput( - f"'region' is required for {dataset.name} resolution '{resolution}'." + f"'region' is required for {dataset.description} resolution '{resolution}'." ) fname = which(f"@{dataset_prefix}{resolution}{reg}", download="a") grid = load_dataarray(fname, engine="netcdf4") @@ -445,7 +445,9 @@ def _load_remote_dataset( # Add some metadata to the grid grid.name = dataset.name - grid.attrs["long_name"] = dataset.long_name + grid.attrs["description"] = dataset.description + if dataset.long_name: + grid.attrs["long_name"] = dataset.long_name if dataset.units: grid.attrs["units"] = dataset.units for key, value in dataset.extra_attributes.items(): diff --git a/pygmt/tests/test_datasets_earth_age.py b/pygmt/tests/test_datasets_earth_age.py index d2262645526..49a9dcc4a38 100644 --- a/pygmt/tests/test_datasets_earth_age.py +++ b/pygmt/tests/test_datasets_earth_age.py @@ -14,7 +14,7 @@ def test_earth_age_01d(): data = load_earth_age(resolution="01d") assert data.name == "z" assert data.attrs["long_name"] == "age_Myr" - # assert data.attrs["description"] == "EarthByte Earth seafloor crustal age" + assert data.attrs["description"] == "EarthByte Earth seafloor crustal age" assert data.attrs["units"] == "Myr" assert data.attrs["horizontal_datum"] == "WGS84" assert data.shape == (181, 361) diff --git a/pygmt/tests/test_datasets_earth_free_air_anomaly.py b/pygmt/tests/test_datasets_earth_free_air_anomaly.py index ac1167124eb..ed450fa728d 100644 --- a/pygmt/tests/test_datasets_earth_free_air_anomaly.py +++ b/pygmt/tests/test_datasets_earth_free_air_anomaly.py @@ -14,7 +14,7 @@ def test_earth_faa_01d(): data = load_earth_free_air_anomaly(resolution="01d") assert data.name == "z" assert data.attrs["long_name"] == "gravity_mGal" - # assert data.attrs["description"] == "IGPP Earth free-air anomaly" + assert data.attrs["description"] == "IGPP Earth free-air anomaly" assert data.attrs["units"] == "mGal" assert data.attrs["horizontal_datum"] == "WGS84" assert data.shape == (181, 361) diff --git a/pygmt/tests/test_datasets_earth_geoid.py b/pygmt/tests/test_datasets_earth_geoid.py index 44bb42feb11..68daa449d7f 100644 --- a/pygmt/tests/test_datasets_earth_geoid.py +++ b/pygmt/tests/test_datasets_earth_geoid.py @@ -14,7 +14,7 @@ def test_earth_geoid_01d(): data = load_earth_geoid(resolution="01d") assert data.name == "z" assert data.attrs["long_name"] == "elevation_m" - # assert data.attrs["description"] == "EGM2008 Earth geoid" + assert data.attrs["description"] == "EGM2008 Earth geoid" assert data.attrs["units"] == "m" assert data.attrs["horizontal_datum"] == "WGS84" assert data.shape == (181, 361) diff --git a/pygmt/tests/test_datasets_earth_magnetic_anomaly.py b/pygmt/tests/test_datasets_earth_magnetic_anomaly.py index 36c179279c6..c8c870fa8ef 100644 --- a/pygmt/tests/test_datasets_earth_magnetic_anomaly.py +++ b/pygmt/tests/test_datasets_earth_magnetic_anomaly.py @@ -16,7 +16,7 @@ def test_earth_mag_01d(): data = load_earth_magnetic_anomaly(resolution="01d") assert data.name == "z" assert data.attrs["long_name"] == "magntic_field_nT" - # assert data.attrs["description"] == "EMAG2 Earth Magnetic Anomaly Model" + assert data.attrs["description"] == "EMAG2 Earth Magnetic Anomaly Model" assert data.attrs["units"] == "nT" assert data.attrs["horizontal_datum"] == "WGS84" assert data.shape == (181, 361) @@ -63,7 +63,7 @@ def test_earth_mag4km_01d(): data = load_earth_magnetic_anomaly(resolution="01d", data_source="emag2_4km") assert data.name == "z" assert data.attrs["long_name"] == "magntic_field_nT" - # assert data.attrs["description"] == "EMAG2 Earth Magnetic Anomaly Model" + assert data.attrs["description"] == "EMAG2 Earth Magnetic Anomaly Model" assert data.attrs["units"] == "nT" assert data.attrs["horizontal_datum"] == "WGS84" assert data.shape == (181, 361) @@ -120,7 +120,7 @@ def test_earth_mag_01d_wdmam(): ) assert data.name == "z" assert data.attrs["long_name"] == "magnetic_field_nT" - # assert data.attrs["description"] == "WDMAM World Digital Magnetic Anomaly Map" + assert data.attrs["description"] == "WDMAM World Digital Magnetic Anomaly Map" assert data.attrs["units"] == "nT" assert data.attrs["horizontal_datum"] == "WGS84" assert data.shape == (181, 361) diff --git a/pygmt/tests/test_datasets_earth_mask.py b/pygmt/tests/test_datasets_earth_mask.py index 59c5da96caf..c449e1a79a7 100644 --- a/pygmt/tests/test_datasets_earth_mask.py +++ b/pygmt/tests/test_datasets_earth_mask.py @@ -13,7 +13,7 @@ def test_earth_mask_01d(): """ data = load_earth_mask(resolution="01d") assert data.name == "z" - # assert data.attrs["description"] == "GSHHG Earth mask" + assert data.attrs["description"] == "GSHHG Earth mask" assert data.attrs["horizontal_datum"] == "WGS84" assert data.shape == (181, 361) assert data.gmt.registration == 0 diff --git a/pygmt/tests/test_datasets_earth_relief.py b/pygmt/tests/test_datasets_earth_relief.py index 031213eb476..958db58d666 100644 --- a/pygmt/tests/test_datasets_earth_relief.py +++ b/pygmt/tests/test_datasets_earth_relief.py @@ -20,7 +20,7 @@ def test_earth_relief_01d_igpp_synbath(data_source): data = load_earth_relief(resolution="01d", data_source=data_source) assert data.name == "z" assert data.attrs["long_name"] == "elevation_m" - # assert data.attrs["description"] == "IGPP Earth relief" + assert data.attrs["description"] == "IGPP Earth relief" assert data.attrs["units"] == "meters" assert data.attrs["vertical_datum"] == "EGM96" assert data.attrs["horizontal_datum"] == "WGS84" @@ -40,7 +40,7 @@ def test_earth_relief_01d_gebco(data_source): data = load_earth_relief(resolution="01d", data_source=data_source) assert data.name == "z" assert data.attrs["long_name"] == "elevation_m" - # assert data.attrs["description"] == "GEBCO Earth relief" + assert data.attrs["description"] == "GEBCO Earth relief" assert data.attrs["units"] == "meters" assert data.attrs["vertical_datum"] == "EGM96" assert data.attrs["horizontal_datum"] == "WGS84" diff --git a/pygmt/tests/test_datasets_earth_vertical_gravity_gradient.py b/pygmt/tests/test_datasets_earth_vertical_gravity_gradient.py index 808847e1bf6..eae0b152106 100644 --- a/pygmt/tests/test_datasets_earth_vertical_gravity_gradient.py +++ b/pygmt/tests/test_datasets_earth_vertical_gravity_gradient.py @@ -14,7 +14,7 @@ def test_earth_vertical_gravity_gradient_01d(): data = load_earth_vertical_gravity_gradient(resolution="01d") assert data.name == "z" assert data.attrs["long_name"] == "gravity_gradient_E" - # assert data.attrs["description"] == "IGPP Earth vertical gravity gradient" + assert data.attrs["description"] == "IGPP Earth vertical gravity gradient" assert data.attrs["units"] == "Eotvos" assert data.attrs["horizontal_datum"] == "WGS84" assert data.shape == (181, 361) diff --git a/pygmt/tests/test_datasets_mars_relief.py b/pygmt/tests/test_datasets_mars_relief.py index fa73932d1bc..a2035d4a5ac 100644 --- a/pygmt/tests/test_datasets_mars_relief.py +++ b/pygmt/tests/test_datasets_mars_relief.py @@ -14,7 +14,7 @@ def test_mars_relief_01d(): data = load_mars_relief(resolution="01d") assert data.name == "z" assert data.attrs["long_name"] == "elevation_m" - # assert data.attrs["description"] == "NASA Mars (MOLA) relief" + assert data.attrs["description"] == "NASA Mars (MOLA) relief" assert data.attrs["units"] == "meters" assert data.shape == (181, 361) assert data.gmt.registration == 0 diff --git a/pygmt/tests/test_datasets_mercury_relief.py b/pygmt/tests/test_datasets_mercury_relief.py index 1f2a18a51a7..70c1954f9c4 100644 --- a/pygmt/tests/test_datasets_mercury_relief.py +++ b/pygmt/tests/test_datasets_mercury_relief.py @@ -14,7 +14,7 @@ def test_mercury_relief_01d(): data = load_mercury_relief(resolution="01d") assert data.name == "z" assert data.attrs["long_name"] == "elevation_m" - # assert data.attrs["description"] == "USGS Mercury relief" + assert data.attrs["description"] == "USGS Mercury relief" assert data.attrs["units"] == "meters" assert data.shape == (181, 361) assert data.gmt.registration == 0 diff --git a/pygmt/tests/test_datasets_moon_relief.py b/pygmt/tests/test_datasets_moon_relief.py index 78f03feafaf..125208f935b 100644 --- a/pygmt/tests/test_datasets_moon_relief.py +++ b/pygmt/tests/test_datasets_moon_relief.py @@ -14,7 +14,7 @@ def test_moon_relief_01d(): data = load_moon_relief(resolution="01d") assert data.name == "z" assert data.attrs["long_name"] == "elevation_m" - # assert data.attrs["description"] == "USGS Moon (LOLA) relief" + assert data.attrs["description"] == "USGS Moon (LOLA) relief" assert data.attrs["units"] == "meters" assert data.shape == (181, 361) assert data.gmt.registration == 0 diff --git a/pygmt/tests/test_datasets_pluto_relief.py b/pygmt/tests/test_datasets_pluto_relief.py index b01247c7de4..e803487e8d2 100644 --- a/pygmt/tests/test_datasets_pluto_relief.py +++ b/pygmt/tests/test_datasets_pluto_relief.py @@ -14,7 +14,7 @@ def test_pluto_relief_01d(): data = load_pluto_relief(resolution="01d") assert data.name == "z" assert data.attrs["long_name"] == "elevation_m" - # assert data.attrs["description"] == "USGS Pluto relief" + assert data.attrs["description"] == "USGS Pluto relief" assert data.attrs["units"] == "meters" assert data.shape == (181, 361) assert data.gmt.registration == 0 diff --git a/pygmt/tests/test_datasets_venus_relief.py b/pygmt/tests/test_datasets_venus_relief.py index 296cecbbd00..f1603155381 100644 --- a/pygmt/tests/test_datasets_venus_relief.py +++ b/pygmt/tests/test_datasets_venus_relief.py @@ -14,7 +14,7 @@ def test_venus_relief_01d(): data = load_venus_relief(resolution="01d") assert data.name == "z" assert data.attrs["long_name"] == "elevation_m" - # assert data.attrs["description"] == "NASA Magellan Venus relief" + assert data.attrs["description"] == "NASA Magellan Venus relief" assert data.attrs["units"] == "meters" assert data.shape == (181, 361) assert data.gmt.registration == 0 From 2f95200e64881789775eae98d2d01e602b4c3c75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= <94163266+yvonnefroehlich@users.noreply.github.com> Date: Tue, 23 Apr 2024 14:33:06 +0200 Subject: [PATCH 45/51] Use match-case statements Co-authored-by: Dongdong Tian --- pygmt/datasets/earth_relief.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pygmt/datasets/earth_relief.py b/pygmt/datasets/earth_relief.py index 4006e7ccd31..a0ddcd6eabc 100644 --- a/pygmt/datasets/earth_relief.py +++ b/pygmt/datasets/earth_relief.py @@ -162,10 +162,11 @@ def load_earth_relief( else: dataset_prefix = earth_relief_sources[data_source] # Choose earth relief dataset - if data_source in ["igpp", "synbath"]: - dataset_name = "earth_igpp" - elif data_source in ["gebco", "gebcosi"]: - dataset_name = "earth_gebco" + match data_source: + case "igpp" | "synbath": + dataset_name = "earth_igpp" + case "gebco" | "gebcosi": + dataset_name = "earth_gebco" grid = _load_remote_dataset( dataset_name=dataset_name, dataset_prefix=dataset_prefix, From 04bf516a30631c7b67cd3d8194124eeb2186242e Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Tue, 23 Apr 2024 14:48:13 +0200 Subject: [PATCH 46/51] Remove setting the 'name' and 'long_name' attributes --- pygmt/datasets/load_remote_dataset.py | 28 ------------------- .../test_datasets_load_remote_datasets.py | 2 +- 2 files changed, 1 insertion(+), 29 deletions(-) diff --git a/pygmt/datasets/load_remote_dataset.py b/pygmt/datasets/load_remote_dataset.py index 0d22285c483..e3733036011 100644 --- a/pygmt/datasets/load_remote_dataset.py +++ b/pygmt/datasets/load_remote_dataset.py @@ -65,8 +65,6 @@ class GMTRemoteDataset(NamedTuple): datasets = { "earth_age": GMTRemoteDataset( - name="z", - long_name="age_Myr", description="EarthByte Earth seafloor crustal age", units="Myr", extra_attributes={"horizontal_datum": "WGS84"}, @@ -85,8 +83,6 @@ class GMTRemoteDataset(NamedTuple): }, ), "earth_faa": GMTRemoteDataset( - name="z", - long_name="gravity_mGal", description="IGPP Earth free-air anomaly", units="mGal", extra_attributes={"horizontal_datum": "WGS84"}, @@ -105,8 +101,6 @@ class GMTRemoteDataset(NamedTuple): }, ), "earth_gebco": GMTRemoteDataset( - name="z", - long_name="elevation_m", description="GEBCO Earth relief", units="meters", extra_attributes={"vertical_datum": "EGM96", "horizontal_datum": "WGS84"}, @@ -129,8 +123,6 @@ class GMTRemoteDataset(NamedTuple): }, ), "earth_geoid": GMTRemoteDataset( - name="z", - long_name="elevation_m", description="EGM2008 Earth geoid", units="m", extra_attributes={"horizontal_datum": "WGS84"}, @@ -149,8 +141,6 @@ class GMTRemoteDataset(NamedTuple): }, ), "earth_igpp": GMTRemoteDataset( - name="z", - long_name="elevation_m", description="IGPP Earth relief", units="meters", extra_attributes={"vertical_datum": "EGM96", "horizontal_datum": "WGS84"}, @@ -173,8 +163,6 @@ class GMTRemoteDataset(NamedTuple): }, ), "earth_mag": GMTRemoteDataset( - name="z", - long_name="magntic_field_nT", description="EMAG2 Earth Magnetic Anomaly Model", units="nT", extra_attributes={"horizontal_datum": "WGS84"}, @@ -192,8 +180,6 @@ class GMTRemoteDataset(NamedTuple): }, ), "earth_mask": GMTRemoteDataset( - name="z", - long_name=None, description="GSHHG Earth mask", units=None, extra_attributes={"horizontal_datum": "WGS84"}, @@ -214,8 +200,6 @@ class GMTRemoteDataset(NamedTuple): }, ), "earth_vgg": GMTRemoteDataset( - name="z", - long_name="gravity_gradient_E", description="IGPP Earth vertical gravity gradient", units="Eotvos", extra_attributes={"horizontal_datum": "WGS84"}, @@ -234,8 +218,6 @@ class GMTRemoteDataset(NamedTuple): }, ), "earth_wdmam": GMTRemoteDataset( - name="z", - long_name="magnetic_field_nT", description="WDMAM World Digital Magnetic Anomaly Map", units="nT", extra_attributes={"horizontal_datum": "WGS84"}, @@ -252,8 +234,6 @@ class GMTRemoteDataset(NamedTuple): }, ), "mars_relief": GMTRemoteDataset( - name="z", - long_name="elevation_m", description="NASA Mars (MOLA) relief", units="meters", extra_attributes={}, @@ -275,8 +255,6 @@ class GMTRemoteDataset(NamedTuple): }, ), "moon_relief": GMTRemoteDataset( - name="z", - long_name="elevation_m", description="USGS Moon (LOLA) relief", units="meters", extra_attributes={}, @@ -298,8 +276,6 @@ class GMTRemoteDataset(NamedTuple): }, ), "mercury_relief": GMTRemoteDataset( - name="z", - long_name="elevation_m", description="USGS Mercury relief", units="meters", extra_attributes={}, @@ -319,8 +295,6 @@ class GMTRemoteDataset(NamedTuple): }, ), "pluto_relief": GMTRemoteDataset( - name="z", - long_name="elevation_m", description="USGS Pluto relief", units="meters", extra_attributes={}, @@ -340,8 +314,6 @@ class GMTRemoteDataset(NamedTuple): }, ), "venus_relief": GMTRemoteDataset( - name="z", - long_name="elevation_m", description="NASA Magellan Venus relief", units="meters", extra_attributes={}, diff --git a/pygmt/tests/test_datasets_load_remote_datasets.py b/pygmt/tests/test_datasets_load_remote_datasets.py index 9556ed4fe83..c6547336e4d 100644 --- a/pygmt/tests/test_datasets_load_remote_datasets.py +++ b/pygmt/tests/test_datasets_load_remote_datasets.py @@ -27,7 +27,7 @@ def test_load_remote_dataset_benchmark_with_region(): """ data = load_remote_dataset_wrapper(resolution="01d", region=[-10, 10, -5, 5]) assert data.name == "z" - assert data.attrs["long_name"] == "age_Myr" + assert data.attrs["long_name"] == "age (Myr)" assert data.attrs["units"] == "Myr" assert data.attrs["horizontal_datum"] == "WGS84" assert data.gmt.registration == 0 From d7a8ea0525a26547a108879612d168035dee8c58 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Tue, 23 Apr 2024 14:55:24 +0200 Subject: [PATCH 47/51] Remove setting the 'name' and 'long_name' attributes --- pygmt/datasets/load_remote_dataset.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/pygmt/datasets/load_remote_dataset.py b/pygmt/datasets/load_remote_dataset.py index e3733036011..6360561989d 100644 --- a/pygmt/datasets/load_remote_dataset.py +++ b/pygmt/datasets/load_remote_dataset.py @@ -41,10 +41,6 @@ class GMTRemoteDataset(NamedTuple): Attributes ---------- - name : str - Always ``"z"``. - long_name : str, None - The long name assigned as an attribute to the DataArray. description : str The name assigned as an attribute to the DataArray. units : str, None @@ -55,8 +51,6 @@ class GMTRemoteDataset(NamedTuple): A dictionary of extra or unique attributes of the dataset. """ - name: str - long_name: str | None description: str units: str | None resolutions: dict[str, Resolution] @@ -432,8 +426,6 @@ def _load_remote_dataset( # Add some metadata to the grid grid.name = dataset.name grid.attrs["description"] = dataset.description - if dataset.long_name: - grid.attrs["long_name"] = dataset.long_name if dataset.units: grid.attrs["units"] = dataset.units for key, value in dataset.extra_attributes.items(): From 3c4cde73b8b429a7e9ae74743dd3f32051acb35f Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Tue, 23 Apr 2024 14:58:34 +0200 Subject: [PATCH 48/51] Remove setting the 'name' and 'long_name' attributes --- pygmt/datasets/load_remote_dataset.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pygmt/datasets/load_remote_dataset.py b/pygmt/datasets/load_remote_dataset.py index 6360561989d..6f099952512 100644 --- a/pygmt/datasets/load_remote_dataset.py +++ b/pygmt/datasets/load_remote_dataset.py @@ -424,7 +424,6 @@ def _load_remote_dataset( grid.encoding["source"] = source # Add some metadata to the grid - grid.name = dataset.name grid.attrs["description"] = dataset.description if dataset.units: grid.attrs["units"] = dataset.units From 7418d6d8db31f2650e4d7a55065bebc1190421f9 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Tue, 23 Apr 2024 15:06:49 +0200 Subject: [PATCH 49/51] Update tests --- pygmt/tests/test_datasets_earth_age.py | 2 +- pygmt/tests/test_datasets_earth_free_air_anomaly.py | 2 +- pygmt/tests/test_datasets_earth_geoid.py | 2 +- pygmt/tests/test_datasets_earth_magnetic_anomaly.py | 6 +++--- pygmt/tests/test_datasets_earth_relief.py | 4 ++-- .../tests/test_datasets_earth_vertical_gravity_gradient.py | 2 +- pygmt/tests/test_datasets_mars_relief.py | 2 +- pygmt/tests/test_datasets_mercury_relief.py | 2 +- pygmt/tests/test_datasets_moon_relief.py | 2 +- pygmt/tests/test_datasets_pluto_relief.py | 2 +- pygmt/tests/test_datasets_venus_relief.py | 2 +- 11 files changed, 14 insertions(+), 14 deletions(-) diff --git a/pygmt/tests/test_datasets_earth_age.py b/pygmt/tests/test_datasets_earth_age.py index 49a9dcc4a38..67ade3dd3d9 100644 --- a/pygmt/tests/test_datasets_earth_age.py +++ b/pygmt/tests/test_datasets_earth_age.py @@ -13,7 +13,7 @@ def test_earth_age_01d(): """ data = load_earth_age(resolution="01d") assert data.name == "z" - assert data.attrs["long_name"] == "age_Myr" + assert data.attrs["long_name"] == "ages (Myr)" assert data.attrs["description"] == "EarthByte Earth seafloor crustal age" assert data.attrs["units"] == "Myr" assert data.attrs["horizontal_datum"] == "WGS84" diff --git a/pygmt/tests/test_datasets_earth_free_air_anomaly.py b/pygmt/tests/test_datasets_earth_free_air_anomaly.py index ed450fa728d..e06743086b0 100644 --- a/pygmt/tests/test_datasets_earth_free_air_anomaly.py +++ b/pygmt/tests/test_datasets_earth_free_air_anomaly.py @@ -13,7 +13,7 @@ def test_earth_faa_01d(): """ data = load_earth_free_air_anomaly(resolution="01d") assert data.name == "z" - assert data.attrs["long_name"] == "gravity_mGal" + assert data.attrs["long_name"] == "ffa (mGal)" assert data.attrs["description"] == "IGPP Earth free-air anomaly" assert data.attrs["units"] == "mGal" assert data.attrs["horizontal_datum"] == "WGS84" diff --git a/pygmt/tests/test_datasets_earth_geoid.py b/pygmt/tests/test_datasets_earth_geoid.py index 68daa449d7f..84bfc5d7bf4 100644 --- a/pygmt/tests/test_datasets_earth_geoid.py +++ b/pygmt/tests/test_datasets_earth_geoid.py @@ -13,7 +13,7 @@ def test_earth_geoid_01d(): """ data = load_earth_geoid(resolution="01d") assert data.name == "z" - assert data.attrs["long_name"] == "elevation_m" + assert data.attrs["long_name"] == "geoid (m)" assert data.attrs["description"] == "EGM2008 Earth geoid" assert data.attrs["units"] == "m" assert data.attrs["horizontal_datum"] == "WGS84" diff --git a/pygmt/tests/test_datasets_earth_magnetic_anomaly.py b/pygmt/tests/test_datasets_earth_magnetic_anomaly.py index c8c870fa8ef..65e1a57601c 100644 --- a/pygmt/tests/test_datasets_earth_magnetic_anomaly.py +++ b/pygmt/tests/test_datasets_earth_magnetic_anomaly.py @@ -15,7 +15,7 @@ def test_earth_mag_01d(): """ data = load_earth_magnetic_anomaly(resolution="01d") assert data.name == "z" - assert data.attrs["long_name"] == "magntic_field_nT" + assert data.attrs["long_name"] == "anomaly (nT)" assert data.attrs["description"] == "EMAG2 Earth Magnetic Anomaly Model" assert data.attrs["units"] == "nT" assert data.attrs["horizontal_datum"] == "WGS84" @@ -62,7 +62,7 @@ def test_earth_mag4km_01d(): """ data = load_earth_magnetic_anomaly(resolution="01d", data_source="emag2_4km") assert data.name == "z" - assert data.attrs["long_name"] == "magntic_field_nT" + assert data.attrs["long_name"] == "anomaly (nT)" assert data.attrs["description"] == "EMAG2 Earth Magnetic Anomaly Model" assert data.attrs["units"] == "nT" assert data.attrs["horizontal_datum"] == "WGS84" @@ -119,7 +119,7 @@ def test_earth_mag_01d_wdmam(): resolution="01d", registration="gridline", data_source="wdmam" ) assert data.name == "z" - assert data.attrs["long_name"] == "magnetic_field_nT" + assert data.attrs["long_name"] == "anomaly (nT)" assert data.attrs["description"] == "WDMAM World Digital Magnetic Anomaly Map" assert data.attrs["units"] == "nT" assert data.attrs["horizontal_datum"] == "WGS84" diff --git a/pygmt/tests/test_datasets_earth_relief.py b/pygmt/tests/test_datasets_earth_relief.py index 958db58d666..48ce69996ba 100644 --- a/pygmt/tests/test_datasets_earth_relief.py +++ b/pygmt/tests/test_datasets_earth_relief.py @@ -19,7 +19,7 @@ def test_earth_relief_01d_igpp_synbath(data_source): """ data = load_earth_relief(resolution="01d", data_source=data_source) assert data.name == "z" - assert data.attrs["long_name"] == "elevation_m" + assert data.attrs["long_name"] == "elevation (m)" assert data.attrs["description"] == "IGPP Earth relief" assert data.attrs["units"] == "meters" assert data.attrs["vertical_datum"] == "EGM96" @@ -39,7 +39,7 @@ def test_earth_relief_01d_gebco(data_source): """ data = load_earth_relief(resolution="01d", data_source=data_source) assert data.name == "z" - assert data.attrs["long_name"] == "elevation_m" + assert data.attrs["long_name"] == "elevation (m)" assert data.attrs["description"] == "GEBCO Earth relief" assert data.attrs["units"] == "meters" assert data.attrs["vertical_datum"] == "EGM96" diff --git a/pygmt/tests/test_datasets_earth_vertical_gravity_gradient.py b/pygmt/tests/test_datasets_earth_vertical_gravity_gradient.py index eae0b152106..c2507575563 100644 --- a/pygmt/tests/test_datasets_earth_vertical_gravity_gradient.py +++ b/pygmt/tests/test_datasets_earth_vertical_gravity_gradient.py @@ -13,7 +13,7 @@ def test_earth_vertical_gravity_gradient_01d(): """ data = load_earth_vertical_gravity_gradient(resolution="01d") assert data.name == "z" - assert data.attrs["long_name"] == "gravity_gradient_E" + assert data.attrs["long_name"] == "vgg (E)" assert data.attrs["description"] == "IGPP Earth vertical gravity gradient" assert data.attrs["units"] == "Eotvos" assert data.attrs["horizontal_datum"] == "WGS84" diff --git a/pygmt/tests/test_datasets_mars_relief.py b/pygmt/tests/test_datasets_mars_relief.py index a2035d4a5ac..88c437848f6 100644 --- a/pygmt/tests/test_datasets_mars_relief.py +++ b/pygmt/tests/test_datasets_mars_relief.py @@ -13,7 +13,7 @@ def test_mars_relief_01d(): """ data = load_mars_relief(resolution="01d") assert data.name == "z" - assert data.attrs["long_name"] == "elevation_m" + assert data.attrs["long_name"] == "elevation (m)" assert data.attrs["description"] == "NASA Mars (MOLA) relief" assert data.attrs["units"] == "meters" assert data.shape == (181, 361) diff --git a/pygmt/tests/test_datasets_mercury_relief.py b/pygmt/tests/test_datasets_mercury_relief.py index 70c1954f9c4..65dbe62e0d1 100644 --- a/pygmt/tests/test_datasets_mercury_relief.py +++ b/pygmt/tests/test_datasets_mercury_relief.py @@ -13,7 +13,7 @@ def test_mercury_relief_01d(): """ data = load_mercury_relief(resolution="01d") assert data.name == "z" - assert data.attrs["long_name"] == "elevation_m" + assert data.attrs["long_name"] == "elevation (m)" assert data.attrs["description"] == "USGS Mercury relief" assert data.attrs["units"] == "meters" assert data.shape == (181, 361) diff --git a/pygmt/tests/test_datasets_moon_relief.py b/pygmt/tests/test_datasets_moon_relief.py index 125208f935b..87f10ded098 100644 --- a/pygmt/tests/test_datasets_moon_relief.py +++ b/pygmt/tests/test_datasets_moon_relief.py @@ -13,7 +13,7 @@ def test_moon_relief_01d(): """ data = load_moon_relief(resolution="01d") assert data.name == "z" - assert data.attrs["long_name"] == "elevation_m" + assert data.attrs["long_name"] == "elevation (m)" assert data.attrs["description"] == "USGS Moon (LOLA) relief" assert data.attrs["units"] == "meters" assert data.shape == (181, 361) diff --git a/pygmt/tests/test_datasets_pluto_relief.py b/pygmt/tests/test_datasets_pluto_relief.py index e803487e8d2..9979f5915a5 100644 --- a/pygmt/tests/test_datasets_pluto_relief.py +++ b/pygmt/tests/test_datasets_pluto_relief.py @@ -13,7 +13,7 @@ def test_pluto_relief_01d(): """ data = load_pluto_relief(resolution="01d") assert data.name == "z" - assert data.attrs["long_name"] == "elevation_m" + assert data.attrs["long_name"] == "elevation (m)" assert data.attrs["description"] == "USGS Pluto relief" assert data.attrs["units"] == "meters" assert data.shape == (181, 361) diff --git a/pygmt/tests/test_datasets_venus_relief.py b/pygmt/tests/test_datasets_venus_relief.py index f1603155381..f2dc9a9489f 100644 --- a/pygmt/tests/test_datasets_venus_relief.py +++ b/pygmt/tests/test_datasets_venus_relief.py @@ -13,7 +13,7 @@ def test_venus_relief_01d(): """ data = load_venus_relief(resolution="01d") assert data.name == "z" - assert data.attrs["long_name"] == "elevation_m" + assert data.attrs["long_name"] == "elevation (m)" assert data.attrs["description"] == "NASA Magellan Venus relief" assert data.attrs["units"] == "meters" assert data.shape == (181, 361) From 1546ada8ee99cceff7b89dc8c26fc1984bfbc348 Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Tue, 23 Apr 2024 15:12:23 +0200 Subject: [PATCH 50/51] Update tests --- pygmt/tests/test_datasets_earth_free_air_anomaly.py | 2 +- pygmt/tests/test_datasets_earth_vertical_gravity_gradient.py | 2 +- pygmt/tests/test_datasets_load_remote_datasets.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pygmt/tests/test_datasets_earth_free_air_anomaly.py b/pygmt/tests/test_datasets_earth_free_air_anomaly.py index e06743086b0..517a1bb9b89 100644 --- a/pygmt/tests/test_datasets_earth_free_air_anomaly.py +++ b/pygmt/tests/test_datasets_earth_free_air_anomaly.py @@ -13,7 +13,7 @@ def test_earth_faa_01d(): """ data = load_earth_free_air_anomaly(resolution="01d") assert data.name == "z" - assert data.attrs["long_name"] == "ffa (mGal)" + assert data.attrs["long_name"] == "faa (mGal)" assert data.attrs["description"] == "IGPP Earth free-air anomaly" assert data.attrs["units"] == "mGal" assert data.attrs["horizontal_datum"] == "WGS84" diff --git a/pygmt/tests/test_datasets_earth_vertical_gravity_gradient.py b/pygmt/tests/test_datasets_earth_vertical_gravity_gradient.py index c2507575563..84fda47f8f7 100644 --- a/pygmt/tests/test_datasets_earth_vertical_gravity_gradient.py +++ b/pygmt/tests/test_datasets_earth_vertical_gravity_gradient.py @@ -13,7 +13,7 @@ def test_earth_vertical_gravity_gradient_01d(): """ data = load_earth_vertical_gravity_gradient(resolution="01d") assert data.name == "z" - assert data.attrs["long_name"] == "vgg (E)" + assert data.attrs["long_name"] == "vgg (Eotvos)" assert data.attrs["description"] == "IGPP Earth vertical gravity gradient" assert data.attrs["units"] == "Eotvos" assert data.attrs["horizontal_datum"] == "WGS84" diff --git a/pygmt/tests/test_datasets_load_remote_datasets.py b/pygmt/tests/test_datasets_load_remote_datasets.py index c6547336e4d..ac28a594813 100644 --- a/pygmt/tests/test_datasets_load_remote_datasets.py +++ b/pygmt/tests/test_datasets_load_remote_datasets.py @@ -27,7 +27,7 @@ def test_load_remote_dataset_benchmark_with_region(): """ data = load_remote_dataset_wrapper(resolution="01d", region=[-10, 10, -5, 5]) assert data.name == "z" - assert data.attrs["long_name"] == "age (Myr)" + assert data.attrs["long_name"] == "ages (Myr)" assert data.attrs["units"] == "Myr" assert data.attrs["horizontal_datum"] == "WGS84" assert data.gmt.registration == 0 From 2772e2dda8ce14182e8f805087de91d6f14a548b Mon Sep 17 00:00:00 2001 From: yvonnefroelich Date: Tue, 23 Apr 2024 17:16:34 +0200 Subject: [PATCH 51/51] Update example of 'grd2xyz' --- pygmt/src/grd2xyz.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/src/grd2xyz.py b/pygmt/src/grd2xyz.py index 04e4d21d848..3fbe933bc04 100644 --- a/pygmt/src/grd2xyz.py +++ b/pygmt/src/grd2xyz.py @@ -139,7 +139,7 @@ def grd2xyz( >>> # Create a pandas DataFrame with the xyz data from an input grid >>> xyz_dataframe = pygmt.grd2xyz(grid=grid, output_type="pandas") >>> xyz_dataframe.head(n=2) - lon lat elevation + lon lat z 0 10.0 25.0 965.5 1 10.5 25.0 876.5 """