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.
Hi Dave, First, I'm glad that the test of wrapping netCDF Perl decoders with a shell script worked/is working! This gives us (Steve actually) another clue as to what may be happening in the 6.13.x version of 'pqact'. re: > The mos script is trickier because I have to deal with the replacements > strings and parenthetical subexpressions: > > WMO ^FOUS11 KWNO ([0-3][0-9])([0-2][0-9][0-5][0-9]) PIPE mos2nc -l > logs/lamp2nc.%Y%m%d.asc etc/lamp_mos.cdl > data/dec_data/mos/lamp_mos/(\1:yyyy)(\1:mm)\1/lamp_mos.(\1:yyyy)(\1:mm)\1.\2.nc Yup, the sketchy script that I sent can be a LOT more generic and handle all of your netCDF Perl decoder invocations in a single script. What I mean by this is that all of the command line arguments to the various netCDF Perl decoders AND the name of the decoder to run could be passed into the script. This would keep the onus of evaluating parenthetical references like the ones in: /mos/lamp_mos/(\1:yyyy)(\1:mm)\1/lamp_mos.(\1:yyyy)(\1:mm)\1.\2.nc in 'pqact' so you wouldn't have to do it in your script (which would be nasty at best). Quick example of what I have in mind: WMO ^S[AP].* .... ([0-3][0-9])([0-2][0-9][0-5][0-9]) PIPE metar2nc.sh metar2nc -t 30 -l logs -d data/dec_data/obs/metar etc/metar.cdl The command line options that would need to be picked up in 'metar2nc.sh' are: $1 - metar2nc $2 - -t $3 - 30 $4 - -l $5 - logs $6 - -d $7 - data/dec_data/obs/metar $8 - etc/metar.cdl One could, of course hard code all of the command line options in a script tailored for the particular netCDF Perl decoder and then only deal with the items that need to be evaluated/expanded by 'pqact'. Here is what I have in mind for mos2nc: WMO ^FOUS11 KWNO ([0-3][0-9])([0-2][0-9][0-5][0-9]) PIPE mos2nc.sh logs/lamp2nc.%Y%m%d.asc etc/lamp_mos.cdl data/dec_data/mos/lamp_mos/(\1:yyyy)(\1:mm)\1/lamp_mos.(\1:yyyy)(\1:mm)\1.\2.nc $1 - the full log file name expanded from ogs/lamp2nc.%Y%m%d.asc etc/lamp_mos.cdl $2 - the CDL file to use $3 - the fully qualified name of the netCDF file containing the decoded data expanded from data/dec_data/mos/lamp_mos/(\1:yyyy)(\1:mm)\1/lamp_mos.(\1:yyyy)(\1:mm) The invocation of 'mos2nc' inside of the 'mos2nc.sh' script would look like: cat | mos2nc -l $1 $2 $3 One small aside: - it is not necessary to 'cat' STDIN to the decoder inside the shell script since each of the decoders reads from STDIN anyway So, the 'mos2nc' decoder invocation can be written as: mos2nc -l $1 $2 $3 I included the 'cat' so that the input product could be written to disk and then used if there were any hiccups in running the wrapped decoder. Cheers, Tom -- **************************************************************************** Unidata User Support UCAR Unidata Program (303) 497-8642 P.O. Box 3000 address@hidden Boulder, CO 80307 ---------------------------------------------------------------------------- Unidata HomePage http://www.unidata.ucar.edu **************************************************************************** Ticket Details =================== Ticket ID: RQD-888533 Department: Support LDM Priority: Normal Status: Closed