Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken ICGEM file loader test #457

Merged
merged 1 commit into from
Feb 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions harmonica/tests/test_icgem.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ def test_load_icgem_gdf():
true_data = np.array([np.arange(nlon)] * nlat, dtype="float64")
height = 1100 * np.ones(shape)

assert icgem_grd.dims["latitude"] == nlat
assert icgem_grd.dims["longitude"] == nlon
assert icgem_grd.sizes["latitude"] == nlat
assert icgem_grd.sizes["longitude"] == nlon
npt.assert_equal(icgem_grd.longitude.values, lon)
npt.assert_equal(icgem_grd.latitude.values, lat)
npt.assert_allclose(true_data, icgem_grd.sample_data.values)
Expand All @@ -55,8 +55,8 @@ def test_load_icgem_gdf_open_file():
true_data = np.array([np.arange(nlon)] * nlat, dtype="float64")
height = 1100 * np.ones(shape)

assert icgem_grd.dims["latitude"] == nlat
assert icgem_grd.dims["longitude"] == nlon
assert icgem_grd.sizes["latitude"] == nlat
assert icgem_grd.sizes["longitude"] == nlon
npt.assert_equal(icgem_grd.longitude.values, lon)
npt.assert_equal(icgem_grd.latitude.values, lat)
npt.assert_allclose(true_data, icgem_grd.sample_data.values)
Expand All @@ -76,8 +76,8 @@ def test_load_icgem_gdf_with_height():
glon, glat = np.meshgrid(lon, lat)
height = glon + glat

assert icgem_grd.dims["latitude"] == nlat
assert icgem_grd.dims["longitude"] == nlon
assert icgem_grd.sizes["latitude"] == nlat
assert icgem_grd.sizes["longitude"] == nlon
npt.assert_equal(icgem_grd.longitude.values, lon)
npt.assert_equal(icgem_grd.latitude.values, lat)
npt.assert_allclose(true_data, icgem_grd.sample_data.values)
Expand All @@ -96,8 +96,8 @@ def test_load_icgem_gdf_usecols():
lon = np.linspace(w, e, nlon, dtype="float64")
height = 1100 * np.ones(shape)

assert icgem_grd.dims["latitude"] == nlat
assert icgem_grd.dims["longitude"] == nlon
assert icgem_grd.sizes["latitude"] == nlat
assert icgem_grd.sizes["longitude"] == nlon
npt.assert_equal(icgem_grd.longitude.values, lon)
npt.assert_equal(icgem_grd.latitude.values, lat)
npt.assert_allclose(height, icgem_grd.height_over_ell.values)
Expand Down Expand Up @@ -295,6 +295,6 @@ def fixture_empty_fname(tmpdir):
def test_empty_file(empty_fname):
"Empty ICGEM file"
error = raises(IOError, match=r"Couldn't read \w+ field from gdf file header")
warn = warns(UserWarning, match=r"loadtxt: input contained no data")
warn = warns(UserWarning, match=r"loadtxt")
with error, warn:
load_icgem_gdf(empty_fname)
Loading