Unsupported File Structure Error
Added by Justyn Jackson almost 5 years ago
I downloaded precipitation data from the IRI, and I'm trying to enssum about 25 .nc files through CDO. However, when I do that, I get an error that says unsupported file structure. These are netCDF3 files, so I wasn't sure if that was the problem. I converted them to netCDF4, but that still didn't work. I've attached one of the files to this message. Thanks for any help!
JJ
Replies (5)
RE: Unsupported File Structure Error - Added by Ralf Mueller almost 5 years ago
hi!
you input is not CF-conform. please note that CDO is not a general netCDF tool like NCOs. But you can make it CF-conform with these two calls renaming variables and dimenions
ncrename -O -v T,time -v Y,lat -v X,lon may1.nc ncrename -O -d T,time -d Y,lat -d X,lon may1.ncProbably this can be combined into a single call.
The you can analyze the file with CDO
cdo infov may1.nc Warning (cdfScanVarAttr): NetCDF: Variable not found - T -1 : Date Time Level Gridsize Miss : Minimum Mean Maximum : Parameter name 1 : 2020-05-01 12:00:00 0 601551 0 : 0.0000 2.0593 183.42 : est_prcp cdo infon: Processed 1 variable over 1 timestep [0.01s 50MB].
the only remaining warning is about a wrong usage of the bounds variable: using the identical variable for bound and one dimension doesn't seem to be correct
hth
ralf
RE: Unsupported File Structure Error - Added by Justyn Jackson almost 5 years ago
I appreciate you explaining this, Ralf. Renaming the variables and dimensions worked, and I'm able to analyze the files with CDO again.
JJ
RE: Unsupported File Structure Error - Added by John Johnson about 4 years ago
Hi ,
It can also be done using:
import xarray as xr
precip='yourpath/may1.nc'
ds = xr.open_dataset(precip, decode_times=False)
prcp= ds.rename({'X': 'lon','Y': 'lat', 'T': 'time'})
#save your new file
prcp.to_netcdf("may1_Fixedcdo.nc")
RE: Unsupported File Structure Error - Added by Ralf Mueller about 4 years ago
hi John!
Does xarray support inplace-edit of the netcdf header? I mean, is there an option to save these changes to the input data?
cheers
ralf
RE: Unsupported File Structure Error - Added by John Johnson about 4 years ago
Hi Ralf,
You can save any change you make for later use.Please have a look at this link http://xarray.pydata.org/en/stable/generated/xarray.Dataset.to_netcdf.html
John