Skip to content

Cube creation #5218

Answered by lbdreyer
Marston asked this question in Q&A
Discussion options

You must be logged in to vote

1.) I'm having trouble understanding Cube dimension time and how to construct it.

Iris stores the time points as numbers since an epoch, which is the standard NetCDF (and CF) representation for datetimes. For example, you could create a coordinate with points=(6, 12, 18) and units='hours since 1970-01-01 00:00:00' which would represent time points of 1970-01-01 06:00:00, 1970-01-01 12:00:00, 1970-01-01 18:00:00.

Xarray typically converts the numbers into numpy.datetimes64 (and discards the units), although you can switch this off by including decode_times=False when you open the file (e.g. with xr.open_dataset).

However, if you need to convert already loaded numpy.datetimes64 objects back…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by trexfeathers
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