Skip to content

Commit e7f12b2

Browse files
authored
Decouple inference preparation and execution (#68)
* draft changes * rename workspace resources dir * working for config/forecasters.yaml * improve logging * works for interpolators.yaml * re-add get_leadtime function * refactor run directives into script
1 parent 8ee5831 commit e7f12b2

17 files changed

+322
-123
lines changed

config/interpolators.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ runs:
1515
config: resources/inference/configs/interpolator_from_test_data_stretched.yaml
1616
forecaster: null
1717
extra_dependencies:
18-
- git+https://github.com/ecmwf/anemoi-inference@14189907b4f4e3b204b7994f828831b8aa51e9b6
18+
- git+https://github.com/ecmwf/anemoi-inference@fix/cutout-preprocessors
1919
- torch-geometric==2.6.1
2020
- anemoi-graphs==0.5.2
2121
- interpolator:
@@ -28,7 +28,7 @@ runs:
2828
config: resources/inference/configs/forecaster_with_global.yaml
2929
steps: 0/120/6
3030
extra_dependencies:
31-
- git+https://github.com/ecmwf/anemoi-inference@14189907b4f4e3b204b7994f828831b8aa51e9b6
31+
- git+https://github.com/ecmwf/anemoi-inference@fix/cutout-preprocessors
3232
- torch-geometric==2.6.1
3333
- anemoi-graphs==0.5.2
3434
- forecaster:

resources/inference/configs/forecaster.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
- printer
2222

2323
write_initial_state: true

resources/inference/configs/forecaster_no_trimedge.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ output:
1515
encoding:
1616
typeOfGeneratingProcess: 2
1717
templates:
18-
samples: _resources/templates_index_cosmo.yaml
18+
samples: resources/templates_index_cosmo.yaml
1919
- printer
2020

2121
write_initial_state: true

resources/inference/configs/forecaster_no_trimedge_fromtraining.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ output:
1515
encoding:
1616
typeOfGeneratingProcess: 2
1717
templates:
18-
samples: _resources/templates_index_cosmo.yaml
18+
samples: resources/templates_index_cosmo.yaml
1919
- printer
2020

2121
write_initial_state: true

resources/inference/configs/forecaster_with_global.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,18 @@ output:
1717
encoding:
1818
typeOfGeneratingProcess: 2
1919
templates:
20-
samples: _resources/templates_index_cosmo.yaml
20+
samples: resources/templates_index_cosmo.yaml
2121
- grib:
2222
path: grib/ifs-{dateTime}_{step:03}.grib
2323
encoding:
2424
typeOfGeneratingProcess: 2
2525
templates:
26-
samples: _resources/templates_index_ifs.yaml
26+
samples: resources/templates_index_ifs.yaml
2727
post_processors:
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: 10 additions & 2 deletions
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
@@ -54,12 +54,20 @@ output:
5454
encoding:
5555
typeOfGeneratingProcess: 2
5656
templates:
57-
samples: _resources/templates_index_cosmo.yaml
57+
samples: resources/templates_index_cosmo.yaml
5858

5959
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: 1 addition & 2 deletions
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:
@@ -15,7 +14,7 @@ output:
1514
encoding:
1615
typeOfGeneratingProcess: 2
1716
templates:
18-
samples: _resources/templates_index_cosmo.yaml
17+
samples: resources/templates_index_cosmo.yaml
1918

2019
verbosity: 1
2120
allow_nans: true

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: 3 additions & 3 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
@@ -100,7 +100,7 @@ output:
100100
encoding:
101101
typeOfGeneratingProcess: 2
102102
templates:
103-
samples: _resources/templates_index_cosmo.yaml
103+
samples: resources/templates_index_cosmo.yaml
104104

105105
verbosity: 1
106106
allow_nans: true
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11

22
# COSMO-2 templates
33
- - {grid: 0.02, levtype: pl}
4-
- _resources/co2-typeOfLevel=isobaricInhPa.grib
4+
- resources/co2-typeOfLevel=isobaricInhPa.grib
55

66
- - {grid: 0.02, levtype: sfc, param: [T_2M, TD_2M, U_10M, V_10M]}
7-
- _resources/co2-typeOfLevel=heightAboveGround.grib
7+
- resources/co2-typeOfLevel=heightAboveGround.grib
88

99
- - {grid: 0.02, levtype: sfc, param: [FR_LAND, TOC_PREC, PMSL, PS, FIS, T_G]}
10-
- _resources/co2-typeOfLevel=surface.grib
10+
- resources/co2-typeOfLevel=surface.grib
1111

1212
- - {grid: 0.02, levtype: sfc, param: [TOT_PREC]}
13-
- _resources/co2-shortName=TOT_PREC.grib
13+
- resources/co2-shortName=TOT_PREC.grib
1414

1515
# COSMO-1E templates
1616
- - {grid: 0.01, levtype: pl}
17-
- _resources/co1e-typeOfLevel=isobaricInhPa.grib
17+
- resources/co1e-typeOfLevel=isobaricInhPa.grib
1818

1919
- - {grid: 0.01, levtype: sfc, param: [T_2M, TD_2M, U_10M, V_10M]}
20-
- _resources/co1e-typeOfLevel=heightAboveGround.grib
20+
- resources/co1e-typeOfLevel=heightAboveGround.grib
2121

2222
- - {grid: 0.01, levtype: sfc, param: [FR_LAND, TOC_PREC, PMSL, PS, FIS, T_G]}
23-
- _resources/co1e-typeOfLevel=surface.grib
23+
- resources/co1e-typeOfLevel=surface.grib
2424

2525
- - {grid: 0.01, levtype: sfc, param: [TOT_PREC]}
26-
- _resources/co1e-shortName=TOT_PREC.grib
26+
- resources/co1e-shortName=TOT_PREC.grib

0 commit comments

Comments
 (0)