Reputation: 923
I have netcdf(month-wise data of 30 years, time = (12*30=360, )) file with 3 variables:
* longitude (longitude) float32 0.0 0.25 0.5 0.75 ... 359.25 359.5 359.75
* latitude (latitude) float32 90.0 89.75 89.5 89.25 ... -89.5 -89.75 -90.0
* time (time) datetime64[ns] 1979-01-01 1979-02-01 ... 2020-01-01
Data variables:
z (time, latitude, longitude) float32 ...
Now I want to calculate mean monthwise, i.e mean of all January, February.... for given 30 years. Which will just return me data of 12 month mean for 30 year(time = (12, )).
Is there any way in xarray to do so, I was able to figure-out how to do it year wise by following code.
data.resample({'time': '1Y'}).mean()
Upvotes: 4
Views: 319