Skip to content

Commit ac956bf

Browse files
committed
Fix conversion to datetime
By converting to microsecond precision
1 parent 6261f60 commit ac956bf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pysteps/blending/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ def decompose_NWP(
315315
)
316316

317317
# Make a NetCDF file
318-
output_date = f"{analysis_time.astype(datetime.datetime):%Y%m%d%H%M%S}"
318+
output_date = f"{analysis_time.astype('datetime64[us]').astype(datetime.datetime):%Y%m%d%H%M%S}"
319319
outfn = Path(output_path) / f"cascade_{NWP_model}_{output_date}.nc"
320320
ncf = netCDF4.Dataset(outfn, "w", format="NETCDF4")
321321

@@ -411,7 +411,7 @@ def compute_store_nwp_motion(
411411
"""
412412

413413
# Set the output file
414-
output_date = f"{analysis_time.astype(datetime.datetime):%Y%m%d%H%M%S}"
414+
output_date = f"{analysis_time.astype('datetime64[us]').astype(datetime.datetime):%Y%m%d%H%M%S}"
415415
outfn = Path(output_path) / f"motion_{nwp_model}_{output_date}.npy"
416416

417417
# Get the velocity field per time step

0 commit comments

Comments
 (0)