Vertical cross section plot

765 views
Skip to first unread message

morstan

unread,
Sep 8, 2015, 5:29:06 AM9/8/15
to Py-ART Users
Dear sir,

I am new to PyART, may i ask how can i make a vertical cross section plot from different elevations of a PPI scan using a SIGMET file? (which is similar to the XSECT display function of IRIS)
I saw a similar example from http://arm-doe.github.io/pyart/dev/auto_examples/plotting/plot_grid_three_panel.html using the methods of plot_longitude_slice and plot_latitude_slice, but the file input was in netCDF format. Thank you.

Stanley

Jonathan Helmus

unread,
Sep 8, 2015, 10:44:07 AM9/8/15
to pyart...@googlegroups.com
--
You received this message because you are subscribed to the Google Groups "Py-ART Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyart-users...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Stanley,

    To create a vertical cross section you will first need to grid the data, then you can follow the process in the three panel example you linked to.  The "Map a single radar to a Cartesian grid" [1] example in the documenation provides and example of opening and creating a grid from a MDV file.  Doing the same for a Sigmet file will require chaning the read function to pyart.io.read_sigmet. 

    The results of gridding and selecting a slice is not the same as the XSECT display in IRIS which I believe does not interpolate the collected gates but directly displays the collected data along a particular azimuth angle.  Such a feature does not yet exist in Py-ART but should be possible to create if you are so inclined.

Cheers,

    - Jonathan Helmus

[1] http://arm-doe.github.io/pyart/dev/auto_examples/mapping/plot_map_one_radar_to_grid.html

morstan

unread,
Sep 10, 2015, 4:54:54 PM9/10/15
to Py-ART Users
Dear Jonathan

Thanks for your advice and it works now. But how can I cut the slice from a certain azimuth instead of longitude or latitude? Thank you!

Scott Collis

unread,
Sep 10, 2015, 4:59:19 PM9/10/15
to pyart...@googlegroups.com
This is very old code and there may be back compatibility issues but
what you need to do is create an RHI from a PPI/SUR
http://nbviewer.ipython.org/github/scollis/notebooks/blob/master/gap_anal/Synthetic%20RHI%20development.ipynb


On 9/10/15 3:54 PM, morstan wrote:
> Dear Jonathan
>
> Thanks for your advice and it works now. But how can I cut the slice from a certain azimuth instead of longitude or latitude? Thank you!
>

--
I ride for Parkinsons research http://www.events.org/sponsorship.aspx?id=51573

Jonathan Helmus

unread,
Sep 11, 2015, 3:42:38 PM9/11/15
to pyart...@googlegroups.com
Py-ART does not have the ability to slide a grid along a particular
angle, only along one of the two orthogonal coordinates. Scott's
notebook it likely your best bet.

morstan

unread,
Sep 17, 2015, 5:21:33 AM9/17/15
to Py-ART Users
I tried Scott's solution (see attached file) but i came up with the following errors:

Traceback (most recent call last):
  File "C:\Users\cwlok\Documents\Python_Scripts\pyart\RHI_allelements.py", line 147, in <module>
    rhi_radar = rhi_from_ppi(radar, [240])
  File "C:\Users\cwlok\Documents\Python_Scripts\pyart\RHI_allelements.py", line 126, in rhi_from_ppi
    this_syn_rhi, azm, ele = extract_rhi(radar, ppi_field, angles)
  File "C:\Users\cwlok\Documents\Python_Scripts\pyart\RHI_allelements.py", line 36, in extract_rhi
    ppi_shape = radar.fields[radar.fields.keys()[0]]['data'].shape
TypeError: 'dict_keys' object does not support indexing

I search the error through the internet and it seems to be the coding problem with Python 2 and 3 (i am using Python 3.4), any solutions with this one? Thank you.

Jonathan Helmus於 2015年9月12日星期六 UTC+8上午3時42分38秒寫道:
RHI_allelements.py

Jonathan Helmus

unread,
Sep 17, 2015, 9:05:49 AM9/17/15
to pyart...@googlegroups.com
If you cast the dict_keys object to a list you should be able to slice it in Python 3:

ppi_shape = radar.fields[list(radar.fields.keys())[0]]['data'].shape

Also I'm working on a function which will produce a synthetic RHI from a PPI and a set of target azimuth angles.  It will be merged into Py-ART this weekend at the latest.

