Re: scatter plot and regression line for 2D vs 2D array

From: H.Dang <danghy_at_nyahnyahspammersnyahnyah>
Date: Mon Sep 17 2012 - 09:46:54 MDT

Thanks, Dennis! This works:)

On Mon, Sep 17, 2012 at 10:42 AM, Dennis Shea <shea@ucar.edu> wrote:

> x_obs = ndtooned( x2d )
> y_mdl = ndtooned( y2d )
>
>
> On 9/17/12 8:33 AM, H.Dang wrote:
>
>> Good morning!
>>
>> I am plotting scatter plots of two 2D datasets and finding their
>> regression line. The 2D arrays are:
>>
>> V_obs(90,144)
>> V_obs@_FillValues = -999
>>
>> V_model(90,144)
>>
>> What I'm doing firstly is to change these two 2D arrays to 1D, and then
>> use the following method to create plot:
>>
>> plot = gsn_csm_xy (wks,data_obs,data,res)
>>
>> The 1D array data_obs will be the X-axis, 1D data_model will be the
>> Y-axis. Where,
>>
>> rc = regline(data_obs,data_model)
>> data(0,:) = data_model
>> data(1,:) = rc*(data_obs - rc@xave) + rc@yave
>>
>> To change the datasets from 2D to 1D, I used:
>>
>> i_data = - 1
>> do isat = 0,90-1
>> do jsat = 0,144-1
>> i_data = i_data + 1
>> data_model(i_data) = V_model(isat,jsat)
>> data_obs(i_data) = V_obs(isat,jsat)
>> end do
>> end do
>>
>> The error message I got is:
>>
>> fatal:Number of dimensions on right hand side do not match number of
>> dimension in left hand side
>> fatal:["Execute.c":7556]:**Execute: Error occurred at or near line 5263
>> in
>> file $NCARG_ROOT/lib/ncarg/**nclscripts/csm/gsn_code.ncl
>>
>> fatal:["Execute.c":7556]:**Execute: Error occurred at or near line 177 in
>> file scatter_sat_model.ncl
>>
>> The line 177 is:
>> gsn_text(wks,plot,text_s,25,**23,res_text)
>>
>> Could you please assist me to find the problems in my code? I'm also
>> not sure if the places with _FillValues in the observation are
>> automatically treated as missing value in model data too.
>>
>> Thank you!
>>
>> Hongyan
>>
>>
>> ______________________________**_________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/**mailman/listinfo/ncl-talk<http://mailman.ucar.edu/mailman/listinfo/ncl-talk>
>>
>>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Sep 17 09:47:46 2012

This archive was generated by hypermail 2.1.8 : Fri Sep 21 2012 - 16:22:30 MDT