[Thread Prev][Thread Next][Index]

Re: [ferret_users] command to plot error bar



Hello Ansley,

GREAT !!!

Thanks

The script which you suggested .. worked
perfectly

Thanks once again,

Regards,
Yogesh


Ansley Manke wrote:
> Hello again,
> It looks like there is a bug in the `return=shape` that error_bars.jnl
> uses, however I have found a way to work around it without having to
> make your own version of the error bars script.  If you specify the
> range of the average explicitly in both X and Y, it gets the correct
> answer, and you should not have to do the RESHAPE operation.  Try this -
> the difference is in using x=@0:360 in the @ave and the @sum.
> 
> yes?let xx = x[gx=CO2]
> yes?let yy = y[gy=CO2]
> yes?let nx = xx[x=@NGD]
> yes?let ny = yy[y=-60:60@NGD]
> yes?let nxy = nx * ny
> 
> yes?let co2_ave = co2[x=0:360@ave,l=1:12,y=-60:60@ave]
> 
> yes?let total_error =(error[x=0:360@SUM,y=-60:60@SUM]/nxy)^0.5
> 
> yes?plot co2_ave
> yes?go error_bars  polygon/thickness=2
> co2_ave, total_error
> 
> 
> 
> 
> 
> Yogesh K. Tiwari wrote:
>>Hi Ansley,
>>
>>Here is the my error_bar script run (attached
>>text file), last mail was to hazy, sorry for
>>that.
>>
>>Ygesh
>>
>>
>> Manke wrote:
>>  
>>>Hi - the data do not depend on Z, do they?
>>>
>>>Can you do this - they should both be time series plots
>>>
>>>plot co2_ave
>>>plot total_error
>>>
>>>
>>>Try run the script like this:
>>>
>>>yes? set mode verify:always
>>>yes? go error_bars  polygon/thickness=2  co2_ave, total_error
>>>
>>>
>>>You will be able to see what Ferret is getting for the SHAPE of the
>>>variable. It seems as if that is not working as we'd expect.
>>>
>>>If nothing else you can make your own copy of the script error_bars.jnl,
>>>and maybe rename it, and remove the checking of dimensions.  Comment out
>>>this line:
>>>DEFINE SYMBOL ERBax `ERBy,return=shape`
>>>
>>>and add this line, since we know the variable is just a line in T:
>>>
>>>DEFINE SYMBOL ERBax  T
>>>
>>>
>>>Yogesh K. Tiwari wrote:
>>>    
>>>>Hi Ansley,
>>>>
>>>>Sorry It did't work
>>>>, the error message is same like last:
>>>>
>>>>#######
>>>>
>>>>yes?let xx = x[gx=CO2]
>>>>yes?let yy = y[gy=CO2]
>>>>yes?let nx = xx[x=@NGD]
>>>>yes?let ny = yy[y=-60:60@NGD]
>>>>yes?let nxy = nx * ny
>>>>yes?let tt = t[g=co2]
>>>>yes?let co2_ave =
>>>>RESHAPE(co2[x=@ave,l=1:12,y=-60:60@ave], tt)
>>>>
>>>>yes?let total_error =
>>>>RESHAPE((error[x=@SUM,y=-60:60@SUM]/nxy)^0.5, tt)
>>>>
>>>>yes?go error_bars  polygon/thickness=2
>>>>co2_ave, total_error
>>>>
>>>>Command file, command group, or REPEAT
>>>>execution aborted
>>>>*** NOTE: error: data is not a point or line
>>>>
>>>>###########
>>>>
>>>>
>>>>Pls suggest
>>>>
>>>>Thanks,
>>>>
>>>>Yogesh
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>Ansley Manke wrote:
>>>> 
>>>>      
>>>>>Hi - I think I know what causes this. The script looks to see if the
>>>>>inputs are one-dimensional using RETURN=SHAPE.  Even though the
>>>>>variables you are sending depend only on time, the SHAPE looks at their
>>>>>grid, which also has x and y dimensions. You can force the arguments to
>>>>>the script to depend only on time this way:
>>>>>
>>>>> yes? let xx = x[gx=CO2]
>>>>> yes? let yy = y[gy=CO2]
>>>>> yes? let nx = xx[x=@NGD]
>>>>> yes? let ny = yy[y=-60:60@NGD]
>>>>>
>>>>> yes? let nxy = nx * ny
>>>>>
>>>>> yes? let tt = t[g=co2]
>>>>> yes? let co2_ave = RESHAPE(co2[x=@ave,l=1:12,y=-60:60@ave], tt)
>>>>> yes? let total_error = RESHAPE((error[x=@SUM,y=-60:60@SUM]/nxy)^0.5, tt)
>>>>>
>>>>> yes? go error_bars  polygon/thickness=2 co2_ave, total_error
>>>>>
>>>>>
>>>>>
>>>>>Yogesh K. Tiwari wrote:
>>>>>   
>>>>>        
>>>>>>Hi Ansley,
>>>>>>
>>>>>>What you told its fine, thanks, but one thing
>>>>>>I am missing is go error_bars command use, I
>>>>>>am not able to understand it,  I am calling
>>>>>>this like:
>>>>>>
>>>>>>yes? GO error_bars polygon/thickness=2/
>>>>>>co2[x=@ave,l=1:12,y=-60:60@ave] total_error
>>>>>>
>>>>>>
>>>>>>Command file, command group, or REPEAT
>>>>>>execution aborted
>>>>>>*** NOTE: error: data is not a point or line
>>>>>>
>>>>>>I think I am missing something, please help,
>>>>>>I could not understand the error_bar demo also .
>>>>>>
>>>>>>Pls help,
>>>>>>
>>>>>>Thanks,
>>>>>>
>>>>>>Regards,
>>>>>>Yogesh
>>>>>>
>>>>>>Ansley Manke wrote:
>>>>>>
>>>>>>     
>>>>>>          
>>>>>>>Hi - To define a variable with the same time axis as
>>>>>>>co2[x=@ave,l=1:12,y=-60:60@ave] and which computes
>>>>>>>
>>>>>>>total_error = (SUM(ERROR)/N)**1/2
>>>>>>>
>>>>>>>I think you'd want to compute the error sum over the same region you're
>>>>>>>using to plot CO2, x=1:360, y=-60:60. The Ferret commands would be
>>>>>>>
>>>>>>>yes? let xx = x[gx=CO2]
>>>>>>>yes? let yy = y[gy=CO2]
>>>>>>>yes? let nx = xx[x=@NGD]
>>>>>>>yes? let ny = yy[y=-60:60@NGD]
>>>>>>>
>>>>>>>yes? let nxy = nx * ny
>>>>>>>yes? let xx = x[gx=CO2]
>>>>>>>yes? let yy = y[gy=CO2]
>>>>>>>yes? let nx = xx[x=@NGD]
>>>>>>>yes? let ny = yy[y=-60:60@NGD]
>>>>>>>
>>>>>>>yes? let nxy = nx * ny
>>>>>>>
>>>>>>>yes? let total_error = (error[x=@SUM,y=-60:60@SUM]/nxy)^0.5
>>>>>>>
>>>>>>>
>>>>>>>( Note that some mail programs may translate the carat symbol before 0.5
>>>>>>>above, making a subscript.  The character is the carat symbol, the
>>>>>>>up-arrow. )
>>>>>>>
>>>>>>>Then you can use this in the error bar script.
>>>>>>>
>>>>>>>Ansley
>>>>>>>
>>>>>>>Yogesh K. Tiwari wrote:
>>>>>>>
>>>>>>>  
>>>>>>>       
>>>>>>>            
>>>>>>>>Hi Ansley,
>>>>>>>>
>>>>>>>>Actually I have 2-d error data file which
>>>>>>>>looks like
>>>>>>>>
>>>>>>>>name title   I         J         K         L
>>>>>>>>ERROR       1:360     1:180    ...       1:12
>>>>>>>>
>>>>>>>>And I have CO2 data related to this error
>>>>>>>>
>>>>>>>>CO2        1:360     1:180     ...       1:12
>>>>>>>>
>>>>>>>>I am ploting CO2 curve in ferret
>>>>>>>>
>>>>>>>>plot  co2[x=@ave,l=1:12,y=-60:60@ave]
>>>>>>>>
>>>>>>>>Now I want to plot error bar using the data 1
>>>>>>>>variable ERROR. This error data(data 1 ERROR)
>>>>>>>>is (sigma)**2 . I want to calulate the total
>>>>>>>>error like
>>>>>>>>
>>>>>>>>total_error = (SUM(ERROR)/N)**1/2
>>>>>>>>
>>>>>>>>here N I guess would be 180*360, am I right ?
>>>>>>>>
>>>>>>>>SO can you please suggest me how to calculate
>>>>>>>>the total error in ferret for each month
>>>>>>>>using this formula, this would be  error bar.
>>>>>>>>
>>>>>>>>
>>>>>>>>And finally I want to plot error bar (total
>>>>>>>>error) on the CO2 curve.
>>>>>>>>
>>>>>>>>For more clarification I wrote formula in
>>>>>>>>word .doc file and I am sending you this
>>>>>>>>little word file.
>>>>>>>>
>>>>>>>>Pls help.
>>>>>>>>
>>>>>>>>Many thanks in advance,
>>>>>>>>
>>>>>>>>Regards,
>>>>>>>>Yogesh
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>    
>>>>>>>>         
>>>>>>>>              
>>>>>>>  
>>>>>>>       
>>>>>>>            
>>>>>>     
>>>>>>          
>>>> 
>>>>      
>>
>>
>>  
>>------------------------------------------------------------------------
>>
>>yes? go error_bar_yogi  polygon/thickness=2  co2_ave, total_error
>>
>>! error_bars.jnl
>>! 6/99 *sh*
>>! 7/01 *acm* update /xlimits to /hlimits
>>
>>! Description: Overlay error bars on a plot
>>
>>! Usage:                   $1       $2   $3       $4           $5
>>! yes?  GO error_bars plot_command base errors [err_down] ["transpose"]
>>! $1 - the plot command with qualifiers (eg PLOT/VS/OVER/LINE=2)
>>! $2 - underlying points to be marked with error bars
>>! $3 - error values associated with points (or error limit above)
>>! $4 - [optional] error limit below (if different that $4)
>>! $5 - [optional] "transpose" to interchange X and Y axes
>>
>>! examples
>>!         demo script has more examples
>>!       yes? go error_bars_demo
>>
>>! Define synthetic data
>>
>>!       yes? let xpts = j[j=1:5]
>>!       yes? let ypts = sin(xpts)
>>!       yes? let errup = 0.6 * RANDU(xpts)
>>!       yes? let errdn = 0.6 * RANDU(xpts+1)
>>!
>>!       yes? plot/hlimits=0:6/vlimits=-2:2/vs/line xpts, ypts
>>!       yes? GO error_bars poly/line=2 ypts errup
>>
>>!       yes? GO error_bars poly/line=3 ypts errup errdn
>>
>>! argument check
>>QUERY/IGNORE $1%<usage: yes? GO error_bars plot_command base errors [err_down] ["transpose"]%
>> !-> QUERY/IGNORE polygon/thickness=2
>>QUERY/IGNORE $2%<usage: yes? GO error_bars plot_command base errors [err_down] ["transpose"]%
>> !-> QUERY/IGNORE co2_ave
>>QUERY/IGNORE $3%<usage: yes? GO error_bars plot_command base errors [err_down] ["transpose"]%
>> !-> QUERY/IGNORE total_error
>>
>>! save the input expressions into simple variable definitions
>>LET/QUIET ERBy = ($2)
>> !-> DEFINE VARIABLE/QUIET ERBy = co2_ave
>>LET/QUIET ERBerr_up = ($3)
>> !-> DEFINE VARIABLE/QUIET ERBerr_up = total_error
>>IF $4"0|*>1" THEN
>> !-> IF 0 THEN
>>ELSE
>>   LET/QUIET ERBerr_dn = ERBerr_up
>>ENDIF
>>DEFINE SYMBOL ERBis_transposed  $5"0|*>1"
>> !-> DEFINE SYMBOL ERBis_transposed  0
>>
>>! determine the orientation of the data (and check that it is 1D)
>>
>>!DEFINE SYMBOL ERBax `ERBy,return=shape`
>>
>>DEFINE SYMBOL ERBax  T
>>
>>DEFINE SYMBOL ERBbar_dim ($ERBax"|PT>Z|X>Z|Y>Z|Z>Y|T>Z|<error: data is not a point or line")
>> !-> DEFINE SYMBOL ERBbar_dim Z
>>
>>  


-- 

===========================================
Yogesh K. Tiwari,
Max-Planck Institute for Biogeochemistry,
Hans-Knoell Strasse 10,
D-07745 Jena,
Germany

Office   : 0049 3641 576 376
Home     : 0049 3641 223 163
Fax      : 0049 3641 577 300
Cell     : 0049 1520 459 1008

Alternate:
e-mail   : yogesh.mpi@gmail.com
id's
         : yogesh.mpi@rediffmail.com
===========================================



[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement