Skip to content

Commit

Permalink
Fix conversion to datetime
Browse files Browse the repository at this point in the history
By converting to microsecond precision
  • Loading branch information
dnerini committed Feb 18, 2022
1 parent 6261f60 commit ac956bf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pysteps/blending/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ def decompose_NWP(
)

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

Expand Down Expand Up @@ -411,7 +411,7 @@ def compute_store_nwp_motion(
"""

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

# Get the velocity field per time step
Expand Down

0 comments on commit ac956bf

Please sign in to comment.