[gradsusr] Programming a Tab in ASCII file within Grads

Goodson,Ron [Edm] Ron.Goodson at EC.gc.ca
Mon Nov 7 13:39:05 EST 2011


Just as an alternate suggestion... rather than fighting with grads, I'd
be tempted to just write the text output with some character or text
which denotes that it should be a tab .. and then run the output through
"sed" or similar to turn your chosen character/text into a tab.

In general .. if I'm using grads to produce output for other purposes,
it is sometime better to produce a generic file from grads and
post-processing to produce a file tailored to the target applications.
This is most useful if you have a bunch of applications which all want
much the same data in different formats.. which you probably don't have

... just a thought...

ron





-----Original Message-----
From: gradsusr-bounces at gradsusr.org
[mailto:gradsusr-bounces at gradsusr.org] On Behalf Of Mac
Sent: November 7, 2011 11:19 AM
To: GrADs Digest - User Group
Subject: [gradsusr] Programming a Tab in ASCII file within Grads

Good afternoon Folks,

I am generating WRF model output for the centroid of a hydrologic
sub-basin for input to the DHI Mark 11 Hydrologic model as part of a
project.

The DHI have provided a proprietary program to convert precipitation and
evaporation values required as input to the Mark 11 model from am ASCII
file format to their proprietary binary format.

There is a requirement to place tabs in the header recorders of the
input ASCII file.

Here is the code section:


******  Write Header records for precipitation *****

valh = " final"
rc = write(filename1, valh)
valh1 = " Time"%^I%Rainfall"
rc = write(filename1, valh1)
valh2 = " Unit      100004        1002           0"
rc = write(filename1, valh2)

I need three spaces between Time and Rainfall and the DHI executable
expects a tab to provide the 3 spaces.  Similarly it requires a tab for
6 spaces between Unit and 100004,  a tab for 8 spaces between 100004 and
1002 and a tab for 11 spaces between 1002 and 0.

The ASCII table character for tab is hex 09 or control I.  I tried ^I as
given in the ASCII table for tab but the GrADS program gave a syntax
error message .

How does one get this in a script to produce the required tab commands?


Thanks in advance for your help.

Sincerely

Mac MacLeod

--
M.A. (Mac) MacLeod,
President and General Manager,
Scotia Weather Services Inc.,
11 Thornhill Dr., Suite 240,
Dartmouth, N.S. B2B 1P9
Tele: 902-468-3866, Cell: 902-225-5747
e-mail: mmacleod at scotiaweather.com
web: www.scotiaweather.com

_______________________________________________
gradsusr mailing list
gradsusr at gradsusr.org
http://gradsusr.org/mailman/listinfo/gradsusr




More information about the gradsusr mailing list