Hi Tononi:<br>To obtain ASCII files from GrADS I usually use the script<br><a href="http://fprintf.gs">fprintf.gs</a><br><br>you will found it here:<br><a href="http://cookbooks.opengrads.org/index.php?title=Recipe-002:_Saving_GrADS_variable_data_to_a_text_file">http://cookbooks.opengrads.org/index.php?title=Recipe-002:_Saving_GrADS_variable_data_to_a_text_file</a><br>
<br>Cheers,<br>Hernán<br><br><div class="gmail_quote">2010/1/14 Daniele Gandini <span dir="ltr"><<a href="mailto:daniele.gandini@arpa.piemonte.it">daniele.gandini@arpa.piemonte.it</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Dear Davide,<br>
<br>
I haven't used 'set gxout print' until now;<br>
but to have the output in a file with 'set gxout stat' I did so:<br>
<br>
outfile="/pub/file_to_pc/cnal.txt"<br>
'set gxout stat'<br>
<br>
# Alessandria<br>
'set lat 44.94'<br>
'set lon 8.7'<br>
'd rh'<br>
statstr=sublin(result,8)<br>
vmin=subwrd(statstr,4)<br>
vmax=subwrd(statstr,5)<br>
write(outfile,'Alessandria: minima:'round(vmin)' massima:'round(vmax),append)<br>
<br>
if, else and endif must be without superscripts ''; for example<br>
<br>
if (flagstampe=yes)<br>
var='st_'%var<br>
endif<br>
<br>
Saluti a Firenze.<br>
<br>
Daniele<br>
<br>
<br>
----- Messaggio originale -----<br>
Da: "Tononi Davide" <<a href="mailto:Ext-Davide.Tononi@VTT.FI">Ext-Davide.Tononi@VTT.FI</a>><br>
A: <a href="mailto:GRADSUSR@LIST.CINECA.IT">GRADSUSR@LIST.CINECA.IT</a><br>
Inviato: Giovedě, 14 gennaio 2010 8:31:39 GMT +01:00 Amsterdam/Berlino/Berna/Roma/Stoccolma/Vienna<br>
Oggetto: Exporting data from Grads to excel<br>
<div><div></div><div class="h5"><br>
<br>
Dear users.<br>
I need to export some data reconrd from grads to excel file but i'm not able to do this.<br>
I have written this command line but doesn't work.<br>
Say that there is a problems on this command:<br>
<br>
'display rh2m'<br>
filename='test.xls'<br>
'set gxout print'<br>
'd rh2m'<br>
'rc=(test.xls,rh2m)'<br>
<br>
That i've written to export.<br>
Some of you can suggest to me how can i export the value of this variable rh2m.<br>
Another question it's about the command IF that in my programme doesn't work.<br>
I write some like this but says that it is not correct unknow command:<br>
<br>
'if (t2m>273.15)'<br>
'define eps1=exp((-6763.6/t2m)-4.9283*log(t2m)+54.23)'<br>
'else'<br>
'define eps1=exp((-6141/t2m)+24.3)'<br>
'endif'<br>
<br>
Thank you so much<br>
davide<br>
<br>
<br>
* Statistics on 2m air temperature and relative humidity in Europe from<br>
* 1/1/1999 to 31/12/2008<br>
* The source data are ECMWF ERA Interim Reanalysis, provided by the European<br>
* Centre for Medium-Range Weather Forecast, in grib format, with spatial<br>
* resolution of 1,5deg x 1,5deg lat/lon, and temporal resolution of 6h (data<br>
* at 00, 06, 12, 18 UTC)<br>
* There are 49x28 grid points (LON from -27 to 45, LAT from 33 to 73.5), and<br>
* 14612 time steps<br>
<br>
'reinit'<br>
'open temperature_Europe_10y.ctl'<br>
'set grads off'<br>
'set t 1 14612'<br>
'define t2m=no2tsfc.1'<br>
<br>
'set t 1 1461'<br>
'set lat 45'<br>
'set lon 23'<br>
'draw title 2mT at lat45 lon23'<br>
'draw ylab 2m Temperature'<br>
'set ccolor 2'<br>
'set cmark 0'<br>
*'display (t2m-273.15)'<br>
*'set fwrite t2m_lat45_lon23.gif'<br>
*'printim t2m_lat45_lon23.gif white gif'<br>
<br>
'open dptemperature_Europe_10y.ctl'<br>
'set t 1 1461'<br>
'define tdp2m=no2dsfc.2'<br>
<br>
*Calculation of saturated pressure of water vapour<br>
<br>
'define eps1=exp((-6763.6/t2m)-4.9283*log(t2m)+54.23)'<br>
<br>
*Calculation of water vapour pressure<br>
<br>
'define eps2=exp((-6763.6/tdp2m)-4.9283*log(tdp2m)+54.23)'<br>
<br>
*Calculation of relative humidity<br>
<br>
'define rh2m=eps2/eps1'<br>
'display rh2m'<br>
filename='test.xls'<br>
'set gxout print'<br>
'd rh2m'<br>
'rc=(test.xls,rh2m)'<br>
</div></div></blockquote></div><br>