Radar Bins#
import warnings
import matplotlib as mpl
import matplotlib.pyplot as plt
import wradlib as wrl
import xradar as xd
warnings.filterwarnings("ignore")
Artificial Dataset#
swp = (
xd.model.create_sweep_dataset(rng=150)
.swap_dims(time="azimuth")
)
swp = swp.assign_coords(sweep_mode="azimuthal_surveillance")
display(swp)
<xarray.Dataset> Size: 17kB
Dimensions: (azimuth: 360, range: 1000)
Coordinates:
* azimuth (azimuth) float64 3kB 0.5 1.5 2.5 3.5 ... 357.5 358.5 359.5
time (azimuth) datetime64[ns] 3kB 2022-08-27T10:00:00 ... 2022-08-...
elevation (azimuth) float64 3kB 1.0 1.0 1.0 1.0 1.0 ... 1.0 1.0 1.0 1.0
* range (range) float64 8kB 75.0 225.0 375.0 ... 1.498e+05 1.499e+05
longitude float64 8B 8.788
latitude float64 8B 46.17
altitude int64 8B 375
sweep_mode <U22 88B 'azimuthal_surveillance'
Data variables:
*empty*Radar Bin Altitude#
With wradlib.georef.GeorefMethods.bin_altitude we can calculate the height of a radar bin taking the refractivity of the atmosphere into account.
Based on [Doviak et al., 1993] the bin altitude is calculated as \(h = \sqrt{r^2 + (k_e r_e)^2 + 2 r k_e r_e \sin\theta} - k_e r_e\).
ke = [0.5, 1., 4/3., 2., 5.]
alt = [swp.wrl.georef.bin_altitude(ke=k) for k in ke]
fig = plt.figure(figsize=(12, 4))
ax = fig.add_subplot()
for k, ba in zip(ke, alt):
ba.isel(azimuth=0).plot(ax=ax, label=f"ke={k:.2f}")
ax.legend(loc="best")
ax.set_title("Bin Altitude")
ax.grid()
ax.set_ylim(0, 6500)
ax.set_xlim(0, 150e3)
fig.tight_layout()
Radar Bin Distance#
With wradlib.georef.GeorefMethods.bin_distance we can calculate the great circle distance from radar site to radar bin over spherical earth, taking the refractivity of the atmosphere into account.
\(s = k_e r_e \arctan\left(\frac{r \cos\theta}{r \cos\theta + k_e r_e + h}\right)\)
where \(h\) would be the radar site altitude amsl.
ke = [0.5, 1., 4/3., 2., 5., 50.]
dist = [swp.wrl.georef.bin_distance(ke=k) for k in ke]
for di in dist:
print(di[0][0].values, di[0][-1].values)
74.97971963171686 149651.33065702143
74.98414812611179 149804.19687673674
74.98525533036683 149833.85281747056
74.98636256688718 149860.06998346088
74.98769129330375 149886.9833123446
74.98848855145745 149900.74689067242
Radar Site Distance#
With wradlib.georef.GeorefMethods.site_distance we can calculate the great circle distance from bin at certain altitude to the radar site over spherical earth, taking the refractivity of the atmosphere into account. Based on [Doviak et al., 1993] the site distance may be calculated as:
\(s = k_e r_e \arcsin\left(\frac{r \cos\theta}{k_e r_e + h_n(r, \theta, r_e, k_e)}\right)\)
where \(h_n\) is provided under the hood by by bin_altitude.
ke = [0.5, 1., 4/3., 2., 5., 50.]
dist = [swp.wrl.georef.site_distance(ke=k) for k in ke]
for di in dist:
print(di[0][0].values, di[0][-1].values)
74.97971963171688 149651.33065702143
74.98414812611179 149804.19687673677
74.98525533036683 149833.85281747056
74.98636256688718 149860.06998346088
74.98769129330375 149886.9833123446
74.98848855145744 149900.7468906724