Skip to content
This repository was archived by the owner on Jun 11, 2024. It is now read-only.

Commit b9e526e

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent bf453d7 commit b9e526e

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

nwp/icon/app.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ def download_model_files(runs=None, parent_folder=None, model="global"):
3333
var_2d_list = GLOBAL_VAR2D_LIST
3434
invariant = GLOBAL_INVARIENT_LIST
3535
pressure_levels = GLOBAL_PRESSURE_LEVELS
36-
f_steps = list(range(0, 79)) + list(range(81, 99, 3)) # 4 days
36+
f_steps = list(range(0, 79)) + list(range(81, 99, 3)) # 4 days
3737
else:
3838
var_3d_list = EU_VAR3D_LIST
3939
var_2d_list = EU_VAR2D_LIST
4040
invariant = None
4141
pressure_levels = EU_PRESSURE_LEVELS
42-
f_steps = list(range(0, 79)) + list(range(81, 123, 3)) # 5 days
42+
f_steps = list(range(0, 79)) + list(range(81, 123, 3)) # 5 days
4343
for run in runs:
4444
run_folder = os.path.join(parent_folder, run)
4545
if not os.path.exists(run_folder):
@@ -87,7 +87,7 @@ def process_model_files(
8787
)
8888
lons = lon_ds.tlon.values
8989
lats = lat_ds.tlat.values
90-
f_steps = list(range(0, 79)) + list(range(81, 99, 3)) # 4 days
90+
f_steps = list(range(0, 79)) + list(range(81, 99, 3)) # 4 days
9191
else:
9292
var_base = "icon-eu_europe_regular-lat-lon"
9393
var_3d_list = EU_VAR3D_LIST

scripts/convert_icon_archive.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@
66
77
"""
88

9+
import multiprocessing as mp
910
import os
11+
import subprocess
1012
from glob import glob
13+
from pathlib import Path
1114

1215
import xarray as xr
1316
import zarr
@@ -18,10 +21,7 @@
1821
EU_VAR2D_LIST,
1922
EU_VAR3D_LIST,
2023
)
21-
import subprocess
2224

23-
from pathlib import Path
24-
import multiprocessing as mp
2525

2626
def decompress(full_bzip_filename: Path, temp_pth: Path) -> str:
2727
"""
@@ -38,7 +38,7 @@ def decompress(full_bzip_filename: Path, temp_pth: Path) -> str:
3838
base_nat_filename = os.path.splitext(base_bzip_filename)[0]
3939
full_nat_filename = os.path.join(temp_pth, base_nat_filename)
4040
if os.path.exists(full_nat_filename):
41-
return full_nat_filename # Don't decompress a second time
41+
return full_nat_filename # Don't decompress a second time
4242
with open(full_nat_filename, "wb") as nat_file_handler:
4343
process = subprocess.run(
4444
["pbzip2", "--decompress", "--keep", "--stdout", full_bzip_filename],
@@ -179,8 +179,8 @@ def upload_to_hf(dataset_xr, folder, model="eu", run="00", token=None):
179179
encoding = {var: {"compressor": Blosc2("zstd", clevel=9)} for var in dataset_xr.data_vars}
180180
encoding["time"] = {"units": "nanoseconds since 1970-01-01"}
181181
with zarr.ZipStore(
182-
zarr_path,
183-
mode="w",
182+
zarr_path,
183+
mode="w",
184184
) as store:
185185
dataset_xr.chunk(chunking).to_zarr(store, encoding=encoding, compute=True)
186186
done = False
@@ -189,10 +189,10 @@ def upload_to_hf(dataset_xr, folder, model="eu", run="00", token=None):
189189
api.upload_file(
190190
path_or_fileobj=zarr_path,
191191
path_in_repo=f"data/{dataset_xr.time.dt.year.values}/"
192-
f"{dataset_xr.time.dt.month.values}/"
193-
f"{dataset_xr.time.dt.day.values}/"
194-
f"{dataset_xr.time.dt.year.values}{str(dataset_xr.time.dt.month.values).zfill(2)}{str(dataset_xr.time.dt.day.values).zfill(2)}"
195-
f"_{str(dataset_xr.time.dt.hour.values).zfill(2)}.zarr.zip",
192+
f"{dataset_xr.time.dt.month.values}/"
193+
f"{dataset_xr.time.dt.day.values}/"
194+
f"{dataset_xr.time.dt.year.values}{str(dataset_xr.time.dt.month.values).zfill(2)}{str(dataset_xr.time.dt.day.values).zfill(2)}"
195+
f"_{str(dataset_xr.time.dt.hour.values).zfill(2)}.zarr.zip",
196196
repo_id="openclimatefix/dwd-icon-global"
197197
if model == "global"
198198
else "openclimatefix/dwd-icon-eu",

0 commit comments

Comments
 (0)