<div dir="ltr">Hello,<br>Thank you muhammad, for your help<br>i solved my problem and the comand grep works fine to filtered desired values.<br><br><br><br><div class="gmail_quote">2011/3/11 Muhammad Rahiz <span dir="ltr">&lt;<a href="mailto:muhammad.rahiz@ouce.ox.ac.uk">muhammad.rahiz@ouce.ox.ac.uk</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">If you have successfully defined 82 objects using the <a href="http://cont.gs" target="_blank">cont.gs</a> that you&#39;ve<br>

attached, you shouldn&#39;t have any problems writing them to an output file.<br>
<br>
Also, the error messages are from <a href="http://test.gs" target="_blank">test.gs</a>, not the <a href="http://cont.gs" target="_blank">cont.gs</a> script hence you need to check <a href="http://test.gs" target="_blank">test.gs</a>. Performing checks like adding the &#39;say&#39; at each stage of your script may help identify the start of error.<br>

<br>
In any case, try adding the following commands at the end of your <a href="http://cont.gs" target="_blank">cont.gs</a> script.<br>
<br>
*** add the following ***<br>
m = 1<br>
while (m &lt;=82)<br>
<br>
&#39;q define&#39;<br>
output = sublin(result,m)<br>
res = write(&quot;ofile.txt&quot;,output,append)<br>
res = close(&quot;ofile.txt&quot;)<br>
<br>
m = m + 1<br>
endwhile<br>
*** end ***<br>
<br>
Regarding filtering variables, I don&#39;t know how to do it in GrADS, but if you&#39;re using a Linux/Unix box, you could run grep. For example, if you want to extact eqmqv501, eqmqv502, eqmqv851, eqmqv852, do<br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
grep &quot;eqmqv&quot; ofile.txt &gt; eqmqv.txt<br>
</blockquote><div class="im">
<br>
<br>
-- <br>
Muhammad Rahiz<br>
Researcher &amp; DPhil Candidate (Climate Systems &amp; Policy)<br>
School of Geography &amp; the Environment<br>
University of Oxford<br>
<br></div><div><div></div><div class="h5">
On Thu, 10 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;">
<br>
Please find my script in attached .<br>
2011/3/10 Muhammad Rahiz &lt;<a href="mailto:muhammad.rahiz@ouce.ox.ac.uk" target="_blank">muhammad.rahiz@ouce.ox.ac.uk</a>&gt;<br>
      Could you attach your script?<br>
<br>
<br>
--<br>
Muhammad Rahiz<br>
Researcher &amp; DPhil Candidate (Climate Systems &amp; Policy)<br>
School of Geography &amp; the Environment<br>
University of Oxford<br>
<br>
On Thu, 10 Mar 2011, hachelaf rabah wrote:<br>
<br>
      Hello ,<br>
      there my q define.<br>
<br>
      ga-&gt; q define<br>
      tdif 0.00353409<br>
      sumxtdif 1.84828<br>
      sumttdif 663.954<br>
      eqmtr850 0.173326<br>
      tdif3 0.00315651<br>
      sumxtdif3 1.89671<br>
      sumttdif3 660.984<br>
      eqmts850 0.172938<br>
      vv1 1.04454<br>
      vv2 1.00704<br>
      vv3 0.999065<br>
      vvdif 0.00140657<br>
      sumxvvdif 6.4696<br>
      sumtvvdif 2598.48<br>
      eqmvr850 0.342889<br>
      vvdif3 0.00206843<br>
      sumxvvdif3 6.51913<br>
      sumtvvdif3 2583.97<br>
      eqmvs850 0.341931<br>
      tdif5 0.00484139<br>
      sumxtdif5 0.391542<br>
      sumttdif5 341.125<br>
      eqmtr500 0.124237<br>
      tdif35 0.00490103<br>
      sumxtdif35 0.403863<br>
      sumttdif35 339.058<br>
      eqmts500 0.12386<br>
      vv15 24.0027<br>
      vv25 24.047<br>
      vv35 24.0475<br>
      vvdif5 0.00195946<br>
      sumxvvdif5 12.7343<br>
      sumtvvdif5 7833.4<br>
      eqmvr500 0.595346<br>
      vvdif35 0.00200719<br>
      sumxvvdif35 12.7124<br>
      sumtvvdif35 7695.36<br>
      eqmvs500 0.590077<br>
      vsfc1 3.9419<br>
      vsfc2 3.9419<br>
      vsfc3 3.9419<br>
      vsfcdif 0<br>
      sumxvsfcdif 0<br>
      sumtvsfcdif 0<br>
      eqmvsfcr 0<br>
      vsfcdif3 0<br>
      sumxvsfcdif3 0<br>
      sumtvsfcdif3 0<br>
      eqmvsfcs 0<br>
      tsfcdif 2.05729e-06<br>
      sumxtsfcdif 0.031608<br>
      sumttsfcdif 3.56429<br>
      eqmtsfcr 0.0126993<br>
      tdifsfc3 4.6948e-06<br>
      sumxtdifsfc3 0.0311705<br>
      sumttdifsfc3 3.60771<br>
      eqmtsfcs 0.0127764<br>
      pmsldif 0.00057525<br>
      sumxpmsldif 4.33772<br>
      sumtpmsldif 938.117<br>
      eqmpmslr 0.206026<br>
      pdif3 0.000571509<br>
      sumxpdif3 4.3276<br>
      sumtpdif3 946.112<br>
      eqmpmsls 0.206902<br>
      qv501 0.290728<br>
      sumxqv501 12.1445<br>
      sumtqv501 17710.8<br>
      eqmqv501 0.895185<br>
      qv502 0.290786<br>
      sumxqv502 12.3113<br>
      sumtqv502 16894.3<br>
      eqmqv502 0.874308<br>
      qv851 0.0132816<br>
      sumxqv851 4.49544<br>
      sumtqv851 14155.8<br>
      eqmqv851 0.800315<br>
      qv852 0.0132447<br>
      sumxqv852 4.586<br>
      sumtqv852 14006.1<br>
      eqmqv852 0.796073<br>
