Re: gsn_csm_pres_hgt for 1D data?

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Thu May 01 2014 - 10:36:33 MDT

There’s no “simple” way to do this, other than editing the gsn_csm_pres_hgt and set_prds_hgt_axes functions to switch all the tmYL resources to tmYR resources, and vice versa. You also have to switch the Yaxis labels.

See the attached example script, and the gsn_csm_pres_switch.ncl function which contains the modifed versions of these functions.

You can edit these functions on your own if you need them to be more customized.

—Mary

On Apr 30, 2014, at 4:56 PM, Sha Feng <sfeng@mail.usf.edu> wrote:

> Thank you, Mary.
>
> I was stuck by this function again. Could you tell me how to switch the y-axes when I use gsn_csm_pres_hgt? For example, by default, the left y-axis uses pressure coordinate and the right uses height coordinate. Is there a simple way to have height on the left and pressure on the right?
>
> -Sha
>
>
> On Tue, Apr 29, 2014 at 11:58 AM, Mary Haley <haley@ucar.edu> wrote:
> Sha,
>
> I'm responding back to ncl-talk, because we prefer that follow-up questions always go back to the list, and not to individual developers.
>
> This particular function uses an internal function to calculate the height based on pressure. Since this calculation depends on coordinate arrays, this function then only allows 2D data that is represented by coordinate arrays. The function is called "gsn_geop_hgt", and you can see it inside the $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl script.
>
> Once you start trying put 1D unstructured data on a plot, you will lose your tickmarks, unless you are putting the data over a map, which you are not doing.
>
> To use gsn_csm_pres_hgt, you will need to regrid your data to a rectilinear grid (e.g. one with coordinate arrays).
>
> Otherwise, you can use gsn_csm_contour to create the contours, which will cause your tickmarks to disappear. You can then overlay this contour plot on a "linear" plot to force the tickmarks to reappear, and then you can use tmYRMode/tmYRValues/tmYRLabels to label the right Y axis with height values. The problem is, you will need to provide the appropriate height values, given the pressure values.
>
> You can see an example of overlaying a contour plot on a linear plot at:
>
> http://www.ncl.ucar.edu/Applications/2Dvertcoord.shtml
>
> Look at the first example on this page.
>
> --Mary
>
> On Apr 28, 2014, at 6:39 PM, Sha Feng <sfeng@mail.usf.edu> wrote:
>
> > Hi Mary,
> >
> > May I ask what the relationship (equation) ncl uses for gsn_csm_pres_hgt to generate the height coordinate?
> >
> > I need to plot a vertical profile with pressure and height coordinates, so I am thinking to take advantage of this function. But it only works for 2d data. Could you please inform?
> >
> > Thanks,
> > Sha
>
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu May 01 10:36:45 2014

This archive was generated by hypermail 2.1.8 : Sun May 04 2014 - 12:38:56 MDT