3 # used to export variables from netcdf output file
8 # the netcdf output file to use
11 # directory to put files into
25 echo `basename $0` /path
/to
/ncdump
/path
/to
/netcdf_file
/path
/to
/output_dir
28 if [ $# -ne 3 ] ; then
35 if ! $NCDUMP_BIN 2>&1 |
grep write_matrix
&> /dev
/null
; then
36 echo "ncdump does not support -w flag"
42 if [ ! -f $NC_FILE ] ; then
43 echo "$NC_FILE is not a file"
50 if ! $NCDUMP_BIN -h $NC_FILE 2>&1 |
grep $var &> /dev
/null
; then
51 echo "either $NC_FILE is not a netcdf file or"
52 echo "$var does not exist in the file"
57 if [ -z "$OUT_DIR" ] ; then
58 echo "no output directory given"
63 if [ -f "$OUT_DIR" ] ; then
64 echo "$OUT_DIR is a file, not a directory"
69 if [ -d "$OUT_DIR" ] && ls "${OUT_DIR}/*" &> /dev
/null
; then
70 echo "$OUT_DIR is not empty"
77 # save full pathname of ncdump binary and netcdf file
78 NCDUMP_FULL
=$
(which $NCDUMP_BIN)
79 NETCDF_FULL
=$
(cd $
(dirname "$NC_FILE") && echo $PWD)/$
(basename "$NC_FILE")
81 if [ ! -e "$OUT_DIR" ] ; then
92 $NCDUMP_FULL -w -v $VC $NETCDF_FULL &> ncdump.log