Re: How to specify data coordinates in wrf_contour

From: Gökhan Sever <gokhansever_at_nyahnyahspammersnyahnyah>
Date: Tue Mar 04 2014 - 10:51:55 MST

Hello,

I am trying to specify data coordinates manually then call the wrf_contour
function. The relevant portion of my plotting code goes as:
(modified from
http://www.mmm.ucar.edu/wrf/OnLineTutorial/Graphics/NCL/Examples/wrf_Hill2d.htm
)

  th_plane = wrf_user_intrp3d(th,z,"v",plane,angle,False)
  z_plane = wrf_user_intrp3d(z,z,"v",plane,angle,False)

  xy = new ((/100,199/), typeof(z_plane))
  cc = fspan(-100.,100.,199)

  do i=0, 100-1
    do j=0, 199-1
       xy(i,j) = cc(j)
    end do
  end do

 ; Theta
      opts_th = res
      opts_th@PlotOrientation = th_plane@Orientation
      opts_th@sfXArray = xy
      opts_th@sfYArray = z_plane
      ;opts_th@trGridType = "TriangularMesh"
      contour_th = wrf_contour(a,wks,th_plane,opts_th)
      draw(contour_th)
      frame(wks)

There should be some logic error in the data coordinate specification as I
cannot get this showing the contour properly. Additionally, uncommenting
opts_th@trGridType and running the script doesn't plot any contour. Anyone
has other comments? I can provide the wrf output and the ncl script if
someone is willing to take a closer look at this issue. Thanks.

On Tue, Mar 4, 2014 at 10:40 AM, Mary Haley <haley@ucar.edu> wrote:

> Hi,
>
> I think wrfhelp (CC'ed here) will need to take this one. With the
> wrf_user_intrp3d routines, I don't see that there
> is any 2D coordinate information returned, but there maybe a way to
> compute these.
>
> --Mary
>
> On Feb 28, 2014, at 12:06 PM, Gökhan Sever <gokhansever@gmail.com> wrote:
>
> > Hello,
> >
> > I am interested in getting data coordinates in 2D simulations,
> particularly to the output from em_hill2d_x in WRF.
> >
> > The example NCL plots/script shown here
> >
> http://www.mmm.ucar.edu/wrf/OnLineTutorial/Graphics/NCL/Examples/wrf_Hill2d.htm
> > just plots the data contour without having the 2D X and Y data
> coordinates specified.
> >
> > For 100 m hill there doesn't seem to be a problem with the simulation
> and plotting, however setting the mountain height to 2 km results in the
> model domain top coming down (i.e. starting maximum model height ~20 km at
> the end of the simulation max height is ~17.5 km). With the current NCL
> example it's not possible to see this issue. Hence, I am looking for a
> modified way to plot data contour in NCL.
> >
> > Thanks.
> >
> >
> > On Thu, Feb 27, 2014 at 12:04 PM, Mary Haley <haley@ucar.edu> wrote:
> > Hi Gökhan,
> >
> > wrf_contour simply draws the contours, with no map projection.
> wrf_map_overlays is what takes the contours and overlays them on a map.
> >
> > If you really are only interested in wrf_contour and want to specify the
> data coordinates, then you need to read XLAT and XLONG off the file (I'm
> assuming you are plotting lat/lon data), and then set the special sfXArray
> and sfYArray resources.
> >
> > Here's a working script that you can try, using the HGT variable on a
> wrf output file.
> >
> > Try it both with and without the sfX/YArray settings, to see what
> happens to the plot. The "trGridType" setting is necessary in order to get
> tickmarks. If you were putting this over a map (via wrf_map_overlays),
> then you wouldn't need trGridType:
> >
> >
> > load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> > load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> > load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
> >
> > begin
> > a = addfile("wrfout.nc","r")
> > hgt = wrf_user_getvar(a,"HGT",0)
> >
> > wks = gsn_open_wks("x11","mapgrid")
> >
> > res = True
> > res@sfXArray = wrf_user_getvar(a,"XLONG",0)
> > res@sfYArray = wrf_user_getvar(a,"XLAT",0)
> > res@trGridType = "TriangularMesh"
> >
> > plot = wrf_contour(a,wks,hgt,res)
> >
> > draw(plot)
> > frame(wks)
> >
> > end
> >
> > On Feb 27, 2014, at 5:43 AM, Gökhan Sever <gokhansever@gmail.com> wrote:
> >
> >> Hello,
> >>
> >> Is there a way to specify X,Y coordinates of data surface within
> wrf_contour? [
> https://www.ncl.ucar.edu/Document/Functions/WRF_arw/wrf_contour.shtml]
> >>
> >> Similar to how is done in matplotlib's contour function [
> http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.contour]
> >>
> >> Thanks.
> >>
> >>
> >> --
> >> Gökhan
> >> _______________________________________________
> >> ncl-talk mailing list
> >> List instructions, subscriber options, unsubscribe:
> >> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
> >
> >
> >
> >
> > --
> > Gökhan
> > _______________________________________________
> > ncl-talk mailing list
> > List instructions, subscriber options, unsubscribe:
> > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>

-- 
Gökhan

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Mar 4 10:52:16 2014

This archive was generated by hypermail 2.1.8 : Fri Mar 14 2014 - 15:08:52 MDT