I have multiple .nc files that I combined using xr.open_mfdataset
, floowed by subsetting it for study region and applying the mask using regionmask
and resampled it to take hourly mean, but it is giving wrong answer.
ds =xr.open_mfdataset("../t2m/*.nc")
has houly data from 01-01-1979 to 31-12-2019 and gives Dimensions: longitude: 1440 latitude: 721 time: 359400. After subsetiing for only month of May each year and for only study region using
dm = ds.isel(time=(ds.time.dt.month == 5)).sel(longitude=slice(65,90),latitude = slice(35,8)).where(land_mask == 0)
gives Dimensions: longitude: 101 latitude: 109 time: 30504 and land_mask uses masking of ocean datapoints using regionmask
.
Now taking the
dout = dm.resample(time='D').mean(dim="time").dropna(dim='time')
Gives dimension as Dimensions: time: 0 latitude: 109 longitude: 101 The output should have been time:1271 i.e. number of days in all the 41 May that comes in between the dataset.(41*31=1271). I dont get any reason why the time dimension is null instead of 1271. NOTE: If I skip isel,sel and regionmask operation this works out fine.(see this previous question
I cant come up with a reason here.