Project

General

Profile

A problem to read netcdf file

Added by Guilong Li about 10 years ago

Hi,

I have a netcdf file generated by ncl. I can use GrADS to read this netcdf format. But when I want to use cdo to read it, it gives me the following error message

cdo infon: Open failed on >out1.nc<
Unsupported file structure
HDF5-DIAG: Error detected in HDF5 (1.8.7) thread 0:
#000: H5D.c line 391 in H5Dclose(): not a dataset
major: Invalid arguments to routine
minor: Inappropriate type

Error (cdf_close) : NetCDF: HDF error

Just in case you need more information, I also give the ncdump output

netcdf out1 {
dimensions:
lev = 6 ;
time = 732 ;
lat = 510 ;
lon = 1068 ;
variables:
float spi(lev, time, lat, lon) ;
spi:long_name = "SPI" ;
spi:_FillValue = 9.96921e+36f ;
double lev(lev) ;
lev:long_name = "Levels" ;
lev:units = "None" ;
lev:axis = "Z" ;
double time(time) ;
time:calendar = "standard" ;
time:units = "days since 1950-01-01 00:00:00" ;
time:standard_name = "time" ;
double lat(lat) ;
lat:axis = "Y" ;
lat:units = "degrees_north" ;
lat:long_name = "latitude" ;
lat:standard_name = "latitude" ;
double lon(lon) ;
lon:axis = "X" ;
lon:units = "degrees_east" ;
lon:long_name = "longitude" ;
lon:standard_name = "longitude" ;
}

Any idea why I get this error message?

Thanks,

Guilong


Replies (6)

RE: A problem to read netcdf file - Added by Jaison-Thomas Ambadan about 10 years ago

For CDO, in order to recognize NetCDF files, the time dimension has to be the first dimension

In your case, I noticed that the variable attributes are:

float spi(lev, time, lat, lon) ;

This could be the reason for the error.

You can re-order with NCO tools

RE: A problem to read netcdf file - Added by Guilong Li about 10 years ago

You are right. I use the following command to change the order

ncpdq -a time,lon,lat,lev out1.nc out2.nc

now cdo can handle the file.

Thanks.

RE: A problem to read netcdf file - Added by Ehsan Taghizadeh almost 6 years ago

Hi,
I have some similar problem with attached file. For following command:
cdo -infov 2_ERAI_Prec_2015_Jan_00_12_24_ncl.nc4

I got following error:

cdf_inq_dimname : ncid = 65536 dimid = 0 name =

Error (cdf_inq_dimname) : NetCDF: Invalid dimension ID or name
HDF5-DIAG: Error detected in HDF5 (1.8.12) thread 0:
#000: ../../src/H5T.c line 1763 in H5Tclose(): not a datatype
major: Invalid arguments to routine
minor: Inappropriate type

Error (cdf_close) : NetCDF: HDF error

Could I ask why, and what I should do?

Sincerely
Ehsan

RE: A problem to read netcdf file - Added by Ehsan Taghizadeh almost 6 years ago

ncpdq -a time,lon,lat,lev out1.nc out2.nc seems work for me, too.
TNX

RE: A problem to read netcdf file - Added by Sohrab Kolsoumi almost 6 years ago

Hello Dear
Many researchers face to problem for reading or extracting data from netcdf files. Netcdf-Extractor is a windows software for extract data easily.
https://youtu.be/XfYzmbjfmNw
This is Netcdf-Extractor:
https://www.agrimetsoft.com/Netcdf-Extractor.aspx

RE: A problem to read netcdf file - Added by Ehsan Taghizadeh almost 6 years ago

Thank you Sohrab. It seems really helpful tools. However I prefer Linux tools to Windows!

Sincerely
Ehsan

    (1-6/6)