[ncl-talk] Cross section vertical coordinate and tick mark labeling

Ryan Connelly rconne01 at gmail.com
Tue May 10 14:12:22 MDT 2016


Hi Evelyn,

I discovered a problem in the code snippet you sent me yesterday.  The data
is not actually interpolating to that new z; only the axis label is
changing.  See below.  Do the arguments for the variables being plotted
change as well?  Right now I have them still referencing z

        dbz_plane = wrf_user_intrp3d(dbz,z,"v",plane,0.,opts)
        thes_plane = wrf_user_intrp3d(thes,z,"v",plane,0.,opts)
        ww_plane = wrf_user_intrp3d(ww,z,"v",plane,0.,opts)

but if I switch one to zz, I get a dimension mismatch error: fatal:Number
of subscripts do not match number of dimensions of variable,(3) Subscripts
used, (2) Subscripts expected

Is it right that both of the first arguments in the call to
wrf_user_intrp3d when defining zz should be z?

         zz = wrf_user_intrp3d(z,z,"v",plane,0.,opts)    ; interpolate z ->
zz

Thanks,
Ryan

[image: Inline image 1]
[image: Inline image 2]



On Mon, May 9, 2016 at 4:30 PM, Evelyn Grell - NOAA Affiliate <
evelyn.grell at noaa.gov> wrote:

> Ryan,
>
> Glad to hear that it is working!
>
> I realize that the example is not exactly intuitive.  I didn't see why z
> was interpolated at first, but it is necessary.
>
> You can actually change that hard-wired # of vertical levels if you go
> into the code in your
> $NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl
> The limit of 100 doesn't give very good resolution in the boundary layer.
> Alternatively, you can limit the number of levels that you send to the
> interpolation....
> But for now, enjoy your success!
>
> Evelyn
>
> On Mon, May 9, 2016 at 12:12 PM, Ryan Connelly <rconne01 at gmail.com> wrote:
>
>> Hi Evelyn,
>>
>> This worked.  Thank you!  Your comments were especially helpful.
>>
>> Ryan
>>
>> On Mon, May 9, 2016 at 11:28 AM, Evelyn Grell - NOAA Affiliate <
>> evelyn.grell at noaa.gov> wrote:
>>
>>> Ryan,
>>>
>>> Your dbz array has been vertically interpolated, using wrf_user_intrp3d.
>>> This routine has a hard-wired number of vertical levels set to 100.
>>>
>>> Since you want to plot from 0-10 km, you should follow the example for a
>>> limited vertical extent:
>>>
>>>  http://www2.mmm.ucar.edu/wrf/OnLineTutorial/Graphics/NCL/Examples/CROSS_SECTION/wrf_CrossSection4.htm
>>> <http://www2.mmm.ucar.edu/wrf/OnLineTutorial/Graphics/NCL/Examples/CROSS_SECTION/wrf_CrossSection4.htm>
>>> in which your height (z) is also vertically interpolated to these 100
>>> levels.  If you follow what happens to zz in the online example, I think
>>> you will get what you want.  I have extracted the required lines and added
>>> a few comments to what they have already.
>>>
>>>    ; get height info for labels
>>>       zmin = 0.
>>>       zmax = 10.                         ; We are only interested in the first 10km
>>>       nz   = floattoint(zmax/2 + 1)        ; nz = # of tick marks (you want 6)
>>>
>>>         ; Find the index where 10km is - only need to do this once
>>>
>>>
>>>           zz = wrf_user_intrp3d(z,z,"v",plane,angle,opts)    ; interpolate z -> zz
>>>           b = ind(zz(:,0) .gt. zmax*1000. )                  ; get 1st index above zmax
>>>           zspan = b(0) - 1                                         ; level index to use
>>>
>>>              delete(zz)
>>>
>>>           delete(b)
>>>
>>> .....
>>>
>>>          opts_xy at tmYLValues      = fspan(0,zspan,nz)         ; Create tick marks
>>>
>>>         opts_xy at tmYLLabels        = sprintf("%.1f",fspan(zmin,zmax,nz))  ; Create labels
>>>
>>> Then when you actually do the plotting, you must set the max index to limit the vertical dimension:
>>>
>>>         contour_dbz = wrf_contour(a,wks,dbz_plane(0:zspan,:),opts_xy)
>>>
>>> Good luck,
>>>
>>> Evelyn
>>>
>>>
>>>
>>> On Sun, May 8, 2016 at 8:22 PM, Ryan Connelly <rconne01 at gmail.com>
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> I produce a vertical plane of, in this case, simulated reflectivity.  I
>>>> want to then manually define the y axis (in this case z) to have tick marks
>>>> every 2 km from 0 to 10 km.  This is proving surprisingly difficult.
>>>>
>>>> This WRF run has 39 vertical levels, yet somehow a PrintVarSummary of
>>>> the newly-created plane (below) reveals that its vertical extent is "100".
>>>>  100 whats?  Not 100 vertical levels, not 100 meters or 100 km, not 100
>>>> hPa...
>>>>
>>>> I figured out how to use the tmYLValues and tmYLLabels options in xy
>>>> plotting resources (also below) to define where to put tick marks and what
>>>> to label them, to get me the 2-4-6-8-10 that I want, *but my problem
>>>> is: how do I get them to match the actual vertical coordinate of the data
>>>> (meters or km)?*  Right now, I can put in any numbers I want and it'll
>>>> put them there, but the contours don't move, so the actual height of the
>>>> data is not changing, and remains unknown.
>>>>
>>>> Variable: dbz_plane
>>>> Type: float
>>>> Total Size: 60400 bytes
>>>>             15100 values
>>>> Number of Dimensions: 2
>>>> Dimensions and sizes:   [Vertical | 100] x [Horizontal | 151]
>>>> Coordinates:
>>>> Number Of Attributes: 4
>>>>   _FillValue :  9.96921e+36
>>>>   units :       dBZ
>>>>   description : Reflectivity
>>>>   Orientation : Cross-Section: (27,254) to (142,156)
>>>>
>>>> ****************************************************
>>>>
>>>>  ; Options for XY Plots
>>>>         opts_xy                         = res
>>>>         opts_xy at tiYAxisString           = "Height (km)"
>>>>         opts_xy at cnMissingValPerimOn     = True
>>>>         opts_xy at cnMissingValFillColor   = 0
>>>>         opts_xy at cnMissingValFillPattern = 11
>>>>         opts_xy at tmYLMode                = "Explicit"
>>>>         ;opts_xy at tmYLValues              = fspan(0,100,6)
>>>>        ; Create tick marks
>>>>         ;opts_xy at tmYLLabels              = fspan(0,10,6)  ; Create
>>>> labels
>>>>         opts_xy at tiXAxisFontHeightF      = 0.020
>>>>         opts_xy at tiYAxisFontHeightF      = 0.020
>>>>         opts_xy at tmXBMajorLengthF        = 0.02
>>>>         opts_xy at tmYLMajorLengthF        = 0.02
>>>>         opts_xy at tmYLLabelFontHeightF    = 0.015
>>>>         opts_xy at PlotOrientation         = dbz_plane at Orientation
>>>>
>>>>
>>>> Thanks,
>>>> Ryan
>>>>
>>>> --
>>>> Ryan Connelly
>>>> M.S. Student in Atmospheric Sciences, Stony Brook University
>>>> B.S. in Meteorology with Minors in Mathematics and GIS, Valparaiso
>>>> University
>>>> rconne01 at gmail.com
>>>> ryan.connelly at stonybrook.edu
>>>>
>>>> _______________________________________________
>>>> ncl-talk mailing list
>>>> ncl-talk at ucar.edu
>>>> List instructions, subscriber options, unsubscribe:
>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>
>>>>
>>>
>>
>>
>> --
>> Ryan Connelly
>> M.S. Student in Atmospheric Sciences, Stony Brook University
>> B.S. in Meteorology with Minors in Mathematics and GIS, Valparaiso
>> University
>> rconne01 at gmail.com
>> ryan.connelly at stonybrook.edu
>>
>
>


-- 
Ryan Connelly
M.S. Student in Atmospheric Sciences, Stony Brook University
B.S. in Meteorology with Minors in Mathematics and GIS, Valparaiso
University
rconne01 at gmail.com
ryan.connelly at stonybrook.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160510/bccfb0b4/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 312722 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160510/bccfb0b4/attachment-0002.png 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 313142 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160510/bccfb0b4/attachment-0003.png 


More information about the ncl-talk mailing list