<div dir="ltr">Hi Anahita,<div>Are you getting any error messages? If so, what are they? Did you try to address them? I'm suspecting that you're getting error messages as the longitude labels of your plot are not correct. I would guess that something is incorrect with your latitude/longitude coordinate variables. You can verify this by using printVarSummary statements to look at the array that is being plotted.</div><div><br></div><div>One aspect of your script that seems a bit odd: </div><div>There are numerous instances of you using both index and coordinate subscripting:</div><div>sde_toa_sw1=FSNT(:,45:61,{-30:15})-FSNTC(:,45:61,{-30:15})<br></div><div><br></div><div>You can do that if you would like, but I am unsure if you meant to select the 46-62nd latitude indices as opposed to coordinate subscripting ({-35:35}).</div><div><br></div><div>Finally when writing to ncl-talk it is always best to include clean, short scripts illustrating the issue, as that helps contributors with diagnosing the issue. As always, please respond to ncl-talk if you have further questions.</div><div>Adam</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Apr 1, 2019 at 4:09 PM Anahita Amiri Farahani <<a href="mailto:aamir003@ucr.edu">aamir003@ucr.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">Dear all,<div><br></div><div>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.</div><div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"</div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"</div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"</div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"</div><div><br></div><div><br></div><div>ana=addfile("SDE_sw_lw_cam4_dust_base.nc","r")</div><div>FSNT = lonFlip(ana->FSNT)</div><div>FSNTC = lonFlip(ana->FSNTC)</div><div>FLNT = lonFlip(ana->FLNT)</div><div>FLNTC= lonFlip(ana->FLNTC)</div><div>lat=ana->lat</div><div>lon=ana->lon</div><div>delete(ana)</div><div><br></div><div><br></div><div>ana=addfile("SDE_sw_lw_cam4_dust.nc","r")</div><div>FSNT_diff = lonFlip(ana->FSNT)</div><div>FSNTC_diff = lonFlip(ana->FSNTC)</div><div>FLNT_diff = lonFlip(ana->FLNT)</div><div>FLNTC_diff = lonFlip(ana->FLNTC)</div><div>delete(ana)</div><div><br></div><div><br></div><div>;************** AFRICA *****************</div><div>lat1 = lat(45:61)</div><div>lon1=fspan(-30,15,19)</div><div><br></div><div>lat1@units = "degrees_north"</div><div>lon1@units = "degrees_east"</div><div><br></div><div>rad = 4.0*atan(1.0)/180.0</div><div>clat = cos(lat1*rad)</div><div>;********************** BASE ******************************</div><div>sde_toa_sw1=FSNT(:,45:61,{-30:15})-FSNTC(:,45:61,{-30:15})</div><div>sde_toa_lw1=-1.*(FLNT(:,45:61,{-30:15})-FLNTC(:,45:61,{-30:15}))</div><div><br></div><div>;********************** Dust ******************************</div><div>sde_toa_sw_diff1=FSNT_diff(:,45:61,{-30:15})-FSNTC_diff(:,45:61,{-30:15})</div><div>sde_toa_lw_diff1=-1.*(FLNT_diff(:,45:61,{-30:15})-FLNTC_diff(:,45:61,{-30:15}))</div><div>; ******** Annual Global Mean CHANGES ********</div><div><br></div><div>sde_toa_tot= sde_toa_sw1 + sde_toa_lw1</div><div>sde_toa_tot_diff= sde_toa_sw_diff1 + sde_toa_lw_diff1</div><div>sde_toa=sde_toa_tot_diff-sde_toa_tot</div><div><br></div><div>;copy_VarCoords(FSNT,sde_toa)</div><div><br></div><div><br></div><div>sde_toa!2 = "lon" ; variable/dim name </div><div>sde_toa&lon = lon1 ; create coordinate variable</div><div>sde_toa!1 = "lat" ; variable/dim name </div><div>sde_toa&lat = lat1 ; create coordinate variable</div><div>sde_toa!0 = "time" </div><div><br></div><div><br></div><div>copy_VarCoords(sde_toa,sde_toa_tot)</div><div>copy_VarCoords(sde_toa,sde_toa_tot_diff)</div><div><br></div><div><br></div><div>sde_toa_tot!0 = "time" ; variable/dim name </div><div>sde_toa_tot_diff!0 = "time" ; variable/dim name </div><div><br></div><div><br></div><div><br></div><div>;toa_toa_area = avg(wgt_areaave(sde_toa, area, 1.0, 0))</div><div>toa_toa_clat = avg(wgt_areaave(sde_toa, clat, 1.0, 0))</div><div>;print("sde_toa_tot="+toa_toa_area)</div><div>print("sde_toa_tot="+toa_toa_clat)</div><div><br></div><div>sde_toa_tot_annual = month_to_annual(sde_toa_tot, 1) </div><div>sde_toa_tot_diff_annual = month_to_annual(sde_toa_tot_diff, 1)</div><div><br></div><div><br></div><div>dsizesPD = dimsizes(sde_toa_tot_diff_annual)</div><div>ntim = dsizesPD(0)</div><div>nlat = dsizesPD(1)</div><div>mlon = dsizesPD(2)</div><div><br></div><div><br></div><div>low_base = sde_toa_tot_annual(lat|:,lon|:,year|:) </div><div>low_dust = sde_toa_tot_diff_annual(lat|:,lon|:,year|:) </div><div><br></div><div>low_avebase = dim_avg(low_base)</div><div>low_avedust = dim_avg(low_dust)</div><div>low_varbase = dim_variance(low_base)</div><div>low_vardust = dim_variance(low_dust)</div><div>low_sPD = conform_dims((/nlat,mlon/),ntim,-1)</div><div>;alpha = swPD(0,:,:)</div><div>alpha = (1.0-ttest(low_avebase,low_varbase,low_sPD,low_avedust,low_vardust,low_sPD,False,False))</div><div><br></div><div>alpha!0 = "lat" </div><div>alpha&lat = lat1 </div><div>alpha!1 = "lon" </div><div>alpha&lon = lon1 </div><div><br></div><div>;***** Global Annual Significance ********</div><div><br></div><div><br></div><div><br></div><div>low_base_area = wgt_areaave(sde_toa_tot_annual, clat, 1.0, 0)</div><div>low_dust_area = wgt_areaave(sde_toa_tot_diff_annual, clat, 1.0, 0)</div><div>low_avD = avg(low_base_area)</div><div>low_avI = avg(low_dust_area)</div><div>low_vaD = variance(low_base_area)</div><div>low_vaI = variance(low_dust_area)</div><div>low_sD = ntim</div><div><br></div><div>low_prob = 100.0*(1.0-ttest(low_avD,low_vaD,low_sD,low_avI,low_vaI,low_sD,False,False))</div><div>print("Significance level of SDE_global = " + sprintf("%5.2f", low_prob))</div><div><br></div><div><br></div><div> low_AAE = dim_avg(sde_toa(lat|:,lon|:,time|:))</div><div><br></div><div> low_AAE!1 = "lon" ; variable/dim name </div><div> low_AAE&lon = lon1 ; create coordinate variable</div><div> low_AAE!0 = "lat" ; variable/dim name </div><div> low_AAE&lat = lat1 ; create coordinate variable</div><div><br></div><div><br></div><div><br></div><div><br></div><div>wks = gsn_open_wks("eps","SDE_TOA_tot_ann")</div><div>gsn_define_colormap(wks,"BlWhRe") ; choose color</div><div>;gsn_define_colormap(wks,"BlAqGrYeOrRe") </div><div>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</div><div> res = True ; plot mods desired</div><div> res@cnFillOn = True ; turn on color </div><div> res@gsnSpreadColors = True ; use full color map</div><div> res@cnLinesOn = False ; no contour lines</div><div> res@cnLineLabelsOn = False ; no line labels</div><div><br></div><div> res@mpMaxLatF = 90 ; specify the plot domain</div><div> res@mpMinLatF = -90 ; </div><div> res@mpMinLonF = 0 ;</div><div> res@mpMaxLonF = 357.5 </div><div> res@mpCenterLonF= 0;178.75</div><div> ;res@gsnAddCyclic = False </div><div><br></div><div>;res@cnLevelSelectionMode = "AutomaticLevels" ; AutomaticLevels</div><div><br></div><div> res@cnLevelSelectionMode = "ManualLevels" ; AutomaticLevels</div><div> res@cnMinLevelValF = -4. ; min level</div><div> res@cnMaxLevelValF = 4. ; max level</div><div> res@cnLevelSpacingF = 0.2 ; interval</div><div><br></div><div><br></div><div><br></div><div>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</div><div>res@tiMainString = "Annual changes SDE at TOA "</div><div><br></div><div>res@gsnDraw = False ; Do not draw plot</div><div>res@gsnFrame = False ; Do not advance frome</div><div>plot = gsn_csm_contour_map_ce(wks,low_AAE(:,:), res) </div><div><br></div><div>; ========================= PLOT 2 ==============================</div><div> res2 = True ; res2 probability plots</div><div><br></div><div> res2@gsnDraw = False ; Do not draw plot</div><div> res2@gsnFrame = False ; Do not advance frome</div><div><br></div><div> res2@cnLevelSelectionMode = "ManualLevels" ; set manual contour levels</div><div> res2@cnMinLevelValF = 0.00 ; set min contour level</div><div> res2@cnMaxLevelValF = 1.05 ; set max contour level</div><div> res2@cnLevelSpacingF = 0.05 ; set contour spacing</div><div><br></div><div> res2@cnInfoLabelOn = False ; turn off info label</div><div> res2@cnNoDataLabelOn = False</div><div><br></div><div> res2@cnLinesOn = False ; do not draw contour lines</div><div> res2@cnLineLabelsOn = False ; do not draw contour labels</div><div> res2@gsnLeftString = ""</div><div> res2@gsnRightString = ""</div><div><br></div><div> res2@cnFillScaleF = 0.6 ; add extra density</div><div> res2@cnLevelSpacingF = 0.04 ; set contour spacing</div><div><br></div><div> plot2 = gsn_csm_contour(wks,gsn_add_cyclic_point(alpha(:,:)), res2) </div><div> plot2 = ShadeGtContour(plot2, 0.95, 17) ; shade all areas less than the</div><div> ; 0.05 contour level</div><div> overlay (plot, plot2)</div><div><br></div><div> draw (plot)</div><div> frame(wks)</div><div> delete(wks)</div><div><br></div><div><br></div></div></div></div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div><div><span><font color="#888888">Adam Phillips <br></font></span></div><span><font color="#888888">Associate Scientist, </font></span><span><font color="#888888">Climate and Global Dynamics Laboratory, NCAR<br></font></span></div></div><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank">www.cgd.ucar.edu/staff/asphilli/</a> </font></span><span><font color="#888888">303-497-1726 </font></span></div><span><font color="#888888"></font></span><div><div><span><font color="#888888"><br></font></span><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli" target="_blank"></a></font></span></div></div></div></div></div></div></div></div></div></div></div>