[ncl-talk] error in scatter xy3 plot/ regression line

Adam Phillips asphilli at ucar.edu
Thu Jan 17 15:34:40 MST 2019


Hi Amal,
Looking at your script, line 66 is this:
plots1 = gsn_csm_xy(wks,x,y_a1,res)
So NCL is failing on the plot call. Looking at how you are setting x and
y_a1:
 y_a1 = dim_avg_n_Wrap(dox_ave_a1,(/1,2/))
x = (/1/)

NCL returned a list of error messages to you, but the most important one is
the first one:
fatal:CheckArray:Each vector in the caXArray array must have at least 2
elements

Your x array has one element. Assyming y_a1 is a 1D array containing values
at each timestep, your input array "x" should contain the times that you
want to plot the timeseries against. A typical example of using gsn_csm_xy
on an annual timeseries that runs from 1900-2017:
plot = gsn_csm_xy(wks,ispan(1900,2017,1),tseries,res)

Hope that helps. If you have any further questions please let the ncl-talk
email list know.
Adam








On Thu, Jan 17, 2019 at 8:03 AM Amal Inge <amalingenieur89 at gmail.com> wrote:

> sorry, this is the error:
> fatal:CheckArray:Each vector in the caXArray array must have at least 2
> elements
> fatal:CoordArraysInitialize:caXArray resource is invalid
> fatal:Unable to initialize layer-Can't Create
> fatal:Unable to access object with id:-4
> fatal:PID #-4 can't be found in NhlSetValues
> fatal:Unable to access object with id:-4
> warning:Unable to add DataItem "(null)" to DataList "xyCoordData"
> fatal:CompileDataList:DataList has no valid members
> fatal:Unable to access object with id:-4
> warning:Unable to add DataItem "(null)" to DataList "xyCoordData"
> fatal:CompileDataList:DataList has no valid members
> fatal:Argument type mismatch on argument (0) of (attsetvalues_check) can
> not coerce
> fatal:["Execute.c":8575]:Execute: Error occurred at or near line 12478 in
> file $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl
>
> fatal:["Execute.c":8575]:Execute: Error occurred at or near line 5083 in
> file $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl
>
> fatal:["Execute.c":8575]:Execute: Error occurred at or near line 66 in
> file dox-landing-xy.ncl
>
>
> Le jeu. 17 janv. 2019 à 13:37, Amal Inge <amalingenieur89 at gmail.com> a
> écrit :
>
>> Dear NCL experts,
>>
>> I tried this script attached to make a scatter plot with 3 y axis, then I
>> had this error and i did not find my mistake.
>> Could you help me please.
>> I checked the script scatter_4.ncl to make a 2 regresseion line (one
>> between all dox data and y2 and the second with y3) but i did not
>> understand how to deal with this, it would be nice if you can tell me how.
>> exemple of variable:
>> Variable: y_a1
>> Type: float
>> Total Size: 4 bytes
>>             1 values
>> Number of Dimensions: 1
>> Dimensions and sizes: [time | 1]
>> Coordinates:
>>             time: [1402876800..1402876800]
>> Number Of Attributes: 7
>>   _FillValue : 1e+20
>>   standard_name :
>> mole_concentration_of_dissolved_molecular_oxygen_in_sea_water
>>   long_name : Mole concentration of Dissolved Molecular Oxygen in sea
>> water
>>   units : millimol m-3
>>   _ChunkSizes : ( 1, 22, 84, 161 )
>>   average_op_ncl : dim_avg_n over dimension(s): lat,lon
>>   missing_value : 1e+20
>>
>> many thanks
>> best regards
>> amal
>>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>


-- 
Adam Phillips
Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
www.cgd.ucar.edu/staff/asphilli/   303-497-1726

<http://www.cgd.ucar.edu/staff/asphilli>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190117/f1887dba/attachment.html>


More information about the ncl-talk mailing list