nc2asc User's Guide

netCDF to ASCII converter


Synopsis

java -jar nc2asc.jar [-b batchFile] [-i input_file.nc] [-o output_file.asc]

Description

nc2asc is a program for converting a netCDF file, or subset of, to ASCII. It operates with a GUI or in batch mode. In GUI mode you may choose which variables to output and choose formatting options for output. In batch mode, you define the preferred data i/o files and formats in a batch file, and pass the batch file as arguments to the program to obtain the desired output.

Command Line Options

nc2asc supports batch files with the -b option. This is useful if you want to run the same configuration on many netCDF files. All options are optional, but input and output file names must be specified either in the batch file or in the command line. A sample batch file follows:
# Input file
if=/home/data/231RF10.nc

# Output file
of=junk.asc

# Time Interval
ti=yyyy-mm-dd,hh:mm:ss ~ yyyy-mm-dd,hh:mm:ss

# Output header format, default is 'Plain'
hd=[Plain | AmesDEF | NcML]

# Output date format, default is 'yyyy-mm-dd'
dt=[yyyy-mm-dd | 'yyyy mm dd' | NoDate]

# Output time format, default is hh::mm:ss
tm=[hh:mm:ss | 'hh mm ss' | SecOfDay]

# Optionally averaging may be performed; specifiy number of seconds to average.
avg=10

# Value separator, default is 'Comma'
sp=[Space | Comma]

# Fill value, default is 'FillValue'
fv=[FillValue | Blank | Replicate]

# List of variables to output.
var=ALT
var=ADIFR
var=BDIFR

# Optionally, you can specify the data output format for a variable. Program takes float format %f %d %i %e %E %g %G,etc. %d, and %i are converted into %.0f. For example:
ALT=%7.2f
ADIFR=%e
BDIFR=%d 

The -i and -o options allow input and output file names to specified on the command line. They may then be eliminated from the batch file.

#!/bin/csh

foreach file (*.nc)
  java -jar nc2asc.jar -b my_batch -i $file  -o `basename $file .nc`.asc
end

Requirements

nc2asc is written in Java under Sun Microsystems JRE.

Author

Ling-Ling Dong
National Center for Atmospheric Research
EOL / CDS.
(303) 497-1014

email Chris Webster

Last update: Thu May 21 17:43:26 MDT 2009