[ncl-talk] Trend_plot_with_90%_CI

S Br sbr.climate at gmail.com
Mon Aug 19 02:40:55 MDT 2019


Please try adding
res2 at gsnAddCyclic     = False

it may work fine.

Cheers
S

On Sun, Aug 18, 2019 at 7:05 PM Kunal Bali via ncl-talk <ncl-talk at ucar.edu>
wrote:

> Dear NCL users,
>
> I also tried the another function (given below) to calculate 90% CI, but
> the CI values are not overlaying correctly.
> please let me know the correct way to plot it.
> (Here, I calculated trend values seperately using CDO), and then using
> resultant file to calculate 90% significant values.
>
> [image: plot03.png]
>
>      var_a    = a->BCSMASS(0,:,:).
>
>
> ;**********************************************
>>
>> ;Calculating significance
>>
>> ;**********************************************
>>
>>
>>>  prob_Dec=rtest(var_a,5,0)
>>
>>  sig_Dec =100*(1-prob_Dec)
>>
>>  sig_Dec = where(ismissing(var_a),sig_Dec at _FillValue,sig_Dec)
>>
>>
>>>  printVarSummary(sig_Dec)
>>
>>  printMinMax(sig_Dec, True)
>>
>>
>>>  ;copy_VarAtts(var_a, sig_Dec)
>>
>>  ;copy_VarCoords_1(var_a,sig_Dec)
>>
>>
>>
>>   sig_Dec = mask(sig_Dec, sig_Dec.ge.99,False)
>>
>>   sig_Dec = mask(sig_Dec, sig_Dec.lt.90,False)
>>
>>
>>
>> printVarSummary(sig_Dec)
>>
>> printMinMax(sig_Dec, True)
>>
>>
>
>   res2=True
>>
>>   res2 at gsnLeftString     = ""
>>
>>   res2 at gsnRightString     = ""
>>
>>   res2 at gsnDraw              = False           ; Do not draw plot
>>
>>   res2 at gsnFrame             = False           ; Do not advance frome
>>
>>   ;res2 at cnMonoFillColor      = False
>>
>>   res2 at cnLinesOn            = False    ; turn off contour lines
>>
>>   res2 at lbLabelBarOn         = False                            ; turn
>>> off label bar
>>
>>   res2 at cnFillColor          = "black"
>>
>>   res2 at cnLevelSelectionMode = "ManualLevels"   ; manually specify
>>> contour levels
>>
>>   res2 at cnMinLevelValF       = 90        ; min level
>>
>>   res2 at cnMaxLevelValF       = 99           ; max level
>>
>>   res2 at cnLevelSpacingF      =  0.1             ; contour interval
>>
>>   res2 at gsnSpreadColors      = False
>>
>>   ;res2 at cnConstFEnableFill = True
>>
>>
>>
>>   res2 at trYReverse             =  True
>>
>>   res2 at tfDoNDCOverlay         =  False                ;-- transform to
>>> standard lat/lon
>>
>>   res2 at trGridType             = "TriangularMesh"
>>
>>
>>>
>>>   plotb=gsn_csm_contour(wks,sig_Dec, res2) ; contours are at 90,100
>>
>>
>>> opt = True
>>
>> opt at gsnShadeFillType = "pattern" ; pattern fill
>>
>> opt at gsnShadeHigh =17    ; use pattern #2
>>
>> opt at gsnShadeFillDotSizeF = 0.005
>>
>> opt at gsnShadeFillScaleF = 1.5
>>
>>
>>> plotc = gsn_contour_shade(plotb,-999.,90.,opt)
>>
>>
>>>
>>
>> ;************************************************
>>
>> ; Attach text to plot using plot coordinates.
>>
>> ;************************************************
>>
>>   txres               = True                     ; text mods desired
>>
>>   txres at txFontHeightF = 0.02                     ; font smaller. default
>>> big
>>
>>   txres at txFontThicknessF = 1
>>
>>   txres at txBackgroundFillColor = "white"
>>
>>
>>>
>>>   ;---Resource list for shapefile outlines
>>
>>  plres                 = True
>>
>>  plres at gsLineColor       = "black"
>>
>>  plres at gsLineThicknessF  = "6"
>>
>>  dumstr           = unique_string("poly")
>>
>>
>>>
>>>
>>
>>  id = gsn_add_shapefile_polylines(wks,plotc,filename,plres)
>>
>>
>>>
>>
>>
>>>  overlay(plot,plotc)
>>
>>  draw(plot)
>>
>>  frame(wks)
>>
>> end
>>
>>
>>
>
>
>
>
>
>
> ---
> Kunal Bali
>
>
>
>
>
>
> On Sun, Aug 18, 2019 at 2:08 PM Kunal Bali <kunal.bali9 at gmail.com> wrote:
>
>> Dear NCL users,
>>
>> I want to highlight the 90% CI over trend plot.
>>
>> I used the given code for climatology, but not working properly during
>> trend calculation.
>>
>>
>>> arr95 = var_a(0,:,:)
>>> arr95 = arr95 at _FillValue
>>> arr5 = arr95
>>> ntime = dimsizes(var_a&time)
>>> i95 = toint(ntime*.95)-1  ; approximate 95% index
>>> ip    = dim_pqsort_n(var_a, 2, 0)   ; ascending order, sort var_a in
>>> ascending order at the 0th dimension.
>>> var_a95 = var_a(i95,:,:)
>>>
>>
>> But I am not getting how to incorporate trend function
>>
>>
>>>   var_b    = b->BCSMASS
>>>
>>    ts         = var_b(lat|:,lon|:,time|:)
>>
>>    time     = ts&time                       ; year since 2001-01-01
>>
>>    rc         = regCoef(time,ts)
>>
>>
>>
>>
>>
>> please provide some information on that. For more clarification I have
>> shared my file with dropbox.
>>
>> Thank you
>>
>>
>> regards
>> Kunal
>>
>>
>>
>>
>>
>>
>>
>>
>> https://www.dropbox.com/s/15z3b06liu8z8a2/YM1.nc?dl=0
>>
> _______________________________________________
> 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/20190819/5452ae80/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plot03.png
Type: image/png
Size: 194610 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190819/5452ae80/attachment-0001.png>


More information about the ncl-talk mailing list