CAPPI plot

311 views
Skip to first unread message

Jordi Figueras i Ventura

unread,
Sep 14, 2016, 4:06:29 AM9/14/16
to Py-ART Users
Dear Py-ART users,

This is likely to be a stupid question but I do not manage to solve it.

I am trying to plot a CAPPI and I would like the axis ticks to be in units of distance from radar in km. Do you have any idea on how to do that? In attachment you can see an example of what I get so far. Here is my relevant code:

    # cartesian mapping
    grid = pyart.map.grid_from_radars(
        (radar,), grid_shape=(1, 241, 241),
        grid_limits=((altitude, altitude), (xmin*1000., xmax*1000.),
                     (ymin*1000., ymax*1000.)),
        fields=[field_name])
   
    # display data
    display = pyart.graph.GridMapDisplay(grid)
    fig = plt.figure(figsize=[prdcfg['ppiImageConfig']['xsize'],
                              prdcfg['ppiImageConfig']['ysize']],
                     dpi=72)
    display.plot_grid(field_name, axislabels_flag=True)
   
    fig.savefig(fname)
    plt.close()


Thanks in advance for your help.

Greetings from Switzerland,



Jordi
20140523000046_cappi_RAW_dBZ_alt1000.0.png

Scott Collis

unread,
Sep 14, 2016, 8:34:48 AM9/14/16
to Jordi Figueras i Ventura, pyart...@googlegroups.com
You will not get a map background but you can use radardisplay (i.e. Not mapdisplay) 

As for getting a basemap with distance ticks as against lat/lon that should be doable but would need an override of the ticks on the axes instance 

-sent from a mobile device-
--
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.
<20140523000046_cappi_RAW_dBZ_alt1000.0.png>

Jordi Figueras i Ventura

unread,
Sep 14, 2016, 10:06:38 AM9/14/16
to Py-ART Users, jfi...@gmail.com
Hi Scott,

I want to generate a CAPPI (constant altitude PPI). As far as I know this is not possible in Py-ART without gridding the radar data and radardisplay does not accept grid objects.

Am I missing something?

Thanks in advance,


Jordi




El dimecres, 14 setembre de 2016 14:34:48 UTC+2, Scott Collis va escriure:

Scott Collis

unread,
Sep 14, 2016, 10:43:12 AM9/14/16
to Jordi Figueras i Ventura, Py-ART Users
Ahh.. My mistake..

I am snowed under at the moment but it would be a nice feature to do this..

I think the way it can be achieved is to simple use the basemap instance to work out Delta_x and Delta_y for the tick locations on the map display and then  change the tick labels.

I know I always put a scale in my plots to show distances using m.drawmapscale



Dr Scott Collis
Purveyor of lofty observations (Atmospheric Scientist) 
Environmental Science Division
Argonne National Laboratory
Mb: +1 630 235 8025
Of: +1 630 252 0550
Become a Py-ART user today! 
http://arm-doe.github.io/pyart/

Jordi Figueras i Ventura

unread,
Sep 15, 2016, 6:18:09 AM9/15/16
to Py-ART Users, jfi...@gmail.com
Hi Scott, all,

I found a way to do what I wanted using the keyword extent but this is a work around since the grid is in lat/lon coordinates. It would be nice to have a proper CAPPI plot in Py-ART. Do you think we should open an issue about it?

    # cartesian mapping
    grid = pyart.map.grid_from_radars(
        (radar,), grid_shape=(1, 241, 241),
        grid_limits=((altitude, altitude), (ymin*1000., ymax*1000.),
                     (xmin*1000., xmax*1000.)),

        fields=[field_name])
   
    # display data   
    fig = plt.figure(figsize=[prdcfg['ppiImageConfig']['xsize'],
                              prdcfg['ppiImageConfig']['ysize']],
                     dpi=72)
    ax = fig.add_subplot(111)
    cmap = pyart.config.get_field_colormap(field_name)
    vmin, vmax = pyart.config.get_field_limits(field_name)
    titl = pyart.graph.common.generate_grid_title(grid, field_name, 0)
   
    cax = ax.imshow(
        grid.fields[field_name]['data'][0], extent=(xmin, xmax, ymin, ymax),
        origin='lower', cmap=cmap, vmin=vmin, vmax=vmax)
    plt.xlabel('East West distance from radar(km)')
    plt.ylabel('North South distance from radar(km)')
    plt.title(titl)
   
    # plot the colorbar and set the label.
    if 'standard_name' in grid.fields[field_name]:
        standard_name = grid.fields[field_name]['standard_name']
    elif 'long_name' in grid.fields[field_name]:
        standard_name = grid.fields[field_name]['long_name']
    else:
        standard_name = field
   
    if 'units' in grid.fields[field_name]:
        units = grid.fields[field_name]['units']
    else:
        units = '?'
   
    label = pyart.graph.common.generate_colorbar_label(standard_name, units)
   
    cb = fig.colorbar(cax)
    cb.set_label(label)
   
    fig.savefig(fname)
    plt.close()


El dimecres, 14 setembre de 2016 16:43:12 UTC+2, Scott Collis va escriure:
Ahh.. My mistake..

I am snowed under at the moment but it would be a nice feature to do this..

I think the way it can be achieved is to simple use the basemap instance to work out Delta_x and Delta_y for the tick locations on the map display and then  change the tick labels.

I know I always put a scale in my plots to show distances using m.drawmapscale


Dr Scott Collis
Purveyor of lofty observations (Atmospheric Scientist) 
Environmental Science Division
Argonne National Laboratory
Auto Generated Inline Image 1
Auto Generated Inline Image 2

Jonathan Helmus

unread,
Sep 16, 2016, 3:55:53 PM9/16/16
to pyart...@googlegroups.com
Jordi,

    Do you want to plot a CAPPI on a map or just a plot with ticks in kilometers?  If the later than no, Py-ART does not have this capability built-in but I would like to see such a capability in Py-ART.  Having a GridDisplay class which is similar to the RadarDisplay class would be my though on how to implement this.  Feel free to open an issue on the topic if you are interested.

Cheers,

    - Jonathan Helmus

Scott Collis

unread,
Sep 16, 2016, 5:08:16 PM9/16/16
to Jonathan Helmus, pyart...@googlegroups.com
Furthermore for both RadarMapDisplay and GridMapDisplay it would be nice to have X/Y axis in meters. even though this would be an approximation (x and y along that meridian and zone only) it would be handy. 

Dr Scott Collis
Purveyor of lofty observations (Atmospheric Scientist) 
Environmental Science Division
Argonne National Laboratory
Mb: +1 630 235 8025
Become a Py-ART user today! 

Jordi Figueras i Ventura

unread,
Sep 19, 2016, 2:02:40 AM9/19/16
to Py-ART Users
Jonathan,

In this particular case I am interested in a plot with ticks in km so yes, something simmilar to RadarDisplay. As Scott said though, a map in km would be a handy addition.

I will open an issue.

Cheers,


Jordi


 

El divendres, 16 setembre de 2016 21:55:53 UTC+2, Jonathan Helmus va escriure:
Auto Generated Inline Image 1
Auto Generated Inline Image 2
Reply all
Reply to author
Forward
0 new messages