[ncl-talk] problem with plotting
Anahita Amiri Farahani
aamir003 at ucr.edu
Mon Apr 1 17:40:19 MDT 2019
I did that And at least the area is in a correct place but not the
significant symbol (Attached is the plot) and I still get this message,
(0) gsn_add_cyclic: Warning: The range of your longitude data is not 360.
(0) You may want to set the gsnAddCyclic resource to False to avoid a
(0) warning message from the spline function.
warning:_NhlCreateSplineCoordApprox: Attempt to create spline approximation
for X axis failed: consider adjusting trXTensionF value
warning:IrTransInitialize: error creating spline approximation for
trXCoordPoints; defaulting to linear
On Mon, Apr 1, 2019 at 3:46 PM Adam Phillips <asphilli at ucar.edu> wrote:
> Hi Anahita,
> Thanks for sending the error message. The message is telling you what to
> do:
>
> gsn_add_cyclic: Warning: The range of your longitude data is not 360.
> (0) You may want to set the gsnAddCyclic resource to False to avoid a
> (0) warning message from the spline function.
>
> Try setting res at gsnAddCyclic = False and see if that helps.
> Adam
>
> On Mon, Apr 1, 2019 at 4:39 PM Anahita Amiri Farahani <aamir003 at ucr.edu>
> wrote:
>
>> and the error is:
>>
>> (0) gsn_add_cyclic: Warning: The range of your longitude data is not 360.
>>
>> (0) You may want to set the gsnAddCyclic resource to False to avoid a
>>
>> (0) warning message from the spline function.
>>
>> warning:_NhlCreateSplineCoordApprox: Attempt to create spline
>> approximation for X axis failed: consider adjusting trXTensionF value
>>
>> warning:IrTransInitialize: error creating spline approximation for
>> trXCoordPoints; defaulting to linear
>>
>> (0) gsn_add_cyclic: Warning: The range of your longitude data is not 360.
>>
>> (0) You may want to set the gsnAddCyclic resource to False to avoid a
>>
>> (0) warning message from the spline function.
>>
>> warning:_NhlCreateSplineCoordApprox: Attempt to create spline
>> approximation for X axis failed: consider adjusting trXTensionF value
>>
>> warning:IrTransInitialize: error creating spline approximation for
>> trXCoordPoints; defaulting to linear
>>
>> On Mon, Apr 1, 2019 at 3:08 PM Anahita Amiri Farahani <aamir003 at ucr.edu>
>> wrote:
>>
>>> Dear all,
>>>
>>> I try to extract some part of Africa and plot it but it does not work,
>>> here is the code and attached is the plot.
>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
>>>
>>>
>>> ana=addfile("SDE_sw_lw_cam4_dust_base.nc","r")
>>> FSNT = lonFlip(ana->FSNT)
>>> FSNTC = lonFlip(ana->FSNTC)
>>> FLNT = lonFlip(ana->FLNT)
>>> FLNTC= lonFlip(ana->FLNTC)
>>> lat=ana->lat
>>> lon=ana->lon
>>> delete(ana)
>>>
>>>
>>> ana=addfile("SDE_sw_lw_cam4_dust.nc","r")
>>> FSNT_diff = lonFlip(ana->FSNT)
>>> FSNTC_diff = lonFlip(ana->FSNTC)
>>> FLNT_diff = lonFlip(ana->FLNT)
>>> FLNTC_diff = lonFlip(ana->FLNTC)
>>> delete(ana)
>>>
>>>
>>> ;************** AFRICA *****************
>>> lat1 = lat(45:61)
>>> lon1=fspan(-30,15,19)
>>>
>>> lat1 at units = "degrees_north"
>>> lon1 at units = "degrees_east"
>>>
>>> rad = 4.0*atan(1.0)/180.0
>>> clat = cos(lat1*rad)
>>> ;********************** BASE ******************************
>>> sde_toa_sw1=FSNT(:,45:61,{-30:15})-FSNTC(:,45:61,{-30:15})
>>> sde_toa_lw1=-1.*(FLNT(:,45:61,{-30:15})-FLNTC(:,45:61,{-30:15}))
>>>
>>> ;********************** Dust ******************************
>>> sde_toa_sw_diff1=FSNT_diff(:,45:61,{-30:15})-FSNTC_diff(:,45:61,{-30:15})
>>>
>>> sde_toa_lw_diff1=-1.*(FLNT_diff(:,45:61,{-30:15})-FLNTC_diff(:,45:61,{-30:15}))
>>> ; ******** Annual Global Mean CHANGES ********
>>>
>>> sde_toa_tot= sde_toa_sw1 + sde_toa_lw1
>>> sde_toa_tot_diff= sde_toa_sw_diff1 + sde_toa_lw_diff1
>>> sde_toa=sde_toa_tot_diff-sde_toa_tot
>>>
>>> ;copy_VarCoords(FSNT,sde_toa)
>>>
>>>
>>> sde_toa!2 = "lon" ; variable/dim name
>>> sde_toa&lon = lon1 ; create coordinate variable
>>> sde_toa!1 = "lat" ; variable/dim name
>>> sde_toa&lat = lat1 ; create coordinate variable
>>> sde_toa!0 = "time"
>>>
>>>
>>> copy_VarCoords(sde_toa,sde_toa_tot)
>>> copy_VarCoords(sde_toa,sde_toa_tot_diff)
>>>
>>>
>>> sde_toa_tot!0 = "time" ; variable/dim name
>>> sde_toa_tot_diff!0 = "time" ; variable/dim name
>>>
>>>
>>>
>>> ;toa_toa_area = avg(wgt_areaave(sde_toa, area, 1.0, 0))
>>> toa_toa_clat = avg(wgt_areaave(sde_toa, clat, 1.0, 0))
>>> ;print("sde_toa_tot="+toa_toa_area)
>>> print("sde_toa_tot="+toa_toa_clat)
>>>
>>> sde_toa_tot_annual = month_to_annual(sde_toa_tot, 1)
>>> sde_toa_tot_diff_annual = month_to_annual(sde_toa_tot_diff, 1)
>>>
>>>
>>> dsizesPD = dimsizes(sde_toa_tot_diff_annual)
>>> ntim = dsizesPD(0)
>>> nlat = dsizesPD(1)
>>> mlon = dsizesPD(2)
>>>
>>>
>>> low_base = sde_toa_tot_annual(lat|:,lon|:,year|:)
>>> low_dust = sde_toa_tot_diff_annual(lat|:,lon|:,year|:)
>>>
>>> low_avebase = dim_avg(low_base)
>>> low_avedust = dim_avg(low_dust)
>>> low_varbase = dim_variance(low_base)
>>> low_vardust = dim_variance(low_dust)
>>> low_sPD = conform_dims((/nlat,mlon/),ntim,-1)
>>> ;alpha = swPD(0,:,:)
>>> alpha =
>>> (1.0-ttest(low_avebase,low_varbase,low_sPD,low_avedust,low_vardust,low_sPD,False,False))
>>>
>>> alpha!0 = "lat"
>>> alpha&lat = lat1
>>> alpha!1 = "lon"
>>> alpha&lon = lon1
>>>
>>> ;***** Global Annual Significance ********
>>>
>>>
>>>
>>> low_base_area = wgt_areaave(sde_toa_tot_annual, clat, 1.0, 0)
>>> low_dust_area = wgt_areaave(sde_toa_tot_diff_annual, clat, 1.0, 0)
>>> low_avD = avg(low_base_area)
>>> low_avI = avg(low_dust_area)
>>> low_vaD = variance(low_base_area)
>>> low_vaI = variance(low_dust_area)
>>> low_sD = ntim
>>>
>>> low_prob =
>>> 100.0*(1.0-ttest(low_avD,low_vaD,low_sD,low_avI,low_vaI,low_sD,False,False))
>>> print("Significance level of SDE_global = " + sprintf("%5.2f", low_prob))
>>>
>>>
>>> low_AAE = dim_avg(sde_toa(lat|:,lon|:,time|:))
>>>
>>> low_AAE!1 = "lon" ; variable/dim name
>>> low_AAE&lon = lon1 ; create coordinate variable
>>> low_AAE!0 = "lat" ; variable/dim name
>>> low_AAE&lat = lat1 ; create coordinate variable
>>>
>>>
>>>
>>>
>>> wks = gsn_open_wks("eps","SDE_TOA_tot_ann")
>>> gsn_define_colormap(wks,"BlWhRe") ; choose color
>>> ;gsn_define_colormap(wks,"BlAqGrYeOrRe")
>>> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>>> res = True ; plot mods desired
>>> res at cnFillOn = True ; turn on color
>>> res at gsnSpreadColors = True ; use full color map
>>> res at cnLinesOn = False ; no contour lines
>>> res at cnLineLabelsOn = False ; no line labels
>>>
>>> res at mpMaxLatF = 90 ; specify the plot domain
>>> res at mpMinLatF = -90 ;
>>> res at mpMinLonF = 0 ;
>>> res at mpMaxLonF = 357.5
>>> res at mpCenterLonF= 0;178.75
>>> ;res at gsnAddCyclic = False
>>>
>>> ;res at cnLevelSelectionMode = "AutomaticLevels" ; AutomaticLevels
>>>
>>> res at cnLevelSelectionMode = "ManualLevels" ; AutomaticLevels
>>> res at cnMinLevelValF = -4. ; min level
>>> res at cnMaxLevelValF = 4. ; max level
>>> res at cnLevelSpacingF = 0.2 ; interval
>>>
>>>
>>>
>>> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>>> res at tiMainString = "Annual changes SDE at TOA "
>>>
>>> res at gsnDraw = False ; Do not draw plot
>>> res at gsnFrame = False ; Do not advance frome
>>> plot = gsn_csm_contour_map_ce(wks,low_AAE(:,:), res)
>>>
>>> ; ========================= PLOT 2 ==============================
>>> res2 = True ; res2 probability plots
>>>
>>> res2 at gsnDraw = False ; Do not draw plot
>>> res2 at gsnFrame = False ; Do not advance frome
>>>
>>> res2 at cnLevelSelectionMode = "ManualLevels" ; set manual contour levels
>>> res2 at cnMinLevelValF = 0.00 ; set min contour level
>>> res2 at cnMaxLevelValF = 1.05 ; set max contour level
>>> res2 at cnLevelSpacingF = 0.05 ; set contour spacing
>>>
>>> res2 at cnInfoLabelOn = False ; turn off info label
>>> res2 at cnNoDataLabelOn = False
>>>
>>> res2 at cnLinesOn = False ; do not draw contour lines
>>> res2 at cnLineLabelsOn = False ; do not draw contour labels
>>> res2 at gsnLeftString = ""
>>> res2 at gsnRightString = ""
>>>
>>> res2 at cnFillScaleF = 0.6 ; add extra density
>>> res2 at cnLevelSpacingF = 0.04 ; set contour spacing
>>>
>>> plot2 = gsn_csm_contour(wks,gsn_add_cyclic_point(alpha(:,:)), res2)
>>> plot2 = ShadeGtContour(plot2, 0.95, 17) ; shade all areas less than
>>> the
>>> ; 0.05 contour level
>>> overlay (plot, plot2)
>>>
>>> draw (plot)
>>> frame(wks)
>>> delete(wks)
>>>
>>>
>>> _______________________________________________
>> 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/20190401/d6cec7f4/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SDE_TOA_tot_ann.eps
Type: application/postscript
Size: 503316 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190401/d6cec7f4/attachment-0001.eps>
More information about the ncl-talk
mailing list