Skip to content

Commit c8aa487

Browse files
havardhhaugentnipen
authored andcommitted
Assign time when creating coords
1 parent aa87c23 commit c8aa487

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

bris/outputs/verif.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,11 @@ def create_nan_array(shape, dtype=np.float32) -> np.ndarray:
222222
def finalize(self) -> None:
223223
"""Write forecasts and observations to file"""
224224

225+
frts = self.intermediate.get_forecast_reference_times()
226+
frts_unix = utils.datetime_to_unixtime(frts).astype(np.double)
227+
225228
coords = {}
226-
coords["time"] = (["time"], [], cf.get_attributes("time"))
229+
coords["time"] = (["time"], frts_unix, cf.get_attributes("time"))
227230
coords["leadtime"] = (
228231
["leadtime"],
229232
self.intermediate.pm.leadtimes.astype(np.float32) / 3600,
@@ -270,9 +273,6 @@ def finalize(self) -> None:
270273

271274
self.ds = xr.Dataset(coords=coords)
272275

273-
frts = self.intermediate.get_forecast_reference_times()
274-
self.ds["time"] = utils.datetime_to_unixtime(frts).astype(np.double)
275-
276276
# Load forecasts
277277
fcst_shape = (
278278
len(frts),

0 commit comments

Comments
 (0)