[ncl-talk] diagonal cross section with wrf_user_intrp3d

Alexander Schaefer alexander.schaefer at mines.sdsmt.edu
Mon Mar 23 13:01:05 MDT 2015


Matt,

Attached is a cross-section script I use. It goes rather in-depth.  This
one simply loops over the index values from point A to point B, which would
be at a 45 deg angle.  To get different angled cross-sections you would
have to create an array of all the points between the points on the line
you want. It may be easier to use the point/angle method and just control
the range of the data plotted.

Best of luck,
-Alex

On Mon, Mar 23, 2015 at 12:01 PM, Matthew Fearon <Matthew.Fearon at dri.edu>
wrote:

>  Alex,
> Yes. As you have time, please send your script. Would be good see an
> alternative.
> thank you,
> Matt
>
>  ------------------------------
> *From:* Alexander Schaefer [alexander.schaefer at mines.sdsmt.edu]
> *Sent:* Monday, March 23, 2015 10:52 AM
> *To:* Matthew Fearon
> *Cc:* Evelyn Grell - NOAA Affiliate; ncl-talk at ucar.edu; wrf-help at ucar.edu
>
> *Subject:* Re: [ncl-talk] diagonal cross section with wrf_user_intrp3d
>
>    Hi Matt,
>
>  I haven't been able to get the diagonal slicing with wrf_user_intrp3d to
> work right but I have been able to get diagonal cross-sections, though it
> was not pretty.  Essentially created some arrays of the points that were in
> the cross-section and then used wrf_interp_1d to interpolate the data at
> each point in the list to higher resolution in the vertical. Works best
> with points on the 45 deg angle to reduce horizontal space between points
> but I suppose that any array of points should work.  I played with the
> "2-point" example for multiple days before going other routes.  This way
> does however let you control the horizontal extent like you were looking to
> do.
>
>
>  I'll search for the script and pass it along if you would like to give
> it a whirl.
>
>  -Alex
>
> On Mon, Mar 23, 2015 at 11:40 AM, Matthew Fearon <Matthew.Fearon at dri.edu>
> wrote:
>
>>  Hi Evelyn,
>> Thank you for your help. I was able to get a diagonal slice using the
>> single pivot point (and angle) example. Still no luck with the two point
>> example. The latter would be better as I could limit the horizontal extent
>> more easily. I'll try again later.
>> thanks again,
>> Matt
>>
>>  ------------------------------
>> *From:* Evelyn Grell - NOAA Affiliate [evelyn.grell at noaa.gov]
>> *Sent:* Monday, March 23, 2015 8:12 AM
>> *To:* Matthew Fearon
>> *Cc:* wrf-help at ucar.edu; ncl-talk at ucar.edu
>> *Subject:* Re: [ncl-talk] diagonal cross section with wrf_user_intrp3d
>>
>>          Matthew,
>>
>>  Regarding your second question (the easier one), I got confused by this
>> too.  I believe the order of the variables got changed between versions:
>>  In v6.1.2, the order to specify 2 points for a cross section has to be
>> x1,x2,y1,y2.
>> In v6.2.1, the order to specify 2 points has to be x1,y1,x2,y2.
>> (maybe wrfhelp could add a note in the example.)
>>
>>  You can check by looking at the code in your
>>  $NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl
>>
>>  Another thing that I ran into is that it assumes you are defining your
>> points in "WRF" space (ie arrays start with 1) rather than in "NCL" space
>> (ie arrays start with 0) so it subtracts 1 for you...
>>
>>  In wrf_user_interp3d:
>>
>> ; set vertical cross section
>>      if (opts) then
>>        xy = wrf_user_set_xy( z, loc_param(0)-1, loc_param(2)-1, \    ; the -1 is for NCL dimensions
>>                                 loc_param(1)-1, loc_param(3)-1, \
>>                                 angle, opts )
>>
>> (loc_param is the variable containing your XS endpoints).
>>
>>  About your first question, maybe you are missing the 2d interpolation
>> that defines the x-axis?
>>
>>            something like:
>>      if (xang.gt.20. .and. xang.lt.340) then
>>        X_plane = wrf_user_intrp2d(lon,xspts,0.,True)
>>      else
>>        X_plane = wrf_user_intrp2d(lat,xspts,0.,True)
>>      end if
>>      dimsX = dimsizes(X_plane)
>>      xspan = dimsX(0)-1
>>
>>       res at tmXBValues              = fspan(0,xspan,2)
>>
>>  Hope that helps,
>> Evelyn Grell
>>
>>
>> On Mon, Mar 23, 2015 at 12:21 AM, Matthew Fearon <Matthew.Fearon at dri.edu>
>> wrote:
>>
>>>  Dear WRF-help and NCL users,
>>>
>>> Has anyone successfully plotted a cross section with wrf data
>>> along a diagonal, say southeast to northwest or vice versa, using
>>> wrf_user_intrp3d? North/south or east/west works fine, but from the
>>> documentation, a diagonal seemed possible using the example below
>>> *, *although I can't get it working
>>>
>>> *? *Also, the plane is defined (/xstart,xend , ystart,yend/) for sure
>>> rather than (/xstart,ystart , xend,yend/) instead?
>>>
>>> thanks,
>>> Matt
>>>
>>>
>>>
>>>
>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>>>   load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"*
>>>
>>>   a = addfile <https://www.ncl.ucar.edu/Document/Functions/Built-in/addfile.shtml>*("wrfout_d01_2000-01-24_12:00:00.nc","r")
>>>
>>>   time = 1
>>>   tc = *wrf_user_getvar* <https://www.ncl.ucar.edu/Document/Functions/WRF_arw/wrf_user_getvar.shtml>(a,"tc",time)   ; T [C]
>>>   z  = *wrf_user_getvar* <https://www.ncl.ucar.edu/Document/Functions/WRF_arw/wrf_user_getvar.shtml>(a,"z",time)    ; z on mass points
>>>
>>>   plane = (/  40,81 , 259,81  /) ; approx. START x;y and END x;y point
>>>
>>>   ; Extract cross section from point A to point B, as defined in "plane"
>>>   ; And vertically interpolate to height coordinates ("z")
>>>   tc_plane = *wrf_user_intrp3d*(tc,z,"v",plane,0.,True)
>>>
>>>
>>> _______________________________________________
>>> 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
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150323/bdd74358/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wrf_crossection.ncl
Type: application/octet-stream
Size: 11220 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150323/bdd74358/attachment.obj 


More information about the ncl-talk mailing list