[ncl-talk] Hovmueller plot, x axis range adjustment

Toni Klemm toni-klemm at tamu.edu
Fri Aug 31 17:22:16 MDT 2018


Hi Adam,

Thanks a lot for explaining that, it worked!

Just one more thing. The spacing between numbers on the x axis is now so large that I only get a “100W” in the middle of my plot (which spans from 95 to 105 degrees West). Is there a way to adjust the spacing between numbers and tick marks to, say, 1 degree intervals? I know how to do it on the y axis (res at cnLevelSpacingF), but I don’t see how to change it to work for the x axis, too.

Thank you again for your help!

Toni



Toni Klemm, Ph.D.
Postdoctoral Research Associate
Department of Ecosystem Science and Management
College of Agriculture and Life Sciences
Texas A&M University, College Station, TX
Contributor to the Early Career Climate Forum <http://www.eccforum.org/>
www.toni-klemm.de <http://www.toni-klemm.de/> | @toniklemm <http://twitter.com/toniklemm>








> On Aug 31, 2018, at 4:28 PM, Adam Phillips <asphilli at ucar.edu> wrote:
> 
> Hi Toni,
> Thanks for sending a clean script and the data file as that made diagnosing the issue easier. When you call the gsn_csm_hov plotting function and pass in your data array (in your script named data_00), NCL will look at the coordinate variables attached to the 2 dimensions for information on how to display the data. If NCL does not find any coordinate variables, it will label the corresponding axis starting at 0. Looking at your data_00 array:
> Variable: data_00
> Type: float
> Total Size: 6800 bytes
>             1700 values
> Number of Dimensions: 2
> Dimensions and sizes:	[year | 85] x [lon_zones | 20]
> Coordinates: 
>             year: [2015..2099]
> Number Of Attributes: 3
>   units :	%
>   long_name :	Grassland percentage of total area in latitude zone 1
>   _FillValue :	9.96921e+36
> 
> The 1st dimension is shown as have a coordinate variable (named year), but the 2nd dimension does not. (Note that the second dimension is named lon_zones though.) To solve the problem you need to attach the lon_zones array from the input .nc file as a coordinate variable to your data_00 array:
> data_00&lon_zones = MC2_f->lon_zones
> 
> If you have further questions let ncl-talk know.
> Adam
> 
> 
> 
> On Fri, Aug 31, 2018 at 3:15 PM Toni Klemm <toni-klemm at tamu.edu <mailto:toni-klemm at tamu.edu>> wrote:
> Hello all,
> 
> I'm trying to plot a time series of data in the form of a Hovmueller plot. However, I have trouble adjusting the x axis such that it shows the range of longitudes correctly. Instead of the longitude range, -105 to -95 degrees East in 0.5 degrees increments, it shows a range from 0 to 18 on the x axis of the plot. Longitudes are included in the netCDF file as variable “lon_zones”. I tried to adjust the x axis range manually using res at trXMinF and res at trXMaxF, but I got this error message: 
> 
> warning:ContourPlotSetValues: X coordinates out of data range: defaulting
> 
> I used example 5 here (https://www.ncl.ucar.edu/Applications/time_lon.shtml <https://urldefense.proofpoint.com/v2/url?u=https-3A__www.ncl.ucar.edu_Applications_time-5Flon.shtml&d=DwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=WsLJ5ywbW3XnTzqo_ETV62H6s1a5bcGgnrpl7xPRfic&m=VgThLzVijhWf-FblNez_y0LmBqtY9dHaMbJ3o1gCOkU&s=zJwsSMX3x66lHFdgGOdI10naJX7N1ScPJ0Shentz8p0&e=>) as a template, but I didn’t find an explanation for how the x axis shows longitudes there.
> 
> Any help would be much appreciated!
> 
> I attached the netCDF file, the plot, and my script. 
> 
> Thank you,
> Toni
> 
> 
> 
> Toni Klemm, Ph.D.
> Postdoctoral Research Associate
> Department of Ecosystem Science and Management
> College of Agriculture and Life Sciences
> Texas A&M University, College Station, TX
> Contributor to the Early Career Climate Forum <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.eccforum.org&d=DwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=WsLJ5ywbW3XnTzqo_ETV62H6s1a5bcGgnrpl7xPRfic&m=VgThLzVijhWf-FblNez_y0LmBqtY9dHaMbJ3o1gCOkU&s=gppt_EbRFvdSA4qLiIQEHsei5NxmDtIsC71YGUDfO1k&e=>
> www.toni-klemm.de <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.toni-2Dklemm.de&d=DwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=WsLJ5ywbW3XnTzqo_ETV62H6s1a5bcGgnrpl7xPRfic&m=VgThLzVijhWf-FblNez_y0LmBqtY9dHaMbJ3o1gCOkU&s=ESCx1g0uuNZA7maAaz9rjOLwzbRGQ7etUXx2FgDocPo&e=> | @toniklemm <https://urldefense.proofpoint.com/v2/url?u=http-3A__twitter.com_toniklemm&d=DwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=WsLJ5ywbW3XnTzqo_ETV62H6s1a5bcGgnrpl7xPRfic&m=VgThLzVijhWf-FblNez_y0LmBqtY9dHaMbJ3o1gCOkU&s=gxXGitckavGUpEA7f8H7ItGPzw5DsZ9CXLsdCWoa7cY&e=>
> 
> 
> 
> 
> 
> 
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu <mailto:ncl-talk at ucar.edu>
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk <https://urldefense.proofpoint.com/v2/url?u=http-3A__mailman.ucar.edu_mailman_listinfo_ncl-2Dtalk&d=DwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=WsLJ5ywbW3XnTzqo_ETV62H6s1a5bcGgnrpl7xPRfic&m=VgThLzVijhWf-FblNez_y0LmBqtY9dHaMbJ3o1gCOkU&s=z0KVxWJGAxDGnpKuj6kbEMjrjt_rO_V3JT3AIs3OR7E&e=>
> 
> 
> -- 
> Adam Phillips 
> Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
> www.cgd.ucar.edu/staff/asphilli/ <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.cgd.ucar.edu_staff_asphilli_&d=DwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=WsLJ5ywbW3XnTzqo_ETV62H6s1a5bcGgnrpl7xPRfic&m=VgThLzVijhWf-FblNez_y0LmBqtY9dHaMbJ3o1gCOkU&s=DmU_yPWQcHL_D5CCJScnx6lbFU3MBkxpBJfU-MtXVk4&e=>   303-497-1726 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180831/ac0add7a/attachment.html>


More information about the ncl-talk mailing list