Re: Adding polygons to a Skew-T plot

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Fri Feb 28 2014 - 10:37:10 MST

Hi,

gsn_add_polygon is the correct route to go, and not gsn_add_annotation.

It looks like you are very close, but the X/Y values you're using for the polygon are not in the same coordinate space as the Skew-T plot.

You need to use the unadvertised "skewtx" and "skewty" functions to convert from your coordinates to the Skew-T coordinates:

      ybox = skewty((/p_data(0,frz_base),p_data(0,frz_top),p_data(0,frz_top),p_data(0,frz_base),p_data(0,frz_base)/))
      xbox = skewtx((/30.,30.,37.,37.,30./),ybox)
      box_frz = gsn_add_polygon (wks,plot,xbox,ybox,boxres)

Dennis is more familiar with this code, so I'm hoping he'll confirm whether this is correct.

You can see the skewtx and skewty functions for yourself in:

$NCARG_ROOT/lib/ncarg/nclscripts/csm/skewt_func.ncl

Search for "function skewty" and "function skewtx":

undef("skewty")
function skewty(pres[*]:numeric) ; y-coord given pressure (mb)
  begin
   return (132.182-44.061*log10(pres))
  end

undef("skewtx")
function skewtx(temp[*]:numeric,y[*]:numeric) ; x-coord given temperature (c)
  begin ; y=skewty(p)
   return (0.54*temp+0.90692*y)
  end

--Mary

On Feb 27, 2014, at 10:42 AM, Katharina Roloff <roloff@muk.uni-hannover.de> wrote:

> Hi all,
>
> after trying to panel some Skew-T plots last week I've now tried to add a polygon to a single Skew-T plot similar to an example of the NCL talk archive
>
> http://www.ncl.ucar.edu/Support/talk_archives/2013/1742.html
>
> but unfortunately it doesn't work at all. Using the gsn_add_annotation function I get the error messages
>
> fatal:NhlAddAnnotation: invalid view id
> fatal:["NclVar.c":1382]:Assignment type mismatch, right hand side can't be coerced to type of left hand side
> fatal:["Execute.c":8128]:Execute: Error occurred at or near line 186 in file Skew_T_Scenarios.ncl
>
> When I just try to add the polygon I can't see it after plotting. Maybe you have any idea what's going wrong? I don't know if the polygon is hidden by the Skew-T background even though I tried different options to make sure that the polygon is plotted last...
>
> In the attachment you see the shortened code and the ps output which just shows the Skew-T plot without any polygon.
>
> If you need the input files, I've sent them via ftp in your /incoming directory:
>
> cosmo_tools.ncl
> grid_calculation.ncl
> grb1_192_pip_LME_sce_k_2013110600_04_ueg
> grb12-lm2mo_scal_2013110600_04.ueg
> mySkewT.ncl
>
> I am working with NCL 6.1.2. When I type "uname -a" I get
>
>> Linux 3.1.10-1.16-desktop #1 SMP PREEMPT Wed Jun 27 05:21:40 UTC 2012 (d016078) x86_64 x86_64 x86_64 GNU/Linux
>
> I would appreciate any assistance again. Thank you, Katharina.
>
>
> --------------------------------------------
>
> M.Sc. Katharina Roloff
> Wissenschaftliche Mitarbeiterin
> Institut fuer Meteorologie und Klimatologie
> Leibniz Universitaet Hannover
> Herrenhaeuser Str. 2
> 30419 Hannover
>
> Email: roloff@muk.uni-hannover.de
>
> --------------------------------------------
> <Skew_T_Scenarios.ncl><Skew_T_frz_20131106_0400.ps>_______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Feb 28 10:37:23 2014

This archive was generated by hypermail 2.1.8 : Mon Mar 03 2014 - 14:26:18 MST