Skip to content

How to write NetCDF with time as type 'int' not 'int64' #5429

Answered by spencerkclark
mankoff asked this question in Q&A
Discussion options

You must be logged in to vote

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 a double precision datatype:

ds.time.encoding["dtype"] = "float64"
ds.to_netcdf("float64-time-coordinate.nc")

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@mankoff
Comment options

@spencerkclark
Comment options

Answer selected by mankoff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants