[gradsusr] writing some defined variables in ASCII file

Muhammad Rahiz muhammad.rahiz at ouce.ox.ac.uk
Wed Mar 9 12:09:23 EST 2011


Dear Rabah,

Could you try the following?

...
...

'set gxout print'
'd eqmVr850'
ret = result
res = write("output.txt",ret,append)
res = close("output.txt)


-- 
Muhammad Rahiz
Researcher & DPhil Candidate (Climate Systems & Policy)
School of Geography & the Environment
University of Oxford

On Wed, 9 Mar 2011, hachelaf rabah wrote:

> Hello all GRADS users,
> 
> My problem is that i can not find a solution to write some defined parameters like result of
> summing some parameters.
> or others statistical operations between variables.
> i have this part of my script :
> ......................................
> 'define VV1=mag(UGRDprs.1,VGRDprs.1)'
> 'define VV2=mag(UGRDprs.2,VGRDprs.2)'
> 'define VV3=mag(UGRDprs.3,VGRDprs.3)'
> 'define VVdif=(VV2-VV1)*(VV2-VV1)'
> 'define sumxVVdif=sum(VVdif,x=1,x=139)'
> 'define sumtVVdif=sum(sumxVVdif,y=1,y=159)'
> 'define eqmVr850=sqrt(sumtVVdif/22101)'
> 'd eqmVr850'
> 'define VVdif3=(VV3-VV1)*(VV3-VV1)'
> 'define sumxVVdif3=sum(VVdif3,x=1,x=139)'
> 'define sumtVVdif3=sum(sumxVVdif3,y=1,y=159)'
> 'define eqmVs850=sqrt(sumtVVdif3/22101)'
> 'd eqmVs850'........
> ..........................................
> so i need to write the result of eqmVr850 and eqmVs850 ....and other variables like that in a ASCII
> file.
> i tried that with the fprintf.gs script but it each time,just the last value is wrote because this
> script erase preceding values wrote in the ASCII file.
> 
> Thank you advance for any suggestions.
> 
> 
> 
> --
> Cordialement,
> Best regards,
> Rabah Hachelaf
> 
>      ______  
>     (          )
>    (            )                      
>   (________)                     
>      /////////     
> 
> 
> 
>


More information about the gradsusr mailing list