@@ -1025,11 +1025,19 @@ def setup_initial_condition(
10251025
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
1028+ < << << << HEAD
10281029
10291030 if reprocessed_var_map ["time_var_name" ] in ic_raw .dims :
10301031 ic_raw = ic_raw .isel ({reprocessed_var_map ["time_var_name" ]: 0 })
10311032 if reprocessed_var_map ["time_var_name" ] in ic_raw .coords :
10321033 ic_raw = ic_raw .drop (reprocessed_var_map ["time_var_name" ])
1034+ == == == =
1035+ ic_raw = xr .open_dataset (raw_ic_path )
1036+ if varnames ["time" ] in ic_raw .dims :
1037+ ic_raw = ic_raw .isel ({varnames ["time" ]: 0 })
1038+ if varnames ["time" ] in ic_raw .coords :
1039+ ic_raw = ic_raw .drop (varnames ["time" ])
1040+ > >> >> >> main
10331041
10341042 # Separate out tracers from two velocity fields of IC
10351043 try :
@@ -2514,7 +2522,7 @@ def setup_era5(self, era5_path):
25142522 )
25152523
25162524 rawdata [fname ].time .attrs = {
2517- "calendar" : "julian " ,
2525+ "calendar" : "gregorian " ,
25182526 "units" : f"hours since { self .date_range [0 ].strftime ('%Y-%m-%d %H:%M:%S' )} " ,
25192527 } ## Fix up calendar to match
25202528
@@ -2568,7 +2576,7 @@ class segment:
25682576
25692577 Data should be at daily temporal resolution, iterating upwards
25702578 from the provided startdate. Function ignores the time metadata
2571- and puts it on Julian calendar.
2579+ and puts it on gregorian calendar.
25722580
25732581 Note:
25742582 Only supports z-star (z*) vertical coordinate.
@@ -2625,7 +2633,7 @@ def regrid_velocity_tracers(
26252633 rotational_method = rot .RotationMethod .EXPAND_GRID ,
26262634 regridding_method = "bilinear" ,
26272635 time_units = "days" ,
2628- calendar = "julian " ,
2636+ calendar = "gregorian " ,
26292637 fill_method = rgd .fill_missing_data ,
26302638 ):
26312639 """
@@ -2768,6 +2776,22 @@ def regrid_velocity_tracers(
27682776 "units" : time_units ,
27692777 }
27702778
2779+ times = xr .DataArray (
2780+ np .arange (
2781+ 0 , #! Indexing everything from start of experiment = simple but maybe counterintutive?
2782+ segment_out [self .time ].shape [
2783+ 0
2784+ ], ## Time is indexed from start date of window
2785+ dtype = float ,
2786+ ), # Import pandas for this shouldn't be a big deal b/c it's already kinda required somewhere deep in some tree.
2787+ dims = ["time" ],
2788+ )
2789+ # This to change the time coordinate.
2790+ segment_out = rgd .add_or_update_time_dim (segment_out , times )
2791+ segment_out .time .attrs = {
2792+ "calendar" : calendar ,
2793+ "units" : f"{ self .time_units } since { self .startdate } " ,
2794+ }
27712795 # Here, keep in mind that 'var' keeps track of the mom6 variable names we want, and self.tracers[var]
27722796 # will return the name of the variable from the original data
27732797
0 commit comments