Exporting data from Grads to excel

Daniele Gandini daniele.gandini at ARPA.PIEMONTE.IT
Thu Jan 14 03:45:24 EST 2010


Dear Davide,

I haven't used 'set gxout print' until now;
but to have the output in a file with 'set gxout stat' I did so:

outfile="/pub/file_to_pc/cnal.txt"
'set gxout stat'

# Alessandria
'set lat 44.94'
'set lon 8.7'
'd rh'
   statstr=sublin(result,8)
   vmin=subwrd(statstr,4)
   vmax=subwrd(statstr,5)
write(outfile,'Alessandria: minima:'round(vmin)' massima:'round(vmax),append)

if, else and endif must be without superscripts ''; for example

if (flagstampe=yes)
  var='st_'%var
endif

Saluti a Firenze.

Daniele


----- Messaggio originale -----
Da: "Tononi Davide" <Ext-Davide.Tononi at VTT.FI>
A: GRADSUSR at LIST.CINECA.IT
Inviato: Giovedì, 14 gennaio 2010 8:31:39 GMT +01:00 Amsterdam/Berlino/Berna/Roma/Stoccolma/Vienna
Oggetto: Exporting data from Grads to excel


Dear users. 
I need to export some data reconrd from grads to excel file but i'm not able to do this. 
I have written this command line but doesn't work. 
Say that there is a problems on this command: 

'display rh2m' 
filename='test.xls' 
'set gxout print' 
'd rh2m' 
'rc=(test.xls,rh2m)' 

That i've written to export. 
Some of you can suggest to me how can i export the value of this variable rh2m. 
Another question it's about the command IF that in my programme doesn't work. 
I write some like this but says that it is not correct unknow command: 

'if (t2m>273.15)' 
'define eps1=exp((-6763.6/t2m)-4.9283*log(t2m)+54.23)' 
'else' 
'define eps1=exp((-6141/t2m)+24.3)' 
'endif' 

Thank you so much 
davide 


* Statistics on 2m air temperature and relative humidity in Europe from 
* 1/1/1999 to 31/12/2008 
* The source data are ECMWF ERA Interim Reanalysis, provided by the European 
* Centre for Medium-Range Weather Forecast, in grib format, with spatial 
* resolution of 1,5deg x 1,5deg lat/lon, and temporal resolution of 6h (data 
* at 00, 06, 12, 18 UTC) 
* There are 49x28 grid points (LON from -27 to 45, LAT from 33 to 73.5), and 
* 14612 time steps 

'reinit' 
'open temperature_Europe_10y.ctl' 
'set grads off' 
'set t 1 14612' 
'define t2m=no2tsfc.1' 

'set t 1 1461' 
'set lat 45' 
'set lon 23' 
'draw title 2mT at lat45 lon23' 
'draw ylab 2m Temperature' 
'set ccolor 2' 
'set cmark 0' 
*'display (t2m-273.15)' 
*'set fwrite t2m_lat45_lon23.gif' 
*'printim t2m_lat45_lon23.gif white gif' 

'open dptemperature_Europe_10y.ctl' 
'set t 1 1461' 
'define tdp2m=no2dsfc.2' 

*Calculation of saturated pressure of water vapour 

'define eps1=exp((-6763.6/t2m)-4.9283*log(t2m)+54.23)' 

*Calculation of water vapour pressure 

'define eps2=exp((-6763.6/tdp2m)-4.9283*log(tdp2m)+54.23)' 

*Calculation of relative humidity 

'define rh2m=eps2/eps1' 
'display rh2m' 
filename='test.xls' 
'set gxout print' 
'd rh2m' 
'rc=(test.xls,rh2m)' 



More information about the gradsusr mailing list