RE: [ncl-talk] GRIB Lambert proj errors

From: Debasish Pai Mazumder <debasish_at_nyahnyahspammersnyahnyah>
Date: Wed, 13 Aug 2008 23:36:57 -0800

Dear Jamie,

 

You need to set

 

res_at_gsnDraw = False ; don't draw

res_at_gsnFrame = False ; don't advance frame

 

and you also can use

 

"draw(plot)" just before "frame(wks)"

 

Please see the example traj_1.ncl in

 

 <http://www.ncl.ucar.edu/Document/Graphics/Interfaces/gsn_polymarker.shtml>
http://www.ncl.ucar.edu/Document/Graphics/Interfaces/gsn_polymarker.shtml

 

Thanks

 

Debasish

 

  _____

From: ncl-talk-bounces_at_ucar.edu [mailto:ncl-talk-bounces_at_ucar.edu] On Behalf
Of Jamie Lahowetz
Sent: Wednesday, August 13, 2008 9:36 PM
To: ncl-talk_at_ucar.edu
Subject: Re: GRIB Lambert proj errors

 

I bet these are all very basic questions.

I don't understand how to get the polymarker to plot on the same plot as the
data. When I click a separate plot opens that is blank with the white marker
by itself.

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
begin

  fili = "/home/jlahowet/THOR/test/wind/narr-a_221_20070314_0300_000.grb"
  f = addfile (fili, "r")

  names = getfilevarnames(f)
  print(names)

  atts = getfilevaratts(f,names(0))
  dims = getfilevardims(f,names(0))
  print(atts)
  print(dims)

  vpt = f->VSTM_221_HTGY
  lat2d = f->gridlat_221
  lon2d = f->gridlon_221

  vpt_at_lat2d = lat2d
  vpt_at_lon2d = lon2d
  
  wks = gsn_open_wks("x11","lcnative")
  gsn_define_colormap(wks,"gui_default")

  res = True
  res_at_tiMainString = "Native Lambert Conformal"

  res_at_mpLimitMode = "Corners"
  res_at_mpLeftCornerLatF = 40.0
  res_at_mpLeftCornerLonF = -105.0
  res_at_mpRightCornerLatF = 50.0
  res_at_mpRightCornerLonF = -90.0

  res_at_mpProjection = "LAMBERTCONFORMAL"
  res_at_mpLambertParallel1F = lon2d_at_Latin1
  res_at_mpLambertParallel2F = lon2d_at_Latin2
  res_at_mpLambertMeridianF = lat2d_at_Lov

  res_at_pmTickMarkDisplayMode = "Always"
  res_at_mpFillOn = False
  res_at_mpOutlineDrawOrder = "PostDraw"
  res_at_mpOutlineBoundarySets = "GeophysicalAndUSStates"
  res_at_mpGridAndLimbOn = True
  
  res_at_tfDoNDCOverlay = False

  res_at_cnFillOn = True
  res_at_cnLinesOn = False
  res_at_gsnSpreadColors = True
  res_at_gsnAddCyclic = False

  plot = gsn_csm_contour_map(wks,vpt,res)

  ;plot marker
  x = -101.35
  y = 45.15
  polyres = True
  polyres_at_gsMarkerIndex = 16
  polyres_at_gsMarkerSizeF = 10.0
  polyres_at_gsMarkerColor = (/"white"/)
  
  gsn_polymarker(wks,plot,x,y,polyres)
  frame(wks)

end

On Wed, Aug 13, 2008 at 9:38 PM, Dennis Shea <shea_at_ucar.edu> wrote:

See:

http://www.ncl.ucar.edu/Document/Graphics/Interfaces/gsn_polymarker.shtml

It might help if you downloaded the mini-reference manuals:
Language and Graphics.

http://www.ncl.ucar.edu/Document/Manuals/

Jamie Lahowetz wrote:

Thanks that worked perfectly.

One more question:
how can I add a mark to the plot at both a lat lon point and a grid point?

