netCDF error number -51 processing file

Dear all,

I get an error as shown below when I use SMOKE ‘speciate’ to deal with emission file. I tried another file named b.ncf and succeeded. a.ncf is copied from b.ncf. I don’t know what’s the difference between these two files except the variables values.
b.ncf.txt (7.0 KB)
a.ncf.txt (6.5 KB)

Value for PROMPTFLAG not defined;returning default: TRUE
Enter logical name for 2-D AND 3-D GRIDDED INPUTS list [FILELIST] >>filelist

 File "filelist" opened for input on unit:  99

 Value for MRG_DIFF_DAYS not defined;returning default:   FALSE
 Mrggrid compiled with I/O API MXVARS3 =   2048
 Error opening file at path-name:
 netCDF error number  -51  processing file ""
 NetCDF: Unknown file format
 NetCDF: Unknown file format
 Could not open file "".
 *** ERROR ABORT in subroutine MRGGRID
 Ending program "MRGGRID".

How was this done exactly, and which tool(s) were involved in the generation of a.ncf?

What does ncdump -k a.ncf and ncdump -k b.ncf show?

The reason for asking these questions is that there is a possibility that the tool(s) used to generate a.ncf created the file using the netcdf-4 / “enhanced” data model while the SMOKE executable was compiled with an underlying netcdf library that only supported the classic data model (i.e. without netcdf-4 support). ncdump -k will show which netcdf data model is used in the file.

Hi Hogrefe,

Yes, b.ncf was created using classic netcdf format, while a.ncf was created using netcdf4. BTW, could you tell how to compile SMOKE with supporting netcdf4?


Run the netCDF commands

nf-config --libs
nc-config --libs
and add the resulting libraries after the -lnetcdff -lnetcdf in the Makefile system.

As an alternative to recompiling netCDF, I/O API, and SMOKE with netCDF4 support, given that your system version of ncdump apparently was generated with netCDF4 support (otherwise you would not have been able to post the header of a.ncf generated by ncdump), you could also convert a.ncf back to classic format with this command nccopy -k classic a.ncf a1.ncf and then use a1.ncf as input to SMOKE (nccopy should reside in the same bin directory as ncdump)