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