[ncl-talk] trend_query

Dennis Shea shea at ucar.edu
Mon Jan 2 14:50:16 MST 2017


tst_regCoef.Kunal_Bali.ncl   contains:

;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   ntim = 13149
   nlat = 67
   mlon = 48
   x    = ispan(1,ntim,1)
   x!0  = "time"
   printVarSummary(x)
   print("==========")

   y    = random_uniform(100,200, (/ntim,nlat,mlon/))
   y!0  = "time"
   y!1  = "lat"
   y!2  = "lon"
   printVarSummary(y)     ; [time | 13149] x [lat | 67] x [lon | 48]
   print("==========")

   printVarSummary(y(lat|:,lon|:,time|:))   ; [lat | 67] x [lon | 48] x
[time | 13149]
   print("==========")

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

   copy_VarCoords(y(0,:,:), rc)
   printVarSummary(rc)
   printMinMax(rc,1)
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%> ncl tst_regCoef.Kunal_Bali.ncl

 NCAR Command Language Version 6.3.0


Variable: x
Type: integer
Total Size: 52596 bytes
            13149 values
Number of Dimensions: 1
Dimensions and sizes:    [time | 13149]
Coordinates:
(0)    ==========

Variable: y
Type: float
Total Size: 169148736 bytes
            42287184 values
Number of Dimensions: 3
Dimensions and sizes:    [time | 13149] x [lat | 67] x [lon | 48]
Coordinates:
(0)    ==========

Variable: y (subsection)
Type: float
Total Size: 169148736 bytes
            42287184 values
Number of Dimensions: 3
Dimensions and sizes:    [lat | 67] x [lon | 48] x [time | 13149]
Coordinates:
(0)    ==========

Variable: rc
Type: float
Total Size: 12864 bytes
            3216 values
Number of Dimensions: 2
Dimensions and sizes:    [lat | 67] x [lon | 48]
Coordinates:
Number Of Attributes: 5
  _FillValue :    9.96921e+36
  nptxy :    <ARRAY of 3216 elements>
  rstd :    <ARRAY of 3216 elements>
  yintercept :    <ARRAY of 3216 elements>
  tval :    <ARRAY of 3216 elements>
(0)
(0)    min=-0.000292889   max=0.000215768

==================================

There are no logged bug fixes for regCoef. Hence, not sure of the issus.

===================================
You can ftp the data file but we can not use old NCL versions:

ftp ftp.cgd.ucar.edu
anonymous
your_email
cd incoming
put your_data_file
quit

Notify ncl-talk after successful transfer of the file.






On Mon, Jan 2, 2017 at 12:05 PM, Kunal Bali <kunal.bali9 at gmail.com> wrote:

> 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
>>>
>>>
>>
>
> _______________________________________________
> 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/49cfa281/attachment.html 


More information about the ncl-talk mailing list