ARM-DOE / pyart

The Python-ARM Radar Toolkit. A data model driven interactive toolkit for working with weather radar data.
https://arm-doe.github.io/pyart/
Other
513 stars 266 forks source link

Issues about creating a PPI plot of a file with a cartopy background and range rings #855

Closed zzwei1 closed 2 years ago

zzwei1 commented 5 years ago

There're 2 questions I wanna figure out. ### Question 1. I have used the following script to create a plot with a cartopy background,while after the script finishes running, the figure flashes past and I can't see the figure.

import numpy as np import matplotlib.pyplot as plt import cartopy.crs as ccrs import pyart `filename='KTLX20160914_111404_V06' radar = pyart.io.read(filename) display = pyart.graph.RadarMapDisplay(radar) a=radar.latitude['data'][0] b=radar.longitude['data'][0]

projection = ccrs.LambertConformal(central_latitude=radar.latitude['data'][0], central_longitude=radar.longitude['data'][0]) # fig = plt.figure(figsize=(6,6)) display.plot_ppi_map('reflectivity', 1, vmin=-20, vmax=20, min_lon=-99, max_lon=-95, min_lat=33, max_lat=37, lon_lines=np.arange(-99, -95, .2), resolution='10m', lat_lines=np.arange(33, 37, .1), projection=projection, fig=fig, lat_0=radar.latitude['data'][0], lon_0=radar.longitude['data'][0])

display.plot_range_ring(10., line_style='k-') display.plot_range_ring(20., line_style='k--') display.plot_range_ring(30., line_style='k-') display.plot_range_ring(40., line_style='k--')

display.plot_line_xy(np.array([-40000.0, 40000.0]), np.array([0.0, 0.0]), line_style='k-') display.plot_line_xy(np.array([0.0, 0.0]), np.array([-20000.0, 200000.0]), line_style='k-')

display.plot_point(radar.longitude['data'][0], radar.latitude['data'][0])

plt.show()`

But I have tried to create a plot with a basemap background and got the following figure with the following script.

`import numpy as np import matplotlib.pyplot as plt import pyart

filename = 'nsaxsaprppiC1.a1.20140201.184802.nc'

filename = 'KTLX20160914_111404_V06' radar = pyart.io.read(filename) display = pyart.graph.RadarMapDisplayBasemap(radar)

display.plot_ppi_map('reflectivity', 1, vmin=-20, vmax=20, min_lon=-99, max_lon=-96, min_lat=34, max_lat=36, lon_lines=np.arange(-99, -96, .5), projection = 'lcc' ,cmap='pyart_NWSRef', lat_lines=np.arange(34, 36, .1), resolution='h', lat_0=radar.latitude['data'][0], lon_0=radar.longitude['data'][0])

display.plot_range_ring(10., line_style='k-') display.plot_range_ring(20., line_style='k--') display.plot_range_ring(30., line_style='k-') display.plot_range_ring(40., line_style='k--')

display.plot_line_xy(np.array([-40000.0, 40000.0]), np.array([0.0, 0.0]), line_style='k-') display.plot_line_xy(np.array([0.0, 0.0]), np.array([-20000.0, 200000.0]), line_style='k-')

display.plot_point(radar.longitude['data'][0], radar.latitude['data'][0]) plt.show()` Figure_1

### Question 2. Could I use pyart to get data of the fixed height from the NEXRAD level-2 data? I noticed that the projection method(like 'lcc' in the script) could help me get data of the given latitude and longitude,but it still the data of an elevation angle.

zssherman commented 5 years ago

@zzwei1 For the cartopy plotting code, are you using jupyter notebook? If so, move your imports to a separate cell, or add: %matplotlib inline And it should work fine.