<div dir="ltr">Hi,<div><br></div><div>I think you are close. By convention and definition, a coordinate variable is a 1D array with its dimension named the same as its variable. So when you set up the variable "u", it should look something like:</div><div><br></div><div><br></div><div><span style="font-size:13px"><font face="times new roman"><div style="font-style:italic;color:rgb(0,0,0);font-size:medium"> lat := b->Latitude <span style="font-family:arial,sans-serif;font-size:small;font-style:normal;color:rgb(34,34,34)">; set up coordinate variables....</span></div></font></span><span style="font-size:13px"><font face="times new roman"><div style="font-style:italic;font-size:medium"><font color="#ff0000">lat!0 = "lat"</font></div><div style="font-style:italic;color:rgb(0,0,0);font-size:medium"> lon := b->Longitude</div><div style="font-style:italic;font-size:medium"><span style="color:rgb(0,0,0);background-color:rgb(255,0,0)">l</span><span style="background-color:rgb(255,255,255)"><font color="#ff0000">on!0 = "lon"</font></span></div><div style="font-style:italic;font-size:medium"><br></div><div style="font-style:italic;color:rgb(0,0,0);font-size:medium"> u!0 = "lat" ; assign coordinates to data variable...</div></font></span><span style="font-size:13px"><font face="times new roman"><div style="font-style:italic;color:rgb(0,0,0);font-size:medium"> u!1 = "lon"</div><div style="font-style:italic;color:rgb(0,0,0);font-size:medium"> u&lat = lat</div><div style="font-style:italic;color:rgb(0,0,0);font-size:medium"> u&lon = lon</div><div style="font-style:italic;color:rgb(0,0,0);font-size:medium"> u&lon@units = "degrees_east"</div><div style="font-style:italic;color:rgb(0,0,0);font-size:medium"> u&lat@units = "degrees_north"</div><div style="font-style:italic;color:rgb(0,0,0)"><br></div><div style="color:rgb(0,0,0)"><span style="font-family:arial,sans-serif;font-size:small;color:rgb(34,34,34)">The same applies to your variable "s" earlier in the script. I'm a bit confused by the mixed case lat/LAT and lon/LON -- you want to make sure everything is consistent.</span></div><div style="color:rgb(0,0,0)"><span style="font-family:arial,sans-serif;font-size:small;color:rgb(34,34,34)"><br></span></div><div style="color:rgb(0,0,0)"><span style="font-family:arial,sans-serif;font-size:small;color:rgb(34,34,34)">Hope that helps...</span></div><div style="color:rgb(0,0,0)"><span style="font-family:arial,sans-serif;font-size:small;color:rgb(34,34,34)">Rick</span></div></font></span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 13, 2016 at 11:55 PM, Sunil Oulkar <span dir="ltr"><<a href="mailto:sunil.oulkar16@gmail.com" target="_blank">sunil.oulkar16@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 dir="ltr"><font color="#000000" style="font-size:12.8px"><em style="font-family:'times new roman';font-size:medium">Hello, </em><br style="font-family:'times new roman';font-size:medium"><em style="font-family:'times new roman';font-size:medium">I have some problem when defining coordinate variables, the error message is: </em></font><div style="font-size:12.8px"><i><font color="#000000"><br style="font-family:'times new roman';font-size:medium"></font></i><div><em><font color="#000000"><div><div><font face="times new roman" size="3">fatal:No coordinate variable exists for dimension (lat) in variable (s)</font></div><div><font face="times new roman" size="3">fatal:["Execute.c":8567]:Execu<wbr>te: Error occurred at or near line 51 in file contour_slope.ncl</font></div></div><div style="font-family:'times new roman';font-size:medium"><br></div><div style="font-family:'times new roman';font-size:medium"><em>My code is: </em><br></div><div style="font-family:'times new roman';font-size:medium"><em><br></em></div><div><font face="times new roman"><div style="font-size:medium">load "/usr/local/ncl/lib/ncarg/ncls<wbr>cripts/csm/gsn_code.ncl" </div><div style="font-size:medium">load "/usr/local/ncl/lib/ncarg/ncls<wbr>cripts/csm/gsn_csm.ncl" </div><div style="font-size:medium">load "/usr/local/ncl/lib/ncarg/ncls<wbr>cripts/csm/contributed.ncl"</div><div style="font-size:medium">load "/usr/local/ncl/lib/ncarg/ncls<wbr>cripts/csm/shea_util.ncl"</div><div style="font-size:medium"><br></div><div style="font-size:medium">begin</div><div style="font-size:medium"> a = addfile("<a href="http://elevation_0.5.nc/" target="_blank">elevation_0.5.nc</a>","r"<wbr>) </div><div style="font-size:medium"> TOPO = a->E({28:36},{70:78})</div><div style="font-size:medium"> </div><div style="font-size:medium"> LON = a->LONGITUDE({70:78})</div><div style="font-size:medium"> LAT = a->LATITUDE({28:36})</div><div style="font-size:medium"><br></div><div style="font-size:medium"> lats = LAT({28.2:35.9})</div><div style="font-size:medium"> lons = LON({70.2:77.9})</div><div style="font-size:medium"><br></div><div style="font-size:medium"> nLAT = dimsizes(LAT)-2</div><div style="font-size:medium"> nLON = dimsizes(LON)-2</div><div style="font-size:medium"><br></div><div style="font-size:medium"> sres = 50000 ;5600</div><div style="font-size:medium"><br></div><div style="font-size:medium"> s = new((/nLAT+1,nLON+1/),double)</div><div style="font-size:medium"> </div><div style="font-size:medium"> do i = 1,nLAT,1 </div><div style="font-size:medium"> do j = 1,nLON,1</div><div style="font-size:medium"> <span style="white-space:pre-wrap">        </span> </div><div style="font-size:medium"> TOPOto = TOPO(i+1,j)</div><div style="font-size:medium"> TOPObo = TOPO(i-1,j)</div><div style="font-size:medium"> </div><div style="font-size:medium"> TOPOri = TOPO(i,j+1)</div><div style="font-size:medium"> TOPOle = TOPO(i,j-1)</div><div style="font-size:medium"> </div><div style="font-size:medium"> s(i,j) = sqrt((((TOPOri-TOPOle)/(2*sres<wbr>))^2)+((TOPOto-TOPObo)/(2*sres<wbr>))^2)</div><div style="font-size:medium"> </div><div style="font-size:medium"> end do </div><div style="font-size:medium"> end do</div><div style="font-size:medium"><br></div><div><font size="3"> </font><font size="4"> s = tan(s)*100 </font></div><div style="font-size:medium"><br></div><div style="font-size:medium"> s!0 = "LAT"</div><div style="font-size:medium"> s!1 = "LON"</div><div style="font-size:medium"> s&lat = lats</div><div style="font-size:medium"> s&lon = lons</div><div style="font-size:medium"> s&lon@units = "degrees_east"</div><div style="font-size:medium"> s&lat@units = "degrees_north" </div><div style="font-size:medium"> </div><div style="font-size:medium"> b = addfile("<a href="http://lisotd_hrfc_v2.3.2014.nc/" target="_blank">LISOTD_HRFC_V2.3.2014<wbr>.nc</a>","r")</div><div style="font-size:medium"> u = b->HRFC_COM_FR</div><div style="font-size:medium"><br></div><div style="font-size:medium"> lat := b->Latitude</div><div style="font-size:medium"> lon := b->Longitude</div><div style="font-size:medium"> u!0 = "lat"</div><div style="font-size:medium"> u!1 = "lon"</div><div style="font-size:medium"> u&lat = lat</div><div style="font-size:medium"> u&lon = lon</div><div style="font-size:medium"> u&lon@units = "degrees_east"</div><div style="font-size:medium"> u&lat@units = "degrees_north"</div><div style="font-size:medium"> </div><div style="font-size:medium"> wks <span style="white-space:pre-wrap">        </span> = gsn_open_wks("x11","contour_sl<wbr>ope_NE")</div><div style="font-size:medium"> </div><div style="font-size:medium"> ;---Set resources</div><div style="font-size:medium"> </div><div style="font-size:medium"> res <span style="white-space:pre-wrap">                                </span>= True</div><div style="font-size:medium"> res@gsnDraw <span style="white-space:pre-wrap">                        </span>= False</div><div style="font-size:medium"> res@gsnFrame <span style="white-space:pre-wrap">                        </span>= False</div><div style="font-size:medium"> res@gsnMaximize <span style="white-space:pre-wrap">                </span>= True</div><div style="font-size:medium"> res@gsnAddCyclic <span style="white-space:pre-wrap">                </span>= False</div><div style="font-size:medium"> res@tiYAxisString <span style="white-space:pre-wrap">                </span>= "" ;"Longitude" </div><div style="font-size:medium"> res@gsnLeftString<span style="white-space:pre-wrap">                </span>= ""</div><div style="font-size:medium"> res@gsnRightString<span style="white-space:pre-wrap">                </span>= ""</div><div style="font-size:medium"> res@cnLevelSelectionMode<span style="white-space:pre-wrap">        </span>= "ExplicitLevels" ; set explicit contour levels </div><div style="font-size:medium"> res@cnLevels <span style="white-space:pre-wrap">                        </span>= ((/ 0.4, 0.8, 1, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30/)) ; set levels </div><div style="font-size:medium"> res@cnFillOn <span style="white-space:pre-wrap">                        </span>= True</div><div style="font-size:medium"> res@cnFillPalette <span style="white-space:pre-wrap">                </span>= "precip3_16lev"</div><div style="font-size:medium"> res@cnLinesOn <span style="white-space:pre-wrap">                        </span>= False</div><div style="font-size:medium"> res@mpMinLatF <span style="white-space:pre-wrap">                        </span>= 28 ; Zoom in on map.</div><div style="font-size:medium"> res@mpMaxLatF <span style="white-space:pre-wrap">                        </span>= 36</div><div style="font-size:medium"> res@mpMinLonF <span style="white-space:pre-wrap">                        </span>= 70</div><div style="font-size:medium"> res@mpMaxLonF <span style="white-space:pre-wrap">                        </span>= 78</div><div style="font-size:medium"> res@mpDataBaseVersion <span style="white-space:pre-wrap">        </span>= "MediumRes"</div><div style="font-size:medium"> res@mpFillOn <span style="white-space:pre-wrap">                        </span>= False</div><div style="font-size:medium"> res@pmTickMarkDisplayMode<span style="white-space:pre-wrap">        </span>= "Always"</div><div style="font-size:medium"> res@mpFillDrawOrder <span style="white-space:pre-wrap">        </span> <span style="white-space:pre-wrap">        </span>="PreDraw"</div><div style="font-size:medium"> res@lbOrientation<span style="white-space:pre-wrap">        </span> = "vertical" </div><div style="font-size:medium"> res@amJust = "TopRight"</div><div style="font-size:medium"> res@pmLabelBarOrthogonalPosF<span style="white-space:pre-wrap">        </span>= 0.02</div><div style="font-size:medium"> res@lbLabelFontHeightF<span style="white-space:pre-wrap">                </span>= 0.02</div><div style="font-size:medium"> res@lbLabelAutoStride <span style="white-space:pre-wrap">                </span>= True</div><div style="font-size:medium"> res@pmLabelBarWidthF<span style="white-space:pre-wrap">                </span>= 0.1</div><div style="font-size:medium"> res@tiXAxisFontHeightF <span style="white-space:pre-wrap">        </span>= 0.025</div><div style="font-size:medium"> res@tiYAxisFontHeightF<span style="white-space:pre-wrap">        </span> <span style="white-space:pre-wrap">        </span>= 0.025</div><div style="font-size:medium"> </div><div style="font-size:medium"> res2 <span style="white-space:pre-wrap">        </span>= True</div><div style="font-size:medium"> res2@cnLineLabelsOn <span style="white-space:pre-wrap">        </span>= True</div><div style="font-size:medium"> res2@gsnAddCyclic <span style="white-space:pre-wrap">        </span> <span style="white-space:pre-wrap">        </span>= False </div><div style="font-size:medium"> res2@cnLineThicknessF <span style="white-space:pre-wrap">        </span>= 2 ; line thickness</div><div style="font-size:medium"> res2@cnLevelSelectionMode <span style="white-space:pre-wrap">        </span>= "ExplicitLevels"<span style="white-space:pre-wrap">        </span></div><div style="font-size:medium"> res2@cnLevels<span style="white-space:pre-wrap">                </span> <span style="white-space:pre-wrap">        </span>= (/0,10,20/) ;NE</div><div style="font-size:medium"> res2@cnLabelMasking = True<span style="white-space:pre-wrap">                                </span></div><div style="font-size:medium"> res2@cnInfoLabelOn <span style="white-space:pre-wrap">        </span> <span style="white-space:pre-wrap">        </span>= False ; turn off contour label</div><div style="font-size:medium"> res2@cnLineLabelInterval = 1 ; default = 2</div><div style="font-size:medium"> res2@cnLineLabelFontHeightF <span style="white-space:pre-wrap">        </span>= 0.015 </div><div style="font-size:medium"><br></div><div style="font-size:medium"> plot = gsn_csm_contour_map_overlay(wk<wbr>s,u,s,res,res2)</div><div style="font-size:medium"><br></div><div style="font-size:medium"> draw(plot)</div><div style="font-size:medium"> frame(wks)</div><div style="font-size:medium"><br></div><div style="font-size:medium"> end</div></font></div></font></em></div></div></div>
<br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>