On Wed, Aug 13, 2008 at 3:06 PM, Mary Haley <haley_at_ucar.edu
<mailto:haley_at_ucar.edu>> wrote:

   On Wed, 13 Aug 2008, Jamie Lahowetz wrote:

       my bad. I changed the proj from 'ps' to 'x11'.

       Another question is how can I zoom into an area to get a better
       idea of the
       values?

   Jamie,

   In order to zoom in on the data, you need to make sure that your data
   goes through the proper transformation on the new map limits.

   To do this, add the following 2 lines:

    vpt_at_lat2d = lat2d
    vpt_at_lon2d = lon2d

   right after:

    vpt = f->VSTM_221_HTGY
    lat2d = f->gridlat_221
    lon2d = f->gridlon_221

   Make sure this resource is False!

    res_at_tfDoNDCOverlay = False

   You can now try zooming in on your data by playing with the values
   of these four resources:

    res_at_mpLeftCornerLatF = lat2d_at_corners(0)
    res_at_mpLeftCornerLonF = lon2d_at_corners(0)
    res_at_mpRightCornerLatF = lat2d_at_corners(2)
    res_at_mpRightCornerLonF = lon2d_at_corners(2)

   --Mary

       On Wed, Aug 13, 2008 at 11:28 AM, Jamie Lahowetz

       <jlahowe2_at_bigred.unl.edu <mailto:jlahowe2_at_bigred.unl.edu>>wrote:

           Thanks for the help. I did a ncl_filedump and fixed the error:
           res_at_mpProjection = "LAMBERTCONFORMAL"
            res_at_mpLambertParallel1F = lon2d_at_Latin1
            res_at_mpLambertParallel2F = lon2d_at_Latin2

           Now, nothing is plotted.

           On Wed, Aug 13, 2008 at 10:20 AM, Mary Haley <haley_at_ucar.edu

           <mailto:haley_at_ucar.edu>> wrote:

               On Wed, 13 Aug 2008, Jamie Lahowetz wrote:

                I could use some help on getting a GRIB to project over
               a Lambert

                   Conformal.
                   I get these errors:
                   warning:Attempt to reference attribute (Latin1)
                   which is undefined
                   warning:Attempt to reference attribute (Latin2)
                   which is undefined
                   warning:GKS:GSVP: --RECTANGLE DEFINITION IS INVALID
                   fatal:MapSetTrans: error initializing map:
                   MAPINT/MDPINT/GKS ERROR
                   REPORTED
                   FROM libhlu.a(Error.o)
                   warning:GKS:GSVP: --RECTANGLE DEFINITION IS INVALID
                   fatal:MapSetTrans: error initializing map:
                   MAPINT/MDPINT/GKS ERROR
                   REPORTED
                   FROM libhlu.a(Error.o)
                   warning:["SetValues.c":474]:SetValuesChild never
                   occurred on
                   map.PlotManager: Error in mapPlotClass
                   warning:tiMainString is not a valid resource in map
                   at this time
                   Segmentation fault

                   I'm not sure what all these errors mean since I'm
                   new to the language.
                   Here
                   is the code:

               Jamie,

               The main problem is that you are trying to reference a
               couple of
               attributes that don't exist:

                res_at_mpLambertParallel1F = lat2d_at_Latin1
                res_at_mpLambertParallel2F = lat2d_at_Latin2

               This code is trying to reference attributes "Latin1" and
               "Latin2" attached
               to the variable "lat2d".

               I think this was an original example where the "lat2d"
               variable did
               indeed have these attributes, because they were
               originally on the
               file. However, you are using your own file, and it looks
               like
               f->gridlat_221 does not have "Latin1" or "Latin2"
               attached to it.

               What you need to do is first print the contents of your
               file, either
               by adding a "print(f)" after the "addfile" call, or by
               doing an
               ncl_filedump on the UNIX command line:

                ncl_filedump
 
