<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 &quot;u&quot;, 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-&gt;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 = &quot;lat&quot;</font></div><div style="font-style:italic;color:rgb(0,0,0);font-size:medium"> lon := b-&gt;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 = &quot;lon&quot;</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 = &quot;lat&quot;   ; 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 = &quot;lon&quot;</div><div style="font-style:italic;color:rgb(0,0,0);font-size:medium"> u&amp;lat = lat</div><div style="font-style:italic;color:rgb(0,0,0);font-size:medium"> u&amp;lon = lon</div><div style="font-style:italic;color:rgb(0,0,0);font-size:medium"> u&amp;lon@units = &quot;degrees_east&quot;</div><div style="font-style:italic;color:rgb(0,0,0);font-size:medium"> u&amp;lat@units = &quot;degrees_north&quot;</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 &quot;s&quot; earlier in the script. I&#39;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">&lt;<a href="mailto:sunil.oulkar16@gmail.com" target="_blank">sunil.oulkar16@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 dir="ltr"><font color="#000000" style="font-size:12.8px"><em style="font-family:&#39;times new roman&#39;;font-size:medium">Hello, </em><br style="font-family:&#39;times new roman&#39;;font-size:medium"><em style="font-family:&#39;times new roman&#39;;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:&#39;times new roman&#39;;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:[&quot;Execute.c&quot;:8567]:Execu<wbr>te: Error occurred at or near line 51 in file contour_slope.ncl</font></div></div><div style="font-family:&#39;times new roman&#39;;font-size:medium"><br></div><div style="font-family:&#39;times new roman&#39;;font-size:medium"><em>My code is: </em><br></div><div style="font-family:&#39;times new roman&#39;;font-size:medium"><em><br></em></div><div><font face="times new roman"><div style="font-size:medium">load &quot;/usr/local/ncl/lib/ncarg/ncls<wbr>cripts/csm/gsn_code.ncl&quot;  </div><div style="font-size:medium">load &quot;/usr/local/ncl/lib/ncarg/ncls<wbr>cripts/csm/gsn_csm.ncl&quot; </div><div style="font-size:medium">load &quot;/usr/local/ncl/lib/ncarg/ncls<wbr>cripts/csm/contributed.ncl&quot;</div><div style="font-size:medium">load &quot;/usr/local/ncl/lib/ncarg/ncls<wbr>cripts/csm/shea_util.ncl&quot;</div><div style="font-size:medium"><br></div><div style="font-size:medium">begin</div><div style="font-size:medium">        a  = addfile(&quot;<a href="http://elevation_0.5.nc/" target="_blank">elevation_0.5.nc</a>&quot;,&quot;r&quot;<wbr>)         </div><div style="font-size:medium">        TOPO = a-&gt;E({28:36},{70:78})</div><div style="font-size:medium"> </div><div style="font-size:medium">        LON = a-&gt;LONGITUDE({70:78})</div><div style="font-size:medium">        LAT = a-&gt;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   = &quot;LAT&quot;</div><div style="font-size:medium"> s!1   = &quot;LON&quot;</div><div style="font-size:medium"> s&amp;lat = lats</div><div style="font-size:medium"> s&amp;lon = lons</div><div style="font-size:medium"> s&amp;lon@units = &quot;degrees_east&quot;</div><div style="font-size:medium"> s&amp;lat@units = &quot;degrees_north&quot;           </div><div style="font-size:medium"> </div><div style="font-size:medium"> b = addfile(&quot;<a href="http://lisotd_hrfc_v2.3.2014.nc/" target="_blank">LISOTD_HRFC_V2.3.2014<wbr>.nc</a>&quot;,&quot;r&quot;)</div><div style="font-size:medium"> u = b-&gt;HRFC_COM_FR</div><div style="font-size:medium"><br></div><div style="font-size:medium"> lat := b-&gt;Latitude</div><div style="font-size:medium"> lon := b-&gt;Longitude</div><div style="font-size:medium"> u!0 = &quot;lat&quot;</div><div style="font-size:medium"> u!1 = &quot;lon&quot;</div><div style="font-size:medium"> u&amp;lat = lat</div><div style="font-size:medium"> u&amp;lon = lon</div><div style="font-size:medium"> u&amp;lon@units = &quot;degrees_east&quot;</div><div style="font-size:medium"> u&amp;lat@units = &quot;degrees_north&quot;</div><div style="font-size:medium"> </div><div style="font-size:medium"> wks <span style="white-space:pre-wrap">        </span>     = gsn_open_wks(&quot;x11&quot;,&quot;contour_sl<wbr>ope_NE&quot;)</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>= &quot;&quot;             ;&quot;Longitude&quot;  </div><div style="font-size:medium"> res@gsnLeftString<span style="white-space:pre-wrap">                </span>= &quot;&quot;</div><div style="font-size:medium"> res@gsnRightString<span style="white-space:pre-wrap">                </span>= &quot;&quot;</div><div style="font-size:medium"> res@cnLevelSelectionMode<span style="white-space:pre-wrap">        </span>= &quot;ExplicitLevels&quot; ; 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>= &quot;precip3_16lev&quot;</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>= &quot;MediumRes&quot;</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>= &quot;Always&quot;</div><div style="font-size:medium"> res@mpFillDrawOrder <span style="white-space:pre-wrap">        </span>   <span style="white-space:pre-wrap">        </span>=&quot;PreDraw&quot;</div><div style="font-size:medium"> res@lbOrientation<span style="white-space:pre-wrap">        </span>        = &quot;vertical&quot;                     </div><div style="font-size:medium"> res@amJust                     = &quot;TopRight&quot;</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>= &quot;ExplicitLevels&quot;<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>