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.
>From: Peter Msikela <address@hidden> >Organization: ? >Keywords: 200512221718.jBMHIL7s017521 Hi Peter, re: >I have tried ncdump,but it is really dumping both metadata and data on the >screen. The default 'ncdump' output does as you say, dump everything. >What is the best way to pull out the lat,lon,and may precipation or >wind see the below and save it to a file instead of dumpin to the screen. >e.g > LAT LON PRECIP > 37.000 -85.500 0.000 > 37.500 -85.500 0.000 > 38.000 -85.500 0.000 > 38.500 -85.500 0.000 > 39.000 -85.500 0.000 > 39.500 -85.500 0.000 > 40.000 -85.500 0.000 > 40.500 -85.500 0.000 > 41.000 -85.500 0.000 > 41.500 -85.500 0.000 > 42.000 -85.500 0.000 Please check the man page for 'ncdump' for options. I think you will want to specify the '-v' flag for the variables you want. Here is the snippit from the man page: UNIDATA UTILITIES NCDUMP(1) NAME ncdump - Convert netCDF files to ASCII form (CDL) SYNOPSIS ncdump [-c] [-h] [-v var1,...] [-b lang] [-f lang] [-l len] [-n name] [-p f_digits[,d_digits]] file ... OPTIONS ... -v var1,...,varn The output will include data values for the specified variables, in addition to the declarations of all di- mensions, variables, and attributes. One or more vari- ables must be specified by name in the comma-delimited list following this option. The list must be a single argument to the command, hence cannot contain blanks or other white space characters. The named variables must be valid netCDF variables in the input-file. The de- fault, without this option and in the absence of the -c or -h options, is to include data values for all vari- ables in the output. As far as creating a formated list in just the way you want, you could either reformat the ncdump output or write your own netcdf routine to product the output in the manner you want. Another option is to check out the various packages that support netCDF: Where is netCDF used? http://www.unidata.ucar.edu/software/netcdf/usage.html One of the packages referenced there might already do the formatting in the way that you want. Cheers, Tom -- NOTE: All email exchanges with Unidata User Support are recorded in the Unidata inquiry tracking system and then made publicly available through the web. If you do not want to have your interactions made available in this way, you must let us know in each email you send to us.