Re: Offset in y-axis position

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Fri, 1 Jun 2007 14:18:36 -0600 (MDT)

On Fri, 1 Jun 2007, Arindam Chakraborty wrote:

> Dear users,
> I've recently started using NCL and got stuck with a simple problem. I
> want to plot a single curve using one of the x-y plot routines (possibly
> gsn_csm_xy). The y axis should be at an offset from the left edge of the x
> axis (very similar to the V-axis in the example
> http://www.ncl.ucar.edu/Applications/Images/xy_19_3_lg.png).
> However, I'm not able to find which resources to be set to get this. I've
> tried to set res_at_amOrthogonalPosF to a negative value (-0.2 or so) but the
> error message was: warning:amOrthogonalPosF is not a valid resource in
> xyplot_xy at this time. My NCL version is 4.3.0.

Hi Arindam,

There's no automatic way to do this, so I created a new example for
you to see. Look at example 22 at:

   http://www.ncl.ucar.edu/Applications/xy.shtml

and let me know if this is not what you want. Basically I'm drawing
the same plot twice, only the second time I shift it to the left
slightly, and I turn off the drawing of everything but the left Y
axis.

> In addition, I've few more queries:
> 1) Is it possible to run a script from ncl command line?

You can use the "load" command:

    ncl 1> load "myscript.ncl"

> 2) Is there any way to let NCL know which is a longitude/latitude (etc)
> dimension in a NetCDF file from the units of the variable, and set default
> analysis region the way we want (other than subscripting like {10:30}).

I'm not exactly sure what you are asking here. The syntax you are
referring to, "{10:30}" is how you do coordinate subscripting in NCL,
which allows you to subscript a variable by actual coordinate values,
rather than index values.

I can't tell if your reference to {10:30} is supposed to be index
subscripting or coordinate subscripting.

Anyway, if you are asking how to do coordinate subscripting, then
you need to first "name" the dimensions of your variable and then
assign coordinate values to them. For example, if your variable is
"t" and is dimensioned nlev x nlat x nlon (say 100 x 64 x 126), then
you can name the dimensions as follows:

     t!0 = "lev"
     t!1 = "lat"
     t!2 = "lon"

Then, you need to assign coordinate values if you want to be able to
use coordinate subscripting. These values can come from other
variables on your file, or you can create them on the fly:

    t&lat = fspan(-90,90,nlat) ; nlat is the lat dimension
    t&lon = fspan(-180,180,nlon) ; nlon is the lon dimension

The "&" syntax is how you attach coordinate array information. The
name to the right of the "&" must be the same name as the dimension
name.

You can now subscript t using latitude and longitude values rather
than index values:

     t_sub = t(:,{-30:30},{-120:60})

This will grab all levels, at a subset from lat = -30 to lat = 30,
and from lon = -120 and lon = 60.

Additionally, for latitude/longitude coordinate arrays, it is a good
idea to assign a "units" attribute to both:

   t&lat_at_units = "degrees_north"
   t&lon_at_units = "degrees_east"

> PS: The numerous graphical and data analysis functions NCL has are really
> impressive. Especially, the ability to use dimensions other than x-y-z-t is
> very useful if there is an ensemble of runs. Also the legend resources is
> very handy, among many others.

Glad to hear NCL is of good use for you!

--Mary

> Thanks a lot for any help.
>
> arindam
> --
>
> ----------------------------
> ARINDAM CHAKRABORTY
> Department of Meteorology
> Florida State University
> Tallahassee, FL-32306, USA
> Tel: +001-850-6443524 (Off)
> +001-850-5758550 (Res)
> Fax: +001-850-6449642
> ____________________________
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Jun 01 2007 - 14:18:36 MDT

This archive was generated by hypermail 2.2.0 : Tue Jun 05 2007 - 16:18:21 MDT