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

[Support #MWB-826938]: NetCDF .cdl to .nc conversion using ncgen

This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.


  • Subject: [Support #MWB-826938]: NetCDF .cdl to .nc conversion using ncgen
  • Date: Wed, 04 Jun 2008 14:43:04 -0600

Hi Chad,

> dimensions:
> station = 121 ; // number of stations
> id_len = 8; // length of station_id strings
  ...
> variables:
> char station_id(station, id_len) ;

I had no idea what your station IDs were, so I just guessed they might be
character
strings that were a maximum of 8 characters.  Feel free to change id_len to a
more
reasonable maximum.

Also, since tthis is netCDF-3, real strings aren't supported, only character
arrays
that can be understood by both C and Fortran.  So if your station IDs are of
lots
of different lengths, you will have to have a convention to indicate how long
each
station ID actually is.  For recommendations about how to do this, see the C or
Fortran Users Guide section on "Reading and Writing Character String Values":

http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-c.html#Strings
http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-f90.html#Reading-and-Writing-Character-String-Values

--Russ


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



Ticket Details
===================
Ticket ID: MWB-826938
Department: Support netCDF
Priority: Normal
Status: Closed