xarray GAMIC backend¶
In this example, we read GAMIC (HDF5) data files using the xarray gamic backend.
[1]:
import glob
import wradlib as wrl
import warnings
warnings.filterwarnings('ignore')
import matplotlib.pyplot as pl
import numpy as np
import xarray as xr
try:
get_ipython().magic("matplotlib inline")
except:
pl.ion()
Load ODIM_H5 Volume Data¶
[2]:
fpath = 'hdf5/DWD-Vol-2_99999_20180601054047_00.h5'
f = wrl.util.get_wradlib_data_file(fpath)
vol = wrl.io.open_gamic_dataset(f)
Inspect RadarVolume¶
[3]:
display(vol)
<wradlib.RadarVolume>
Dimension(s): (sweep: 10)
Elevation(s): (28.0, 18.0, 14.0, 11.0, 8.2, 6.0, 4.5, 3.1, 1.7, 0.6)
Inspect root group¶
The sweep dimension contains the number of scans in this radar volume. Further the dataset consists of variables (location coordinates, time_coverage) and attributes (Conventions, metadata).
[4]:
vol.root
[4]:
<xarray.Dataset>
Dimensions: (sweep: 10)
Coordinates:
time datetime64[ns] 2018-06-01T05:40:47.040999936
sweep_mode <U20 'azimuth_surveillance'
longitude float64 6.457
altitude float64 310.0
latitude float64 50.93
Dimensions without coordinates: sweep
Data variables:
volume_number int64 0
platform_type <U5 'fixed'
instrument_type <U5 'radar'
primary_axis <U6 'axis_z'
time_coverage_start <U20 '2018-06-01T05:40:47Z'
time_coverage_end <U20 '2018-06-01T05:44:16Z'
sweep_group_name (sweep) <U7 'sweep_0' 'sweep_1' ... 'sweep_8' 'sweep_9'
sweep_fixed_angle (sweep) float64 28.0 18.0 14.0 11.0 ... 4.5 3.1 1.7 0.6
Attributes:
version: None
title: None
institution: None
references: None
source: None
history: None
comment: im/exported using wradlib
instrument_name: None
fixed_angle: 28.0- sweep: 10
- time()datetime64[ns]2018-06-01T05:40:47.040999936
- standard_name :
- time
array('2018-06-01T05:40:47.040999936', dtype='datetime64[ns]') - sweep_mode()<U20'azimuth_surveillance'
array('azimuth_surveillance', dtype='<U20') - longitude()float646.457
- long_name :
- longitude
- units :
- degrees_east
- standard_name :
- longitude
array(6.4569489)
- altitude()float64310.0
- long_name :
- altitude
- units :
- meters
- standard_name :
- altitude
array(310.)
- latitude()float6450.93
- long_name :
- latitude
- units :
- degrees_north
- positive :
- up
- standard_name :
- latitude
array(50.9287272)
- volume_number()int640
array(0)
- platform_type()<U5'fixed'
array('fixed', dtype='<U5') - instrument_type()<U5'radar'
array('radar', dtype='<U5') - primary_axis()<U6'axis_z'
array('axis_z', dtype='<U6') - time_coverage_start()<U20'2018-06-01T05:40:47Z'
array('2018-06-01T05:40:47Z', dtype='<U20') - time_coverage_end()<U20'2018-06-01T05:44:16Z'
array('2018-06-01T05:44:16Z', dtype='<U20') - sweep_group_name(sweep)<U7'sweep_0' 'sweep_1' ... 'sweep_9'
array(['sweep_0', 'sweep_1', 'sweep_2', 'sweep_3', 'sweep_4', 'sweep_5', 'sweep_6', 'sweep_7', 'sweep_8', 'sweep_9'], dtype='<U7') - sweep_fixed_angle(sweep)float6428.0 18.0 14.0 11.0 ... 3.1 1.7 0.6
array([28. , 18. , 14. , 11. , 8.2, 6. , 4.5, 3.1, 1.7, 0.6])
- version :
- None
- title :
- None
- institution :
- None
- references :
- None
- source :
- None
- history :
- None
- comment :
- im/exported using wradlib
- instrument_name :
- None
- fixed_angle :
- 28.0
Inspect sweep group(s)¶
The sweep-groups can be accessed via their respective keys. The dimensions consist of range and time with added coordinates azimuth, elevation, range and time. There will be variables like radar moments (DBZH etc.) and sweep-dependend metadata (like fixed_angle, sweep_mode etc.).
[5]:
display(vol[0])
<xarray.Dataset>
Dimensions: (azimuth: 360, range: 360)
Coordinates:
* azimuth (azimuth) float64 0.5 1.5 2.5 3.5 ... 356.5 357.5 358.5 359.5
elevation (azimuth) float64 28.0 28.0 28.0 28.0 ... 28.0 28.0 28.0 28.0
rtime (azimuth) datetime64[ns] 2018-06-01T05:40:57.362999808 ... 20...
* range (range) float32 50.0 150.0 250.0 ... 3.585e+04 3.595e+04
time datetime64[ns] 2018-06-01T05:40:47.040999936
sweep_mode <U20 'azimuth_surveillance'
longitude float64 6.457
latitude float64 50.93
altitude float64 310.0
Data variables:
DBZH (azimuth, range) float32 ...
DBZV (azimuth, range) float32 ...
KDP (azimuth, range) float32 ...
RHOHV (azimuth, range) float32 ...
DBTH (azimuth, range) float32 ...
DBTV (azimuth, range) float32 ...
ZDR (azimuth, range) float32 ...
VRADH (azimuth, range) float32 ...
VRADV (azimuth, range) float32 ...
WRADH (azimuth, range) float32 ...
WRADV (azimuth, range) float32 ...
PHIDP (azimuth, range) float32 ...
Attributes:
fixed_angle: 28.0- azimuth: 360
- range: 360
- azimuth(azimuth)float640.5 1.5 2.5 ... 357.5 358.5 359.5
- standard_name :
- ray_azimuth_angle
- long_name :
- azimuth_angle_from_true_north
- units :
- degrees
- axis :
- radial_azimuth_coordinate
- a1gate :
- 72
- angle_res :
- 1.0
array([ 0.5, 1.5, 2.5, ..., 357.5, 358.5, 359.5])
- elevation(azimuth)float64...
- standard_name :
- ray_elevation_angle
- long_name :
- elevation_angle_from_horizontal_plane
- units :
- degrees
- axis :
- radial_elevation_coordinate
array([27.998657, 27.998657, 27.998657, ..., 27.998657, 27.998657, 27.998657])
- rtime(azimuth)datetime64[ns]2018-06-01T05:40:57.362999808 .....
- standard_name :
- time
array(['2018-06-01T05:40:57.362999808', '2018-06-01T05:40:57.398999808', '2018-06-01T05:40:57.435000064', ..., '2018-06-01T05:40:57.256000000', '2018-06-01T05:40:57.292000000', '2018-06-01T05:40:57.326999808'], dtype='datetime64[ns]') - range(range)float3250.0 150.0 ... 3.585e+04 3.595e+04
- units :
- meters
- standard_name :
- projection_range_coordinate
- long_name :
- range_to_measurement_volume
- spacing_is_constant :
- true
- axis :
- radial_range_coordinate
- meters_to_center_of_first_gate :
- 50.0
- meters_between_gates :
- 100.0
array([ 50., 150., 250., ..., 35750., 35850., 35950.], dtype=float32)
- time()datetime64[ns]2018-06-01T05:40:47.040999936
- standard_name :
- time
array('2018-06-01T05:40:47.040999936', dtype='datetime64[ns]') - sweep_mode()<U20...
array('azimuth_surveillance', dtype='<U20') - longitude()float64...
- long_name :
- longitude
- units :
- degrees_east
- standard_name :
- longitude
array(6.456949)
- latitude()float64...
- long_name :
- latitude
- units :
- degrees_north
- positive :
- up
- standard_name :
- latitude
array(50.928727)
- altitude()float64...
- long_name :
- altitude
- units :
- meters
- standard_name :
- altitude
array(310.)
- DBZH(azimuth, range)float32...
- format :
- UV8
- is_dft :
- 0
- unit :
- dBZ
- _Undetect :
- 0.0
[129600 values with dtype=float32]
- DBZV(azimuth, range)float32...
- format :
- UV8
- is_dft :
- 0
- unit :
- dBZ
- _Undetect :
- 0.0
[129600 values with dtype=float32]
- KDP(azimuth, range)float32...
- format :
- UV8
- is_dft :
- 0
- unit :
- deg/km
- _Undetect :
- 0.0
[129600 values with dtype=float32]
- RHOHV(azimuth, range)float32...
- format :
- UV16
- is_dft :
- 0
- _Undetect :
- 0.0
[129600 values with dtype=float32]
- DBTH(azimuth, range)float32...
- format :
- UV8
- is_dft :
- 0
- unit :
- dBZ
- _Undetect :
- 0.0
[129600 values with dtype=float32]
- DBTV(azimuth, range)float32...
- format :
- UV8
- is_dft :
- 0
- unit :
- dBZ
- _Undetect :
- 0.0
[129600 values with dtype=float32]
- ZDR(azimuth, range)float32...
- format :
- UV8
- is_dft :
- 0
- unit :
- dB
- _Undetect :
- 0.0
[129600 values with dtype=float32]
- VRADH(azimuth, range)float32...
- format :
- UV8
- is_dft :
- 0
- unit :
- m/s
- _Undetect :
- 0.0
[129600 values with dtype=float32]
- VRADV(azimuth, range)float32...
- format :
- UV8
- is_dft :
- 0
- unit :
- m/s
- _Undetect :
- 0.0
[129600 values with dtype=float32]
- WRADH(azimuth, range)float32...
- format :
- UV8
- is_dft :
- 0
- unit :
- m/s
- _Undetect :
- 0.0
[129600 values with dtype=float32]
- WRADV(azimuth, range)float32...
- format :
- UV8
- is_dft :
- 0
- unit :
- m/s
- _Undetect :
- 0.0
[129600 values with dtype=float32]
- PHIDP(azimuth, range)float32...
- format :
- UV8
- is_dft :
- 0
- unit :
- deg
- _Undetect :
- 0.0
[129600 values with dtype=float32]
- fixed_angle :
- 28.0
Goereferencing¶
[6]:
swp = vol[0].copy().pipe(wrl.georef.georeference_dataset)
Plotting¶
[7]:
swp.DBZH.plot.pcolormesh(x='x', y='y')
pl.gca().set_aspect('equal')
[8]:
fig = pl.figure(figsize=(10,10))
swp.DBZH.wradlib.plot_ppi(proj='cg', fig=fig)
[8]:
<matplotlib.collections.QuadMesh at 0x7f36419857c0>
[9]:
import cartopy
import cartopy.crs as ccrs
import cartopy.feature as cfeature
map_trans = ccrs.AzimuthalEquidistant(central_latitude=swp.latitude.values,
central_longitude=swp.longitude.values)
[10]:
map_proj = ccrs.AzimuthalEquidistant(central_latitude=swp.latitude.values,
central_longitude=swp.longitude.values)
pm = swp.DBZH.wradlib.plot_ppi(proj=map_proj)
ax = pl.gca()
ax.gridlines(crs=map_proj)
print(ax)
< GeoAxes: <cartopy.crs.AzimuthalEquidistant object at 0x7f3641feedb0> >
[11]:
map_proj = ccrs.Mercator(central_longitude=swp.longitude.values)
fig = pl.figure(figsize=(10,8))
ax = fig.add_subplot(111, projection=map_proj)
pm = swp.DBZH.wradlib.plot_ppi(ax=ax)
ax.gridlines(draw_labels=True)
[11]:
<cartopy.mpl.gridliner.Gridliner at 0x7f3641e2ce80>
[12]:
import cartopy.feature as cfeature
def plot_borders(ax):
borders = cfeature.NaturalEarthFeature(category='physical',
name='coastline',
scale='10m',
facecolor='none')
ax.add_feature(borders, edgecolor='black', lw=2, zorder=4)
map_proj = ccrs.Mercator(central_longitude=swp.longitude.values)
fig = pl.figure(figsize=(10,8))
ax = fig.add_subplot(111, projection=map_proj)
DBZH = swp.DBZH
pm = DBZH.where(DBZH > 0).wradlib.plot_ppi(ax=ax)
plot_borders(ax)
ax.gridlines(draw_labels=True)
[12]:
<cartopy.mpl.gridliner.Gridliner at 0x7f3641da74c0>
[13]:
import matplotlib.path as mpath
theta = np.linspace(0, 2*np.pi, 100)
center, radius = [0.5, 0.5], 0.5
verts = np.vstack([np.sin(theta), np.cos(theta)]).T
circle = mpath.Path(verts * radius + center)
map_proj = ccrs.AzimuthalEquidistant(central_latitude=swp.latitude.values,
central_longitude=swp.longitude.values,
)
fig = pl.figure(figsize=(10,8))
ax = fig.add_subplot(111, projection=map_proj)
ax.set_boundary(circle, transform=ax.transAxes)
pm = swp.DBZH.wradlib.plot_ppi(proj=map_proj, ax=ax)
ax = pl.gca()
ax.gridlines(crs=map_proj)
[13]:
<cartopy.mpl.gridliner.Gridliner at 0x7f3641dd0130>
[14]:
fig = pl.figure(figsize=(10, 8))
proj=ccrs.AzimuthalEquidistant(central_latitude=swp.latitude.values,
central_longitude=swp.longitude.values)
ax = fig.add_subplot(111, projection=proj)
pm = swp.DBZH.wradlib.plot_ppi(ax=ax)
ax.gridlines()
[14]:
<cartopy.mpl.gridliner.Gridliner at 0x7f36397d9b80>
[15]:
swp.DBZH.wradlib.plot_ppi()
[15]:
<matplotlib.collections.QuadMesh at 0x7f3641bd0d00>
Inspect radar moments¶
The DataArrays can be accessed by key or by attribute. Each DataArray has dimensions and coordinates of it’s parent dataset. There are attributes connected which are defined by ODIM_H5 standard.
[16]:
display(swp.DBZH)
<xarray.DataArray 'DBZH' (azimuth: 360, range: 360)>
array([[13.177166, 11.671261, 19.200787, ..., nan, nan, nan],
[11.169292, 11.671261, 17.192913, ..., nan, nan, nan],
[12.173229, 11.671261, 19.702755, ..., nan, nan, nan],
...,
[10.165356, 11.169292, 19.702755, ..., nan, nan, nan],
[11.169292, 11.671261, 16.188976, ..., nan, nan, nan],
[12.173229, 12.675198, 19.200787, ..., nan, nan, nan]],
dtype=float32)
Coordinates: (12/15)
* azimuth (azimuth) float64 0.5 1.5 2.5 3.5 ... 356.5 357.5 358.5 359.5
elevation (azimuth) float64 28.0 28.0 28.0 28.0 ... 28.0 28.0 28.0 28.0
rtime (azimuth) datetime64[ns] 2018-06-01T05:40:57.362999808 ... 20...
* range (range) float32 50.0 150.0 250.0 ... 3.585e+04 3.595e+04
time datetime64[ns] 2018-06-01T05:40:47.040999936
sweep_mode <U20 'azimuth_surveillance'
... ...
x (azimuth, range) float64 0.3852 1.156 1.926 ... -275.7 -276.4
y (azimuth, range) float64 44.14 132.4 ... 3.159e+04 3.168e+04
z (azimuth, range) float64 333.5 380.4 ... 1.72e+04 1.725e+04
gr (azimuth, range) float64 44.15 132.4 ... 3.159e+04 3.168e+04
rays (azimuth, range) float64 0.5 0.5 0.5 0.5 ... 359.5 359.5 359.5
bins (azimuth, range) float32 50.0 150.0 ... 3.585e+04 3.595e+04
Attributes:
format: UV8
is_dft: 0
unit: dBZ
_Undetect: 0.0- azimuth: 360
- range: 360
- 13.18 11.67 19.2 18.7 22.71 21.71 19.7 ... nan nan nan nan nan nan nan
array([[13.177166, 11.671261, 19.200787, ..., nan, nan, nan], [11.169292, 11.671261, 17.192913, ..., nan, nan, nan], [12.173229, 11.671261, 19.702755, ..., nan, nan, nan], ..., [10.165356, 11.169292, 19.702755, ..., nan, nan, nan], [11.169292, 11.671261, 16.188976, ..., nan, nan, nan], [12.173229, 12.675198, 19.200787, ..., nan, nan, nan]], dtype=float32) - azimuth(azimuth)float640.5 1.5 2.5 ... 357.5 358.5 359.5
- standard_name :
- ray_azimuth_angle
- long_name :
- azimuth_angle_from_true_north
- units :
- degrees
- axis :
- radial_azimuth_coordinate
- a1gate :
- 72
- angle_res :
- 1.0
array([ 0.5, 1.5, 2.5, ..., 357.5, 358.5, 359.5])
- elevation(azimuth)float6428.0 28.0 28.0 ... 28.0 28.0 28.0
- standard_name :
- ray_elevation_angle
- long_name :
- elevation_angle_from_horizontal_plane
- units :
- degrees
- axis :
- radial_elevation_coordinate
array([27.998657, 27.998657, 27.998657, ..., 27.998657, 27.998657, 27.998657])
- rtime(azimuth)datetime64[ns]2018-06-01T05:40:57.362999808 .....
- standard_name :
- time
array(['2018-06-01T05:40:57.362999808', '2018-06-01T05:40:57.398999808', '2018-06-01T05:40:57.435000064', ..., '2018-06-01T05:40:57.256000000', '2018-06-01T05:40:57.292000000', '2018-06-01T05:40:57.326999808'], dtype='datetime64[ns]') - range(range)float3250.0 150.0 ... 3.585e+04 3.595e+04
- units :
- meters
- standard_name :
- projection_range_coordinate
- long_name :
- range_to_measurement_volume
- spacing_is_constant :
- true
- axis :
- radial_range_coordinate
- meters_to_center_of_first_gate :
- 50.0
- meters_between_gates :
- 100.0
array([ 50., 150., 250., ..., 35750., 35850., 35950.], dtype=float32)
- time()datetime64[ns]2018-06-01T05:40:47.040999936
- standard_name :
- time
array('2018-06-01T05:40:47.040999936', dtype='datetime64[ns]') - sweep_mode()<U20'azimuth_surveillance'
array('azimuth_surveillance', dtype='<U20') - longitude()float646.457
- long_name :
- longitude
- units :
- degrees_east
- standard_name :
- longitude
array(6.456949)
- latitude()float6450.93
- long_name :
- latitude
- units :
- degrees_north
- positive :
- up
- standard_name :
- latitude
array(50.928727)
- altitude()float64310.0
- long_name :
- altitude
- units :
- meters
- standard_name :
- altitude
array(310.)
- x(azimuth, range)float640.3852 1.156 ... -275.7 -276.4
array([[ 3.85243340e-01, 1.15572363e+00, 1.92619539e+00, ..., 2.74904895e+02, 2.75672328e+02, 2.76439754e+02], [ 1.15561267e+00, 3.46681884e+00, 5.77799944e+00, ..., 8.24630946e+02, 8.26933013e+02, 8.29235054e+02], [ 1.92562999e+00, 5.77685802e+00, 9.62804345e+00, ..., 1.37410581e+03, 1.37794181e+03, 1.38177776e+03], ..., [-1.92562999e+00, -5.77685802e+00, -9.62804345e+00, ..., -1.37410581e+03, -1.37794181e+03, -1.38177776e+03], [-1.15561267e+00, -3.46681884e+00, -5.77799944e+00, ..., -8.24630946e+02, -8.26933013e+02, -8.29235054e+02], [-3.85243340e-01, -1.15572363e+00, -1.92619539e+00, ..., -2.74904895e+02, -2.75672328e+02, -2.76439754e+02]]) - y(azimuth, range)float6444.14 132.4 ... 3.159e+04 3.168e+04
array([[ 44.14451428, 132.43281034, 220.72012977, ..., 31500.98083157, 31588.92000067, 31676.85820171], [ 44.13106743, 132.39247003, 220.65289628, ..., 31491.38532766, 31579.29770963, 31667.20912384], [ 44.10417784, 132.31180168, 220.51844978, ..., 31472.1972427 , 31560.05605859, 31647.91390731], ..., [ 44.10417784, 132.31180168, 220.51844978, ..., 31472.1972427 , 31560.05605859, 31647.91390731], [ 44.13106743, 132.39247003, 220.65289628, ..., 31491.38532766, 31579.29770963, 31667.20912384], [ 44.14451428, 132.43281034, 220.72012977, ..., 31500.98083157, 31588.92000067, 31676.85820171]]) - z(azimuth, range)float64333.5 380.4 ... 1.72e+04 1.725e+04
array([[ 333.45971573, 380.40454469, 427.34911045, ..., 17151.26201347, 17198.60832619, 17245.95256648], [ 333.45971573, 380.40454469, 427.34911045, ..., 17151.26201347, 17198.60832619, 17245.95256648], [ 333.45971573, 380.40454469, 427.34911045, ..., 17151.26201347, 17198.60832619, 17245.95256648], ..., [ 333.45971573, 380.40454469, 427.34911045, ..., 17151.26201347, 17198.60832619, 17245.95256648], [ 333.45971573, 380.40454469, 427.34911045, ..., 17151.26201347, 17198.60832619, 17245.95256648], [ 333.45971573, 380.40454469, 427.34911045, ..., 17151.26201347, 17198.60832619, 17245.95256648]]) - gr(azimuth, range)float6444.15 132.4 ... 3.159e+04 3.168e+04
array([[ 44.14619523, 132.43785317, 220.72853444, ..., 31502.18033807, 31590.12285575, 31678.06440534], [ 44.14619523, 132.43785317, 220.72853444, ..., 31502.18033807, 31590.12285575, 31678.06440534], [ 44.14619523, 132.43785317, 220.72853444, ..., 31502.18033807, 31590.12285575, 31678.06440534], ..., [ 44.14619523, 132.43785317, 220.72853444, ..., 31502.18033807, 31590.12285575, 31678.06440534], [ 44.14619523, 132.43785317, 220.72853444, ..., 31502.18033807, 31590.12285575, 31678.06440534], [ 44.14619523, 132.43785317, 220.72853444, ..., 31502.18033807, 31590.12285575, 31678.06440534]]) - rays(azimuth, range)float640.5 0.5 0.5 ... 359.5 359.5 359.5
array([[ 0.5, 0.5, 0.5, ..., 0.5, 0.5, 0.5], [ 1.5, 1.5, 1.5, ..., 1.5, 1.5, 1.5], [ 2.5, 2.5, 2.5, ..., 2.5, 2.5, 2.5], ..., [357.5, 357.5, 357.5, ..., 357.5, 357.5, 357.5], [358.5, 358.5, 358.5, ..., 358.5, 358.5, 358.5], [359.5, 359.5, 359.5, ..., 359.5, 359.5, 359.5]]) - bins(azimuth, range)float3250.0 150.0 ... 3.585e+04 3.595e+04
array([[ 50., 150., 250., ..., 35750., 35850., 35950.], [ 50., 150., 250., ..., 35750., 35850., 35950.], [ 50., 150., 250., ..., 35750., 35850., 35950.], ..., [ 50., 150., 250., ..., 35750., 35850., 35950.], [ 50., 150., 250., ..., 35750., 35850., 35950.], [ 50., 150., 250., ..., 35750., 35850., 35950.]], dtype=float32)
- format :
- UV8
- is_dft :
- 0
- unit :
- dBZ
- _Undetect :
- 0.0
Create simple plot¶
Using xarray features a simple plot can be created like this. Note the sortby('rtime') method, which sorts the radials by time.
[17]:
swp.DBZH.sortby('rtime').plot(x="range", y="rtime", add_labels=False)
[17]:
<matplotlib.collections.QuadMesh at 0x7f36397c3610>
[18]:
fig = pl.figure(figsize=(5,5))
pm = swp.DBZH.wradlib.plot_ppi(proj={'latmin': 3e3}, fig=fig)
Mask some values¶
[19]:
swp['DBZH'] = swp['DBZH'].where(swp['DBZH'] >= 0)
swp['DBZH'].plot()
[19]:
<matplotlib.collections.QuadMesh at 0x7f3641dc5a90>
Export to ODIM and CfRadial2¶
[20]:
vol.to_odim('gamic_as_odim.h5')
vol.to_cfradial2('gamic_as_cfradial2.nc')
Import again¶
[21]:
vola = wrl.io.open_odim_dataset('gamic_as_odim.h5')
[22]:
volb = wrl.io.open_cfradial2_dataset('gamic_as_cfradial2.nc')
Check equality¶
We have to drop the time variable when checking equality since GAMIC has millisecond resolution, ODIM has seconds.
[23]:
xr.testing.assert_allclose(vol.root.drop("time"), vola.root.drop("time"))
xr.testing.assert_allclose(vol[0].drop(["rtime", "time"]), vola[0].drop(["rtime", "time"]))
xr.testing.assert_allclose(vol.root.drop("time"), volb.root.drop("time"))
xr.testing.assert_equal(vol[0].drop("time"), volb[0].drop("time"))
xr.testing.assert_allclose(vola.root, volb.root)
xr.testing.assert_allclose(vola[0].drop("rtime"), volb[0].drop("rtime"))
More GAMIC loading mechanisms¶
Use xr.open_dataset to retrieve explicit group¶
[24]:
swp = xr.open_dataset(f, engine="gamic", group="scan9")
display(swp)
<xarray.Dataset>
Dimensions: (azimuth: 360, range: 1000)
Coordinates:
* azimuth (azimuth) float64 0.5 1.5 2.5 3.5 ... 356.5 357.5 358.5 359.5
elevation (azimuth) float64 0.5988 0.5988 0.5988 ... 0.5988 0.5988 0.5988
rtime (azimuth) datetime64[ns] 2018-06-01T05:43:49.404000 ... 2018-...
* range (range) float32 75.0 225.0 375.0 ... 1.498e+05 1.499e+05
time datetime64[ns] 2018-06-01T05:43:40.504000
sweep_mode <U20 'azimuth_surveillance'
longitude float64 6.457
latitude float64 50.93
altitude float64 310.0
Data variables:
DBZH (azimuth, range) float32 ...
DBZV (azimuth, range) float32 ...
KDP (azimuth, range) float32 ...
RHOHV (azimuth, range) float32 ...
DBTH (azimuth, range) float32 ...
DBTV (azimuth, range) float32 ...
ZDR (azimuth, range) float32 ...
VRADH (azimuth, range) float32 ...
VRADV (azimuth, range) float32 ...
WRADH (azimuth, range) float32 ...
WRADV (azimuth, range) float32 ...
PHIDP (azimuth, range) float32 ...
Attributes:
fixed_angle: 0.6- azimuth: 360
- range: 1000
- azimuth(azimuth)float640.5 1.5 2.5 ... 357.5 358.5 359.5
- standard_name :
- ray_azimuth_angle
- long_name :
- azimuth_angle_from_true_north
- units :
- degrees
- axis :
- radial_azimuth_coordinate
- a1gate :
- 271
- angle_res :
- 1.0
array([ 0.5, 1.5, 2.5, ..., 357.5, 358.5, 359.5])
- elevation(azimuth)float64...
- standard_name :
- ray_elevation_angle
- long_name :
- elevation_angle_from_horizontal_plane
- units :
- degrees
- axis :
- radial_elevation_coordinate
array([0.598755, 0.598755, 0.598755, ..., 0.598755, 0.598755, 0.598755])
- rtime(azimuth)datetime64[ns]...
- standard_name :
- time
array(['2018-06-01T05:43:49.404000000', '2018-06-01T05:43:49.504000000', '2018-06-01T05:43:49.604999936', ..., '2018-06-01T05:43:49.102999808', '2018-06-01T05:43:49.204999936', '2018-06-01T05:43:49.304000000'], dtype='datetime64[ns]') - range(range)float3275.0 225.0 ... 1.498e+05 1.499e+05
- units :
- meters
- standard_name :
- projection_range_coordinate
- long_name :
- range_to_measurement_volume
- spacing_is_constant :
- true
- axis :
- radial_range_coordinate
- meters_to_center_of_first_gate :
- 75.0
- meters_between_gates :
- 150.0
array([7.50000e+01, 2.25000e+02, 3.75000e+02, ..., 1.49625e+05, 1.49775e+05, 1.49925e+05], dtype=float32) - time()datetime64[ns]...
- standard_name :
- time
array('2018-06-01T05:43:40.504000000', dtype='datetime64[ns]') - sweep_mode()<U20...
array('azimuth_surveillance', dtype='<U20') - longitude()float64...
- long_name :
- longitude
- units :
- degrees_east
- standard_name :
- longitude
array(6.456949)
- latitude()float64...
- long_name :
- latitude
- units :
- degrees_north
- positive :
- up
- standard_name :
- latitude
array(50.928727)
- altitude()float64...
- long_name :
- altitude
- units :
- meters
- standard_name :
- altitude
array(310.)
- DBZH(azimuth, range)float32...
- format :
- UV8
- is_dft :
- 0
- unit :
- dBZ
- _Undetect :
- 0.0
[360000 values with dtype=float32]
- DBZV(azimuth, range)float32...
- format :
- UV8
- is_dft :
- 0
- unit :
- dBZ
- _Undetect :
- 0.0
[360000 values with dtype=float32]
- KDP(azimuth, range)float32...
- format :
- UV8
- is_dft :
- 0
- unit :
- deg/km
- _Undetect :
- 0.0
[360000 values with dtype=float32]
- RHOHV(azimuth, range)float32...
- format :
- UV16
- is_dft :
- 0
- _Undetect :
- 0.0
[360000 values with dtype=float32]
- DBTH(azimuth, range)float32...
- format :
- UV8
- is_dft :
- 0
- unit :
- dBZ
- _Undetect :
- 0.0
[360000 values with dtype=float32]
- DBTV(azimuth, range)float32...
- format :
- UV8
- is_dft :
- 0
- unit :
- dBZ
- _Undetect :
- 0.0
[360000 values with dtype=float32]
- ZDR(azimuth, range)float32...
- format :
- UV8
- is_dft :
- 0
- unit :
- dB
- _Undetect :
- 0.0
[360000 values with dtype=float32]
- VRADH(azimuth, range)float32...
- format :
- UV8
- is_dft :
- 0
- unit :
- m/s
- _Undetect :
- 0.0
[360000 values with dtype=float32]
- VRADV(azimuth, range)float32...
- format :
- UV8
- is_dft :
- 0
- unit :
- m/s
- _Undetect :
- 0.0
[360000 values with dtype=float32]
- WRADH(azimuth, range)float32...
- format :
- UV8
- is_dft :
- 0
- unit :
- m/s
- _Undetect :
- 0.0
[360000 values with dtype=float32]
- WRADV(azimuth, range)float32...
- format :
- UV8
- is_dft :
- 0
- unit :
- m/s
- _Undetect :
- 0.0
[360000 values with dtype=float32]
- PHIDP(azimuth, range)float32...
- format :
- UV8
- is_dft :
- 0
- unit :
- deg
- _Undetect :
- 0.0
[360000 values with dtype=float32]
- fixed_angle :
- 0.6