<div dir="ltr">Hello Muhamed,<br>your script help me , but it doesn't work fine <br>i have this warning when i run it : <br>ga-> <a href="http://test.gs">test.gs</a><br>Data Request Error: File number out of range <br>
Variable = tdif0.00353409 <br> Error ocurred at column 1<br>DISPLAY error: Invalid expression <br> Expression = tdif0.00353409<br>Data Request Error: File number out of range <br> Variable = sumxtdif1.84828 <br> Error ocurred at column 1<br>
DISPLAY error: Invalid expression <br> Expression = sumxtdif1.84828<br>Data Request Error: File number out of range <br> Variable = sumttdif663.954 <br> Error ocurred at column 1<br>DISPLAY error: Invalid expression <br>
Expression = sumttdif663.954<br>Data Request Error: File number out of range <br> Variable = eqmtr8500.173326 <br>..............................<br>However i need to write just some variables from all screened by taping " q define " <br>
so i don't know who to filtered just desired variables. <br><br><br><div class="gmail_quote">2011/3/10 Muhammad Rahiz <span dir="ltr"><<a href="mailto:muhammad.rahiz@ouce.ox.ac.uk">muhammad.rahiz@ouce.ox.ac.uk</a>></span><br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Dear Rabah,<br>
<br>
EQMVR850,EQMVR500 (& others) are objects which you've defined earlier in your original calculation. If you want to add the defined variables automatically, you can use the 'q define' and 'sublin' command.<br>
<br>
**********<br>
'set gxout print'<br>
<br>
n1 = 5 # assuming you have 5 defined variables/objects<br>
n2 = 1<br>
while (n2 <=n1)<br>
<br>
'q define'<br>
var = sublin(result,n2)<br>
'd 'var''<div class="im"><br>
ret = result<br>
res = write("output.txt",ret,append)<br>
res = close("output.txt)<br>
<br></div>
n2 = n2 + 1<br>
endwhile<br>
**********<br>
<br>
What the code does is to create a while loop and select each of the defined variables in 'sublin(result,n2)' where n2 = 1,2,3,4,5 and print it to output.txt. The following illustrates what 'q define' and 'sublin' does;<br>
<br>
'q define'<div class="im"><br>
EQMVR850 = 1.58<br>
EQMVR500 = 1.89<br>
EQMVR700 = 1.98<br>
<br></div>
sublin(result,1) # EQMVR850 = 1.58<br>
sublin(result,2) # EQMVR500 = 1.89<br>
sublin(result,3) # EQMVR700 = 1.98<div><div></div><div class="h5"><br>
<br>
<br>
-- <br>
Muhammad Rahiz<br>
Researcher & DPhil Candidate (Climate Systems & Policy)<br>
School of Geography & the Environment<br>
University of Oxford<br>
<br>
On Wed, 9 Mar 2011, hachelaf rabah wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Dear Muhamaad,<br>
Thank you for help , your suggestion works correctely<br>
could you tell me who can i add the name of parameter to write it, with the<br>
value like that :<br>
exemple :<br>
EQMVR850 = 1.58<br>
EQMVR500 = 1.89<br>
EQMVR700 =1.98<br>
.......<br>
.........<br>
<br>
2011/3/9 Muhammad Rahiz <<a href="mailto:muhammad.rahiz@ouce.ox.ac.uk" target="_blank">muhammad.rahiz@ouce.ox.ac.uk</a>><br>
Dear Rabah,<br>
<br>
Could you try the following?<br>
<br>
...<br>
...<br>
<br>
'set gxout print'<br>
'd eqmVr850'<br>
ret = result<br>
res = write("output.txt",ret,append)<br>
res = close("output.txt)<br>
<br>
<br>
--<br>
Muhammad Rahiz<br>
Researcher & DPhil Candidate (Climate Systems & Policy)<br>
School of Geography & the Environment<br>
University of Oxford<br>
<br>
<br>
On Wed, 9 Mar 2011, hachelaf rabah wrote:<br>
<br>
Hello all GRADS users,<br>
<br>
My problem is that i can not find a solution to write some<br>
defined parameters like result of<br>
summing some parameters.<br>
or others statistical operations between variables.<br>
i have this part of my script :<br>
......................................<br>
'define VV1=mag(UGRDprs.1,VGRDprs.1)'<br>
'define VV2=mag(UGRDprs.2,VGRDprs.2)'<br>
'define VV3=mag(UGRDprs.3,VGRDprs.3)'<br>
'define VVdif=(VV2-VV1)*(VV2-VV1)'<br>
'define sumxVVdif=sum(VVdif,x=1,x=139)'<br>
'define sumtVVdif=sum(sumxVVdif,y=1,y=159)'<br>
'define eqmVr850=sqrt(sumtVVdif/22101)'<br>
'd eqmVr850'<br>
'define VVdif3=(VV3-VV1)*(VV3-VV1)'<br>
'define sumxVVdif3=sum(VVdif3,x=1,x=139)'<br>
'define sumtVVdif3=sum(sumxVVdif3,y=1,y=159)'<br>
'define eqmVs850=sqrt(sumtVVdif3/22101)'<br>
'd eqmVs850'........<br>
..........................................<br>
so i need to write the result of eqmVr850 and eqmVs850<br>
....and other variables like that in a ASCII<br>
file.<br>
i tried that with the <a href="http://fprintf.gs" target="_blank">fprintf.gs</a> script but it each<br>
time,just the last value is wrote because this<br>
script erase preceding values wrote in the ASCII file.<br>
<br>
Thank you advance for any suggestions.<br>
<br>
<br>
<br>
--<br>
Cordialement,<br>
Best regards,<br>
Rabah Hachelaf<br>
<br>
______ <br>
( )<br>
( ) <br>
(________) <br>
///////// <br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
<br>
<br>
<br>
<br>
--<br>
Cordialement,<br>
Best regards,<br>
Rabah Hachelaf<br>
<br>
______ <br>
( )<br>
( ) <br>
(________) <br>
///////// <br>
<br>
<br>
<br>
</blockquote>
</div></div><br>_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Cordialement,<br>Best regards,<br>Rabah Hachelaf <br><br> ______ <br> ( )<br> ( ) <br> (________) <br>
///////// <br><br><br>
</div>