[ncl-talk] trend_query

Kunal Bali kunal.bali9 at gmail.com
Mon Jan 2 12:05:05 MST 2017


The summarty shows


















*Variable: yType: floatTotal Size: 169148736 bytes            42287184
valuesNumber of Dimensions: 3Dimensions and sizes:    [time | 13149] x [lat
| 67] x [lon | 48]Coordinates:             time:
[1080..18934200]            lat: [   5..  38]            lon:
[68.125..97.5]Number Of Attributes: 7  vmin :    -1e+15  vmax :    1e+15
fmissing_value :    1e+15  _FillValue :    1e+15  units :    W m-2
long_name :    toa_net_downward_shortwave_flux_assuming_clear_sky
standard_name :    toa_net_downward_shortwave_flux_assuming_clear_sky*

Variable: x
Type: double
Total Size: 105192 bytes
            13149 values
Number of Dimensions: 1
Dimensions and sizes:    [time | 13149]
Coordinates:
Number Of Attributes: 3
  standard_name :    time
  units :    minutes since 1980-01-01 00:30:00
  calendar :    standard
fatal:regCoef: The rightmost dimension of x must be equal to the rightmost
dimension of y
fatal:["Execute.c":8567]:Execute: Error occurred at or near line 37 in file
trend.ncl



And the script is

















* tmp  = a->SWTNTCLR   y   = tmp(time|:,lat|:,lon|:)               ;
reorder variable   delete(tmp)                                  ; no longer
needed;************************************************; create x and
calculate the regression coefficients (slopes, trends)
;************************************************   x         = y&time
printVarSummary(y)   printVarSummary(x)                  rc           =
regCoef(x,y)     *

*So how to set the x (which is time) with y (which is time|lat|lon)*



Kunal Bali
Research Scholar
Radio & Atmospheric Science Division
CSIR - National Physical Laboratory
New Delhi - 110012
India





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

> I believe ncl-talk has been down his raod with you before. Please look at
> the error messages and *always* include printVarSummary of the the
> variables used. Place the ***before*** the line where the error occurs.
>
> printVarSummary(x)
> printVarSummary(y)
> or
> printVarSummary(y(lat|:,lon|:,time|:) )
>
> rc = *regCoef*(x, y(lat|:,lon|:,time|:) )
>
> The error message state:
>
>
>
>
> *fatal:regCoef: The rightmost dimension of x must be equal to the rightmost dimension of y*
>
> Please look  ....
>
> What are the sizes of 'x' and the rightmost dimension of 'y' ?
>
>
>
> On Mon, Jan 2, 2017 at 10:45 AM, Kunal Bali <kunal.bali9 at gmail.com> wrote:
>
>> 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
>>>>
>>>>
>>>
>>
>> _______________________________________________
>> 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/20170103/171e2876/attachment.html 


More information about the ncl-talk mailing list