<div dir="ltr"><div><div><div><div><div><div>Some examples of what DaveB is talking about are at:<br><br>====<br><a href="https://www.ncl.ucar.edu/Applications/narr.shtml">https://www.ncl.ucar.edu/Applications/narr.shtml</a><br></div>Examples 5 &amp; 6<br><br><br></div>NARR Example 5 uses a weight file generated by an ESMF Example 30<br>  <a href="http://www.ncl.ucar.edu/Applications/ESMF.shtml">http://www.ncl.ucar.edu/Applications/ESMF.shtml</a><br><br>=====<br><a href="http://www.ncl.ucar.edu/Applications/asr.shtml">http://www.ncl.ucar.edu/Applications/asr.shtml</a><br></div>Examples 5 &amp; 6<br><br>++++++++++++++++++++++++++++++++++++++++++++++++++++<br></div>NOTE: if you are &#39;new to NCL&#39; ... PLEASE read documentation.<br><br> <a href="http://www.ncl.ucar.edu/Document/Manuals/">http://www.ncl.ucar.edu/Document/Manuals/</a><br><br></div> [1]  The &quot;Mini-Language Manual&quot; contains a detailed overview of the language<br><br></div> [2] THE DKRZ turotials are quite good.<br><br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 2, 2014 at 3:56 PM, David Brown <span dir="ltr">&lt;<a href="mailto:dbrown@ucar.edu" target="_blank">dbrown@ucar.edu</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">Hi Bedassa,<div><br></div><div>You can&#39;t plot something with a 2D coordinate against a 1D coordinate in a 2D plot. The lon2d gives the longitude values for a horizontal 2D field. You have to make some choices to get a vertical plot -- you need to reduce the latitude dimension to a single element somehow. The simplest thing to do would be to just pick one index along the y axis of the lon coordinate -- e.g. lon2d(100,:). However, because the coordinates are 2d, the chances are that this would not be a constant latitude, so you could not say for instance that your plot represents height vs longitude at 10 degrees North latitude.</div><div><br></div><div>But with proper labeling you could describe what this plot does represent. I suggest you look at the NCL Examples page for Pressure/Height vs Longitude plots and specifically at the last example on the page called narr_6.ncl. It shows height plots for data where the coordinates are 2D (aka &quot;curvilinear&quot; coordinates). Notice that the X axis for these plots has both lat/lon values for the tickmark labels.This should give you some ideas of what the issues are and how to solve them. </div><div><br></div><div>Creating a plot where the latitude is constant would require a bit more work. But if you wanted to try you would probably want to use the function</div><div>getind_latlon2d. This might actually be a good topic for a future example.</div><div> -dave</div><div> </div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Wed, Oct 1, 2014 at 4:24 PM, Bedassa Regassa <span dir="ltr">&lt;<a href="mailto:beregassa@gmail.com" target="_blank">beregassa@gmail.com</a>&gt;</span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><p dir="ltr">I am new to ncl. I am to plot the vertical Height vs longitude but I got warning and I tried to a lot to find my error.</p>
<p dir="ltr">here is the wraning<br>
 <br>
warning:ScalarFieldSetValues: 2d coordinate array sfXArray has an incorrect dimension size: defaulting sfXArray</p>
<p dir="ltr">here is my data information ncl_filedump and below alos my scrip<br></p>
<p dir="ltr">dimensions:<br>
      x = 186<br>
      y = 166<br>
      pressure = 9<br>
      time = 1  // unlimited<br>
      nb2 = 2<br>
   variables:<br>
      float lon ( y, x )<br>
         standard_name :        longitude<br>
         long_name :    longitude<br>
         units :        degrees_east<br>
         _CoordinateAxisType :  Lon</p>
<p dir="ltr">      float lat ( y, x )<br>
         standard_name :        latitude<br>
         long_name :    latitude<br>
         units :        degrees_north<br>
         _CoordinateAxisType :  Lat</p>
<p dir="ltr">      float pressure ( pressure )<br>
         standard_name :        air_pressure<br>
         long_name :    pressure<br>
         units :        Pa<br>
         positive :     down<br>
         axis : Z</p>
<p dir="ltr">      double time ( time )<br>
         standard_name :        time<br>
         long_name :    time<br>
         bounds :       time_bnds<br>
         units :        seconds since 2009-05-01 00:00:00<br>
         calendar :     proleptic_gregorian</p>
<p dir="ltr">      double time_bnds ( time, nb2 )<br>
         units :        seconds since 2009-05-01 00:00:00<br>
         calendar :     proleptic_gregorian</p>
<p dir="ltr"> float U ( time, pressure, y, x )<br>
         standard_name :        grid_eastward_wind<br>
         long_name :    U-component of wind<br>
         units :        m s-1<br>
         coordinates :  lon lat</p>
<p dir="ltr">;************************************************<br>
;load the graphic libraries <br>
;************************************************<br>
load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl&quot;<br>
load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl&quot;<br>
load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl&quot; <br>
;************************************************<br>
begin<br>
;************************************************<br>
;open file and read in data<br>
;************************************************<br>
f=addfile(&quot;u_2009_JJAS_mean.nc&quot;,&quot;r&quot;)<br>
;************************************************<br>
; get variables infromation and print them  cclm <br>
;************************************************<br>
vars = getfilevarnames(f)<br>
print(vars)<br>
;************************************************<br>
var=f-&gt;U(0,:,15,:)        <br>
lon2d=f-&gt;lon<br>
lev=f-&gt;pressure</p>
<p dir="ltr">var@lon2d=lon2d<br>
var@lev=lev<br>
;*******************************<br>
;create plot<br>
;************************************************</p>
<p dir="ltr">;-- define workstation<br>
wks = gsn_open_wks(&quot;png&quot;,&quot;plot_slices&quot;)<br>
gsn_define_colormap(wks,&quot;ncl_default&quot;) ;-- set the colormap to be used<br>
;-- set resources<br>
res = True<br>
res@tiMainString = &quot;DKRZ NCL Tutorial Example: Slice plot at 40N&quot;<br>
res@cnFillOn = True ;-- turn on color fill<br>
res@cnLineLabelsOn = False ;-- turns off contour line labels<br>
res@cnInfoLabelOn = False ;-- turns off contour info label<br>
res@lbOrientation = &quot;vertical&quot; ;-- vertical label bar<br>
res@tiYAxisString = var@long_name+&quot; [hPa]&quot;<br>
;-- append units to y-axis label<br>
;res@tfDoNDCOverlay = True<br>
res@sfXArray = lon2d ;-- uses lon_t as plot x-axis<br>
res@sfYArray = lev/100 ;-- uses lev_t in hPa as plot y-axis<br>
res@gsnYAxisIrregular2Linear = True ;-- converts irreg depth to linear<br>
res@trYReverse = True ;-- reverses y-axis</p>
<p dir="ltr">;-- generate the plot<br>
plot = gsn_csm_contour(wks,var,res)<br>
end</p>
<br></div></div>_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>
<br>_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>