I have a netCDF file generated by a model output. The file contains spatially gridded variables over a 30 yr time span and I've confirmed that the file contains the data using Ferret from within linux. When I read the file into Python with both xarray and netCDF4 the file reads successfully with correct dimensions but the data variables are all missing.
I first obtained the error:
ValueError: unable to decode time units 'growing seasons since 2071-01-01 00:00:00' with 'the default calendar'. Try opening your dataset with decode_times=False or installing cftime if it is not installed.
So, I added the following lines in order to solve the time issue:
ds = xr.open_dataset('my_file.nc4', decode_times=False)
units, reference_date = ds.time.attrs['units'].split('since')`
ds['time'] = pd.date_range(start=reference_date, periods=ds.sizes['time'],` `freq='A')`
Now, there is no error when reading the file in but all of the data variables are showing NaN. I don't have a problem reading in any other netCDF files. I have a very similar file with extension '.nc' instead of '.nc4' which is one of the tiles that make up the final file and it's reading in with all data present. I'm thinking there is some sort of disagreement with the dimensions of my dataset and xarray. Here is the summary of the dataset: