[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

20000112: McIDAS: WXTLIST and shell script questions



>From: Michael Keables <address@hidden>
>Organization: DU
>Keywords: 200001051736.KAA12788 McIDAS-X WXTLIST shell scripts

Mike,

Sorry I wasn't able to get to these before now.

>Is there a way to use WXTLIST to print only a portion of an FOS product
>file?

Not that I am aware of.

>I'm trying to create a text file with the Denver Metro forecast
>for our weather web, but the only product I can find it in is FPUS55
>(zone forecasts) from KBOU.

OK.  The zone forecast is issued from Boulder.

>I don't want to include the entire forecast
>product, just the forcast for metro Denver.

I understand, but the matching in WXTLIST is by entire identifiable product.

>I can find LFP's for other cities using WXTLIST APRO=LFP but can't find
>anything with WXTLIST APRO=LFP ASTN=DEN.

>I didn't see a ZONE= keyword
>anywhere in the help documentation (which is what I need, namely
>something like ASTN=CO ZONE=040.)

There isn't one.  The string that could be matched on is COZ040, but you
will still get the entire product:

WXTLIST APRO=ZFP MATCH=COZ040
FPUS55 KBOU 172202                                              2000017 2206
ZFPBOU

ZONE FORECASTS FOR NORTHEAST AND NORTH CENTRAL COLORADO
NATIONAL WEATHER SERVICE DENVER CO
330 PM MST MON JAN 17 2000

COZ040-181200-
DENVER METROPOLITAN AREA-
INCLUDING BRIGHTON...DENVER INTERNATIONAL AIRPORT...GOLDEN...PARKER
330 PM MST MON JAN 17 2000

.TONIGHT...MOSTLY CLOUDY.  LOWS IN THE LOWER TO MID 30S.
.TUESDAY...MOSTLY CLOUDY WITH A 20 PERCENT CHANCE OF RAIN SHOWERS.
HIGHS IN THE MID 40S.
.TUESDAY NIGHT...MOSTLY CLOUDY WITH A 20 PERCENT CHANCE OF RAIN OR
SNOW SHOWERS.  LOWS IN THE MID 20S TO LOWER 30S.
.WEDNESDAY...PARTLY CLOUDY.  HIGHS IN THE LOWER TO MID 50S.
.THURSDAY...COLDER WITH A CHANCE OF LIGHT SNOW.  LOWS 15 TO 20.
HIGHS 30 TO 35.
.FRIDAY...A CHANCE OF LIGHT SNOW.  LOWS 15 TO 20.  HIGHS 30 TO 35.
.SATURDAY...DRY.  LOWS AROUND 20.  HIGHS IN THE LOWER TO MID 40S
=
$$
COZ039-181200-
EASTERN BOULDER COUNTY/BOULDER AND VICINITY-
INCLUDING ERIE...LONGMONT
330 PM MST MON JAN 17 2000

.TONIGHT...MOSTLY CLOUDY.  LOWS IN THE LOWER TO MID 30S.
.TUESDAY...MOSTLY CLOUDY WITH A 20 PERCENT CHANCE OF RAIN SHOWERS.
HIGHS IN THE MID 40S.
.TUESDAY NIGHT...MOSTLY CLOUDY WITH A 20 PERCENT CHANCE OF RAIN OR
SNOW SHOWERS.  LOWS IN THE MID 20S TO LOWER 30S.
.WEDNESDAY...PARTLY CLOUDY.  HIGHS IN THE LOWER TO MID 50S.
.THURSDAY...COLDER WITH A CHANCE OF LIGHT SNOW.  LOWS 15 TO 20.
HIGHS 30 TO 35.
.FRIDAY...A CHANCE OF LIGHT SNOW.  LOWS 15 TO 20.  HIGHS 30 TO 35.
.SATURDAY...DRY.  LOWS AROUND 20.  HIGHS IN THE LOWER TO MID 40S
=

 ...


>I've been toying with the idea of routing the WXTLIST output to a
>program that will excise the Zone 40 text, but figured there is probably
>an eaisier way to do this in McIDAS.

I don't know the easier way.  I have to quickly add, however, that I
am no expert on using WXTLIST since I don't know enough about what is
in which products in the datastream.  Sorry.

>Suggestions?

I will ask Don if he knows the answer to your query.  He knows a lot
more about these products than I.

A different idea might be to use regular expressions in the LDM's
pqact.conf file IF the zone 40 stuff is actually coming in with a
unique WMO header.  What I am thinking is demonstrated by actions
that we use in our LDM's pqact.conf:

# Local severe weather
# severe_KDEN to severe_kden because Majordomo case insensitive.
DDPLUS  ^WWUS.. KDEN
        PIPE    -strip -close   /usr/ucb/mail -s "Severe Weather (KDEN)" 
severe_kden@unidata
# Local (state) forecast, includes extended.
# state_KDEN to state_kden because Majordomo case insensitive.
DDPLUS  ^.*/pSFPCO
        PIPE    -strip -close   /usr/ucb/mail -s "State Forecast for Colorado" 
state_kden@unidata
# Colorado Zone Forecast
DDPLUS   ^.*/pZFPBOU
        PIPE    -strip -close   /usr/ucb/mail -s "Colorado Zone Forecast" 
zone_kden@unidata
# Colorado Snow Report
# ski_KDEN to ski_kden because Majordomo case insensitive.
DDPLUS  ^FWUS01 KDEN
        PIPE    -strip -close   /usr/ucb/mail -s "Colorado Snow Report" 
ski_kden@unidata

What is going above is that we mail the various reports to an email list
within Unidata (the names: severe_kden, state_kden, zone_kden, and ski_kden
are email lists).

You could setup the same kind of thing using the LDM and FILE the product
instead of mailing it to a list of receipients.

<next message>

>I'm having problems getting a shell script utilizing PTLIST to find the
>proper records. I'm trying to get the current weather obs for KDEN so that
>I can export them to a file on our web server.  I can set the script up as
>a BATCH file and run it outside of McIDAS but I don't want all of the 
>extraneous text that BATCH generates as output.

OK.

>I've patterned the script
>after the example you have on the web for the surface obs map (using
>mceval.k) but each time the script runs it returns with no data ("No
>match.")

Which characters to "escape" in shell script scan be confusing.

>Clearly I have a problem with directory pointers but I can't
>figure it out.
>
>Here is the script (Bourne shell):

The first line should be:

#!/bin/sh

>MCHOME=/export/home/mcidas
>MCDATA=$MCHOME/workdata
>MCLOG=$MCDATA/scour.log
>MCPATH=${MCDATA}:$MCHOME/data:$MCHOME/help
>
># Setup PATH so that the McIDAS-X executables can be found
>
>PATH=$MCHOME/bin:$PATH
>
># Set LD_LIBRARY_PATH to include all directories (other than those
>searched
># by default) that are needed to be searched to find shared libraries.
># For this example, I assume that the shared Fortran library is located
># in /opt/SUNWspro/SC4.2/lib
>
>LD_LIBRARY_PATH=/usr/openwin/lib:/opt/SUNWspro/SC4.2/lib:$MCHOME/lib:/usr/lib:
> /usr/ucbl
>ib
>
># Send all textual output to the log file
>#exec 2>$MCLOG 1>&2
>
># cd to the MCDATA directory
>cd $MCDATA
>
># Now run 'mcenv' to create a McIDAS-X environment in which all of the
># routines will run.
>
>MCPATH=$MCPATH PATH=$PATH LD_LIBRARY_PATH=$LD_LIBRARY_PATH mcenv << 'EOF'
>
># Get Denver Observations
>
>mceval.k PTLIST RTPTSRC/SFCHOURLY PAR=T[F] TD[F] PSL[MB] SPD[KT] DIR
>PCP[IN] SEL='ID KDEN; DAY \#SYS\(2003\); TIME \#SYS\(2002\)'

The characters '[' and ']' need to be escaped as the shell will try to
interpret them.  In addition, the '#', '(', and ')' characters should not
be escaped since they are occurring inside a clause delimited by single
quotes.  Your line should, therefore, look like:

mceval.k PTLIST RTPTSRC/SFCHOURLY PAR=T\[F\] TD\[F\] PSL\[MB\] SPD\[KT\] DIR 
PCP\[IN\] SEL='ID KDEN; DAY #SYS(2003); TIME #SYS(2002)'

># copy files to weather server
>
>#rcp -p /export/home/mkeables/wxweb/denstats.txt
>agora:/u1/m/mkeables/public_html/wx
>exit
>
>EOF
>
># Done
>exit 0
>
>
>Why will this run as a batch file outside of McIDAS but not as mceval.k in
>a mcenv shell script?

The problem was in which characters needed to be escaped.

>Thanks in advance.

You are welcome.

Tom