I have downloaded a published netCDF file that contains various climate data globally for 120,000 years into the past. (See public .nc file contained here: https://figshare.com/articles/dataset/LateQuaternary_Environment_nc/12293345/3). There are many variables including temperature, precipitation, etc.
All I want is to find out, globally, what was the average precipitation for the last 120,000 years. I.e., I want to end up with a single map for time-averaged precipitation for the whole planet. An important point is that the time intervals are not equally spaced, they vary between 1 and 2 thousand years. While trying to figure this out, I am running into many problems using Xarray, as I have not worked with netCDFs before. I tried using this simple method:
import xarray as xr
climate_file = 'LateQuaternary_Environment.nc' #Dataset linked to above
ds = xr.open_dataset(climate_file, decode_times=False)
ppt = ds.precipitation
ppt_avg = ppt.mean('time')
However, when I print(ppt_avg), all the values in the array are NaNs. Also, even if this gave actual values, I'm not sure if they would be the correct mean, because the time intervals are all different, so would I not have to weight them somehow, or resample the time data? I don't know because I don't understand how time averaging works for netCDFs or Xarray functions. I am not even sure if Xarray is the right thing to use.
Any help is welcome, thanks!