<div dir="ltr"><div class="gmail_default" style="font-size:small">Dawit,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">When you send messages to ncl-talk, I have a couple of suggestions:</div><div class="gmail_default" style="font-size:small"><br></div>[1] When you have a new question, please compose a new message with a meaningful subject. A subject of "Re: ncl-talk Digest, Vol 161, Issue 23"<div class="gmail_default" style="font-size:small;display:inline"> may cause some people to skip the message.</div><div><div class="gmail_default" style="font-size:small;display:inline"></div><div class="gmail_default" style="font-size:small">[2] Only send your message to <a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a> and don't CC other people. Otherwise, we all get multiple messages in our mailboxes.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Thanks for your consideration.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">The source of your problem is this line:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default"> res@gsnCenterString = yyyymm({192112})<br></div><div class="gmail_default"><br></div><div class="gmail_default">Whenever you use the '{...}' syntax, this is called "coordinate subscripting". To use coordinate subscripting, yyyymm must have a coordinate array associated with it that defines the coordinates.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">To assign a coordinate array to a one-dimensional array, you need to name the dimension and then assign the coordinate array:</div><div class="gmail_default" style="font-size:small"><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><font face="monospace, monospace"> year = yyyymm/100</font></div><div style="font-size:12.8px"><font face="monospace, monospace"> yrStrt = 1901</font></div><div style="font-size:12.8px"><font face="monospace, monospace"> yrLast = 2014</font></div><div style="font-size:12.8px"><font face="monospace, monospace"> nyear = yrLast-yrStrt+1</font></div><div style="font-size:12.8px"><font face="monospace, monospace"> yyyymm = yyyymm_time(yrStrt, yrLast, "integer")<br><br></font><div style="font-size:12.8px"><font face="monospace, monospace"> yyyymm<b>!0</b> = "<b>time</b>" ; Name the dimension of "yyyymm" so we can assign a coordinate array</font></div><div style="font-size:12.8px"><font face="monospace, monospace"> yyyymm&time = yyyymm ; Assign a coordinate array called "<b>time</b>"</font></div><div style="font-size:12.8px"><font face="arial, helvetica, sans-serif"><br></font></div><div style="font-size:12.8px"><font face="arial, helvetica, sans-serif">Note that the name "time" is arbitrary. You just need to make sure that whatever name you give the dimension is the same name you use when you assign the coordinate array:</font></div><div style="font-size:12.8px"><font face="monospace, monospace"><br></font></div><div style="font-size:12.8px"><font face="monospace, monospace"><br></font></div></div><div style="font-size:12.8px"><div style="font-size:12.8px"><font face="monospace, monospace"> yyyymm<b>!0</b> = "<b>date</b>" ; Name the dimension of "yyyymm" so we can assign a coordinate array</font></div><div style="font-size:12.8px"><font face="monospace, monospace"> yyyymm<b>&date</b> = yyyymm ; Assign a coordinate array called "<b>date</b>"</font></div></div></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Now, you should be able to use coordinate subscripting:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><div class="gmail_default"><font face="monospace, monospace"> res@gsnCenterString = yyyymm({192112})<br></font></div><div><br></div><div>--Mary</div><div><br></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 18, 2017 at 8:50 AM, Dawit Abebe <span dir="ltr"><<a href="mailto:dawit.kan@gmail.com" target="_blank">dawit.kan@gmail.com</a>></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">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 "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_code.ncl"</div><div>load "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_csm.ncl"</div><div>load "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/contributed.<wbr>ncl"</div><div><br></div><div>begin</div><div><br></div><div> diri = "./"</div><div> fili = "<a href="http://pre_cru_1901_2014.nc" target="_blank">pre_cru_1901_2014.nc</a>"</div><div> f = addfile(diri+fili, "r")</div><div><br></div><div> prc = f->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_-4943166290922558066Apple-tab-span" style="white-space:pre-wrap">        </span>run = (/12/)</div><div><span class="m_-4943166290922558066Apple-tab-span" style="white-space:pre-wrap">        </span>nrun = dimsizes(run)</div><div><br></div><div><span class="m_-4943166290922558066Apple-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_-4943166290922558066Apple-tab-span" style="white-space:pre-wrap">        </span> spi(nr,:,:,:)= dim_spi_n(prc, run(nr), True, 0)</div><div><span class="m_-4943166290922558066Apple-tab-span" style="white-space:pre-wrap">        </span>end do</div><div><br></div><div><span class="m_-4943166290922558066Apple-tab-span" style="white-space:pre-wrap">        </span> copy_VarCoords(prc,spi(0,:,:,:<wbr>))</div><div><span class="m_-4943166290922558066Apple-tab-span" style="white-space:pre-wrap">        </span> spi@long_name = "SPI"</div><div><span class="m_-4943166290922558066Apple-tab-span" style="white-space:pre-wrap">        </span> spi!0 = "run"</div><div><span class="m_-4943166290922558066Apple-tab-span" style="white-space:pre-wrap">        </span> spi&run = run</div><div><span class="m_-4943166290922558066Apple-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->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, "integer")</div><div> yrfrac = (/ yyyymm_to_yyyyfrac(yyyymm, 0.0) /)</div><div><br></div><div> prc&time = (/ yyyymm /)</div><div><br></div><div>;=============================<wbr>==============================<wbr>=============================</div><div><br></div><div> wks = gsn_open_wks ("ps","spi")</div><div> gsn_define_colormap(wks,"<wbr>BlueWhiteOrangeRed")</div><div> gsn_reverse_colormap(wks) ; Reverse the color map.</div><div><br></div><div> res = True</div><div> res@gsnDraw = False ; don't draw</div><div> res@gsnFrame = False ; don't advance frame</div><div> res@gsnSpreadColors = True</div><div><br></div><div> res@cnFillOn = True ; color Fill</div><div> res@cnFillMode = "RasterFill" ; Raster Mode</div><div> res@cnLinesOn = False ; Turn off contour lines</div><div> res@cnLevelSelectionMode = "ManualLevels" ; 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'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, "graphic")</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 = "SPI"</div><div> spi@units = "nrun="+run(nr)</div><div> copy_VarCoords(prc,spi(0,:,:,<wbr>:))</div><div><span class="m_-4943166290922558066Apple-tab-span" style="white-space:pre-wrap">        </span> spi!0 = "run"</div><div><span class="m_-4943166290922558066Apple-tab-span" style="white-space:pre-wrap">        </span> spi&run = run</div><div><span class="m_-4943166290922558066Apple-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><p 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></p>
<p 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></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">Variable: prc</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">Type: double</span></p>
<p 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></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"> 49248 values</span></p>
<p 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></p>
<p 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_-4943166290922558066Apple-tab-span" style="white-space:pre-wrap">        </span>[time | 1368] x [lat | 4] x [lon | 9]</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">Coordinates: </span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"> time: [ 380..41987]</span></p>
<p 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></p>
<p 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></p>
<p 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></p>
<p 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_-4943166290922558066Apple-tab-span" style="white-space:pre-wrap">        </span> 450</span></p>
<p 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_-4943166290922558066Apple-tab-span" style="white-space:pre-wrap">        </span>precipitation</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"> units :<span class="m_-4943166290922558066Apple-tab-span" style="white-space:pre-wrap">        </span>mm/month</span></p>
<p 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_-4943166290922558066Apple-tab-span" style="white-space:pre-wrap">        </span>9.96920996839e+36</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"> _FillValue :<span class="m_-4943166290922558066Apple-tab-span" style="white-space:pre-wrap">        </span>-999</span></p>
<p 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></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">Variable: spi</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">Type: double</span></p>
<p 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></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"> 49248 values</span></p>
<p 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></p>
<p 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_-4943166290922558066Apple-tab-span" style="white-space:pre-wrap">        </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"><span style="font-variant-ligatures:no-common-ligatures">Coordinates: </span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"> run: [12..12]</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"> time: [ 380..41987]</span></p>
<p 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></p>
<p 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></p>
<p 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></p>
<p 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_-4943166290922558066Apple-tab-span" style="white-space:pre-wrap">        </span>SPI</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"> _FillValue :<span class="m_-4943166290922558066Apple-tab-span" style="white-space:pre-wrap">        </span>-999</span></p>
<p 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></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">Variable: spi</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">Type: double</span></p>
<p 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></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"> 49248 values</span></p>
<p 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></p>
<p 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_-4943166290922558066Apple-tab-span" style="white-space:pre-wrap">        </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"><span style="font-variant-ligatures:no-common-ligatures">Coordinates: </span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"> run: [12..12]</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"> time: [190101..201412]</span></p>
<p 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></p>
<p 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></p>
<p 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></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"> units :<span class="m_-4943166290922558066Apple-tab-span" style="white-space:pre-wrap">        </span>nrun=12</span></p>
<p 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_-4943166290922558066Apple-tab-span" style="white-space:pre-wrap">        </span>SPI</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"> run :<span class="m_-4943166290922558066Apple-tab-span" style="white-space:pre-wrap">        </span>12</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"> _FillValue :<span class="m_-4943166290922558066Apple-tab-span" style="white-space:pre-wrap">        </span>-999</span></p>
<p 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't continue</font></span></p>
<p 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></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"><font color="#ff2600">fatal:["Execute.c":8640]:<wbr>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"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p 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></p></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_-4943166290922558066Apple-interchange-newline"><div><div>Send ncl-talk mailing list submissions to<br><span class="m_-4943166290922558066Apple-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_-4943166290922558066Apple-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 'help' to<br><span class="m_-4943166290922558066Apple-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_-4943166290922558066Apple-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 "Re: Contents of ncl-talk digest..."<br><br><br>Today'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 <<a href="mailto:sdafis@cc.uoi.gr" target="_blank">sdafis@cc.uoi.gr</a>><br>Subject: Re: [ncl-talk] Problem with gsn_add_text<br>To: Rick Brownrigg <<a href="mailto:brownrig@ucar.edu" target="_blank">brownrig@ucar.edu</a>><br>Cc: "<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>" <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>><br>Message-ID: <<a href="mailto:1492454911.58f50dffc9203@webmail.uoi.gr" target="_blank">1492454911.58f50dffc9203@<wbr>webmail.uoi.gr</a>><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 <<a href="mailto:brownrig@ucar.edu" target="_blank">brownrig@ucar.edu</a>>:<br><br><blockquote type="cite">Hi Stavros,<br><br>I don't know for certain, but I suspect you need to assign the _FillValue<br>to the string array "points" that you constructed from "t2" (I don'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 <<a href="mailto:sdafis@cc.uoi.gr" target="_blank">sdafis@cc.uoi.gr</a>> 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>&#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.&#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("%3.0f", t2)<br>;points = ""+t2(:,:)+""<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 <<a href="mailto:jgmsantos@gmail.com" target="_blank">jgmsantos@gmail.com</a>><br>Subject: [ncl-talk] Problem with contour plot<br>To: NCL <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>><br>Message-ID:<br><span class="m_-4943166290922558066Apple-tab-span" style="white-space:pre-wrap">        </span><CAH+t_<wbr>hMaRUDHM0wMkLC9cz2pFmMYGXgGC+<wbr>X+bcxDLo=+<a href="mailto:8fgWQg@mail.gmail.com" target="_blank">8fgWQg@mail.gmail.<wbr>com</a>><br>Content-Type: text/plain; charset="utf-8"<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 <<a href="mailto:brownrig@ucar.edu" target="_blank">brownrig@ucar.edu</a>><br>Subject: Re: [ncl-talk] Problem with gsn_add_text<br>To: Stavros Dafis <<a href="mailto:sdafis@cc.uoi.gr" target="_blank">sdafis@cc.uoi.gr</a>><br>Cc: "<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>" <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>><br>Message-ID:<br><span class="m_-4943166290922558066Apple-tab-span" style="white-space:pre-wrap">        </span><CAGKRhbHX1v-1sJ3G=<a href="mailto:QrXGA%2B0wSJ2KKsBB_7GqbCnp9krh9fkkQ@mail.gmail.com" target="_blank">QrXGA+<wbr>0wSJ2KKsBB_7GqbCnp9krh9fkkQ@<wbr>mail.gmail.com</a>><br>Content-Type: text/plain; charset="utf-8"<br><br>Hi,<br><br>You used -1 as _FillValue for variable "t2". 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 "points" from t2 as "%3.0f", so that any data values<br>in t2 that were -1 are now " -1", and thus it seems your _FillValue should<br>be " -1". Did you do this, and do the types between data and _FillValue<br>agree everywhere?<br><br>If that'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 <<a href="mailto:sdafis@cc.uoi.gr" target="_blank">sdafis@cc.uoi.gr</a>> 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 <<a href="mailto:brownrig@ucar.edu" target="_blank">brownrig@ucar.edu</a>>:<br><br><blockquote type="cite">Hi Stavros,<br><br>I don't know for certain, but I suspect you need to assign the _FillValue<br>to the string array "points" that you constructed from "t2" (I don'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 <<a href="mailto:sdafis@cc.uoi.gr" target="_blank">sdafis@cc.uoi.gr</a>><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>&#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.&#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("%3.0f", t2)<br>;points = ""+t2(:,:)+""<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 <<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a>><br>Subject: Re: [ncl-talk] Problem with contour plot<br>To: Guilherme Martins <<a href="mailto:jgmsantos@gmail.com" target="_blank">jgmsantos@gmail.com</a>><br>Cc: NCL <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>><br>Message-ID:<br><span class="m_-4943166290922558066Apple-tab-span" style="white-space:pre-wrap">        </span><<a href="mailto:CACNN_CJz1yvpMXMABZ8FhSEov1T0qN63rzsNBBVXBhLos3UKjg@mail.gmail.com" target="_blank">CACNN_<wbr>CJz1yvpMXMABZ8FhSEov1T0qN63rzs<wbr>NBBVXBhLos3UKjg@mail.gmail.com</a><wbr>><br>Content-Type: text/plain; charset="utf-8"<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 "blocky" 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'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't want to see graphically. That's what example 21 is showing.<br><br>--Mary<br><br><br>On Mon, Apr 17, 2017 at 1:00 PM, Guilherme Martins <<a href="mailto:jgmsantos@gmail.com" target="_blank">jgmsantos@gmail.com</a>><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> <+55%2012%203186-9205> || Celular<br>(TIM): <a href="tel:+55%2012%2098111-4292" value="+5512981114292" target="_blank">+55 12 98111-4292</a> <+55%2012%2098111-4292><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 <<a href="mailto:wenguanhuan@163.com" target="_blank">wenguanhuan@163.com</a>><br>Subject: [ncl-talk] how to draw this kind of plot<br>To: ncl-list <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>><br>Message-ID: <<a href="mailto:5de3ed86.9f7f.15b7ff6fb6f.Coremail.wenguanhuan@163.com" target="_blank">5de3ed86.9f7f.15b7ff6fb6f.<wbr>Coremail.wenguanhuan@163.com</a>><br>Content-Type: text/plain; charset="gbk"<br><br>Hi all,<br> 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>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></blockquote></div><br></div>