diff --git a/data/README.md b/data/README.md index da3e5a6df..727f05d2c 100644 --- a/data/README.md +++ b/data/README.md @@ -8,13 +8,11 @@ These files are used as sample data in Harmonica: geometric (ellipsoidal) height of 10 km. The grid was generated from the EIGEN-6C4 gravity field model using the [ICGEM Calculation Service](http://icgem.gfz-potsdam.de) and the WGS84 Reference System. The data are stored in a netCDF file and then `xz` - compressed using Python's `lzma` library. + compressed. * `etopo1-0.5deg.nc.xz`: Global relief (topography and bathymetry) of the Earth based on - the ETOPO1 model at 0.5 degree grid spacing. The original heights referenced to the - sea level were converted to geometric (ellipsoidal) heights using a geoid grid derived - from the EIGEN-6C4 gravity field model. Both grids were generated by the - [ICGEM Calculation Service](http://icgem.gfz-potsdam.de). The data are stored in a - netCDF file and then `xz` compressed using Python's `lzma` library. + the ETOPO1 model at 0.5 degree grid spacing. The grid was generated by the [ICGEM + Calculation Service](http://icgem.gfz-potsdam.de). The data are stored in a netCDF + file and then `xz` compressed. * `rio-magnetic.csv.xz`: Total-field magnetic anomaly data from the northwestern part of an airborne survey of Rio de Janeiro, Brazil, conducted in 1978. Columns are longitude, latitude, total field anomaly (nanoTesla), observation height above the diff --git a/data/etopo1-0.5deg.nc.xz b/data/etopo1-0.5deg.nc.xz index 96587b90b..4cd1e7bc3 100644 Binary files a/data/etopo1-0.5deg.nc.xz and b/data/etopo1-0.5deg.nc.xz differ diff --git a/data/examples/gravity_earth.py b/data/examples/earth_gravity.py similarity index 83% rename from data/examples/gravity_earth.py rename to data/examples/earth_gravity.py index 4246ce347..b4c52f9ed 100644 --- a/data/examples/gravity_earth.py +++ b/data/examples/earth_gravity.py @@ -1,10 +1,11 @@ """ -Gravity of the Earth -==================== +Earth Gravity +============= This is the magnitude of the gravity vector of the Earth (gravitational + centrifugal) -at 10 km height. The data is on a regular grid with 0.5 degree spacing which was -generated from the spherical harmonic model EIGEN-6C4 [Forste_etal2014]_. +at 10 km height. The data is on a regular grid with 0.5 degree spacing at 10km +ellipsoidal height. It was generated from the spherical harmonic model EIGEN-6C4 +[Forste_etal2014]_. """ import matplotlib.pyplot as plt import cartopy.crs as ccrs diff --git a/data/examples/topography_earth.py b/data/examples/earth_topography.py similarity index 91% rename from data/examples/topography_earth.py rename to data/examples/earth_topography.py index 7754de1d3..0872775dc 100644 --- a/data/examples/topography_earth.py +++ b/data/examples/earth_topography.py @@ -1,10 +1,11 @@ """ -Topography of the Earth -======================= +Earth Topography +================ The topography and bathymetry of the Earth according to the ETOPO1 model [AmanteEakins2009]_. The original model has 1 arc-minute grid spacing but here we -downsampled to 0.5 degree grid spacing to save space and download times. +downsampled to 0.5 degree grid spacing to save space and download times. Heights are +referenced to sea level. """ import matplotlib.pyplot as plt import cartopy.crs as ccrs diff --git a/harmonica/datasets/registry.txt b/harmonica/datasets/registry.txt index ed044e08f..e8317c10a 100644 --- a/harmonica/datasets/registry.txt +++ b/harmonica/datasets/registry.txt @@ -1,3 +1,3 @@ -etopo1-0.5deg.nc.xz 9f21f7c946e649389dce28631de94fa05217750e9ebc77df4311458c33f0682b +etopo1-0.5deg.nc.xz d975b2f90111043744f70eb1382ed4c654c79065cabe71d067ea8fde7010be2b gravity-earth-0.5deg.nc.xz 02c62a251225e2e76722a80d87c488160fbdcae2c1a8bbc2386c32e68ea8f43a rio-magnetic.csv.xz 134542c1a0c4b89040a4b7d0e52ff55b97e4a3fb7cbda7004a739166897a5eeb diff --git a/harmonica/datasets/sample_data.py b/harmonica/datasets/sample_data.py index 139f056f6..e66417e88 100644 --- a/harmonica/datasets/sample_data.py +++ b/harmonica/datasets/sample_data.py @@ -44,7 +44,9 @@ def fetch_gravity_earth(): """ fname = POOCH.fetch("gravity-earth-0.5deg.nc.xz") - data = _load_xz_compressed_grid(fname, engine="scipy") + # The heights are stored as ints and data as float32 to save space on the data file. + # Cast them to float64 to avoid integer division errors. + data = _load_xz_compressed_grid(fname, engine="scipy").astype("float64") return data @@ -56,9 +58,11 @@ def fetch_topography_earth(): arc-minute grid spacing but here we downsampled to 0.5 degree grid spacing to save space and download times. The downsampled grid was generated from a spherical harmonic model using the `ICGEM Calculation Service - `__. See the ``attrs`` attribute of the + `__. See the ``attrs`` attribute of the returned :class:`xarray.Dataset` for information regarding the grid generation. + ETOPO1 heights are referenced to "sea level". + If the file isn't already in your data directory, it will be downloaded automatically. @@ -69,7 +73,9 @@ def fetch_topography_earth(): """ fname = POOCH.fetch("etopo1-0.5deg.nc.xz") - data = _load_xz_compressed_grid(fname, engine="scipy") + # The data are stored as int16 to save disk space. Cast them to floats to avoid + # integer division problems when processing. + data = _load_xz_compressed_grid(fname, engine="scipy").astype("float64") return data diff --git a/harmonica/tests/test_sample_data.py b/harmonica/tests/test_sample_data.py index 8a732317a..174af58d6 100644 --- a/harmonica/tests/test_sample_data.py +++ b/harmonica/tests/test_sample_data.py @@ -24,8 +24,8 @@ def test_topography_earth(): "Sanity checks for the loaded grid" grid = fetch_topography_earth() assert grid.topography.shape == (361, 721) - npt.assert_allclose(grid.topography.max(), 5622) - npt.assert_allclose(grid.topography.min(), -8397) + npt.assert_allclose(grid.topography.max(), 5651, atol=1) + npt.assert_allclose(grid.topography.min(), -8409, atol=1) def test_rio_magnetic():