<div dir="ltr">It is perfect answer. It works!!<div>Bedassa</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 3, 2014 at 12:10 AM, Dennis Shea <span dir="ltr"><<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</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"><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" target="_blank">https://www.ncl.ucar.edu/Applications/narr.shtml</a><br></div>Examples 5 & 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" target="_blank">http://www.ncl.ucar.edu/Applications/ESMF.shtml</a><br><br>=====<br><a href="http://www.ncl.ucar.edu/Applications/asr.shtml" target="_blank">http://www.ncl.ucar.edu/Applications/asr.shtml</a><br></div>Examples 5 & 6<br><br>++++++++++++++++++++++++++++++++++++++++++++++++++++<br></div>NOTE: if you are 'new to NCL' ... PLEASE read documentation.<br><br> <a href="http://www.ncl.ucar.edu/Document/Manuals/" target="_blank">http://www.ncl.ucar.edu/Document/Manuals/</a><br><br></div> [1] The "Mini-Language Manual" contains a detailed overview of the language<br><br></div> [2] THE DKRZ turotials are quite good.<br><br><br></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 2, 2014 at 3:56 PM, David Brown <span dir="ltr"><<a href="mailto:dbrown@ucar.edu" target="_blank">dbrown@ucar.edu</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">Hi Bedassa,<div><br></div><div>You can'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 "curvilinear" 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>On Wed, Oct 1, 2014 at 4:24 PM, Bedassa Regassa <span dir="ltr"><<a href="mailto:beregassa@gmail.com" target="_blank">beregassa@gmail.com</a>></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><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 "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"<br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"<br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" <br>
;************************************************<br>
begin<br>
;************************************************<br>
;open file and read in data<br>
;************************************************<br>
f=addfile("u_2009_JJAS_mean.nc","r")<br>
;************************************************<br>
; get variables infromation and print them cclm <br>
;************************************************<br>
vars = getfilevarnames(f)<br>
print(vars)<br>
;************************************************<br>
var=f->U(0,:,15,:)        <br>
lon2d=f->lon<br>
lev=f->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("png","plot_slices")<br>
gsn_define_colormap(wks,"ncl_default") ;-- set the colormap to be used<br>
;-- set resources<br>
res = True<br>
res@tiMainString = "DKRZ NCL Tutorial Example: Slice plot at 40N"<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 = "vertical" ;-- vertical label bar<br>
res@tiYAxisString = var@long_name+" [hPa]"<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>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><div><div style="font-family:arial,sans-serif;font-size:13px;text-indent:0%"><font color="#002266" face="Verdana, Helvetica, Arial, Tahoma, sans-serif"><b>--------------------------------------------------</b></font></div><div style="font-family:arial,sans-serif;font-size:13px;text-indent:0%"><br></div></div><div style="font-family:arial,sans-serif;font-size:13px"><strong style="color:rgb(0,34,102);font-family:Verdana,Helvetica,Arial,Tahoma,sans-serif;text-align:center;text-indent:0%">------------------------------------------------------</strong></div></div>
</div>