<br>
<br>
      2011/3/10 Muhammad Rahiz &lt;<a href="mailto:muhammad.rahiz@ouce.ox.ac.uk" target="_blank">muhammad.rahiz@ouce.ox.ac.uk</a>&gt;<br>
           Could you provide the result of &#39;q define&#39;?<br>
<br>
           --<br>
           Muhammad Rahiz<br>
           Researcher &amp; DPhil Candidate (Climate Systems &amp; Policy)<br>
           School of Geography &amp; the Environment<br>
           University of Oxford<br>
<br>
      On Thu, 10 Mar 2011, hachelaf rabah wrote:<br>
<br>
           Hello Muhamed,<br>
           your script help me , but it doesn&#39;t work fine<br>
           i have this warning when i run it :<br>
           ga-&gt; <a href="http://test.gs" target="_blank">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 &quot; q<br>
           define &quot;<br>
           so i don&#39;t know who to filtered just desired variables.<br>
<br>
<br>
           2011/3/10 Muhammad Rahiz &lt;<a href="mailto:muhammad.rahiz@ouce.ox.ac.uk" target="_blank">muhammad.rahiz@ouce.ox.ac.uk</a>&gt;<br>
                Dear Rabah,<br>
<br>
                EQMVR850,EQMVR500 (&amp; others) are objects which you&#39;ve defined earlier in<br>
           your<br>
                original calculation. If you want to add the defined variables<br>
           automatically, you<br>
                can use the &#39;q define&#39; and &#39;sublin&#39; command.<br>
<br>
                **********<br>
                &#39;set gxout print&#39;<br>
<br>
                n1 = 5 # assuming you have 5 defined variables/objects<br>
                n2 = 1<br>
                while (n2 &lt;=n1)<br>
<br>
                &#39;q define&#39;<br>
                var = sublin(result,n2)<br>
                &#39;d &#39;var&#39;&#39;<br>
                ret = result<br>
                res = write(&quot;output.txt&quot;,ret,append)<br>
                res = close(&quot;output.txt)<br>
<br>
           n2 = n2 + 1<br>
           endwhile<br>
           **********<br>
<br>
           What the code does is to create a while loop and select each of the defined<br>
           variables in<br>
           &#39;sublin(result,n2)&#39; where n2 = 1,2,3,4,5 and print it to output.txt. The<br>
           following<br>
           illustrates what &#39;q define&#39; and &#39;sublin&#39; does;<br>
<br>
           &#39;q define&#39;<br>
           EQMVR850 = 1.58<br>
           EQMVR500 = 1.89<br>
           EQMVR700 = 1.98<br>
<br>
           sublin(result,1) # EQMVR850 = 1.58<br>
           sublin(result,2) # EQMVR500 = 1.89<br>
           sublin(result,3) # EQMVR700 = 1.98<br>
<br>
<br>
<br>
           --<br>
           Muhammad Rahiz<br>
           Researcher &amp; DPhil Candidate (Climate Systems &amp; Policy)<br>
           School of Geography &amp; the Environment<br>
           University of Oxford<br>
<br>
           On Wed, 9 Mar 2011, hachelaf rabah wrote:<br>
<br>
                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<br>
           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 &lt;<a href="mailto:muhammad.rahiz@ouce.ox.ac.uk" target="_blank">muhammad.rahiz@ouce.ox.ac.uk</a>&gt;<br>
                     Dear Rabah,<br>
<br>
                     Could you try the following?<br>
<br>
                     ...<br>
                     ...<br>
<br>
                     &#39;set gxout print&#39;<br>
                     &#39;d eqmVr850&#39;<br>
                     ret = result<br>
                     res = write(&quot;output.txt&quot;,ret,append)<br>
                     res = close(&quot;output.txt)<br>
<br>
<br>
                     --<br>
                     Muhammad Rahiz<br>
                     Researcher &amp; DPhil Candidate (Climate Systems &amp; Policy)<br>
                     School of Geography &amp; 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>
                     &#39;define VV1=mag(UGRDprs.1,VGRDprs.1)&#39;<br>
                     &#39;define VV2=mag(UGRDprs.2,VGRDprs.2)&#39;<br>
                     &#39;define VV3=mag(UGRDprs.3,VGRDprs.3)&#39;<br>
                     &#39;define VVdif=(VV2-VV1)*(VV2-VV1)&#39;<br>
                     &#39;define sumxVVdif=sum(VVdif,x=1,x=139)&#39;<br>
                     &#39;define sumtVVdif=sum(sumxVVdif,y=1,y=159)&#39;<br>
                     &#39;define eqmVr850=sqrt(sumtVVdif/22101)&#39;<br>
                     &#39;d eqmVr850&#39;<br>
                     &#39;define VVdif3=(VV3-VV1)*(VV3-VV1)&#39;<br>
                     &#39;define sumxVVdif3=sum(VVdif3,x=1,x=139)&#39;<br>
                     &#39;define sumtVVdif3=sum(sumxVVdif3,y=1,y=159)&#39;<br>
                     &#39;define eqmVs850=sqrt(sumtVVdif3/22101)&#39;<br>
                     &#39;d eqmVs850&#39;........<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>
<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>
<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>
<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>