<div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Michael,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">It looks like you have a curvilinear grid. The information I gave you was assuming you had a rectilinear grid, which means your data contains 1D lat/lon coordinate arrays attached to it.</div>
<div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">With a curvilinear grid, you have to read the 2D lat/lon coordinate values off the file separately and attach them to your data.</div>
<div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Can you do a "printVarSummary" on the two variables you are trying to plot, so I can see what kind of metadata they have:</div>
<div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><span style="color:rgb(255,0,0);font-family:Tahoma;font-size:13px;background-color:rgb(255,255,153)">printVarSummary(potTavg)</span><br>
</div><div class="gmail_default" style="font-size:small"><span style="color:rgb(255,0,0);font-family:Tahoma;font-size:13px;background-color:rgb(255,255,153)">printVarsummary(Tavg)</span></div><div class="gmail_default" style="font-size:small">
<span style="font-family:Tahoma;font-size:13px;background-color:rgb(255,255,153)"><font color="#000000"><br></font></span></div><div class="gmail_default" style="font-size:small"><span style="color:rgb(0,0,0);font-family:Tahoma">This will help me determine what kind of grid you have, and hopefully what the lat/lon arrays associated with it are.</span></div>
<div class="gmail_default" style="font-size:small"><span style="color:rgb(0,0,0);font-family:Tahoma"><br></span></div><div class="gmail_default" style="font-size:small"><span style="color:rgb(0,0,0);font-family:Tahoma">Better yet, if you can provide me with your full script and data (you can do this offline), then I can probably quickly provide you with an NCL script that will plot it.</span><br>
</div><div class="gmail_default" style="font-size:small"><span style="font-family:Tahoma;font-size:13px;background-color:rgb(255,255,255)"><font color="#000000"><br>
</font></span></div><div class="gmail_default" style="font-size:small"><span style="font-family:Tahoma;font-size:13px;background-color:rgb(255,255,255)"><font color="#000000">Thanks,</font></span></div><div class="gmail_default" style="font-size:small">
<span style="font-family:Tahoma;font-size:13px;background-color:rgb(255,255,255)"><font color="#000000"><br></font></span></div><div class="gmail_default"><font face="Tahoma" color="#000000" style="background-color:rgb(255,255,255)">--Mary</font></div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jul 28, 2014 at 1:14 AM, Michael Hemming <span dir="ltr"><<a href="mailto:michael.hemming@mpimet.mpg.de" target="_blank">michael.hemming@mpimet.mpg.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
Hi Mary,<br>
<br>
Thanks for replying but it doesn't seem to work, it complains:<br>
<br>
'check_for_y_lat_coord: Warning: data does not contain a valid
latitude coordinate array or doesn't contain one at all..'<br>
<br>
and the same for the lon_coord<br>
<br>
I'm confused as Ferret plots the data with the correct lat and lon.<br>
<br>
Is there something else I am missing? the only thing I changed
within the code was the removal of the two lines you stated below
and the addition of '_map' to the gsn command.<br>
<br>
thanks,<br>
Michael<div><div class="h5"><br>
<br>
<div>On 27/07/2014 19:48, Mary Haley wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div class="gmail_default" style="font-size:small">Hi Michael,</div>
<div class="gmail_default" style="font-size:small"><br>
</div>
<div class="gmail_default" style="font-size:small">Part of the
problem is that you've set the minimum of your X axis (the
longitude axis to 0):</div>
<div class="gmail_default" style="font-size:small"><br>
</div>
<div class="gmail_default" style="font-size:small"><span style="color:rgb(255,0,0);font-family:Tahoma;font-size:13px;background-color:rgb(255,255,153)">res@trXMinF
= 0 ; set minimum X-axis value</span><br style="color:rgb(255,0,0);font-family:Tahoma;font-size:13px;background-color:rgb(255,255,153)">
<span style="color:rgb(255,0,0);font-family:Tahoma;font-size:13px;background-color:rgb(255,255,153)">res@trXMaxF
= 30 ; set maximum X-axis value </span><br>
</div>
<div class="gmail_default" style="font-size:small">
<br>
</div>
<div class="gmail_default" style="font-size:small">This is
causing your longitudes to only go from 0 to 30, and hence you
are not going to see any labels or tickmarks at negative
longitude values.</div>
<div class="gmail_default" style="font-size:small">
<br>
</div>
<div class="gmail_default" style="font-size:small">I suggest not
setting the tr*M**F resources at all, unless you need to zoom
in on the plot for some reason.</div>
<div class="gmail_default" style="font-size:small">
<br>
</div>
<div class="gmail_default" style="font-size:small">Also, if you
are indeed plotting lat/lon data, you should be calling
"gsn_csm_contour_map" and not "gsn_csm_contour". The former
will put draw contours over a map, whereas the latter only
draws a contour plot. For examples of using
gsn_csm_contour_map, see:</div>
<div class="gmail_default" style="font-size:small"><br>
</div>
<div class="gmail_default"><a href="http://www.ncl.ucar.edu/Applications/cylineq.shtml" target="_blank">http://www.ncl.ucar.edu/Applications/cylineq.shtml</a><br>
</div>
<div class="gmail_default">
<br>
</div>
<div class="gmail_default">Note that some of these
examples are using "gsn_csm_contour_map_ce", which is the same
thing. gsn_csm_contour_map will draw a cylindrical
equidistant map plot by default, unless you change the map
projection.</div>
<div class="gmail_default" style="font-size:small"><br>
</div>
<div class="gmail_default" style="font-size:small">--Mary</div>
<div class="gmail_default" style="font-size:small"><br>
</div>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Sat, Jul 26, 2014 at 7:44 AM,
Hemming, Michael <span dir="ltr"><<a href="mailto:michael.hemming@mpimet.mpg.de" target="_blank">michael.hemming@mpimet.mpg.de</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">Hey
everyone,<br>
<br>
I am having trouble understanding how to alter tickmarks
on a contour plot. I want to change my index numbers on
the x and y axis to lat and lon values. I have been
trying to use the example given here:
<a href="http://www.ncl.ucar.edu/Applications/Scripts/tm_2.ncl" target="_blank">http://www.ncl.ucar.edu/Applications/Scripts/tm_2.ncl</a>
<br>
<br>
Here is my code ( I have only tried altering the second
plot out of the 2 e.g. for plot1(1)..):<br>
<br>
;----------MPIOM vs. ICON comparison plots<br>
<br>
<br>
<span style="background-color:rgb(255,255,153)"><br>
<font color="FF0000">wks =
gsn_open_wks("x11","MPIOM_vs_ICON_panelplot_surface")<br>
gsn_define_colormap(wks,"gui_default") <br>
<br>
<br>
plot1 = new(2,graphic) <br>
<br>
res@gsnDraw = False ;
don't draw<br>
res@gsnFrame =
False ; don't advance
frame<br>
resP = True<br>
res@tiYAxisString = "Latitude"<br>
res@tiXAxisString = "Longitude"<br>
resP@txString = "Surface T averaged
for years 01-99"<br>
res@lbOrientation = "vertical"
; vertical label bar<br>
<br>
res@trXMinF = 0
; set minimum X-axis value<br>
res@trXMaxF = 40
; set maximum X-axis value <br>
res@trYMinF = 0 ;
set minimum Y-axis value<br>
res@trYMaxF = 120
; set maximum Y-axis value<br>
res@tiMainString = "MPIOM exp 12"<br>
<br>
<br>
plot1(0) =
gsn_csm_contour(wks,Tavg(1,:,:),res)<br>
<br>
<br>
res@trXMinF = 0 ;
set minimum X-axis value<br>
res@trXMaxF = 30 ;
set maximum X-axis value <br>
res@trYMinF = 0 ;
set minimum Y-axis value<br>
res@trYMaxF = 80
; set maximum Y-axis value<br>
res@tiMainString = "ICON NOSH.UPW"<br>
<br>
res@tmXBMode = "Explicit" <br>
res@tmXBValues = (/-44.5,-27.5,-5.5,14.5,34.5/)<br>
res@tmXBLabels = "" + res@tmXBValues <br>
res@tmXBMinorValues = ispan(0,30,1)<br>
<br>
<br>
<br>
<br>
plot1(1) =
gsn_csm_contour(wks,potTavg(1,:,:),res)<br>
<br>
<br>
gsn_panel(wks,plot1,(/1,2/),resP) </font></span><br>
<br>
<br>
<span style="background-color:rgb(255,255,255)"><font color="000000">I want l<font color="000000">ongitude
from -44.5
<font color="000000">E</font> to 34.5 <font color="000000">W, once I know how to do it for
longitude, I can then apply the code to the lat.<br>
<br>
<font color="000000">thanks<font color="000000"><font color="000000"> in advance!</font><span><font color="#888888"><br>
<br>
<font color="000000">Micha<font color="000000">el</font></font><br>
</font></span></font></font></font></font></font></span></div>
</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>
</blockquote>
<br>
</div></div></div>
</blockquote></div><br></div>