NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.


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

Re: 19990422: Ascii to netCDF



>To: address@hidden
>From: "Marc V. Gorenstein" <address@hidden>
>Subject: ASCII to AIA
>Organization: .
>Keywords: 199904222041.OAA26052

Hi Marc,

> Is there a utility that will take a column of data in ASCII format and
> translate to netCDF or AIA format?

Yes, there's the tbl2cdf program from our "User Contributed netCDF
Software" page at
http://www.unidata.ucar.edu/packages/netcdf/contrib.html

  tbl2cdf.c 
      Chuck Denham's program to convert a flat ASCII table to a netCDF
      file. The program scans a flat ASCII table for the name and most
      general data type of each column. It then creates and populates
      a netCDF file with the data.

You can click on the link on that page or get the source from
ftp://ftp.unidata.ucar.edu/pub/netcdf/contrib/tbl2cdf.c

Using "ncgen" with the "-b" option is another pretty quick way to
generate a netCDF file, say data.nc, from ASCII data, by editing a CDL
file, say data.cdl, that contains the ASCII data delimited by commas
and using that as input to ncgen

   $ ncgen -b -o data.nc data.cdl

I've appended a small example of a CDL file that shows what's needed
...

--Russ

_____________________________________________________________________

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

netcdf foo {
dimensions:
  nx=10;
variables:
  float var(nx);
data:
  var =
    0,
    10,
    20,
    30,
    40,
    50,
    60,
    70,
    80,
    90;
}