Skip to content

Commit 7b2826d

Browse files
committed
works for interpolators.yaml
1 parent 378f350 commit 7b2826d

File tree

8 files changed

+27
-17
lines changed

8 files changed

+27
-17
lines changed

config/interpolators.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ runs:
1717
config: resources/inference/configs/interpolator_from_test_data.yaml
1818
forecaster: null
1919
extra_dependencies:
20-
- git+https://github.com/ecmwf/anemoi-inference@fix/interp_files
20+
- git+https://github.com/ecmwf/anemoi-inference@fix/cutout-preprocessors
2121
- torch-geometric==2.6.1
2222
- anemoi-graphs==0.5.2
2323
- interpolator:
@@ -28,7 +28,7 @@ runs:
2828
mlflow_id: d0846032fc7248a58b089cbe8fa4c511
2929
config: resources/inference/configs/forecaster_with_global.yaml
3030
extra_dependencies:
31-
- git+https://github.com/ecmwf/anemoi-inference@fix/interp_files
31+
- git+https://github.com/ecmwf/anemoi-inference@fix/cutout-preprocessors
3232
- torch-geometric==2.6.1
3333
- anemoi-graphs==0.5.2
3434
- interpolator:
@@ -40,7 +40,7 @@ runs:
4040
mlflow_id: d0846032fc7248a58b089cbe8fa4c511
4141
config: resources/inference/configs/forecaster_with_global.yaml
4242
extra_dependencies:
43-
- git+https://github.com/ecmwf/anemoi-inference@fix/interp_files
43+
- git+https://github.com/ecmwf/anemoi-inference@fix/cutout-preprocessors
4444
- torch-geometric==2.6.1
4545
- anemoi-graphs==0.5.2
4646

resources/inference/configs/forecaster_with_global.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ output:
2828
- extract_slice: [189699, -1]
2929
- assign_mask: "global/cutout_mask"
3030

31-
forcings:
31+
constant_forcings:
3232
test:
3333
use_original_paths: true
3434

resources/inference/configs/interpolator.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ post_processors:
1010

1111
input:
1212
grib:
13-
path: forecaster_grib/20*.grib # TODO: remove dirty fix to only use local files
13+
path: forecaster/20*.grib # TODO: remove dirty fix to only use local files
1414
namer:
1515
rules:
1616
- - shortName: SKT
@@ -60,6 +60,14 @@ constant_forcings:
6060
test:
6161
use_original_paths: true
6262

63+
dynamic_forcings:
64+
test:
65+
use_original_paths: true
66+
67+
patch_metadata:
68+
dataset:
69+
constant_fields: [z, lsm]
70+
6371
verbosity: 1
6472
allow_nans: true
6573
output_frequency: "1h"

resources/inference/configs/interpolator_from_test_data.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
runner: time_interpolator
2-
include_forcings: true
32

43
input:
54
test:

resources/inference/configs/interpolator_from_test_data_stretched.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ output:
1717
encoding:
1818
typeOfGeneratingProcess: 2
1919
templates:
20-
samples: _resources/templates_index_cosmo.yaml
20+
samples: resources/templates_index_cosmo.yaml
2121

2222
verbosity: 1
2323
allow_nans: true

resources/inference/configs/interpolator_stretched.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ input:
44
cutout:
55
lam_0:
66
grib:
7-
path: forecaster_grib/20*
87
pre_processors:
98
- extract_mask: "source0/trimedge_mask"
9+
path: forecaster/20*
1010
namer:
1111
rules:
1212
- - shortName: T
@@ -43,7 +43,7 @@ input:
4343
- tp
4444
global:
4545
grib:
46-
path: forecaster_grib/ifs*
46+
path: forecaster/ifs*
4747
namer:
4848
rules:
4949
- - shortName: T

workflow/envs/anemoi_inference.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ dependencies = [
88
"torchaudio",
99
"anemoi-datasets>=0.5.23,<0.7.0",
1010
"anemoi-graphs>=0.5.0,<0.7.0",
11-
"anemoi-inference>=0.7.0,<0.8.0",
11+
"anemoi-inference>=0.8.0,<0.9.0",
1212
"anemoi-models>=0.4.20,<0.6.0",
1313
"anemoi-training>=0.3.3,<0.5.0",
1414
"anemoi-transform>=0.1.10,<0.3.0",

workflow/rules/inference.smk

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,15 @@ rule prepare_inference_forecaster:
160160
log:
161161
OUT_ROOT / "logs/prepare_inference_forecaster/{run_id}-{init_time}.log",
162162
run:
163-
LOG = setup_logger("prepare_inference_forecaster", log_file=log[0])
163+
logger_name = (
164+
f"prepare_inference_forecaster_{wildcards.run_id}_{wildcards.init_time}"
165+
)
166+
LOG = setup_logger(logger_name, log_file=log[0])
164167
try:
165168
import yaml
166169
import shutil
167170

168-
L(
171+
LOG.info(
169172
"Preparing inference forecaster for run_id=%s, init_time=%s",
170173
wildcards.run_id,
171174
wildcards.init_time,
@@ -193,7 +196,7 @@ rule prepare_inference_forecaster:
193196
config["date"] = params.reftime_to_iso
194197
config["lead_time"] = params.lead_time
195198
with open(output.config, "w") as f:
196-
yaml.safe_dump(config, f)
199+
yaml.safe_dump(config, f, sort_keys=False)
197200
LOG.info("Config: \n%s", config)
198201
LOG.info("Wrote config file at %s", output.config)
199202
except Exception as e:
@@ -243,13 +246,13 @@ rule prepare_inference_interpolator:
243246
if RUN_CONFIGS[wc.run_id].get("forecaster") is None
244247
else _get_forecaster_run_id(wc.run_id)
245248
),
246-
image_path=lambda wc, input: f"{Path(input.image).resolve()}",
247249
log:
248250
OUT_ROOT / "logs/prepare_inference_interpolator/{run_id}-{init_time}.log",
249251
run:
250-
LOG = setup_logger(
251-
f"prepare_inference_interpolator_{OUT_ROOT.stem}", log_file=log[0]
252+
logger_name = (
253+
f"prepare_inference_interpolator_{wildcards.run_id}_{wildcards.init_time}"
252254
)
255+
LOG = setup_logger(logger_name, log_file=log[0])
253256
try:
254257
import yaml
255258
import shutil
@@ -300,7 +303,7 @@ rule prepare_inference_interpolator:
300303
config["date"] = params.reftime_to_iso
301304
config["lead_time"] = params.lead_time
302305
with open(output.config, "w") as f:
303-
yaml.safe_dump(config, f)
306+
yaml.safe_dump(config, f, sort_keys=False)
304307
LOG.info("Config: \n%s", config)
305308
LOG.info("Wrote config file at %s", output.config)
306309
except Exception as e:

0 commit comments

Comments
 (0)