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

[Support #DML-648002]: Importing ascii surface & upper air data into GEMPAK



>I've been checking the Unidata GEMPAK tutorial and the email support archives
>but have not quite figured out how to import ascii surface and upper air data
>into GEMPAK.
>
>I created a station table file (see attached).
>A sample of the surface data is in the attached Excel file. The weather 
>elements
>are listed in columns except the final column has the metar coded obs.
>This is data from the AFWA and needs to be added converted to GEMPAK format
>so that we can display plots and analyses for a COMET Module.
>The email support archives mention "dcmetr" and the tutorial page states that 
>one
>should "Follow the format of the output of one of the listing programs: 
>SFLIST, SNLIST or GDLIST when >generating your ascii files for input."

Arlene,

There are two options to importing your data, which contains both METAR as well 
as Surface
Synoptic code observations. Since you have the original coded observation in 
column "T"
of your spreadsheet, you can wrap these with the appropriate bulletin 
delimeters and
pass them to dcmetr and dclsfc for decoding. The first 2 colums which contain 
the date and time
are just what is needed to specify the "-c dattim" input to the decoders, so I
put together a quick script that would process the XLS file saves as a CSV data 
file from Excel.

1) Use the "Save As" option from Excel and select CSV. The file I created 
called "kuwait.csv" looks like:

YMD,TIME,WNDIR,WSPD,WGUST,VSBY,PRESWX,LYR1,HGT1,LYR2,HGT2,LYR3,HGT3,LYR4,HGT4,TEMPC,DEWPC,ALSTG,CIG,RMKS
20060111,0,50,3,,8000,BR,FEW,15,,,,,,,17,15,,120,AAXX  11004 40582 31458 60503 
10172 20148 40151 56016 71022 82650 333 00015 82715 86358;
20060111,0,50,3,,8000,,FEW,15,BKN,100,,,,,17,15,29.91,100,OKBK 110000Z 05003KT 
8000 FEW015 BKN100 17/15 Q1013 NOSIG;
...
etc.
...

2) The columns that are of interest are 1,2, and 20. The OKBK observations are 
METAR reports.
The AAXX reports for station number 40582 (aka OKBK) are surface synoptic 
reports.

To use the "dc" decoders, these observations have to be wrapped in the normal 
bulletin headers that
are used in the real-time data stream, eg "^A \r \r \n seqno \n WMO_HEADER \n 
report \n \r\r\n ETX".
The attached csh script will process each line of the CSV file (run as "csv2gem 
kuwait.csv"),
use the date and time from colums 1 and 2 to formulate the "-c" time for the 
decoder, as
well as for the WMO bulletin header, then pipe the observation (column 20) to 
the decoder
using your supplied station table with the "-s" option to the decoders. I've 
also
attached my kuwait.csv for sample input.


The alternative is to take each of your data columns, and create the 
appropriate SFLIST
format Ascii representation of your data, then create a gempak surface file with
the station table as well as a packing file that matches the supplied 
parameters 
using the SFCFIL program. You can then use SFEDIT to import the ascii table 
values.

I have an example of importing an asii data set in the tutorial:
http://www.unidata.ucar.edu/software/gempak/tutorial/importingdata.html
which has a sample SFLIST format data file referenced by:
http://www.unidata.ucar.edu/software/gempak/tutorial/data/astex_1.dat
a station table is also provided.

If you go this route, you will be relying on the original decoder that
was used to create the values you see in the spread sheet columns. If you
don't have access to that decoder, you may have question laster about how 
certain bad coding was handled.

Steve Chiswell
Unidata User Support

Ticket Details
===================
Ticket ID: DML-648002
Department: Support GEMPAK
Priority: Normal
Status: Closed

Attachment: csv2gem.csh
Description: Binary data

Attachment: kuwait.csv
Description: Binary data