[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #YCK-274847]: Probelms reading ARGO data



Enicho,

> However I still problem using ncgen command. Pleae attached
> a newly downloaded file: 4900072_prof.nc
>
> When I apply
>
> ncgen -f 4900072_prof.nc
>
> command I get a message:
>
> ncgen: 4900072_prof.nc: syntax error
>
> What can be the reason for this problem? Thank you

The reason is ncgen expects text files as input, not binary netCDF files.  You
can use ncdump on netCDF files to create text files in CDL format.  Then you
can use ncgen on the CDL files to create binary netCDF files or C or Fortran-77
programs for small CDL files.

For example, with the file you attached, if you run

  ncdump  4000073_prof.nc > 4000073_prof.cdl

it will create a large CDL file that is the text version of the binary netCDF
file:

  -rw-r--r--   1 russ     ustaff   1262734 Jul 10 08:56 4000073_prof.cdl

If you then use ncgen to convert in the opposite direction, from the CDL file
to a netCDF file named  "test.nc", the result is essentially the same as the
original netCDF file, with the possible exception of a bit or two in the least
significant bits of floating point values:

  ncgen -o test.nc 4000073_prof.cdl
  ls -l test.nc 4000073_prof.nc
  -rw-r--r--   1 russ     ustaff    758076 Jul 10 08:50 4000073_prof.nc
  -rw-r--r--   1 russ     ustaff    758076 Jul 10 09:03 test.nc

and you can verify this by doing another comparison:

  ncdump test.nc > test.cdl
  diff 4000073_prof.cdl test.cdl
  1c1
  < netcdf 4000073_profx {
  ---
  > netcdf test {

showing all the values are the same, the only difference is the part of the CDL
derived from the file name.

This looks like it has variables that are too to use ncgen to directly generate
a Fortran-77 program that will create it:

  ncgen -f 4000073_prof.cdl > 4000073_prof.f
  Segmentation Fault(coredump)

ncgen should fail more gracefully than that, but it is trying to generate a
single Fortran statement initializing a character array for PROJECT_NAME, and
that cannot be done in a single Fortran-77 statement, which is limited to 1320
characters, since the PROJECT_NAME array seems to have 8960 characters.

However, 4000073_prof.f does have all the Fortran-77 needed to create the
netCDF file, it's only missing statements that write all the variable values
after PROJECT_NAME.

--Russ






Russ Rew                                         UCAR Unidata Program
address@hidden                     http://www.unidata.ucar.edu



Ticket Details
===================
Ticket ID: YCK-274847
Department: Support netCDF
Priority: Critical
Status: Closed