Home > Software design >  Numpy datetime64 extract month-day
Numpy datetime64 extract month-day

Time:05-18

I have the 3d data set and I want to have only month-date i.e numpy.datetime64('05-09'). Any idea how to do that? The original 3d datasets:

<xarray.DataArray (time: 153, lat: 281, lon: 481)>
array([[[5839.5454, 5839.581 , 5839.4844, ..., 5865.13  , 5865.8213,
         5865.933 ],
        [5838.614 , 5838.59  , 5838.548 , ..., 5864.121 , 5864.8354,
         5865.13  ],

       
       [[5853.7334, 5854.075 , 5854.291 , ..., 5882.3706, 5882.638 ,
         5882.379 ],
        [5853.297 , 5853.583 , 5853.858 , ..., 5882.602 , 5882.878 ,
         5882.687 ],

        ...,

        [5230.2534, 5230.2534, 5230.2534, ..., 5230.2534, 5230.2534,
         5230.2534]]], dtype=float32)
Coordinates:
  * lon      (lon) float64 -80.0 -79.75 -79.5 -79.25 ... 39.25 39.5 39.75 40.0
  * lat      (lat) float64 20.0 20.25 20.5 20.75 21.0 ... 89.25 89.5 89.75 90.0
  * time     (time) datetime64[ns] 2000-05-01 2000-05-02 ... 2000-09-30

CodePudding user response:

You could simply access the enter image description here

  • Related