You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: config/default_configs/default_config.yml
+3Lines changed: 3 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -172,6 +172,9 @@ bubble:
172
172
start_date:
173
173
help: "Start date and time of the simulation. Specified as either yyyymmdd (defaults to midnight) or yyyymmdd-HHMM. Examples: [`20100101`, `20100101-0000`]"
174
174
value: "20100101"
175
+
era5_initial_condition_dir:
176
+
help: "Directory containing ERA5 initial condition files. Filenames inferred from start_date [none (default)]. Generated with `https://github.com/CliMA/WeatherQuest`."
- If `era5_initial_condition_dir` is provided, use
20
+
`era5_init_processed_internal_YYYYMMDD_0000.nc` from that directory.
21
+
- Otherwise, use the `weather_model_ic` artifact.
15
22
"""
16
-
functionweather_model_data_path(start_date)
23
+
functionweather_model_data_path(
24
+
start_date,
25
+
target_levels,
26
+
era5_initial_condition_dir =nothing,
27
+
)
17
28
# Parse the date using the existing parse_date function
18
29
dt =parse_date(start_date)
19
30
20
31
# Extract components for filename generation
21
32
start_date_str = Dates.format(dt, "yyyymmdd")
22
-
start_time = Dates.format(dt, "HHMM")
33
+
start_time = Dates.format(dt, "HHMM") # Note: this is not the same as `start_time` in the coupler!
34
+
35
+
# If user provided a directory with preprocessed initial conditions, use it
36
+
if!isnothing(era5_initial_condition_dir)
37
+
ic_data_path =joinpath(
38
+
era5_initial_condition_dir,
39
+
"era5_init_processed_internal_$(start_date_str)_0000.nc", #TODO: generalize for all times once Coupler supports HHMM specification
40
+
)
41
+
raw_data_path =joinpath(
42
+
era5_initial_condition_dir,
43
+
"era5_raw_$(start_date_str)_0000.nc",
44
+
)
45
+
if!isfile(ic_data_path)
46
+
if!isfile(raw_data_path)
47
+
error(
48
+
"Neither preprocessed nor raw initial condition file exist in $(era5_initial_condition_dir). Please run `python get_initial_conditions.py` in the WeatherQuest repository to download the data.",
49
+
)
50
+
end
51
+
@info"Interpolating raw weather model data onto z-levels from user-provided directory"
@info"Using existing interpolated IC file: $ic_data_path"
55
+
end
56
+
return ic_data_path
57
+
end
58
+
59
+
# Otherwise, use artifact-based paths and generate if needed
23
60
ic_data_path =joinpath(
24
61
@clima_artifact("weather_model_ic"),
25
62
"init",
@@ -31,23 +68,6 @@ function weather_model_data_path(start_date)
31
68
"era5_raw_$(start_date_str)_$(start_time).nc",
32
69
)
33
70
34
-
if!isfile(ic_data_path)
35
-
@info"Initial condition file $ic_data_path does not exist. Attempting to generate it now..."
36
-
if!isfile(raw_data_path)
37
-
day = Dates.format(dt, "yyyy-mm-dd")
38
-
time = Dates.format(dt, "HH:MM")
39
-
error(
40
-
"Source file $(raw_data_path) does not exist. Please run `python get_initial_conditions.py --output-dir $(@clima_artifact("weather_model_ic"))/raw --date $(day) --time $(time)` to download the data.",
41
-
)
42
-
end
43
-
# get target levels - TODO: make this more flexible
0 commit comments