diff --git a/doc/source/arm_figure.png b/doc/source/arm_figure.png new file mode 100644 index 00000000..76960d97 Binary files /dev/null and b/doc/source/arm_figure.png differ diff --git a/doc/source/hrrr_figure.png b/doc/source/hrrr_figure.png new file mode 100644 index 00000000..13ef2a0c Binary files /dev/null and b/doc/source/hrrr_figure.png differ diff --git a/doc/source/sydney_tornado.png b/doc/source/sydney_tornado.png new file mode 100644 index 00000000..aa366d0f Binary files /dev/null and b/doc/source/sydney_tornado.png differ diff --git a/examples/hurricane_florence.py b/examples/hurricane_florence.py index b97794fd..58778912 100644 --- a/examples/hurricane_florence.py +++ b/examples/hurricane_florence.py @@ -4,7 +4,12 @@ This is an example of how to retrieve winds in Hurricane Florence. In this example, we use data from 2 NEXRAD radars as well as from -the HRRR to retrieve the winds. +the HRRR to retrieve the winds + +Grided netCDF files are downloadable from: +https://drive.google.com/drive/u/1/folders/1pcQxWRJV78xuJePTZnlXPPpMe1qut0ie + +.. image:: ../../hrrr_figure.png Author: Robert C. Jackson """ @@ -14,6 +19,7 @@ import pydda import matplotlib.pyplot as plt import cartopy.crs as ccrs +import numpy as np hrrr_url = ('https://pando-rgw01.chpc.utah.edu/hrrr/prs/20180914/' + 'hrrr.t06z.wrfprsf00.grib2') @@ -27,15 +33,16 @@ u_init, v_init, w_init = pydda.initialization.make_constant_wind_field( grid_mhx, (0.0, 0.0, 0.0)) out_grids = pydda.retrieval.get_dd_wind_field( - [grid_mhx, grid_ltx], u_init, v_init, w_init, Co=1.0, Cm=1000.0, Cmod=1e-3, + [grid_mhx, grid_ltx], u_init, v_init, w_init, Co=0.1, Cm=1000.0, Cmod=1e-3, mask_outside_opt=True, vel_name='corrected_velocity', model_fields=["hrrr"]) -fig = plt.figure(figsize=(15, 10)) +fig = plt.figure(figsize=(25, 15)) ax = plt.axes(projection=ccrs.PlateCarree()) ax = pydda.vis.plot_horiz_xsection_barbs_map( out_grids, ax=ax, bg_grid_no=-1, level=1, barb_spacing_x_km=20.0, - barb_spacing_y_km=20.0) - + barb_spacing_y_km=20.0, cmap='pyart_HomeyerRainbow') +ax.set_xticks(np.arange(-80, -75, 0.5)) +ax.set_yticks(np.arange(33., 35.5, 0.5)) plt.title(out_grids[0].time['units'][13:] + ' winds at 0.5 km') plt.show() diff --git a/examples/oklahoma_example.py b/examples/oklahoma_example.py new file mode 100644 index 00000000..77b6bebf --- /dev/null +++ b/examples/oklahoma_example.py @@ -0,0 +1,48 @@ +""" + +Example of a wind retrieval from KVNX and 2 XSAPRs in Oklahoma +-------------------------------------------------------------- + +This shows an example of how to combine data from 3 radars and HRRR in +the vicinity of the SGP site in North Central Oklahoma. + +Grided netCDF files are downloadable from: +https://drive.google.com/drive/u/1/folders/1pcQxWRJV78xuJePTZnlXPPpMe1qut0ie + +.. image:: ../../arm_figure.png + +""" + +import pyart +import pydda +import matplotlib.pyplot as plt +import numpy as np +import urllib + +hrrr_url = ('https://pando-rgw01.chpc.utah.edu/hrrr/prs/20181004/' + + 'hrrr.t10z.wrfprsf00.grib2') +grid0 = pyart.io.read_grid('grid0.20171004.095021.nc') +grid1 = pyart.io.read_grid('grid1.20171004.095021.nc') +grid2 = pyart.io.read_grid('grid2.20171004.095021.nc') + +urllib.request.urlretrieve(hrrr_url, 'test.grib2') +grid_mhx = pydda.constraints.add_hrrr_constraint_to_grid(grid0, + 'test.grib2') + +# Set initialization and do retrieval +u_init, v_init, w_init = pydda.initialization.make_constant_wind_field(grid1) +new_grids = pydda.retrieval.get_dd_wind_field([grid0, grid1, grid2], + u_init, v_init, w_init, Co=0.1, Cm=100.0, + model_fields=["hrrr"], + mask_outside_opt=True) +# Make a neat plot +fig = plt.figure(figsize=(10,10)) +ax = pydda.vis.plot_horiz_xsection_quiver(new_grids, background_field='reflectivity', level=3, + show_lobes=False, bg_grid_no=0, vmin=0, vmax=60, + quiverkey_len=10.0, + quiver_spacing_x_km=2.0, quiver_spacing_y_km=2.0, + quiverkey_loc='top', colorbar_contour_flag=True, + cmap='pyart_HomeyerRainbow') +ax.set_xlim([-20, 40]) +ax.set_ylim([-20, 40]) +plt.show(ax) diff --git a/examples/plot_examples.py b/examples/plot_examples.py index 0556c5ad..b69328c9 100644 --- a/examples/plot_examples.py +++ b/examples/plot_examples.py @@ -28,7 +28,7 @@ # Start the wind retrieval. This example only uses the mass continuity # and data weighting constraints. Grids = pydda.retrieval.get_dd_wind_field([berr_grid, cpol_grid], u_init, - v_init, w_init, Co=10.0, Cm=1500.0, + v_init, w_init, Co=1.0, Cm=1500.0, Cz=0, frz=5000.0, filt_iterations=2, mask_outside_opt=True, upper_bc=1) diff --git a/examples/plot_examples_nested.py b/examples/plot_examples_nested.py index 0d5393a7..5cfc8aa5 100644 --- a/examples/plot_examples_nested.py +++ b/examples/plot_examples_nested.py @@ -38,7 +38,7 @@ # Start the wind retrieval. This example only uses the mass continuity # and data weighting constraints. Grids = pydda.retrieval.get_dd_wind_field_nested( - [berr_grid, cpol_grid], u_init, v_init, w_init, client, Co=10.0, + [berr_grid, cpol_grid], u_init, v_init, w_init, client, Co=1.0, Cm=1500.0, Cz=0, frz=5000.0, filt_iterations=2, mask_outside_opt=True, upper_bc=1) diff --git a/examples/plot_fun_with_constraints.py b/examples/plot_fun_with_constraints.py index ff3d2d0e..a7f976e4 100644 --- a/examples/plot_fun_with_constraints.py +++ b/examples/plot_fun_with_constraints.py @@ -40,7 +40,7 @@ new_grids = pydda.retrieval.get_dd_wind_field([cpol_grid, berr_grid], u_init, v_init, w_init, Co=1.0, Cm=1500.0, frz=5000.0, - mask_outside_opt=True) + mask_outside_opt=False) fig = plt.figure(figsize=(7, 7)) ax = plt.axes(projection=ccrs.PlateCarree()) @@ -52,8 +52,8 @@ # Or, let's make the radar data more important! new_grids = pydda.retrieval.get_dd_wind_field([cpol_grid, berr_grid], u_init, v_init, w_init, - Co=10.0, Cm=1500.0, frz=5000.0, - mask_outside_opt=True) + Co=1.0, Cm=1500.0, frz=5000.0, + mask_outside_opt=False) fig = plt.figure(figsize=(7, 7)) ax = plt.axes(projection=ccrs.PlateCarree()) diff --git a/examples/sydney_tornado.py b/examples/sydney_tornado.py new file mode 100644 index 00000000..c7a97774 --- /dev/null +++ b/examples/sydney_tornado.py @@ -0,0 +1,43 @@ +""" + +Example of a wind retrieval in a tornado over Sydney +---------------------------------------------------- + +This shows an example of how to retrieve winds from 4 radars over Sydney. + +Grided netCDF files are downloadable from: +https://drive.google.com/drive/u/1/folders/1pcQxWRJV78xuJePTZnlXPPpMe1qut0ie + +.. image:: ../../sydney_tornado.png + +""" + +import pyart +import pydda +import matplotlib.pyplot as plt +import numpy as np + +grid1 = pyart.io.read_grid('grid1_sydney.nc') +grid2 = pyart.io.read_grid('grid2_sydney.nc') +grid3 = pyart.io.read_grid('grid3_sydney.nc') +grid4 = pyart.io.read_grid('grid4_sydney.nc') + +# Set initialization and do retrieval +u_init, v_init, w_init = pydda.initialization.make_constant_wind_field(grid1, vel_field='VRADH_corr') +new_grids = pydda.retrieval.get_dd_wind_field([grid1, grid2, grid3, grid4], + u_init, v_init, w_init, + vel_name='VRADH_corr', refl_field='DBZH', + mask_outside_opt=True) +# Make a neat plot +fig = plt.figure(figsize=(10,7)) +ax = pydda.vis.plot_horiz_xsection_quiver_map(new_grids, background_field='DBZH', level=3, + show_lobes=False, bg_grid_no=3, vmin=0, vmax=60, + quiverkey_len=40.0, + quiver_spacing_x_km=2.0, quiver_spacing_y_km=2.0, + quiverkey_loc='top', colorbar_contour_flag=True, + cmap='pyart_HomeyerRainbow') +ax.set_xticks(np.arange(150.5, 153, 0.1)) +ax.set_yticks(np.arange(-36, -32.0, 0.1)) +ax.set_xlim([151.0, 151.35]) +ax.set_ylim([-34.15, -33.9]) +plt.show(ax)