From 9ec925a230a851a1f56966e49609383ce304ac5f Mon Sep 17 00:00:00 2001 From: Wolfgang Preimesberger Date: Tue, 29 Oct 2024 12:50:01 +0100 Subject: [PATCH] Fix test --- README.rst | 2 ++ tests/tests_era5/test_era5_reshuffle.py | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/README.rst b/README.rst index 9a87119..572df78 100644 --- a/README.rst +++ b/README.rst @@ -128,6 +128,8 @@ variable or the ``--cds_token`` option. $ docker run -v /data/era5/img:/container/path ecmwf_models:latest bash -c \ 'era5land update_img /container/path --cds_token xxxx-xxx-xxx-xx-xxxx' +You can use this together with a task scheduler to regularly pull new data + Citation ======== diff --git a/tests/tests_era5/test_era5_reshuffle.py b/tests/tests_era5/test_era5_reshuffle.py index 1461211..6ad7955 100644 --- a/tests/tests_era5/test_era5_reshuffle.py +++ b/tests/tests_era5/test_era5_reshuffle.py @@ -62,12 +62,12 @@ def test_cli_reshuffle_and_update(): ts_path = tempdir / 'ts' - subprocess.call(["era5", "reshuffle", img_path, ts_path, "2010-01-01", - "2010-01-01", "-v", "swvl1,swvl2", "-l", "True", - "--bbox", "12.0", "46.0", "17.0", "50.0", + subprocess.call(["era5", "reshuffle", str(img_path), str(ts_path), + "--end", "2010-01-01", "-v", "swvl1,swvl2", "-l", + "True", "--bbox", "12.0", "46.0", "17.0", "50.0", "--h_steps", "0"]) - ts_reader = ERATs(ts_path) + ts_reader = ERATs(str(ts_path)) ts = ts_reader.read(15, 48) assert 99 not in ts['swvl1'].values # verify ERA5-T was NOT used! swvl1_values_should = np.array([0.402825], dtype=np.float32) @@ -77,16 +77,16 @@ def test_cli_reshuffle_and_update(): ts_reader.close() # Manipulate settings to update with different time stamp for same day - props = read_summary_yml(ts_path) + props = read_summary_yml(str(ts_path)) props['img2ts_kwargs']['h_steps'] = [12] - props['img2ts_kwargs']['startdate'] = datetime(2009,12,31) - props['img2ts_kwargs']['enddate'] = datetime(2009,12,31) + props['img2ts_kwargs']['startdate'] = datetime(2009, 12, 31) + props['img2ts_kwargs']['enddate'] = datetime(2009, 12, 31) with open(ts_path / 'overview.yml', 'w') as f: yaml.dump(props, f, default_flow_style=False, sort_keys=False) - subprocess.call(["era5", "update_ts", ts_path]) - ts_reader = ERATs(ts_path) + subprocess.call(["era5", "update_ts", str(ts_path)]) + ts_reader = ERATs(str(ts_path)) ts = ts_reader.read(15, 48) swvl1_values_should = np.array([0.402825, 0.390983], dtype=np.float32) nptest.assert_allclose( @@ -149,4 +149,4 @@ def test_ERA5_reshuffle_grb(): ts["swvl1"].values, swvl1_values_should, rtol=1e-5) swvl2_values_should = np.array([0.390514, 0.390980], dtype=np.float32) nptest.assert_allclose( - ts["swvl2"].values, swvl2_values_should, rtol=1e-5) \ No newline at end of file + ts["swvl2"].values, swvl2_values_should, rtol=1e-5)