/home/jlahowet/THOR/test/wind/narr-a_221_20070314_0000_000.grb

               Check the output closely to see if there's anything that
               looks like it
               might be related to the map projection of your data, and
               especially,
               that might give you the two lambert parallel values that
               you need.

               For example, in one NARR example that we have, the two
               parallels are
               attached to a variable called "Lambert_Conformal" and
               are stored in an
               array called "standard_parallel" that has two elements:

                res_at_mpLambertParallel1F =
               f->Lambert_Conformal_at_standard_parallel(0)
                res_at_mpLambertParallel2F =
               f->Lambert_Conformal_at_standard_parallel(1)

               Hopefully this will help you get started.

               --Mary

                load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"

                   load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
                   begin

                    fili =
 
"/home/jlahowet/THOR/test/wind/narr-a_221_20070314_0000_000.grb"
                    f = addfile (fili, "r")

                    names = getfilevarnames(f)
                    print(names)

                    atts = getfilevaratts(f,names(0))
                    dims = getfilevardims(f,names(0))
                    print(atts)
                    print(dims)

                    vpt = f->VSTM_221_HTGY
                    lat2d = f->gridlat_221
                    lon2d = f->gridlon_221

                    wks = gsn_open_wks("ps","lcnative")
                    gsn_define_colormap(wks,"gui_default")

                    res = True
                    res_at_tiMainString = "Native Lambert Conformal"

                    res_at_mpLimitMode = "Corners"
                    res_at_mpLeftCornerLatF = lat2d_at_corners(0)
                    res_at_mpLeftCornerLonF = lon2d_at_corners(0)
                    res_at_mpRightCornerLatF = lat2d_at_corners(2)
                    res_at_mpRightCornerLonF = lon2d_at_corners(2)

                    res_at_mpProjection = "LambertConformal"
                    res_at_mpLambertParallel1F = lat2d_at_Latin1
                    res_at_mpLambertParallel2F = lat2d_at_Latin2
                    res_at_mpLambertMeridianF = lat2d_at_Lov

                    res_at_pmTickMarkDisplayMode = "Always"
                    res_at_mpFillOn = False
                    res_at_mpOutlineDrawOrder = "PostDraw"
                    res_at_mpOutlineBoundarySets = "GeophysicalAndUSStates"

                    res_at_tfDoNDCOverlay = True

                    res_at_cnFillOn = True
                    res_at_cnLinesOn = False
                    res_at_gsnSpreadColors = True
                    res_at_gsnAddCyclic = False

                    plot = gsn_csm_contour_map(wks,vpt,res)
                   end

                   Thanks

                   --
                   Jamie Ryan Lahowetz
                   University of Nebraska - Lincoln
                   Graduate Student - Geosciences
                   402.304.0766

                   jlahowe2_at_bigred.unl.edu <mailto:jlahowe2_at_bigred.unl.edu>

           --
           Jamie Ryan Lahowetz
           University of Nebraska - Lincoln
           Graduate Student - Geosciences
           402.304.0766

           jlahowe2_at_bigred.unl.edu <mailto:jlahowe2_at_bigred.unl.edu>

       -- Jamie Ryan Lahowetz
       University of Nebraska - Lincoln
       Graduate Student - Geosciences
       402.304.0766

       jlahowe2_at_bigred.unl.edu <mailto:jlahowe2_at_bigred.unl.edu>

-- 
Jamie Ryan Lahowetz
University of Nebraska - Lincoln
Graduate Student - Geosciences
402.304.0766
jlahowe2_at_bigred.unl.edu <mailto:jlahowe2_at_bigred.unl.edu>
------------------------------------------------------------------------
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-- 
Jamie Ryan Lahowetz
University of Nebraska - Lincoln
Graduate Student - Geosciences
402.304.0766
jlahowe2_at_bigred.unl.edu

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Aug 14 2008 - 01:36:57 MDT

This archive was generated by hypermail 2.2.0 : Thu Aug 14 2008 - 08:32:16 MDT