How to take the time coordinate in a NetCDF file to use a title string in Python

28 Views Asked by At

I am using NetCDF4 dataset to plot some data.

dataset information

I want to take the time coordinate to use as a string for the title of a plot. A basic question, but how do I do this?

I got as far as to this, but how do I select the '2023-12-05T12:00:00.000000000' only? enter image description here

1

There are 1 best solutions below

0
dodohjk On

I knew it was going to be something really simple. I will answer my own question.

To extract the value you can use the attribute ".data"

ie myds['time'].data

enter image description here