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.
Hello Tom, Your query matches a category of commands which I call filters. Filters answer requests for specific information and are, I think, best implemented as short shell scripts that cull information from more complex, and difficult to remember, command line arguments. Filters are described in more detail at http://nco.sf.net/nco.html#filters Below are sample implementations of the filters you want. ncwa and ncks, or ncap2, are both amenable to this task. ncap2 would be better for arbitrarily complex and longer filters. They all produce the same results, of course, and can be strung together and reformatted as desired. Charlie Usage: ncmax variable file # Prints maximum function ncmax { ncwa -y max -O -C -v ${1} ${2} ~/foo.nc ; ncks -H -C -v ${1} ~/foo.nc | cut -f 3- -d ' ' ; } function ncmax { ncap2 -O -C -v -s "foo=${1}.max();print(foo)" ${2} ~/foo.nc | cut -f 3- -d ' ' ; } ncavg variable file # Prints average function ncavg { ncwa -y avg -O -C -v ${1} ${2} ~/foo.nc ; ncks -H -C -v ${1} ~/foo.nc | cut -f 3- -d ' ' ; } function ncavg { ncap2 -O -C -v -s "foo=${1}.avg();print(foo)" ${2} ~/foo.nc | cut -f 3- -d ' ' ; } ncrng variable file # Prints range function ncrng { ncap2 -O -C -v -s "foo_min=${1}.min();foo_max=${1}.max();print(foo_min,\"%f\");print(\" to \");print(foo_max,\"%f\")" ${2} ~/foo.nc ; } -- Charlie Zender, Earth System Sci. & Computer Sci. University of California, Irvine 949-891-2429 )'(
netcdfgroup
archives: