Project

General

Profile

Error while trying to open nc file format with PyNIO in Python.

Added by Manuel Luis about 6 years ago

Hello there,

This is my first question.

I am trying to analize extrange values contained in a big amount of NC files produced by WRF4G. I am trying to open the files in Python (v2.7.5) with PyNIO (v1.5.0). The following lines are used inside the Python interpreter:

import nio
file = nio.open_file("/disk/sabina/disk1/Projects/Please/repository/Ple_GFDL_2940_45/Ple_GFDL_2940_45/output/wrfout_d01_20371228T030000Z.nc")

The line used to open the file bring me out of the Python Interpreter with the following error:

ncvarget: ncid 65536; varid 6: NetCDF: HDF error

However if I fire up a ncdump of the same file, I got it successfully. The result of the command is quite big so I have attached it to this message.

Thanks for all in advance.
I will appreciate any help and answer
Manuel

ncDump.txt (38.3 KB) ncDump.txt NC Dump of the file

Replies (10)

RE: Error while trying to open nc file format with PyNIO in Python. - Added by Ralf Mueller about 6 years ago

Hi Manuel!
Sorry to disappoint you, but your question is not related to CDO, but to PyNIO. I don't think you will get a reasonable answer here.

cheers
ralf

RE: Error while trying to open nc file format with PyNIO in Python. - Added by Manuel Luis about 6 years ago

Hello there again,

Sorry because I did not get back to you to appreciate the answers.

After dealing with some problems in the machine that keeps all our data, I can continue with this errors.

A proffesor told me that a possible solution would be reading files with a cdo command. So I get on with that and I use the following:

cdo -f nc copy error_wrfout_d01_20371010T030000Z.nc prueba.nc

I get the following error:

cdf_get_var_double : ncid = 65536 varid = 0 val0 = 0.000000

Error (cdf_get_var_double) : NetCDF: HDF error
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

I am using CDO version 1.9.2

Any help would be appreciated.
Thanks,
Manuel

RE: Error while trying to open nc file format with PyNIO in Python. - Added by Karin Meier-Fleischer about 6 years ago

Hi Manuel,

without the data file it's not really possible to help. Can you upload the file here or if it is too big to the ftp.zmaw.de incoming directory?

-Karin

RE: Error while trying to open nc file format with PyNIO in Python. - Added by Manuel Luis about 6 years ago

Hello there,

Thanks for the answer.

The file size is 149MBytes. So I will upload it, splited into three parts.

I attach first part to this message.

RE: Error while trying to open nc file format with PyNIO in Python. - Added by Manuel Luis about 6 years ago

Message with third part.

To join the files you can use the following:

cat wrfout_d01_20371010T030000Z* > file.nc

Thanks for all in advance
Manuel

RE: Error while trying to open nc file format with PyNIO in Python. - Added by Karin Meier-Fleischer about 6 years ago

I'm sorry to say that the file is not readable with the CDOs.

I tried to read some variables and to convert the file using NCL but it also failed.

Sorry :(
-Karin

RE: Error while trying to open nc file format with PyNIO in Python. - Added by Ralf Mueller about 6 years ago

Manuel Luis wrote:

Message with third part.

To join the files you can use the following:

cat wrfout_d01_20371010T030000Z* > file.nc

Manuel,

this code does not work - you cannot use unix cat with netcdf files and expect valid data files since the cdf standard is not designed for that. you could use the cat operator from CDO, though.

hth
ralf

RE: Error while trying to open nc file format with PyNIO in Python. - Added by Ralf Mueller about 6 years ago

Both wrfout_d01_20371010T030000Z.nc01 abd wrfout_d01_20371010T030000Z.nc01 are not readable with ncdump

    (1-10/10)