Skip to content

Commit

Permalink
center map sample data
Browse files Browse the repository at this point in the history
  • Loading branch information
mathause committed Jan 10, 2024
1 parent 314b6bd commit f997abe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions mplotutils/cartopy_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ def sample_data_map(nlons, nlats):
"""

dlat = 180.0 / nlats / 2
dlon = 360.0 / nlons
dlon = 360.0 / nlons / 2

lat = np.linspace(-90 + dlat, 90 - dlat, nlats)
lon = np.linspace(0, 360 - dlon, nlons)
lon = np.linspace(dlon, 360 - dlon, nlons)

lons, lats = np.meshgrid(np.deg2rad(lon), np.deg2rad(lat))
wave = 0.75 * (np.sin(2 * lats) ** 8) * np.cos(4 * lons)
Expand Down
6 changes: 3 additions & 3 deletions mplotutils/tests/test_sample_data_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ def test_lat():
__, lat, __ = sample_data_map(36, 9)

expected_lat = np.arange(-80, 81, 20)
assert np.allclose(lat, expected_lat)
np.testing.assert_allclose(lat, expected_lat)


def test_lon():
lon, __, __ = sample_data_map(36, 9)

expected_lon = np.arange(0, 351, 10)
assert np.allclose(lon, expected_lon)
expected_lon = np.arange(5, 356, 10)
np.testing.assert_allclose(lon, expected_lon)


@pytest.mark.parametrize("nlon", [5, 10])
Expand Down

0 comments on commit f997abe

Please sign in to comment.