[gradsusr] writing some defined variables in ASCII file

hachelaf rabah r.hachelaf at gmail.com
Thu Mar 10 08:08:24 EST 2011


Hello ,
there my q define.

ga-> q define
tdif 0.00353409
sumxtdif 1.84828
sumttdif 663.954
*eqmtr850 0.173326*
tdif3 0.00315651
sumxtdif3 1.89671
sumttdif3 660.984
*eqmts850 0.172938*
vv1 1.04454
vv2 1.00704
vv3 0.999065
vvdif 0.00140657
sumxvvdif 6.4696
sumtvvdif 2598.48
*eqmvr850 0.342889*
vvdif3 0.00206843
sumxvvdif3 6.51913
sumtvvdif3 2583.97
eqmvs850 0.341931
tdif5 0.00484139
sumxtdif5 0.391542
sumttdif5 341.125
*eqmtr500 0.124237*
tdif35 0.00490103
sumxtdif35 0.403863
sumttdif35 339.058
*eqmts500 0.12386*
vv15 24.0027
vv25 24.047
vv35 24.0475
vvdif5 0.00195946
sumxvvdif5 12.7343
sumtvvdif5 7833.4
*eqmvr500 0.595346*
vvdif35 0.00200719
sumxvvdif35 12.7124
sumtvvdif35 7695.36
*eqmvs500 0.590077*
vsfc1 3.9419
vsfc2 3.9419
vsfc3 3.9419
vsfcdif 0
sumxvsfcdif 0
sumtvsfcdif 0
eqmvsfcr 0
vsfcdif3 0
sumxvsfcdif3 0
sumtvsfcdif3 0
eqmvsfcs 0
tsfcdif 2.05729e-06
sumxtsfcdif 0.031608
sumttsfcdif 3.56429
eqmtsfcr 0.0126993
tdifsfc3 4.6948e-06
sumxtdifsfc3 0.0311705
sumttdifsfc3 3.60771
eqmtsfcs 0.0127764
pmsldif 0.00057525
sumxpmsldif 4.33772
sumtpmsldif 938.117
eqmpmslr 0.206026
pdif3 0.000571509
sumxpdif3 4.3276
sumtpdif3 946.112
eqmpmsls 0.206902
qv501 0.290728
sumxqv501 12.1445
sumtqv501 17710.8
eqmqv501 0.895185
qv502 0.290786
sumxqv502 12.3113
sumtqv502 16894.3
eqmqv502 0.874308
qv851 0.0132816
sumxqv851 4.49544
sumtqv851 14155.8
eqmqv851 0.800315
qv852 0.0132447
sumxqv852 4.586
sumtqv852 14006.1
eqmqv852 0.796073


2011/3/10 Muhammad Rahiz <muhammad.rahiz at ouce.ox.ac.uk>

> Could you provide the result of 'q define'?
>
>
> --
> Muhammad Rahiz
> Researcher & DPhil Candidate (Climate Systems & Policy)
> School of Geography & the Environment
> University of Oxford
>
> On Thu, 10 Mar 2011, hachelaf rabah wrote:
>
>  Hello Muhamed,
>> your script help me , but it doesn't work fine
>> i have this warning when i run it :
>> ga-> test.gs
>> Data Request Error:  File number out of range
>>   Variable = tdif0.00353409
>>   Error ocurred at column 1
>> DISPLAY error:  Invalid expression
>>   Expression = tdif0.00353409
>> Data Request Error:  File number out of range
>>   Variable = sumxtdif1.84828
>>   Error ocurred at column 1
>> DISPLAY error:  Invalid expression
>>   Expression = sumxtdif1.84828
>> Data Request Error:  File number out of range
>>   Variable = sumttdif663.954
>>   Error ocurred at column 1
>> DISPLAY error:  Invalid expression
>>   Expression = sumttdif663.954
>> Data Request Error:  File number out of range
>>   Variable = eqmtr8500.173326
>> ..............................
>> However i need to write just some variables from all screened by taping "
>> q define "
>> so i don't know who to filtered just desired variables.
>>
>>
>> 2011/3/10 Muhammad Rahiz <muhammad.rahiz at ouce.ox.ac.uk>
>>      Dear Rabah,
>>
>>      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.
>>
>>      **********
>>      'set gxout print'
>>
>>      n1 = 5 # assuming you have 5 defined variables/objects
>>      n2 = 1
>>      while (n2 <=n1)
>>
>>      'q define'
>>      var = sublin(result,n2)
>>      'd 'var''
>>      ret = result
>>      res = write("output.txt",ret,append)
>>      res = close("output.txt)
>>
>> n2 = n2 + 1
>> endwhile
>> **********
>>
>> 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;
>>
>> 'q define'
>> EQMVR850 = 1.58
>> EQMVR500 = 1.89
>> EQMVR700 = 1.98
>>
>> sublin(result,1) # EQMVR850 = 1.58
>> sublin(result,2) # EQMVR500 = 1.89
>> sublin(result,3) # EQMVR700 = 1.98
>>
>>
>>
>> --
>> Muhammad Rahiz
>> Researcher & DPhil Candidate (Climate Systems & Policy)
>> School of Geography & the Environment
>> University of Oxford
>>
>> On Wed, 9 Mar 2011, hachelaf rabah wrote:
>>
>>      Dear Muhamaad,
>>      Thank you for help , your suggestion works correctely
>>      could you tell me who can i add the name of parameter to write it,
>> with the
>>      value like that :
>>      exemple :
>>      EQMVR850 = 1.58
>>      EQMVR500 = 1.89
>>      EQMVR700 =1.98
>>      .......
>>      .........
>>
>>      2011/3/9 Muhammad Rahiz <muhammad.rahiz at ouce.ox.ac.uk>
>>           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
>>
>>                ______
>>               (          )
>>              (            )
>>             (________)
>>                /////////
>>
>>
>>
>>
>>      _______________________________________________
>>      gradsusr mailing list
>>      gradsusr at gradsusr.org
>>      http://gradsusr.org/mailman/listinfo/gradsusr
>>
>>
>>
>>
>>      --
>>      Cordialement,
>>      Best regards,
>>      Rabah Hachelaf
>>
>>           ______
>>          (          )
>>         (            )
>>        (________)
>>           /////////
>>
>>
>>
>>
>> _______________________________________________
>> gradsusr mailing list
>> gradsusr at gradsusr.org
>> http://gradsusr.org/mailman/listinfo/gradsusr
>>
>>
>>
>>
>> --
>> Cordialement,
>> Best regards,
>> Rabah Hachelaf
>>
>>      ______
>>     (          )
>>    (            )
>>   (________)
>>      /////////
>>
>>
>>
>>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>
>


-- 
Cordialement,
Best regards,
Rabah Hachelaf

     ______
    (          )
   (            )
  (________)
     /////////
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20110310/f99402f1/attachment-0003.html 


More information about the gradsusr mailing list