<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Dear All,<div class=""><br class=""></div><div class="">I was trying to plot a spatial map of SPI but having a challenge indexing coordinates. I pasted my script as well as the point a stuck (red text) from NCL output below.</div><div class=""><br class=""></div><div class="">Thank you so much for your support as usual.</div><div class=""><br class=""></div><div class="">Dawit</div><div class=""><br class=""></div><div class=""><font color="#0433ff" class=""><b class="">1. My script</b></font></div><div class=""><br class=""></div><div class="">;=========================================================================================</div><div class="">;spi spatial map plot</div><div class="">;=========================================================================================</div><div class="">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"</div><div class="">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"</div><div class="">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"</div><div class=""><br class=""></div><div class="">begin</div><div class=""><br class=""></div><div class=""> diri = "./"</div><div class=""> fili = "pre_cru_1901_2014.nc"</div><div class=""> f = addfile(diri+fili, "r")</div><div class=""><br class=""></div><div class=""> prc = f->pre</div><div class=""> prc@_FillValue = -999.0</div><div class=""> pmsg = prc@_FillValue</div><div class=""> printVarSummary(prc)</div><div class=""><br class=""></div><div class=""> dimp = dimsizes(prc)</div><div class=""> ntim = dimp(0)</div><div class=""> nlat = dimp(1)</div><div class=""> mlon = dimp(2)</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>run = (/12/)</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>nrun = dimsizes(run)</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>spi = new((/nrun,ntim,nlat,mlon/), typeof(prc), pmsg)</div><div class=""><br class=""></div><div class=""> opt = True</div><div class=""><br class=""></div><div class=""> do nr=0,nrun-1</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span> spi(nr,:,:,:)= dim_spi_n(prc, run(nr), True, 0)</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>end do</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span> copy_VarCoords(prc,spi(0,:,:,:))</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span> spi@long_name = "SPI"</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span> spi!0 = "run"</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span> spi&run = run</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span> printVarSummary(spi)</div><div class=""><br class=""></div><div class=""> ;========================================================================================</div><div class=""> ; Plot parameter</div><div class=""> ;========================================================================================</div><div class=""> dimp = dimsizes(prc)</div><div class=""> ntim = dimp(0)</div><div class=""> nlat = dimp(1)</div><div class=""> mlon = dimp(2)</div><div class=""><br class=""></div><div class=""> yyyymm = f->time</div><div class=""> yyyymm = yyyymm/100</div><div class=""><br class=""></div><div class=""> year = yyyymm/100</div><div class=""> yrStrt = 1901</div><div class=""> yrLast = 2014</div><div class=""> nyear = yrLast-yrStrt+1</div><div class=""> yyyymm = yyyymm_time(yrStrt, yrLast, "integer")</div><div class=""> yrfrac = (/ yyyymm_to_yyyyfrac(yyyymm, 0.0) /)</div><div class=""><br class=""></div><div class=""> prc&time = (/ yyyymm /)</div><div class=""><br class=""></div><div class="">;========================================================================================</div><div class=""><br class=""></div><div class=""> wks = gsn_open_wks ("ps","spi")</div><div class=""> gsn_define_colormap(wks,"BlueWhiteOrangeRed")</div><div class=""> gsn_reverse_colormap(wks) ; Reverse the color map.</div><div class=""><br class=""></div><div class=""> res = True</div><div class=""> res@gsnDraw = False ; don't draw</div><div class=""> res@gsnFrame = False ; don't advance frame</div><div class=""> res@gsnSpreadColors = True</div><div class=""><br class=""></div><div class=""> res@cnFillOn = True ; color Fill</div><div class=""> res@cnFillMode = "RasterFill" ; Raster Mode</div><div class=""> res@cnLinesOn = False ; Turn off contour lines</div><div class=""> res@cnLevelSelectionMode = "ManualLevels" ; set manual contour levels</div><div class=""> res@cnMinLevelValF = -3.0 ; set min contour level</div><div class=""> res@cnMaxLevelValF = 3.0 ; set max contour level</div><div class=""> res@cnLevelSpacingF = 0.5 ; set contour spacing</div><div class=""> res@lbLabelBarOn = False ; turn off individual cb's</div><div class=""><br class=""></div><div class=""> resP = True ; panel resources</div><div class=""> resP@txString = False</div><div class=""> resP@gsnPanelLabelBar= True ; add common colorbar</div><div class=""><br class=""></div><div class=""> plot = new ( 5, "graphic")</div><div class=""><br class=""></div><div class=""> do nl=0,nlat-1</div><div class=""> do ml=0,mlon-1</div><div class=""> do nr=0,nrun-1</div><div class=""> spi(nr,:,:,:)= dim_spi_n(prc, run(nr), True, 0)</div><div class=""> spi@long_name = "SPI"</div><div class=""> spi@units = "nrun="+run(nr)</div><div class=""> copy_VarCoords(prc,spi(0,:,:,:))</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span> spi!0 = "run"</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span> spi&run = run</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span> printVarSummary(spi)</div><div class=""><br class=""></div><div class=""> res@gsnCenterString = yyyymm({192112})</div><div class=""> plot(0) = gsn_csm_contour_map_ce(wks,spi({192112},:,:,:), res)</div><div class=""><br class=""></div><div class=""> res@gsnCenterString = yyyymm({192212})</div><div class=""> plot(1) = gsn_csm_contour_map_ce(wks,spi({192212},:,:,:), res)</div><div class=""><br class=""></div><div class=""> res@gsnCenterString = yyyymm({192712})</div><div class=""> plot(2) = gsn_csm_contour_map_ce(wks,spi({192712},:,:,:), res)</div><div class=""><br class=""></div><div class=""> res@gsnCenterString = yyyymm({197312})</div><div class=""> plot(3) = gsn_csm_contour_map_ce(wks,spi({197312},:,:,:), res)</div><div class=""><br class=""></div><div class=""> res@gsnCenterString = yyyymm({198412})</div><div class=""> plot(4) = gsn_csm_contour_map_ce(wks,spi({198412},:,:,:), res)</div><div class=""> end do</div><div class=""> end do</div><div class=""> end do</div><div class=""><br class=""></div><div class=""> gsn_panel(wks,plot,(/5,1/),resP) ; now draw as one plot</div><div class=""><br class=""></div><div class="">end</div><div class=""><br class=""></div><div class=""><b style="color: rgb(4, 51, 255);" class="">2. NCL output from exciting the script above</b></div><div class=""><br class=""></div><div class=""><p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">(my_ncl) Dagemawes-MacBook-Pro:~ dawitabebe$ ncl -Q spi12_plotmap_script.ncl</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Variable: prc</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Type: double</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Total Size: 393984 bytes</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> 49248 values</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Number of Dimensions: 3</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Dimensions and sizes:<span class="Apple-tab-span" style="white-space:pre">        </span>[time | 1368] x [lat | 4] x [lon | 9]</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Coordinates: </span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> time: [ 380..41987]</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> lat: [3.75..5.25]</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> lon: [36.75..40.75]</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Number Of Attributes: 5</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> correlation_decay_distance :<span class="Apple-tab-span" style="white-space:pre">        </span> 450</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> long_name :<span class="Apple-tab-span" style="white-space:pre">        </span>precipitation</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> units :<span class="Apple-tab-span" style="white-space:pre">        </span>mm/month</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> missing_value :<span class="Apple-tab-span" style="white-space:pre">        </span>9.96920996839e+36</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> _FillValue :<span class="Apple-tab-span" style="white-space:pre">        </span>-999</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Variable: spi</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Type: double</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Total Size: 393984 bytes</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> 49248 values</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Number of Dimensions: 4</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Dimensions and sizes:<span class="Apple-tab-span" style="white-space:pre">        </span>[run | 1] x [time | 1368] x [lat | 4] x [lon | 9]</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Coordinates: </span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> run: [12..12]</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> time: [ 380..41987]</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> lat: [3.75..5.25]</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> lon: [36.75..40.75]</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Number Of Attributes: 2</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> long_name :<span class="Apple-tab-span" style="white-space:pre">        </span>SPI</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> _FillValue :<span class="Apple-tab-span" style="white-space:pre">        </span>-999</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Variable: spi</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Type: double</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Total Size: 393984 bytes</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> 49248 values</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Number of Dimensions: 4</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Dimensions and sizes:<span class="Apple-tab-span" style="white-space:pre">        </span>[run | 1] x [time | 1368] x [lat | 4] x [lon | 9]</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Coordinates: </span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> run: [12..12]</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> time: [190101..201412]</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> lat: [3.75..5.25]</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> lon: [36.75..40.75]</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Number Of Attributes: 4</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> units :<span class="Apple-tab-span" style="white-space:pre">        </span>nrun=12</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> long_name :<span class="Apple-tab-span" style="white-space:pre">        </span>SPI</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> run :<span class="Apple-tab-span" style="white-space:pre">        </span>12</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> _FillValue :<span class="Apple-tab-span" style="white-space:pre">        </span>-999</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">fatal:NclOneDValGetClosestIndex: <font color="#ff2600" class="">finish coordinate index out of range, can't continue</font></span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font color="#ff2600" class="">fatal:Could not obtain coordinate indexes, unable to perform subscript</font></span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font color="#ff2600" class="">fatal:["Execute.c":8640]:Execute: Error occurred at or near line 98 in file spi12_plotmap_script.ncl</font></span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">(my_ncl) Dagemawes-MacBook-Pro:~ dawitabebe$ </span></p></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class="">……………………………………...</span></div><div class=""> <br class=""><div><blockquote type="cite" class=""><div class="">On Apr 18, 2017, at 10:29 AM, <a href="mailto:ncl-talk-request@ucar.edu" class="">ncl-talk-request@ucar.edu</a> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Send ncl-talk mailing list submissions to<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span><a href="mailto:ncl-talk@ucar.edu" class="">ncl-talk@ucar.edu</a><br class=""><br class="">To subscribe or unsubscribe via the World Wide Web, visit<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>http://mailman.ucar.edu/mailman/listinfo/ncl-talk<br class="">or, via email, send a message with subject or body 'help' to<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>ncl-talk-request@ucar.edu<br class=""><br class="">You can reach the person managing the list at<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>ncl-talk-owner@ucar.edu<br class=""><br class="">When replying, please edit your Subject line so it is more specific<br class="">than "Re: Contents of ncl-talk digest..."<br class=""><br class=""><br class="">Today's Topics:<br class=""><br class=""> 1. Re: Problem with gsn_add_text (Stavros Dafis)<br class=""> 2. Problem with contour plot (Guilherme Martins)<br class=""> 3. Re: Problem with gsn_add_text (Rick Brownrigg)<br class=""> 4. Re: Problem with contour plot (Mary Haley)<br class=""> 5. how to draw this kind of plot (wen)<br class=""><br class=""><br class="">----------------------------------------------------------------------<br class=""><br class="">Message: 1<br class="">Date: Mon, 17 Apr 2017 21:48:31 +0300<br class="">From: Stavros Dafis <sdafis@cc.uoi.gr><br class="">Subject: Re: [ncl-talk] Problem with gsn_add_text<br class="">To: Rick Brownrigg <brownrig@ucar.edu><br class="">Cc: "ncl-talk@ucar.edu" <ncl-talk@ucar.edu><br class="">Message-ID: <1492454911.58f50dffc9203@webmail.uoi.gr><br class="">Content-Type: text/plain; charset=ISO-8859-7<br class=""><br class="">Dear Rick, thank you for your suggestion, I have tried to assign both the<br class="">FillValue and the missing value (@missing_value) but nothing seems to work.<br class=""><br class="">I forgot to mention that I am using NCL 6.2.0, 6.3.0 and 6.4.0, on different<br class="">machines.<br class=""><br class=""><br class="">-- <br class="">Stavros NTAFIS (DAFIS)<br class="">-----------------------------------------------<br class="">Physicist - Meteorologist, M.Sc.<br class="">Research Associate, National Observatory of Athens<br class="">(+33)9 81 94 22 12, Mobile: +30 697 04 20 242<br class="">---------------<br class="">Weather charts:<br class="">http://www.meteo.gr<br class="">http://www.meteo.gr/meteomaps/<br class=""><br class=""><br class="">Quoting Rick Brownrigg <brownrig@ucar.edu>:<br class=""><br class=""><blockquote type="cite" class="">Hi Stavros,<br class=""><br class="">I don't know for certain, but I suspect you need to assign the _FillValue<br class="">to the string array "points" that you constructed from "t2" (I don't see<br class="">how the attributes from t2 would carry to points via the sprintf() ).<br class=""><br class="">Hope that helps...<br class="">Rick<br class=""><br class="">On Sun, Apr 16, 2017 at 12:56 PM, Stavros Dafis <sdafis@cc.uoi.gr> wrote:<br class=""><br class=""><blockquote type="cite" class="">Hello everyone, I am facing a problem with the function gsn_add_text. In<br class="">the<br class="">description of the function, it is mentioned that no missing values will be<br class="">plotted:<br class=""><br class="">&#8220;This function attaches a list of text strings to the given plot.<br class="">The text<br class="">strings will be drawn only when the plot is drawn. If a missing value is<br class="">encountered in the text strings or x/y values, then no text string will be<br class="">drawn at this pair.&#8221;<br class=""><br class="">My script reads a netCDF file with 3 variables t2(lat,lon), lat(lat),<br class="">lon(lon),<br class="">so in order to attach values on the plot using this function, I have to<br class="">make<br class="">new 2-D variables for lat/lon and define the string to be plotted on the<br class="">map.<br class="">Values are assigned just fine on the plot, over the land, but missing<br class="">values<br class="">are also printed over the sea. I tried to use landsea masking but my data<br class="">have<br class="">high horizontal resolution (5km). Any suggestions?<br class=""><br class="">I have the same problem with WRF data, with already 2-D lat/lon arrays.<br class=""><br class=""> This is the part of the code which prints the values:<br class="">.<br class="">.<br class="">.<br class="">contour = gsn_csm_contour_map(wks,t2,res)<br class=""><br class="">t2@missing_value = -1<br class="">t2@_FillValue = -1<br class="">(default missing values = -999)<br class=""><br class="">lat2 = new(dimsizes(t2),typeof(lat),-1)<br class="">lon2 = new(dimsizes(t2),typeof(lon),-1)<br class=""><br class="">nb = dimsizes(t2)<br class=""><br class="">do nl=0,nb(0)-1,1<br class="">do ml=0,nb(1)-1,1<br class=""><br class="">lat2(nl,ml) = lat(nl)<br class="">lon2(nl,ml) = lon(ml)<br class=""><br class="">end do<br class="">end do<br class=""><br class="">points = sprintf("%3.0f", t2)<br class="">;points = ""+t2(:,:)+""<br class=""><br class="">values = gsn_add_text(wks,contour,points,lon2(:,:),lat2(:,:),True)<br class=""><br class=""><br class=""><br class="">--<br class="">Stavros NTAFIS (DAFIS)<br class="">-----------------------------------------------<br class="">Physicist - Meteorologist, M.Sc.<br class="">Research Associate, National Observatory of Athens<br class="">(+33)9 81 94 22 12, Mobile: +30 697 04 20 242<br class="">---------------<br class="">Weather charts:<br class="">http://www.meteo.gr<br class="">http://www.meteo.gr/meteomaps/<br class=""><br class=""><br class=""><br class="">_______________________________________________<br class="">ncl-talk mailing list<br class="">ncl-talk@ucar.edu<br class="">List instructions, subscriber options, unsubscribe:<br class="">http://mailman.ucar.edu/mailman/listinfo/ncl-talk<br class=""><br class=""></blockquote><br class=""></blockquote><br class=""><br class="">------------------------------<br class=""><br class="">Message: 2<br class="">Date: Mon, 17 Apr 2017 19:00:02 +0000<br class="">From: Guilherme Martins <jgmsantos@gmail.com><br class="">Subject: [ncl-talk] Problem with contour plot<br class="">To: NCL <ncl-talk@ucar.edu><br class="">Message-ID:<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span><CAH+t_hMaRUDHM0wMkLC9cz2pFmMYGXgGC+X+bcxDLo=+8fgWQg@mail.gmail.com><br class="">Content-Type: text/plain; charset="utf-8"<br class=""><br class="">Dear users,<br class=""><br class="">After searching extensively on the NCL website I was not able to find a<br class="">solution to my problem. I only want values within the contour of the<br class="">continent, but some edges appear in the figure that are stemming from the<br class="">mask that I applied and I do not know how to remove this. The figure is<br class="">attached for a better view of my problem.<br class=""><br class="">Best regards,<br class=""><br class="">Guilherme.<br class="">-- <br class="">------------------------------------------------------------------------------------------------<br class="">Instituto Nacional de Pesquisas Espaciais (INPE)<br class="">Centro de Previs?o de Tempo e Estudos Clim?ticos (CPTEC)<br class="">Divis?o de Sat?lites e Sistemas Ambientais (DSA)<br class="">Programa de Monitoramento de Queimadas<br class="">Telefone (INPE/CP): +55 12 3186-9205 || Celular (TIM): +55 12 98111-4292<br class="">E-mail: guilherme.martins@inpe.br || jgmsantos@gmail.com<br class="">Skype: guilherme.martins.<br class="">Homepage: https://sites.google.com/site/jgmsantos<br class="">Curr?culo Lattes: http://lattes.cnpq.br/5997657584785803<br class="">------------------------------------------------------------------------------------------------<br class="">-------------- next part --------------<br class="">An HTML attachment was scrubbed...<br class="">URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170417/c3215b0e/attachment-0001.html <br class="">-------------- next part --------------<br class="">A non-text attachment was scrubbed...<br class="">Name: figure.png<br class="">Type: image/png<br class="">Size: 58495 bytes<br class="">Desc: not available<br class="">Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170417/c3215b0e/attachment-0001.png <br class=""><br class="">------------------------------<br class=""><br class="">Message: 3<br class="">Date: Mon, 17 Apr 2017 14:32:43 -0600<br class="">From: Rick Brownrigg <brownrig@ucar.edu><br class="">Subject: Re: [ncl-talk] Problem with gsn_add_text<br class="">To: Stavros Dafis <sdafis@cc.uoi.gr><br class="">Cc: "ncl-talk@ucar.edu" <ncl-talk@ucar.edu><br class="">Message-ID:<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span><CAGKRhbHX1v-1sJ3G=QrXGA+0wSJ2KKsBB_7GqbCnp9krh9fkkQ@mail.gmail.com><br class="">Content-Type: text/plain; charset="utf-8"<br class=""><br class="">Hi,<br class=""><br class="">You used -1 as _FillValue for variable "t2". Note it is an integer value --<br class="">what type is the array t2 -- float or int? In any case, you created the<br class="">formatted string array "points" from t2 as "%3.0f", so that any data values<br class="">in t2 that were -1 are now " -1", and thus it seems your _FillValue should<br class="">be " -1". Did you do this, and do the types between data and _FillValue<br class="">agree everywhere?<br class=""><br class="">If that's not the issue, I think we may need to see script and dataset to<br class="">figure out what the issue is.<br class=""><br class="">HTH...<br class="">Rick<br class=""><br class="">On Mon, Apr 17, 2017 at 12:48 PM, Stavros Dafis <sdafis@cc.uoi.gr> wrote:<br class=""><br class=""><blockquote type="cite" class="">Dear Rick, thank you for your suggestion, I have tried to assign both the<br class="">FillValue and the missing value (@missing_value) but nothing seems to work.<br class=""><br class="">I forgot to mention that I am using NCL 6.2.0, 6.3.0 and 6.4.0, on<br class="">different<br class="">machines.<br class=""><br class=""><br class="">--<br class="">Stavros NTAFIS (DAFIS)<br class="">-----------------------------------------------<br class="">Physicist - Meteorologist, M.Sc.<br class="">Research Associate, National Observatory of Athens<br class="">(+33)9 81 94 22 12, Mobile: +30 697 04 20 242<br class="">---------------<br class="">Weather charts:<br class="">http://www.meteo.gr<br class="">http://www.meteo.gr/meteomaps/<br class=""><br class=""><br class="">Quoting Rick Brownrigg <brownrig@ucar.edu>:<br class=""><br class=""><blockquote type="cite" class="">Hi Stavros,<br class=""><br class="">I don't know for certain, but I suspect you need to assign the _FillValue<br class="">to the string array "points" that you constructed from "t2" (I don't see<br class="">how the attributes from t2 would carry to points via the sprintf() ).<br class=""><br class="">Hope that helps...<br class="">Rick<br class=""><br class="">On Sun, Apr 16, 2017 at 12:56 PM, Stavros Dafis <sdafis@cc.uoi.gr><br class=""></blockquote>wrote:<br class=""><blockquote type="cite" class=""><br class=""><blockquote type="cite" class="">Hello everyone, I am facing a problem with the function gsn_add_text.<br class=""></blockquote></blockquote>In<br class=""><blockquote type="cite" class=""><blockquote type="cite" class="">the<br class="">description of the function, it is mentioned that no missing values<br class=""></blockquote></blockquote>will be<br class=""><blockquote type="cite" class=""><blockquote type="cite" class="">plotted:<br class=""><br class="">&#8220;This function attaches a list of text strings to the given plot.<br class="">The text<br class="">strings will be drawn only when the plot is drawn. If a missing value<br class=""></blockquote></blockquote>is<br class=""><blockquote type="cite" class=""><blockquote type="cite" class="">encountered in the text strings or x/y values, then no text string<br class=""></blockquote></blockquote>will be<br class=""><blockquote type="cite" class=""><blockquote type="cite" class="">drawn at this pair.&#8221;<br class=""><br class="">My script reads a netCDF file with 3 variables t2(lat,lon), lat(lat),<br class="">lon(lon),<br class="">so in order to attach values on the plot using this function, I have to<br class="">make<br class="">new 2-D variables for lat/lon and define the string to be plotted on<br class=""></blockquote></blockquote>the<br class=""><blockquote type="cite" class=""><blockquote type="cite" class="">map.<br class="">Values are assigned just fine on the plot, over the land, but missing<br class="">values<br class="">are also printed over the sea. I tried to use landsea masking but my<br class=""></blockquote></blockquote>data<br class=""><blockquote type="cite" class=""><blockquote type="cite" class="">have<br class="">high horizontal resolution (5km). Any suggestions?<br class=""><br class="">I have the same problem with WRF data, with already 2-D lat/lon arrays.<br class=""><br class=""> This is the part of the code which prints the values:<br class="">.<br class="">.<br class="">.<br class="">contour = gsn_csm_contour_map(wks,t2,res)<br class=""><br class="">t2@missing_value = -1<br class="">t2@_FillValue = -1<br class="">(default missing values = -999)<br class=""><br class="">lat2 = new(dimsizes(t2),typeof(lat),-1)<br class="">lon2 = new(dimsizes(t2),typeof(lon),-1)<br class=""><br class="">nb = dimsizes(t2)<br class=""><br class="">do nl=0,nb(0)-1,1<br class="">do ml=0,nb(1)-1,1<br class=""><br class="">lat2(nl,ml) = lat(nl)<br class="">lon2(nl,ml) = lon(ml)<br class=""><br class="">end do<br class="">end do<br class=""><br class="">points = sprintf("%3.0f", t2)<br class="">;points = ""+t2(:,:)+""<br class=""><br class="">values = gsn_add_text(wks,contour,points,lon2(:,:),lat2(:,:),True)<br class=""><br class=""><br class=""><br class="">--<br class="">Stavros NTAFIS (DAFIS)<br class="">-----------------------------------------------<br class="">Physicist - Meteorologist, M.Sc.<br class="">Research Associate, National Observatory of Athens<br class="">(+33)9 81 94 22 12, Mobile: +30 697 04 20 242<br class="">---------------<br class="">Weather charts:<br class="">http://www.meteo.gr<br class="">http://www.meteo.gr/meteomaps/<br class=""><br class=""><br class=""><br class="">_______________________________________________<br class="">ncl-talk mailing list<br class="">ncl-talk@ucar.edu<br class="">List instructions, subscriber options, unsubscribe:<br class="">http://mailman.ucar.edu/mailman/listinfo/ncl-talk<br class=""><br class=""></blockquote><br class=""></blockquote><br class=""></blockquote>-------------- next part --------------<br class="">An HTML attachment was scrubbed...<br class="">URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170417/01bd2242/attachment-0001.html <br class=""><br class="">------------------------------<br class=""><br class="">Message: 4<br class="">Date: Mon, 17 Apr 2017 15:02:08 -0600<br class="">From: Mary Haley <haley@ucar.edu><br class="">Subject: Re: [ncl-talk] Problem with contour plot<br class="">To: Guilherme Martins <jgmsantos@gmail.com><br class="">Cc: NCL <ncl-talk@ucar.edu><br class="">Message-ID:<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span><CACNN_CJz1yvpMXMABZ8FhSEov1T0qN63rzsNBBVXBhLos3UKjg@mail.gmail.com><br class="">Content-Type: text/plain; charset="utf-8"<br class=""><br class="">Guilherme,<br class=""><br class="">Please see examples shapefiles_21.ncl at:<br class=""><br class="">http://www.ncl.ucar.edu/Applications/shapefiles.shtml#ex21<br class=""><br class="">It explains why you see these "blocky" contours in NCL.<br class=""><br class="">Simply put, if you have four points that represent a box at the edge of a<br class="">domain, and three of them have data one them and one is missing, then NCL<br class="">will only draw contours in half of the box, because it won't extrapolate to<br class="">that missing point.<br class=""><br class="">The real question is: do you simply want the graphics not to have gaps, or<br class="">do you actually want there to be data in locations that fall just outside<br class="">the geographical boundary? You can do things to force values just outside<br class="">the geographical boundary, but this depends on how you are masking in the<br class="">first place.<br class=""><br class="">If you are masking based on a shapefile, then see example shapefiles_18.ncl<br class="">on the same page:<br class=""><br class="">http://www.ncl.ucar.edu/Applications/shapefiles.shtml#ex18<br class=""><br class="">Note, however, that this mask is now returning values outside the range of<br class="">interest.<br class=""><br class="">If you are simply trying to mask your data *graphically* by some<br class="">geographical area, then instead of trying to use a mask function, you can<br class="">draw the full data, and then draw polygons filled in with white in the<br class="">areas you don't want to see graphically. That's what example 21 is showing.<br class=""><br class="">--Mary<br class=""><br class=""><br class="">On Mon, Apr 17, 2017 at 1:00 PM, Guilherme Martins <jgmsantos@gmail.com><br class="">wrote:<br class=""><br class=""><blockquote type="cite" class="">Dear users,<br class=""><br class="">After searching extensively on the NCL website I was not able to find a<br class="">solution to my problem. I only want values within the contour of the<br class="">continent, but some edges appear in the figure that are stemming from the<br class="">mask that I applied and I do not know how to remove this. The figure is<br class="">attached for a better view of my problem.<br class=""><br class="">Best regards,<br class=""><br class="">Guilherme.<br class="">--<br class="">------------------------------------------------------------<br class="">------------------------------------<br class="">Instituto Nacional de Pesquisas Espaciais (INPE)<br class="">Centro de Previs?o de Tempo e Estudos Clim?ticos (CPTEC)<br class="">Divis?o de Sat?lites e Sistemas Ambientais (DSA)<br class="">Programa de Monitoramento de Queimadas<br class="">Telefone (INPE/CP): +55 12 3186-9205 <+55%2012%203186-9205> || Celular<br class="">(TIM): +55 12 98111-4292 <+55%2012%2098111-4292><br class="">E-mail: guilherme.martins@inpe.br || jgmsantos@gmail.com<br class="">Skype: guilherme.martins.<br class="">Homepage: https://sites.google.com/site/jgmsantos<br class="">Curr?culo Lattes: http://lattes.cnpq.br/5997657584785803<br class="">------------------------------------------------------------<br class="">------------------------------------<br class=""><br class="">_______________________________________________<br class="">ncl-talk mailing list<br class="">ncl-talk@ucar.edu<br class="">List instructions, subscriber options, unsubscribe:<br class="">http://mailman.ucar.edu/mailman/listinfo/ncl-talk<br class=""><br class=""><br class=""></blockquote>-------------- next part --------------<br class="">An HTML attachment was scrubbed...<br class="">URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170417/96b2b947/attachment-0001.html <br class=""><br class="">------------------------------<br class=""><br class="">Message: 5<br class="">Date: Tue, 18 Apr 2017 15:29:04 +0800 (CST)<br class="">From: wen <wenguanhuan@163.com><br class="">Subject: [ncl-talk] how to draw this kind of plot<br class="">To: ncl-list <ncl-talk@ucar.edu><br class="">Message-ID: <5de3ed86.9f7f.15b7ff6fb6f.Coremail.wenguanhuan@163.com><br class="">Content-Type: text/plain; charset="gbk"<br class=""><br class="">Hi all,<br class=""> I am trying to use TRMM 3B42 data to draw this kind of plot. I haven't found a example on the website to draw it. Do anyone know how to make it. Which function should I<br class="">use. Thank you!<br class=""><br class=""><br class=""><br class=""><br class=""><br class=""><br class=""><br class=""><br class="">--<br class=""><br class="">??<br class="">???<br class="">-------------- next part --------------<br class="">An HTML attachment was scrubbed...<br class="">URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170418/b09be439/attachment.html <br class="">-------------- next part --------------<br class="">A non-text attachment was scrubbed...<br class="">Name: ??1.png<br class="">Type: image/png<br class="">Size: 249741 bytes<br class="">Desc: not available<br class="">Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170418/b09be439/attachment.png <br class=""><br class="">------------------------------<br class=""><br class="">_______________________________________________<br class="">ncl-talk mailing list<br class="">ncl-talk@ucar.edu<br class="">List instructions, subscriber options, unsubscribe:<br class="">http://mailman.ucar.edu/mailman/listinfo/ncl-talk<br class=""><br class=""><br class="">End of ncl-talk Digest, Vol 161, Issue 23<br class="">*****************************************<br class=""></div></div></blockquote></div><br class=""></div></body></html>