Skip to content

Commit

Permalink
Enable using forcings with lats-lons only
Browse files Browse the repository at this point in the history
  • Loading branch information
sandorkertesz committed Oct 23, 2024
1 parent 8167ec0 commit 0b26d64
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tests/forcings/test_forcings_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,11 @@ def test_forcings_3():


@pytest.mark.parametrize("lat_key,lon_key", [("latitudes", "longitudes"), ("latitude", "longitude")])
def test_forcings_from_lat_lon_core(lat_key, lon_key):
sample = from_source("file", earthkit_test_data_file("t_time_series.grib"))
@pytest.mark.parametrize(
"filename", ["t_time_series.grib", "rgg_small_subarea_cellarea_ref.grib", "mercator.grib"]
)
def test_forcings_from_lat_lon_core(lat_key, lon_key, filename):
sample = from_source("file", earthkit_test_data_file(filename))

dates = [
datetime.datetime(2020, 12, 21, 12, 0),
Expand All @@ -131,7 +134,7 @@ def test_forcings_from_lat_lon_core(lat_key, lon_key):

params = all_params

ll = sample[0].to_latlon()
ll = sample[0].to_latlon() # flatten=True is important here
lats = ll["lat"]
lons = ll["lon"]

Expand All @@ -149,6 +152,7 @@ def test_forcings_from_lat_lon_core(lat_key, lon_key):
for f, r in zip(ds, ref):
assert f.metadata("valid_datetime") == r[0].isoformat()
assert f.metadata("param") == r[1]
assert f.to_numpy().shape == lats.shape


def test_forcings_from_lat_lon_bad():
Expand Down

0 comments on commit 0b26d64

Please sign in to comment.