[ncl-talk] trend_query

Kunal Bali kunal.bali9 at gmail.com
Mon Jan 2 10:45:35 MST 2017


I have 6.2.0 NCL version

I tried with

rc = *regCoef*(x, y(lat|:,lon|:,time|:) )

but still getting some error

*fatal:regCoef: The rightmost dimension of x must be equal to the
rightmost dimension of y*



regards
Kunal Bali






On Mon, Jan 2, 2017 at 9:24 PM, Dennis Shea <shea at ucar.edu> wrote:

> I would recommend:
>
> http://www.ncl.ucar.edu/Document/Functions/Built-in/regCoef_n.shtml
>
> This is the most recent version. As noted in the documentation:
> Note: with NCL V6.2.1 or later, you can use *regCoef_n*
> <http://www.ncl.ucar.edu/Document/Functions/Built-in/regCoef_n.shtml> to
> avoid having to reorder the arrays first:
>
>    rc   = *regCoef_n* <http://www.ncl.ucar.edu/Document/Functions/Built-in/regCoef_n.shtml>(x, y, 0, 0)
>
> ===
>
> ****PLease See: Example 2***
>
> rc   = *regCoef_n*(time, ts, 0, 0) ; *rc(nlat,mlon)*
>
> copy_VarCoords(ts(0,:,),rc)
> printVarSummary(rc)
>
> =====
> Using the original regCoef rather than regCoef_n may require the arrays to
> be reordered.
>
> http://www.ncl.ucar.edu/Document/Functions/Built-in/regCoef-1.shtml
>
> ****See: Examples 2 and 3***
>
>    rc   = *regCoef*(x, y(lat|:,lon|:,time|:) )
>
> If *y* has coordinate variables
> <http://www.ncl.ucar.edu/Document/Language/cv.shtml> these may readily be
> assigned via NCL syntax:
>
>    rc!0   = "lat"    ; name dimensions
>    rc!1   = "lon"
>    rc&lat = y&lat    ; assign coordinate values to named dimensions
>    rc&lon = y&lon
>
>
>
>
> On Mon, Jan 2, 2017 at 3:01 AM, Kunal Bali <kunal.bali9 at gmail.com> wrote:
>
>> Dear NCL users,
>>
>> I have the data with time steps > 1000
>>
>> I want to plot the spatial map of trend analysis of the given dataset.
>> So I tried the script given below for getting the desired plot but
>> couldn't successed.
>>
>> the given error is
>>
>>
>> *fatal:regCoef: The rightmost dimension of x must be at least
>> 2fatal:["Execute.c":8567]:Execute: Error occurred at or near line 32 in
>> file trend.ncl*
>>
>> Could anyone please help me out
>>
>>
>>
>>    tmp  = a->SWTNTCLR
>>    ts   = tmp(time|:,lat|:,lon|:)               ; reorder variable
>>
>>    delete(tmp)                                  ; no longer needed
>>
>> ;************************************************
>> ; create x and calculate the regression coefficients (slopes, trends)
>> ;************************************************
>>    time         = ts&time                       ; days since 1850-01-01
>>    rc           = regCoef(time,ts)
>>
>>    rc at long_name = "regression coefficient (trend)"
>>    rc at units     = ts at units+"/day"
>> ;   copy_VarCoords(ts(:,:,0), rc)                ; copy lat,lon coords
>>
>>
>> ;************************************************
>> ; plotting parameters
>> ;************************************************
>>    wks  = gsn_open_wks("ps" ,"regress")
>>    gsn_define_colormap(wks,"ViBlGrWhYeOrRe")    ; choose colormap
>>
>>    res                       = True
>>    res at gsnMaximize           = True             ; make large
>>
>>    res at cnFillOn              = True             ; turn on color
>>    res at cnLinesOn             = False            ; turn off contour lines
>>    res at cnLineLabelsOn        = False            ; turn off contour line
>> labels
>>  ;;res at cnFillMode            = "RasterFill"
>>
>> ;   res at cnLevelSelectionMode  = "ManualLevels"   ; set manual contour
>> levels
>> ;   res at cnMinLevelValF        =  -1.00           ; set min contour level
>> ;   res at cnMaxLevelValF        =   1.00           ; set max contour level
>>    res at cnLevelSpacingF       =   0.10           ; set contour interval
>> ;
>>    res at mpFillOn              = False            ; turn off default
>> background gray
>>  ;  res at mpCenterLonF          = 210
>>
>>    res at tiMainString          = fili
>>    plot = gsn_csm_contour_map_ce(wks,rc,res)
>>   end
>>
>>
>>
>>
>>
>>
>>
>>
>> Regards
>> Kunal Bali
>>
>>
>>
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170102/6fd4e469/attachment.html 


More information about the ncl-talk mailing list