Skip to content

Commit 1024448

Browse files
committed
Change to time_var_name
1 parent a96378d commit 1024448

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

regional_mom6/regional_mom6.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,10 +1026,10 @@ def setup_initial_condition(
10261026
# Remove time dimension if present in the IC.
10271027
# Assume that the first time dim is the intended one if more than one is present
10281028

1029-
if reprocessed_var_map["time"] in ic_raw.dims:
1030-
ic_raw = ic_raw.isel({reprocessed_var_map["time"]: 0})
1031-
if reprocessed_var_map["time"] in ic_raw.coords:
1032-
ic_raw = ic_raw.drop(reprocessed_var_map["time"])
1029+
if reprocessed_var_map["time_var_name"] in ic_raw.dims:
1030+
ic_raw = ic_raw.isel({reprocessed_var_map["time_var_name"]: 0})
1031+
if reprocessed_var_map["time_var_name"] in ic_raw.coords:
1032+
ic_raw = ic_raw.drop(reprocessed_var_map["time_var_name"])
10331033

10341034
# Separate out tracers from two velocity fields of IC
10351035
try:
@@ -2726,7 +2726,7 @@ def regrid_velocity_tracers(
27262726
np.nanmin(
27272727
segment_out[reprocessed_var_map["tracer_var_names"]["temp"]].isel(
27282728
{
2729-
reprocessed_var_map["time"]: 0,
2729+
reprocessed_var_map["time_var_name"]: 0,
27302730
depth_coord: 0,
27312731
}
27322732
)
@@ -2748,7 +2748,7 @@ def regrid_velocity_tracers(
27482748
times = xr.DataArray(
27492749
np.arange(
27502750
0, #! Indexing everything from start of experiment = simple but maybe counterintutive?
2751-
segment_out[reprocessed_var_map["time"]].shape[
2751+
segment_out[reprocessed_var_map["time_var_name"]].shape[
27522752
0
27532753
], ## Time is indexed from start date of window
27542754
dtype=float,
@@ -3267,7 +3267,7 @@ def apply_arakawa_grid_mapping(var_mapping: dict, arakawa_grid: str = None) -> d
32673267
"u_var_name": var_mapping["u"],
32683268
"v_var_name": var_mapping["v"],
32693269
"eta_var_name": var_mapping["eta"],
3270-
"time": var_mapping["time"],
3270+
"time_var_name": var_mapping["time"],
32713271
"depth_coord": var_mapping["zl"],
32723272
"tracer_var_names": {
32733273
"salt": var_mapping["tracers"]["salt"],
@@ -3342,7 +3342,7 @@ def validate_var_mapping(var_map: dict, is_xhyh: bool = False) -> None:
33423342
"""
33433343
if not is_xhyh:
33443344
required_keys = {
3345-
"time",
3345+
"time_var_name",
33463346
"u_x_coord",
33473347
"u_y_coord",
33483348
"v_x_coord",

0 commit comments

Comments
 (0)