How to write NetCDF with time as type 'int' not 'int64' #5429
-
I'm writing a NetCDF file and checking for CF compliance. I am getting the following error:
Is there some way to make xarray write non-int64 time dimension? |
Beta Was this translation helpful? Give feedback.
Answered by
spencerkclark
Jun 2, 2021
Replies: 1 comment 2 replies
-
Yes, you may set the ds.time.encoding["dtype"] = "float64"
ds.to_netcdf("float64-time-coordinate.nc") |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
mankoff
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes, you may set the
"dtype"
encoding attribute of the time coordinate before writing it out to a file. E.g. this will encode the dates with adouble
precision datatype: