[gradsusr] plotting problem
frankq
frankq at katestone.com.au
Wed Nov 10 21:37:37 EST 2010
Greetings All,
I would be very grateful if anyone could assist with the following
problem. It essentially boils down to plotting a list of (user
generated) values on a line graph. The background to the problem is as
follows:
* We use WRF to generate forecasts (6 days ahead) of temp, wind speed,
rel. hum ...
* We calculate a heat load index (as well an "integrated" heat load - if
you could call it that) on an hourly basis. The expressions include
sqrt's, logs, exp's, consequently situations like sqrt(Temp) where Temp
< 0 have to be handled.
The approach we have taken is as follows:
* Extract a time series of all required variables
* Import some initialisations/coefficients from a file
* Perform all calculations
* Write results to an ascii output file
* Plot results on a graph.
It all works except for the plotting bit. Below is the skeleton of the
GrADS script:
/***********************************/
'open easthl.ctl'
'set t 1 144'
'set z 1 1'
etc... etc... etc...
'set gxout print'
'display ' rh
if(rc != 0); return -1; endif
relhum_timeseries = result <<<<<<< THIS IS WHERE I GET HOURLY VALUES
REPEAT ABOVE BLOCK FOR u, v, tc, swdown.
* init counters etc
file = "h_output.txt"
tcount = 1
i = 10
* loop to calculate hourly values
while(tcount < 144)
relhum = subwrd(relhum_timeseries, i) <<<<<< get hourly rh value
repeat above code for u, v, tc, swdown.
hlx = calc_htload(relhum, temp, u_comp, v_comp, solarrad) <<<<<
calculate ht load for this hour
line = temp % " " % relhum % " " % solarrad " " etc etc
write(file, line)
endwhile
close(file)
/*****************************************/
The above script works. The output file contains all the correct results.
BUT
When it comes to plotting it, I can't find a "clean" way to do it.
Ideally I would like something like
///////
while(tcount < 144)
......
......
hlx.tcount = calc_htload(relhum, temp, u_comp, v_comp, solarrad) <<<<<
CALCULATE HEAT LOAD INDEX FOR THIS HOUR
......
endwhile
'display ' hlx
///////
where "hli" is an array of sorts.
I've tried lots of approaches, but it is now degenerating into a
Monte-Carlo exercise - ie let's try this and see if it works.
Any help would be greatly appreciated - even if it means "no - it can't
be done"
Cheers
FrankQ
--
*Dr Frank Quintarelli | Software Development Manager*
Katestone Environmental Pty Ltd | ABN 92 097 270 276
Terrace 5, 249 Coronation Drive, PO Box 2217 Milton Queensland, Australia
Ph +61 7 3369 3699 | Fax +61 7 3369 1966
frankqAtkatestoneDotcomDotau | *wwwDotkatestoneDotcomDotau*
More information about the gradsusr
mailing list