<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="">I’m not sure how those lines came to be. Read the documentation and the examples on the documentation page. They are usually very helpful to understand what functions are doing and how to interact with them.<div class=""><br class=""></div><div class="">Here is a greatly reduced version of your script to focus on getind_latlon2d() function and output. Make sure you understand what is happening before copy pasting into your original script. </div><div class=""><br class=""></div><div class="">if in doubt run it interactively line by line, with extensive use of print() and printVarSummary() to understand the variable types and dimensions. </div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Alan. </div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><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="">;; The above lines aren't necessary if you're using a current version of ncl. </div><div class=""><br class=""></div><div class="">begin</div><div class=""><br class=""></div><div class="">;**************************************************</div><div class="">; Set file paths and plot specifics</div><div class="">;**************************************************</div><div class=""><br class=""></div><div class="">print("Setting File Paths")</div><div class=""><br class=""></div><div class="">;***** File Paths and Names *****</div><div class=""><br class=""></div><div class="">filen = "b.e12.B1850C5CN.f09_g16.YD13ka.003.pop.SFWF.1_cat_840.nc"</div><div class="">file_loc = "/glade/scratch/hughlett/csm/b.e12.B1850C5CN.f09_g16.YD13ka.003/ocn/tseries/cat/"</div><div class="">grid = "b.e12.B1850C5CN.f09_g16.YD13ka.003.pop.h.0810.nc"</div><div class="">grid_loc = "/glade/scratch/hughlett/csm/b.e12.B1850C5CN.f09_g16.YD13ka.003/ocn/hist/"</div><div class="">;**************************************************</div><div class="">; Read In and Process Data</div><div class="">;**************************************************</div><div class=""><br class=""></div><div class="">print("Reading in and processing data")</div><div class="">;***** Read in All Variables *****</div><div class=""><br class=""></div><div class="">fvar = addfile(file_loc+filen,"r")</div><div class="">fgrid = addfile(grid_loc+grid,"r")</div><div class=""><br class=""></div><div class="">lat2d = fgrid->TLAT</div><div class="">lon2d = fgrid->TLONG</div><div class=""><br class=""></div><div class="">lat = 50</div><div class="">lon = 28</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">;***** Get indicies of the point to plot *****</div><div class=""><br class=""></div><div class="">ll_ind = getind_latlon2d( lat2d, lon2d, lat, lon)</div><div class=""><br class=""></div><div class="">print(ll_ind) ; should be a 1x2 array or dimsizes(lat) x 2 </div><div class=""><br class=""></div><div class="">do k=0,dimsizes(lat)-1 ;; single iteration in this case. k=0</div><div class=""> n = ll_ind(k,0) ;; this is how you should retrieve the relevant index for lat</div><div class=""> m = ll_ind(k,1) ;; and for lon</div><div class=""> print(lat2d(n,m)+" "+lon2d(n,m)) ;; check that n & m reference the right location. should be close to 50 28</div><div class="">end do</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">lat_index = ll_ind(0,0)</div><div class="">lon_index = ll_ind(0,1)</div><div class=""><br class=""></div><div class="">printVarSummary(var0(:,lat_index,lon_index) )</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">end</div></div><div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 2 Feb 2017, at 15:15, Hughlett, Taylor M <<a href="mailto:taylor.hughlett@uta.edu" class="">taylor.hughlett@uta.edu</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; font-size: 12px; font-family: Helvetica, sans-serif;" class="">
<div class="">
<div class="">
<div class="">Hello again,</div>
<div class=""><br class="">
</div>
<div class="">Thank you both for the info, and I seem to have fixed that issue, but now it appears I am back to square 1. The error reads:</div>
<div class="">
<div class="">fatal:No coordinate variable exists for dimension (lat) in variable (ll_ind)</div>
</div>
<div class=""><br class="">
</div>
<div class="">As always, full code is below the sig.</div>
<div class=""><br class="">
</div>
<div class="">Thanks again,</div>
<div class="">Taylor M Hughlett, Ph.D.<br class="">
UTA Earth and Environmental Sciences<br class="">
500 Yates St.<br class="">
Geoscience Bldg Rm 117<br class="">
Arlington, TX 76013-0049</div>
</div>
</div>
<div class=""><br class="">
</div>
<div class="">
<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="">;**************************************************</div>
<div class="">; Set file paths and plot specifics</div>
<div class="">;**************************************************</div>
<div class=""><br class="">
</div>
<div class="">print("Setting File Paths")</div>
<div class=""><br class="">
</div>
<div class="">;***** File Paths and Names *****</div>
<div class=""><br class="">
</div>
<div class="">case = "b.e12.B1850C5CN.f09_g16.YD13ka.003"</div>
<div class="">filen = "b.e12.B1850C5CN.f09_g16.YD13ka.003.pop.SFWF.1_cat_840.nc"</div>
<div class="">file_loc = "/glade/scratch/hughlett/csm/b.e12.B1850C5CN.f09_g16.YD13ka.003/ocn/tseries/cat/"</div>
<div class="">grid = "b.e12.B1850C5CN.f09_g16.YD13ka.003.pop.h.0810.nc"</div>
<div class="">grid_loc = "/glade/scratch/hughlett/csm/b.e12.B1850C5CN.f09_g16.YD13ka.003/ocn/hist/"</div>
<div class="">plot_loc = "/glade/scratch/hughlett/plots/b.e12.B1850C5CN.f09_g16.YD13ka.003/timeseries"</div>
<div class=""><br class="">
</div>
<div class="">;***** Variable to Plot *****</div>
<div class=""><br class="">
</div>
<div class="">var = "SFWF"</div>
<div class=""><br class="">
</div>
<div class="">;***** Text for Plot *****</div>
<div class=""><br class="">
</div>
<div class="">CenterString = "Surface Freshwater Flux"</div>
<div class="">YAxisString = "SFWF (Sverdrups)"</div>
<div class="">XAxisString = "Years"</div>
<div class=""><br class="">
</div>
<div class="">;***** Start and End Time for Plot *****</div>
<div class=""><br class="">
</div>
<div class="">plot_begin = 0001</div>
<div class="">plot_end = 840</div>
<div class=""><br class="">
</div>
<div class="">;***** Data Options (0 = no, 1 = yes) *****</div>
<div class=""><br class="">
</div>
<div class="">smooth = 0</div>
<div class="">dtrd = 0</div>
<div class="">ncwrite = 0</div>
<div class=""><br class="">
</div>
<div class="">;**************************************************</div>
<div class="">; Read In and Process Data</div>
<div class="">;**************************************************</div>
<div class=""><br class="">
</div>
<div class="">print("Reading in and processing data")</div>
</div>
<div class="">
<div class="">;***** Read in All Variables *****</div>
<div class=""><br class="">
</div>
<div class="">fvar = addfile(file_loc+filen,"r")</div>
<div class="">fgrid = addfile(grid_loc+grid,"r")</div>
<div class=""><br class="">
</div>
<div class="">var0 = fvar->SFWF(:,:,:)</div>
<div class="">lat2d = fgrid->TLAT</div>
<div class="">lon2d = fgrid->TLONG</div>
<div class="">salt = fgrid->SALT</div>
<div class=""><br class="">
</div>
<div class="">lat = 50</div>
<div class="">lon = 28</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">;***** Create a More Plottable Timeline *****</div>
<div class=""><br class="">
</div>
<div class="">years = ispan(plot_begin,plot_end,1)</div>
<div class="">nyrs = dimsizes(years)</div>
<div class=""><br class="">
</div>
<div class="">;***** Get indicies of the point to plot *****</div>
<div class=""><br class="">
</div>
<div class="">ll_ind = getind_latlon2d( lat2d, lon2d, lat, lon)</div>
<div class=""><br class="">
</div>
<div class="">ll_ind!0 = "lat"</div>
<div class="">ll_ind!1 = "lon"</div>
<div class=""><br class="">
</div>
<div class="">copy_VarCoords_n(salt,ll_ind,(/2,3/))</div>
<div class=""><br class="">
</div>
<div class="">;**************************************************</div>
<div class="">; Open workstation, set plot resources, and plot</div>
<div class="">;**************************************************</div>
<div class=""><br class="">
</div>
<div class="">print("Creating Plot")</div>
<div class=""><br class="">
</div>
<div class="">;***** Create Plot Name *****</div>
<div class=""><br class="">
</div>
<div class="">pname = var + "." + case + "_" + "timeseries_0m" + plot_begin + "-" + plot_end</div>
<div class=""><br class="">
</div>
<div class="">;***** Open workstation *****</div>
<div class=""><br class="">
</div>
<div class="">wks = gsn_open_wks("ps",plot_loc+pname)</div>
<div class=""><br class="">
</div>
<div class="">;***** Set Resources *****</div>
<div class=""><br class="">
</div>
<div class="">res = True</div>
<div class="">res@gsnMaximize = True</div>
<div class="">res@gsnFrame = False</div>
<div class="">res@gsnDraw = False</div>
<div class="">res@vpHeightF = .23</div>
<div class="">res@vpWidthF = .783</div>
<div class="">res@tiXAxisFontHeightF = .015</div>
<div class="">res@tiYAxisFontHeightF = .015</div>
<div class="">res@tmYLLabelFontHeightF = .015</div>
<div class="">res@tmXBLabelFontHeightF = .015</div>
<div class="">res@gsnLeftString = " "</div>
<div class="">res@gsnRightString = " "</div>
<div class="">res@xyLineColor = (/"black"/)</div>
</div>
<div class="">
<div class="">res@gsnCenterString = CenterString</div>
<div class="">res@tiYAxisString = YAxisString</div>
<div class="">res@tiXAxisString = XAxisString</div>
<div class="">res@trYMinF = 15</div>
<div class="">res@trYMaxF = 19</div>
<div class=""><br class="">
</div>
<div class="">;***** Create New Plot *****</div>
<div class=""><br class="">
</div>
<div class="">plot = new(1,graphic)</div>
<div class="">plot(0) = gsn_csm_xy (wks,years,var0(:,ll_ind&lat,ll_ind&lon),res)</div>
<div class=""><br class="">
</div>
<div class="">print("Plot Created")</div>
<div class=""><br class="">
</div>
<div class="">end</div>
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<span id="OLK_SRC_BODY_SECTION" class="">
<div style="font-family: Calibri; font-size: 11pt; text-align: left; border-width: 1pt medium medium; border-style: solid none none; padding: 3pt 0in 0in; border-top-color: rgb(181, 196, 223);" class="">
<span style="font-weight:bold" class="">From: </span>Alan Brammer <<a href="mailto:abrammer@albany.edu" class="">abrammer@albany.edu</a>><br class="">
<span style="font-weight:bold" class="">Date: </span>Thursday, February 2, 2017 at 11:20 AM<br class="">
<span style="font-weight:bold" class="">To: </span>"Hughlett, Taylor M" <<a href="mailto:taylor.hughlett@uta.edu" class="">taylor.hughlett@uta.edu</a>><br class="">
<span style="font-weight:bold" class="">Cc: </span>"<a href="mailto:ncl-talk@ucar.edu" class="">ncl-talk@ucar.edu</a>" <<a href="mailto:ncl-talk@ucar.edu" class="">ncl-talk@ucar.edu</a>><br class="">
<span style="font-weight:bold" class="">Subject: </span>Re: [ncl-talk] Dimension (nlon) of (var0) does not have an associated coordinate variable<br class="">
</div>
<div class=""><br class="">
</div>
<div class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
Yeah, Guido is right.
<div class=""><br class="">
</div>
<div class="">I didn’t test the code I wrote. Do a printVarSummary(ll_ind) and read the docs and you’ll see <span style="font-family: Helvetica, sans-serif;" class="">getind_latlon2d always returns a 2-d array. </span></div>
<div class=""><font face="Helvetica,sans-serif" class=""><br class="">
</font></div>
<div class=""><font face="Helvetica,sans-serif" class="">for a single point it should be (0,0) and (0,1) for lat | lon indices. Examples in the docs show you how to double check that it is all working as desired. </font></div>
<div class=""><font face="Helvetica,sans-serif" class=""><br class="">
</font></div>
<div class=""><font face="Helvetica,sans-serif" class=""><br class="">
</font></div>
<div class=""><font face="Helvetica,sans-serif" class="">Alan.</font></div>
<div class=""><font face="Helvetica,sans-serif" class=""><br class="">
</font></div>
<div class=""><font face="Helvetica,sans-serif" class=""><br class="">
</font>
<div class="">
<blockquote type="cite" class="">
<div class="">On 2 Feb 2017, at 12:17, Guido Cioni <<a href="mailto:guidocioni@gmail.com" class="">guidocioni@gmail.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
I'm pretty sure NCL is referring to <font face="Menlo" class="">ll_ind</font>, which is 2-Dimensional :) (see <a href="https://www.ncl.ucar.edu/Document/Functions/Contributed/getind_latlon2d.shtml" class="">https://www.ncl.ucar.edu/Document/Functions/Contributed/getind_latlon2d.shtml</a>).<br class="">
<div class="">
<div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<br class="Apple-interchange-newline">
Guido Cioni</div>
<div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<a href="http://guidocioni.altervista/" class="">http://guidocioni.altervista</a>.org</div>
</div>
<br class="">
<div class="">
<blockquote type="cite" class="">
<div class="">On 02 Feb 2017, at 18:14, Hughlett, Taylor M <<a href="mailto:taylor.hughlett@uta.edu" class="">taylor.hughlett@uta.edu</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; font-size: 12px; font-family: Helvetica, sans-serif;" class="">
<div class="">
<div class="">Good afternoon,</div>
<div class=""><br class="">
</div>
<div class="">Thank you very much for the suggestion! I have used the function that you recommended, but now I am receiving the following error:</div>
<div class=""><br class="">
</div>
<div class="">Number of subscripts do not match number of dimensions of variable,(1) Subscripts used, (2) Subscripts expected</div>
<div class=""><br class="">
</div>
<div class="">It occurs at the line where I actually create the plot:</div>
<div class=""><br class="">
</div>
<div class="">plot(0) = gsn_csm_xy (wks,years,var0(:,ll_ind(0),ll_ind(1)),res)</div>
<div class=""><br class="">
</div>
<div class="">I have checked that var0 is three dimensional, and I have specified three subscripts required…</div>
<div class=""><br class="">
</div>
<div class="">Have I missed something?</div>
<div class=""><br class="">
</div>
<div class="">Taylor M Hughlett, Ph.D.<br class="">
UTA Earth and Environmental Sciences<br class="">
500 Yates St.<br class="">
Geoscience Bldg Rm 117<br class="">
Arlington, TX 76013-0049</div>
</div>
<div class=""><br class="">
</div>
<div class="">The Full Code:</div>
<div class=""><br class="">
</div>
<div class="">
<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="">;**************************************************</div>
<div class="">; Set file paths and plot specifics</div>
<div class="">;**************************************************</div>
<div class=""><br class="">
</div>
<div class="">print("Setting File Paths")</div>
<div class=""><br class="">
</div>
<div class="">;***** File Paths and Names *****</div>
<div class=""><br class="">
</div>
<div class="">case = "b.e12.B1850C5CN.f09_g16.YD13ka.003"</div>
<div class="">filen = "b.e12.B1850C5CN.f09_g16.YD13ka.003.pop.SFWF.1_cat_840.nc"</div>
<div class="">file_loc = "/glade/scratch/hughlett/csm/b.e12.B1850C5CN.f09_g16.YD13ka.003/ocn/tseries/cat/"</div>
<div class="">grid = "b.e12.B1850C5CN.f09_g16.YD13ka.003.pop.h.0810.nc"</div>
<div class="">grid_loc = "/glade/scratch/hughlett/csm/b.e12.B1850C5CN.f09_g16.YD13ka.003/ocn/hist/"</div>
<div class="">plot_loc = "/glade/scratch/hughlett/plots/b.e12.B1850C5CN.f09_g16.YD13ka.003/timeseries"</div>
<div class=""><br class="">
</div>
<div class="">;***** Variable to Plot *****</div>
<div class=""><br class="">
</div>
<div class="">var = "SFWF"</div>
<div class=""><br class="">
</div>
<div class="">;***** Text for Plot *****</div>
<div class=""><br class="">
</div>
<div class="">CenterString = "Surface Freshwater Flux"</div>
<div class="">YAxisString = "SFWF (Sverdrups)"</div>
<div class="">XAxisString = "Years"</div>
<div class=""><br class="">
</div>
<div class="">;***** Start and End Time for Plot *****</div>
<div class=""><br class="">
</div>
<div class="">plot_begin = 0001</div>
<div class="">plot_end = 840</div>
<div class=""><br class="">
</div>
<div class="">;***** Data Options (0 = no, 1 = yes) *****</div>
<div class=""><br class="">
</div>
<div class="">smooth = 0</div>
<div class="">dtrd = 0</div>
<div class="">ncwrite = 0</div>
<div class=""><br class="">
</div>
<div class="">;**************************************************</div>
<div class="">; Read In and Process Data</div>
<div class="">;**************************************************</div>
<div class=""><br class="">
</div>
<div class="">print("Reading in and processing data")</div>
</div>
<div class="">
<div class="">;***** Read in All Variables *****</div>
<div class=""><br class="">
</div>
<div class="">fvar = addfile(file_loc+filen,"r")</div>
<div class="">fgrid = addfile(grid_loc+grid,"r")</div>
<div class=""><br class="">
</div>
<div class="">var0 = fvar->SFWF(:,:,:)</div>
<div class="">lat2d = fgrid->TLAT</div>
<div class="">lon2d = fgrid->TLONG</div>
<div class=""><br class="">
</div>
<div class="">lat = 50</div>
<div class="">lon = 28</div>
<div class=""><br class="">
</div>
<div class="">;***** Create a More Plottable Timeline *****</div>
<div class=""><br class="">
</div>
<div class="">years = ispan(plot_begin,plot_end,1)</div>
<div class="">nyrs = dimsizes(years)</div>
<div class=""><br class="">
</div>
<div class="">;***** Get indicies of the point to plot *****</div>
<div class=""><br class="">
</div>
<div class="">ll_ind = getind_latlon2d( lat2d, lon2d, lat, lon)</div>
<div class=""><br class="">
</div>
<div class="">;**************************************************</div>
<div class="">; Open workstation, set plot resources, and plot</div>
<div class="">;**************************************************</div>
<div class=""><br class="">
</div>
<div class="">print("Creating Plot")</div>
<div class=""><br class="">
</div>
<div class="">;***** Create Plot Name *****</div>
<div class=""><br class="">
</div>
<div class="">pname = var + "." + case + "_" + "timeseries_0m" + plot_begin + "-" + plot_end</div>
<div class=""><br class="">
</div>
<div class="">;***** Open workstation *****</div>
<div class=""><br class="">
</div>
<div class="">wks = gsn_open_wks("ps",plot_loc+pname)</div>
<div class=""><br class="">
</div>
<div class="">;***** Set Resources *****</div>
<div class=""><br class="">
</div>
<div class="">res = True</div>
<div class="">res@gsnMaximize = True</div>
<div class="">res@gsnFrame = False</div>
<div class="">res@gsnDraw = False</div>
<div class="">res@vpHeightF = .23</div>
<div class="">res@vpWidthF = .783</div>
<div class="">res@tiXAxisFontHeightF = .015</div>
<div class="">res@tiYAxisFontHeightF = .015</div>
<div class="">res@tmYLLabelFontHeightF = .015</div>
<div class="">res@tmXBLabelFontHeightF = .015</div>
<div class="">res@gsnLeftString = " "</div>
<div class="">res@gsnRightString = " "</div>
<div class="">res@xyLineColor = (/"black"/)</div>
<div class="">res@gsnCenterString = CenterString</div>
<div class="">res@tiYAxisString = YAxisString</div>
<div class="">res@tiXAxisString = XAxisString</div>
<div class="">res@trYMinF = 15</div>
<div class="">res@trYMaxF = 19</div>
<div class=""><br class="">
</div>
<div class="">;***** Create New Plot *****</div>
</div>
<div class="">
<div class=""><br class="">
</div>
<div class="">plot = new(1,graphic)</div>
<div class="">plot(0) = gsn_csm_xy (wks,years,var0(:,ll_ind(0),ll_ind(1)),res)</div>
<div class=""><br class="">
</div>
<div class="">print("Plot Created")</div>
<div class=""><br class="">
</div>
<div class="">end</div>
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<span id="OLK_SRC_BODY_SECTION" class="">
<div style="font-family: Calibri; font-size: 11pt; text-align: left; border-width: 1pt medium medium; border-style: solid none none; padding: 3pt 0in 0in; border-top-color: rgb(181, 196, 223);" class="">
<span style="font-weight:bold" class="">From: </span>Alan Brammer <<a href="mailto:abrammer@albany.edu" class="">abrammer@albany.edu</a>><br class="">
<span style="font-weight:bold" class="">Date: </span>Wednesday, February 1, 2017 at 2:15 PM<br class="">
<span style="font-weight:bold" class="">To: </span>"Hughlett, Taylor M" <<a href="mailto:taylor.hughlett@uta.edu" class="">taylor.hughlett@uta.edu</a>><br class="">
<span style="font-weight:bold" class="">Cc: </span>"<a href="mailto:ncl-talk@ucar.edu" class="">ncl-talk@ucar.edu</a>" <<a href="mailto:ncl-talk@ucar.edu" class="">ncl-talk@ucar.edu</a>><br class="">
<span style="font-weight:bold" class="">Subject: </span>Re: [ncl-talk] Dimension (nlon) of (var0) does not have an associated coordinate variable<br class="">
</div>
<div class=""><br class="">
</div>
<div class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
If you were plotting a map, like Barry Lynn's similar question today also on ncl-talk, you would want to do:
<div class=""><br class="">
</div>
<div class=""><span style="font-family: Helvetica, sans-serif;" class="">var0@lon2d = </span><span style="font-family: Helvetica, sans-serif;" class="">lon2d</span>
<div class="" style="font-family: Helvetica, sans-serif;">var0@lat2d = lat2d</div>
</div>
<div class="" style="font-family: Helvetica, sans-serif;"><br class="">
</div>
<div class="" style="font-family: Helvetica, sans-serif;">The below lines are not needed. </div>
<div class=""><font face="Helvetica,sans-serif" class=""> ; LON2D = lon2d(::1,::1) ;; I don’t think (::1,::1) does anything, </font><span style="font-family: Helvetica, sans-serif;" class=""> it will take all values with an increment of 1, i.e. the whole array. </span></div>
<div class="">
<div class="" style="font-family: Helvetica, sans-serif;"> ; LAT2D = lat2d(::1,::1)<span class="Apple-tab-span" style="white-space:pre"></span> ; so this is just redundant characters which aren’t needed. </div>
</div>
<div class="">You don’t need to replicate a variable that already exists. </div>
<div class=""><br class="">
</div>
<div class="">
<div class="" style="font-family: Helvetica, sans-serif;">To set coordinate variables named nlon and nlat, you want to use the & syntax not the @ syntax, but coordinate subscripting won’t work with 2d coordinates anyway. </div>
<div class="" style="font-family: Helvetica, sans-serif;"><br class="">
</div>
<div class="" style="font-family: Helvetica, sans-serif;">So instead get the index of the point you want using:</div>
<div class=""><font face="Helvetica,sans-serif" class=""><a href="https://www.ncl.ucar.edu/Document/Functions/Contributed/getind_latlon2d.shtml" class="">https://www.ncl.ucar.edu/Document/Functions/Contributed/getind_latlon2d.shtml</a></font></div>
<div class="">e.g.</div>
<div class=""><br class="">
</div>
<div class=""><font face="Helvetica,sans-serif" class="">ll_ind = getind_latlon2d( lat2d, lon2d, </font><span style="font-family: Helvetica, sans-serif;" class="">28,50)</span></div>
<div class=""><font face="Helvetica,sans-serif" class="">…</font></div>
<div class=""><font face="Helvetica,sans-serif" class="">… </font></div>
<div class=""><span style="font-family: Helvetica, sans-serif;" class="">plot(0) = gsn_csm_xy (wks, years, var0(:, ll_ind(0), ll_ind(1) ), res)</span></div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">Good luck, </div>
<div class=""><br class="">
</div>
<div class="">Alan</div>
<div class=""><br class="">
</div>
<br class="">
<div class="">
<div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div style="font-family: Helvetica; font-style: normal; font-variant-ligatures: normal; font-variant-position: normal; font-variant-caps: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px;">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
##############################<br class="">
Alan Brammer,
<div class="">Post-Doc Researcher</div>
<div class=""><br class="">
</div>
<div class="">Department of Atmospheric and Environmental Sciences,<br class="">
University at Albany, State University of New York, Albany, NY, 12222
<div class=""><a href="mailto:abrammer@albany.edu" class="">abrammer@albany.edu</a><br class="">
##############################</div>
</div>
</div>
</span></div>
</div>
</div>
</div>
</div>
</div>
</span></div>
_______________________________________________<br class="">
ncl-talk mailing list<br class="">
<a href="mailto:ncl-talk@ucar.edu" class="">ncl-talk@ucar.edu</a><br class="">
List instructions, subscriber options, unsubscribe:<br class="">
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" class="">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br class="">
</div>
</blockquote>
</div>
<br class="">
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
</div>
</div>
</span>
</div>
</div></blockquote></div><br class=""></div></body></html>