Cheers,

    - Jonathan Helmus

morstan

unread,
Sep 18, 2015, 2:33:16 AM9/18/15
to Py-ART Users
Dear Jonathan,

I tried again and it was successful this time, thank you.

Looking forward to your update function, cheers!!

Stanley

Jonathan Helmus於 2015年9月17日星期四 UTC+8下午9時05分49秒寫道:

Nick Guy

unread,
Oct 2, 2015, 12:32:19 PM10/2/15
to Py-ART Users
Jonathan,

Did this synthetic RHI method get merged? I was just needing something like this.

Nick

Jonathan Helmus

unread,
Oct 5, 2015, 2:06:59 PM10/5/15
to pyart...@googlegroups.com
Nick,

    Yes, the code for the pyart.util.cross_section_ppi function was merged in in PR #380 [1].  As described in the documentation [2] for the function this creates a RHI-like radar volume at the specified azimuth angles.  Any suggestions on a better name or location for this function would be much appreciated.

Cheers,

    - Jonathan Helmus


[1] https://github.com/ARM-DOE/pyart/pull/380
[2] http://arm-doe.github.io/pyart-docs-travis/user_reference/generated/pyart.util.cross_section_ppi.html

Nick Guy

unread,
Oct 9, 2015, 11:17:10 AM10/9/15
to Py-ART Users
Thanks Jonathan, I was looking in the wrong place.
It works well it seems.

Where is the `to_vpt` function located?
Just spit-balling here: I wonder if this could be combined with an RHI plot function, with an optional return of the radar-like instance. Calling it something like `plot_ppi_azimuth' or 'plot_vert_azimuth'? This way it less likely to be confused with an actual RHI down the road.

Nick

Jonathan Helmus

unread,
Oct 9, 2015, 12:08:08 PM10/9/15
to pyart...@googlegroups.com
Nick,

    The to_vpt function can be found as pyart.core.to_vpt.  The location there is a bit inconsistent, I may move it to pyart.util in the future.  The to_vpt function is a bit different than cross_section_ppi the data is interpreted as a VPT volume, not projected like the cross section does.  Also the Radar instance is modified in place, no copy is made.

I like the idea of being able to plot a azimuth cross section of a ppi using RadarDisplay.  I created issue #398 on GitHub [1] to track this.

[1] https://github.com/ARM-DOE/pyart/issues/398

Cheers,

    - Jonathan Helmus

Nick Guy

unread,
Oct 22, 2015, 12:55:39 PM10/22/15
to Py-ART Users
I just submitted a PR that does this. Let me know what you think.

Nick

Jonathan Helmus

unread,
Oct 23, 2015, 12:28:03 PM10/23/15
to pyart...@googlegroups.com
Look good, I made a few suggestions on how to fix a few minor issues but then this should be good to go!

    Thanks for the code!

    - Jonathan Helmus

Afham Yaccop

unread,
Jun 12, 2016, 9:41:09 AM6/12/16
to Py-ART Users

Dear Jonathan, 

I am also new to PyART. I am not sure how to get a cross section as in IRIS below. Basically, in IRIS, we can just make a cut by placing two points to draw a line on top of PPI. I have take a look at the utils.xsect.py, but I am not sure on how insert the two points in the function argument in order to get the vertical cut as in the picture. 

I also have seen this one:
http://arm-doe.github.io/pyart/dev/auto_examples/plotting/plot_xsect.html#example-plotting-plot-xsect-py
From there I can see it cuts from certain azimuth and originating from radar.

Many thanks
Afham


Jonathan Helmus

unread,
Jun 13, 2016, 2:42:45 PM6/13/16
to pyart...@googlegroups.com
Afham,

    The xsect feature in Py-ART can only produce a cross section along a particular azimuth angle and must pass through the center of the volume.  If you can map your two line points into an azimuth angle then you can use this function, if not you will need to write your own cross section tool.  A more general purpose tool for generating cross sections through an arbitrary line segment have been discussed but this feature is not yet available in Py-ART.

    Additionally, Py-ART is text/script driven. You may be interested in ARTView, https://github.com/nguy/artview, which is an interactive GUI viewer build on top of Py-ART which exposed many of the processing and viewing functions in an interactive environment.

Cheers,

    - Jonathan Helmus
Reply all
Reply to author
Forward
0 new messages