Skip to content

Commit

Permalink
Update test
Browse files Browse the repository at this point in the history
  • Loading branch information
wpreimes committed Oct 27, 2024
1 parent c7387e3 commit 2b56a20
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/ecmwf_models/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ def update_image_summary_file(data_path: str,
data_path, start_from_last=True)
except ValueError:
warnings.warn(f"Could not infer date from filenames in {data_path}")
return
return

props = img_infer_file_props(data_path, start_from_last=False)
_ = props.pop("datetime")
Expand Down
8 changes: 8 additions & 0 deletions tests/tests_era5/test_era5_download_cds.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

from ecmwf_models.era5.reader import ERA5NcImg
from ecmwf_models.utils import check_api_ready
from ecmwf_models.era5.download import download_and_move

try:
check_api_ready()
Expand Down Expand Up @@ -39,6 +40,9 @@ def test_cli_download(self):

subprocess.call(['era5', 'download'] + args)

# download_and_move(dl_path, startdate, enddate, variables=['swvl1'],
# h_steps=[0])

out_path = os.path.join(dl_path, '2023', '001')
assert(os.path.exists(out_path))
imgs = os.listdir(out_path)
Expand All @@ -47,3 +51,7 @@ def test_cli_download(self):
ds = ERA5NcImg(os.path.join(out_path, imgs[0]), parameter='swvl1')
img = ds.read(datetime(2023, 1, 1))
assert img.data['swvl1'].shape == (721, 1440)


if __name__ == '__main__':
DownloadTest().test_cli_download()
2 changes: 1 addition & 1 deletion tests/tests_era5/test_era5_reshuffle.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ 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"
"2010-01-01", "-v", "swvl1,swvl2", "-l", "True",
"--bbox", "12.0", "46.0", "17.0", "50.0",
"--h_steps", "0"])

Expand Down

0 comments on commit 2b56a20

Please sign in to comment.