xarray powered Cf/Radial and ODIM_H5¶
In this example, we read and write Cf/Radial (NetCDF) and ODIM_H5 (HDF5) data files from different sources using an xarray powered data structure.
[1]:
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()
from wradlib.io.xarray import CfRadial, OdimH5
Load ODIM_H5 Volume Data¶
[2]:
fpath = 'hdf5/knmi_polar_volume.h5'
f = wrl.util.get_wradlib_data_file(fpath)
cf1 = OdimH5(f, standard='cf', georef=True)
Inspect root group¶
You can use the object dictionary using cf1[‘root’] or the property cf1.root.
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).
[3]:
cf1.root
[3]:
<xarray.Dataset>
Dimensions: (sweep: 14)
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 '2011-06-10T11:40:02Z'
time_coverage_end <U20 '2011-06-10T11:43:54Z'
latitude float32 52.95334
longitude float32 4.78997
altitude float32 50.0
altitude_agl float64 nan
sweep_group_name (sweep) <U8 'sweep_1' 'sweep_2' ... 'sweep_14'
sweep_fixed_angle (sweep) float32 0.3 0.4 0.8 1.1 ... 12.0 15.0 20.0 25.0
frequency float64 nan
status_xml <U4 'None'
Attributes:
Conventions: Cf/Radial
version: H5rad 2.0
title: None
institution: RAD:NL51;PLC:nldhl
references: None
source: None
history: None
comment: im/exported using wradlib
instrument_name: None
site_name: name of site where data were gathered
scan_name: name of scan strategy used, if applicable
scan_id: scan strategy id, if applicable. assumed 0 if missing
platform_is_mobile: "true" or "false", assumed "false" if missing
ray_times_increase: "true" or "false", assumed "true" if missing. This ...
field_names: array of strings of field names present in this file.
time_coverage_start: copy of time_coverage_start global variable
time_coverage_end: copy of time_coverage_end global variable
simulated data: "true" or "false", assumed "false" if missing. data...
instrument: RAD:NL51;PLC:nldhl- sweep: 14
- 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'2011-06-10T11:40:02Z'
array('2011-06-10T11:40:02Z', dtype='<U20') - time_coverage_end()<U20'2011-06-10T11:43:54Z'
array('2011-06-10T11:43:54Z', dtype='<U20') - latitude()float3252.95334
array(52.95334, dtype=float32)
- longitude()float324.78997
array(4.78997, dtype=float32)
- altitude()float3250.0
array(50., dtype=float32)
- altitude_agl()float64nan
array(nan)
- sweep_group_name(sweep)<U8'sweep_1' 'sweep_2' ... 'sweep_14'
array(['sweep_1', 'sweep_2', 'sweep_3', 'sweep_4', 'sweep_5', 'sweep_6', 'sweep_7', 'sweep_8', 'sweep_9', 'sweep_10', 'sweep_11', 'sweep_12', 'sweep_13', 'sweep_14'], dtype='<U8') - sweep_fixed_angle(sweep)float320.3 0.4 0.8 1.1 ... 15.0 20.0 25.0
array([ 0.3, 0.4, 0.8, 1.1, 2. , 3. , 4.5, 6. , 8. , 10. , 12. , 15. , 20. , 25. ], dtype=float32) - frequency()float64nan
array(nan)
- status_xml()<U4'None'
array('None', dtype='<U4')
- Conventions :
- Cf/Radial
- version :
- H5rad 2.0
- title :
- None
- institution :
- RAD:NL51;PLC:nldhl
- references :
- None
- source :
- None
- history :
- None
- comment :
- im/exported using wradlib
- instrument_name :
- None
- site_name :
- name of site where data were gathered
- scan_name :
- name of scan strategy used, if applicable
- scan_id :
- scan strategy id, if applicable. assumed 0 if missing
- platform_is_mobile :
- "true" or "false", assumed "false" if missing
- ray_times_increase :
- "true" or "false", assumed "true" if missing. This is set to true if ray times increase monotonically thoughout all of the sweeps in the volume
- field_names :
- array of strings of field names present in this file.
- time_coverage_start :
- copy of time_coverage_start global variable
- time_coverage_end :
- copy of time_coverage_end global variable
- simulated data :
- "true" or "false", assumed "false" if missing. data in this file are simulated
- instrument :
- RAD:NL51;PLC:nldhl
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.).
[4]:
cf1['sweep_1']
[4]:
<xarray.Dataset>
Dimensions: (range: 320, time: 360)
Coordinates:
sweep_mode <U20 ...
latitude float32 ...
altitude float32 ...
longitude float32 ...
elevation (time) float32 ...
azimuth (time) float32 ...
* range (range) float32 500.0 1500.0 2500.0 ... 318500.0 319500.0
y (time, range) float32 ...
z (time, range) float32 ...
gr (time, range) float32 ...
rays (time, range) float32 ...
bins (time, range) float32 ...
x (time, range) float32 ...
* time (time) datetime64[ns] 2011-06-10T11:40:06.694446592 ... 201...
Data variables:
DBZH (time, range) float32 ...
sweep_number int64 ...
follow_mode <U4 ...
prt_mode <U5 ...
fixed_angle float32 ...- range: 320
- time: 360
- sweep_mode()<U20...
array('azimuth_surveillance', dtype='<U20') - latitude()float32...
array(52.95334, dtype=float32)
- altitude()float32...
array(50., dtype=float32)
- longitude()float32...
array(4.78997, dtype=float32)
- elevation(time)float32...
- standard_name :
- ray_elevation_angle
- long_name :
- elevation_angle_from_horizontal_plane
- units :
- degrees
- axis :
- radial_elevation_coordinate
array([0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3], dtype=float32)
- azimuth(time)float32...
- standard_name :
- ray_azimuth_angle
- long_name :
- azimuth_angle_from_true_north
- units :
- degrees
- axis :
- radial_azimuth_coordinate
array([ 0.5, 1.5, 2.5, ..., 357.5, 358.5, 359.5], dtype=float32)
- range(range)float32500.0 1500.0 ... 318500.0 319500.0
- 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 :
- 500.0
- meters_between_gates :
- 1000.0
array([ 500., 1500., 2500., ..., 317500., 318500., 319500.], dtype=float32) - y(time, range)float32...
[115200 values with dtype=float32]
- z(time, range)float32...
[115200 values with dtype=float32]
- gr(time, range)float32...
[115200 values with dtype=float32]
- rays(time, range)float32...
[115200 values with dtype=float32]
- bins(time, range)float32...
[115200 values with dtype=float32]
- x(time, range)float32...
[115200 values with dtype=float32]
- time(time)datetime64[ns]2011-06-10T11:40:06.694446592 .....
- standard_name :
- time
array(['2011-06-10T11:40:06.694446592', '2011-06-10T11:40:06.750002176', '2011-06-10T11:40:06.805557760', ..., '2011-06-10T11:40:06.527779840', '2011-06-10T11:40:06.583335424', '2011-06-10T11:40:06.638891008'], dtype='datetime64[ns]')
- DBZH(time, range)float32...
- IMAGE_VERSION :
- 1.2
- standard_name :
- radar_equivalent_reflectivity_factor_h
- long_name :
- Equivalent reflectivity factor H
- units :
- dBZ
[115200 values with dtype=float32]
- sweep_number()int64...
array(0)
- follow_mode()<U4...
array('none', dtype='<U4') - prt_mode()<U5...
array('fixed', dtype='<U5') - fixed_angle()float32...
array(0.3, dtype=float32)
[5]:
cf1['sweep_1'].DBZH
[5]:
<xarray.DataArray 'DBZH' (time: 360, range: 320)>
[115200 values with dtype=float32]
Coordinates:
sweep_mode <U20 ...
latitude float32 ...
altitude float32 ...
longitude float32 ...
elevation (time) float32 ...
azimuth (time) float32 ...
* range (range) float32 500.0 1500.0 2500.0 ... 318500.0 319500.0
y (time, range) float32 ...
z (time, range) float32 ...
gr (time, range) float32 ...
rays (time, range) float32 ...
bins (time, range) float32 ...
x (time, range) float32 ...
* time (time) datetime64[ns] 2011-06-10T11:40:06.694446592 ... 2011-...
Attributes:
IMAGE_VERSION: 1.2
standard_name: radar_equivalent_reflectivity_factor_h
long_name: Equivalent reflectivity factor H
units: dBZ- time: 360
- range: 320
- ...
[115200 values with dtype=float32]
- sweep_mode()<U20...
array('azimuth_surveillance', dtype='<U20') - latitude()float32...
array(52.95334, dtype=float32)
- altitude()float32...
array(50., dtype=float32)
- longitude()float32...
array(4.78997, dtype=float32)
- elevation(time)float32...
- standard_name :
- ray_elevation_angle
- long_name :
- elevation_angle_from_horizontal_plane
- units :
- degrees
- axis :
- radial_elevation_coordinate
array([0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3], dtype=float32)
- azimuth(time)float32...
- standard_name :
- ray_azimuth_angle
- long_name :
- azimuth_angle_from_true_north
- units :
- degrees
- axis :
- radial_azimuth_coordinate
array([ 0.5, 1.5, 2.5, ..., 357.5, 358.5, 359.5], dtype=float32)
- range(range)float32500.0 1500.0 ... 318500.0 319500.0
- 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 :
- 500.0
- meters_between_gates :
- 1000.0
array([ 500., 1500., 2500., ..., 317500., 318500., 319500.], dtype=float32) - y(time, range)float32...
[115200 values with dtype=float32]
- z(time, range)float32...
[115200 values with dtype=float32]
- gr(time, range)float32...
[115200 values with dtype=float32]
- rays(time, range)float32...
[115200 values with dtype=float32]
- bins(time, range)float32...
[115200 values with dtype=float32]
- x(time, range)float32...
[115200 values with dtype=float32]
- time(time)datetime64[ns]2011-06-10T11:40:06.694446592 .....
- standard_name :
- time
array(['2011-06-10T11:40:06.694446592', '2011-06-10T11:40:06.750002176', '2011-06-10T11:40:06.805557760', ..., '2011-06-10T11:40:06.527779840', '2011-06-10T11:40:06.583335424', '2011-06-10T11:40:06.638891008'], dtype='datetime64[ns]')
- IMAGE_VERSION :
- 1.2
- standard_name :
- radar_equivalent_reflectivity_factor_h
- long_name :
- Equivalent reflectivity factor H
- units :
- dBZ
Plotting¶
[6]:
cf1['sweep_1'].DBZH.plot.pcolormesh(x='x', y='y')
pl.gca().set_aspect('equal')
[7]:
fig = pl.figure(figsize=(10,8))
cf1['sweep_1'].DBZH.sortby('azimuth').wradlib.plot_ppi(proj='cg', fig=fig)
[7]:
<matplotlib.collections.QuadMesh at 0x7fdf22330ac0>
[8]:
import cartopy
import cartopy.crs as ccrs
import cartopy.feature as cfeature
map_trans = ccrs.AzimuthalEquidistant(central_latitude=cf1['sweep_1'].latitude.values,
central_longitude=cf1['sweep_1'].longitude.values)
[9]:
map_proj = ccrs.AzimuthalEquidistant(central_latitude=cf1['sweep_1'].latitude.values,
central_longitude=cf1['sweep_1'].longitude.values)
pm = cf1['sweep_1'].DBZH.wradlib.plot_ppi(proj=map_proj)
ax = pl.gca()
ax.gridlines(crs=map_proj)
print(ax)
< GeoAxes: <cartopy.crs.AzimuthalEquidistant object at 0x7fdf2045c950> >
[10]:
map_proj = ccrs.Mercator(central_longitude=cf1['sweep_1'].longitude.values)
fig = pl.figure(figsize=(10,8))
ax = fig.add_subplot(111, projection=map_proj)
pm = cf1['sweep_1'].DBZH.wradlib.plot_ppi(ax=ax)
ax.gridlines(draw_labels=True)
[10]:
<cartopy.mpl.gridliner.Gridliner at 0x7fdf2037df10>
[11]:
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=cf1['sweep_1'].longitude.values)
fig = pl.figure(figsize=(10,8))
ax = fig.add_subplot(111, projection=map_proj)
DBZH = cf1['sweep_1'].DBZH
pm = DBZH.where(DBZH > 0).wradlib.plot_ppi(ax=ax)
plot_borders(ax)
ax.gridlines(draw_labels=True)
[11]:
<cartopy.mpl.gridliner.Gridliner at 0x7fdf20365c10>
[12]:
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=cf1['sweep_1'].latitude.values,
central_longitude=cf1['sweep_1'].longitude.values,
)
fig = pl.figure(figsize=(10,8))
ax = fig.add_subplot(111, projection=map_proj)
ax.set_boundary(circle, transform=ax.transAxes)
pm = cf1['sweep_1'].DBZH.wradlib.plot_ppi(proj=map_proj, ax=ax)
ax = pl.gca()
ax.gridlines(crs=map_proj)
[12]:
<cartopy.mpl.gridliner.Gridliner at 0x7fdf21e47970>
[13]:
fig = pl.figure(figsize=(10, 8))
proj=ccrs.AzimuthalEquidistant(central_latitude=cf1['sweep_1'].latitude.values,
central_longitude=cf1['sweep_1'].longitude.values)
ax = fig.add_subplot(111, projection=proj)
pm = cf1['sweep_1'].DBZH.wradlib.plot_ppi(ax=ax)
ax.gridlines()
[13]:
<cartopy.mpl.gridliner.Gridliner at 0x7fdf2030a9d0>
[14]:
dbz = cf1['sweep_1']
dbz.DBZH.wradlib.plot_ppi()
[14]:
<matplotlib.collections.QuadMesh at 0x7fdf2259d430>
Inspect radar moments¶
The dataarrays can be accessed by key or by attribute. Each dataarray has the datasets dimensions and coordinates of it’s parent dataset. There are attributes connected which are defined by Cf/Radial and/or ODIM_H5 standard.
[15]:
cf1['sweep_1'].DBZH
[15]:
<xarray.DataArray 'DBZH' (time: 360, range: 320)>
[115200 values with dtype=float32]
Coordinates:
sweep_mode <U20 ...
latitude float32 ...
altitude float32 ...
longitude float32 ...
elevation (time) float32 ...
azimuth (time) float32 ...
* range (range) float32 500.0 1500.0 2500.0 ... 318500.0 319500.0
y (time, range) float32 ...
z (time, range) float32 ...
gr (time, range) float32 ...
rays (time, range) float32 ...
bins (time, range) float32 ...
x (time, range) float32 ...
* time (time) datetime64[ns] 2011-06-10T11:40:06.694446592 ... 2011-...
Attributes:
IMAGE_VERSION: 1.2
standard_name: radar_equivalent_reflectivity_factor_h
long_name: Equivalent reflectivity factor H
units: dBZ- time: 360
- range: 320
- ...
[115200 values with dtype=float32]
- sweep_mode()<U20...
array('azimuth_surveillance', dtype='<U20') - latitude()float32...
array(52.95334, dtype=float32)
- altitude()float32...
array(50., dtype=float32)
- longitude()float32...
array(4.78997, dtype=float32)
- elevation(time)float32...
- standard_name :
- ray_elevation_angle
- long_name :
- elevation_angle_from_horizontal_plane
- units :
- degrees
- axis :
- radial_elevation_coordinate
array([0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3], dtype=float32)
- azimuth(time)float32...
- standard_name :
- ray_azimuth_angle
- long_name :
- azimuth_angle_from_true_north
- units :
- degrees
- axis :
- radial_azimuth_coordinate
array([ 0.5, 1.5, 2.5, ..., 357.5, 358.5, 359.5], dtype=float32)
- range(range)float32500.0 1500.0 ... 318500.0 319500.0
- 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 :
- 500.0
- meters_between_gates :
- 1000.0
array([ 500., 1500., 2500., ..., 317500., 318500., 319500.], dtype=float32) - y(time, range)float32...
[115200 values with dtype=float32]
- z(time, range)float32...
[115200 values with dtype=float32]
- gr(time, range)float32...
[115200 values with dtype=float32]
- rays(time, range)float32...
[115200 values with dtype=float32]
- bins(time, range)float32...
[115200 values with dtype=float32]
- x(time, range)float32...
[115200 values with dtype=float32]
- time(time)datetime64[ns]2011-06-10T11:40:06.694446592 .....
- standard_name :
- time
array(['2011-06-10T11:40:06.694446592', '2011-06-10T11:40:06.750002176', '2011-06-10T11:40:06.805557760', ..., '2011-06-10T11:40:06.527779840', '2011-06-10T11:40:06.583335424', '2011-06-10T11:40:06.638891008'], dtype='datetime64[ns]')
- IMAGE_VERSION :
- 1.2
- standard_name :
- radar_equivalent_reflectivity_factor_h
- long_name :
- Equivalent reflectivity factor H
- units :
- dBZ
[16]:
cf1['sweep_1']
[16]:
<xarray.Dataset>
Dimensions: (range: 320, time: 360)
Coordinates:
sweep_mode <U20 ...
latitude float32 ...
altitude float32 ...
longitude float32 ...
elevation (time) float32 ...
azimuth (time) float32 ...
* range (range) float32 500.0 1500.0 2500.0 ... 318500.0 319500.0
y (time, range) float32 ...
z (time, range) float32 ...
gr (time, range) float32 ...
rays (time, range) float32 ...
bins (time, range) float32 ...
x (time, range) float32 ...
* time (time) datetime64[ns] 2011-06-10T11:40:06.694446592 ... 201...
Data variables:
DBZH (time, range) float32 ...
sweep_number int64 ...
follow_mode <U4 ...
prt_mode <U5 ...
fixed_angle float32 ...- range: 320
- time: 360
- sweep_mode()<U20...
array('azimuth_surveillance', dtype='<U20') - latitude()float32...
array(52.95334, dtype=float32)
- altitude()float32...
array(50., dtype=float32)
- longitude()float32...
array(4.78997, dtype=float32)
- elevation(time)float32...
- standard_name :
- ray_elevation_angle
- long_name :
- elevation_angle_from_horizontal_plane
- units :
- degrees
- axis :
- radial_elevation_coordinate
array([0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3], dtype=float32)
- azimuth(time)float32...
- standard_name :
- ray_azimuth_angle
- long_name :
- azimuth_angle_from_true_north
- units :
- degrees
- axis :
- radial_azimuth_coordinate
array([ 0.5, 1.5, 2.5, ..., 357.5, 358.5, 359.5], dtype=float32)
- range(range)float32500.0 1500.0 ... 318500.0 319500.0
- 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 :
- 500.0
- meters_between_gates :
- 1000.0
array([ 500., 1500., 2500., ..., 317500., 318500., 319500.], dtype=float32) - y(time, range)float32...
[115200 values with dtype=float32]
- z(time, range)float32...
[115200 values with dtype=float32]
- gr(time, range)float32...
[115200 values with dtype=float32]
- rays(time, range)float32...
[115200 values with dtype=float32]
- bins(time, range)float32...
[115200 values with dtype=float32]
- x(time, range)float32...
[115200 values with dtype=float32]
- time(time)datetime64[ns]2011-06-10T11:40:06.694446592 .....
- standard_name :
- time
array(['2011-06-10T11:40:06.694446592', '2011-06-10T11:40:06.750002176', '2011-06-10T11:40:06.805557760', ..., '2011-06-10T11:40:06.527779840', '2011-06-10T11:40:06.583335424', '2011-06-10T11:40:06.638891008'], dtype='datetime64[ns]')
- DBZH(time, range)float32...
- IMAGE_VERSION :
- 1.2
- standard_name :
- radar_equivalent_reflectivity_factor_h
- long_name :
- Equivalent reflectivity factor H
- units :
- dBZ
[115200 values with dtype=float32]
- sweep_number()int64...
array(0)
- follow_mode()<U4...
array('none', dtype='<U4') - prt_mode()<U5...
array('fixed', dtype='<U5') - fixed_angle()float32...
array(0.3, dtype=float32)
Create simple plot¶
Using xarray features a simple plot can be created like this. Note the sortby('time') method, which sorts the radials by time.
[17]:
cf1['sweep_1'].DBZH.sortby('time').plot(add_labels=False)
[17]:
<matplotlib.collections.QuadMesh at 0x7fdf20061af0>
[18]:
pm = cf1['sweep_1'].DBZH.wradlib.plot_ppi(proj={'latmin': 33e3})
[19]:
cf1.to_odim('knmi_odim.h5')
cf1.to_cfradial2('knmi_odim_as_cfradial.nc')
Import again¶
[20]:
cf1a = OdimH5('knmi_odim.h5', standard='cf', georef=True)
cf1b = CfRadial('knmi_odim_as_cfradial.nc', georef=True)
[21]:
cf1a['sweep_1']
[21]:
<xarray.Dataset>
Dimensions: (range: 320, time: 360)
Coordinates:
sweep_mode <U20 ...
latitude float32 ...
altitude float32 ...
longitude float32 ...
elevation (time) float32 ...
azimuth (time) float32 ...
* range (range) float32 500.0 1500.0 2500.0 ... 318500.0 319500.0
y (time, range) float32 ...
z (time, range) float32 ...
gr (time, range) float32 ...
rays (time, range) float32 ...
bins (time, range) float32 ...
x (time, range) float32 ...
* time (time) datetime64[ns] 2011-06-10T11:40:06.694446592 ... 201...
Data variables:
DBZH (time, range) float32 ...
sweep_number int64 ...
follow_mode <U4 ...
prt_mode <U5 ...
fixed_angle float32 ...- range: 320
- time: 360
- sweep_mode()<U20...
array('azimuth_surveillance', dtype='<U20') - latitude()float32...
array(52.95334, dtype=float32)
- altitude()float32...
array(50., dtype=float32)
- longitude()float32...
array(4.78997, dtype=float32)
- elevation(time)float32...
- standard_name :
- ray_elevation_angle
- long_name :
- elevation_angle_from_horizontal_plane
- units :
- degrees
- axis :
- radial_elevation_coordinate
array([0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3], dtype=float32)
- azimuth(time)float32...
- standard_name :
- ray_azimuth_angle
- long_name :
- azimuth_angle_from_true_north
- units :
- degrees
- axis :
- radial_azimuth_coordinate
array([ 0.5, 1.5, 2.5, ..., 357.5, 358.5, 359.5], dtype=float32)
- range(range)float32500.0 1500.0 ... 318500.0 319500.0
- 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 :
- 500.0
- meters_between_gates :
- 1000.0
array([ 500., 1500., 2500., ..., 317500., 318500., 319500.], dtype=float32) - y(time, range)float32...
[115200 values with dtype=float32]
- z(time, range)float32...
[115200 values with dtype=float32]
- gr(time, range)float32...
[115200 values with dtype=float32]
- rays(time, range)float32...
[115200 values with dtype=float32]
- bins(time, range)float32...
[115200 values with dtype=float32]
- x(time, range)float32...
[115200 values with dtype=float32]
- time(time)datetime64[ns]2011-06-10T11:40:06.694446592 .....
- standard_name :
- time
array(['2011-06-10T11:40:06.694446592', '2011-06-10T11:40:06.750002176', '2011-06-10T11:40:06.805557760', ..., '2011-06-10T11:40:06.527779840', '2011-06-10T11:40:06.583335424', '2011-06-10T11:40:06.638891008'], dtype='datetime64[ns]')
- DBZH(time, range)float32...
- IMAGE_VERSION :
- 1.2
- standard_name :
- radar_equivalent_reflectivity_factor_h
- long_name :
- Equivalent reflectivity factor H
- units :
- dBZ
[115200 values with dtype=float32]
- sweep_number()int64...
array(0)
- follow_mode()<U4...
array('none', dtype='<U4') - prt_mode()<U5...
array('fixed', dtype='<U5') - fixed_angle()float32...
array(0.3, dtype=float32)
Check equality¶
[22]:
xr.testing.assert_equal(cf1.root, cf1a.root)
xr.testing.assert_equal(cf1['sweep_1'], cf1a['sweep_1'])
xr.testing.assert_equal(cf1.root, cf1b.root)
xr.testing.assert_equal(cf1['sweep_1'], cf1b['sweep_1'])
Mask some values¶
[23]:
cf1['sweep_1']['DBZH'] = cf1['sweep_1']['DBZH'].where(cf1['sweep_1']['DBZH'] >= 0)
cf1['sweep_1']['DBZH'].sortby('time').plot()
[23]:
<matplotlib.collections.QuadMesh at 0x7fdf2adeb5b0>
Load Cf/Radial1 Volume Data¶
[24]:
fpath = 'netcdf/cfrad.20080604_002217_000_SPOL_v36_SUR.nc'
f = wrl.util.get_wradlib_data_file(fpath)
cf2 = CfRadial(f, georef=True)
Inspect root group¶
[25]:
cf2.root
[25]:
<xarray.Dataset>
Dimensions: (sweep: 9)
Dimensions without coordinates: sweep
Data variables:
volume_number int32 36
platform_type |S32 b'fixed'
primary_axis |S32 b'axis_z'
status_xml |S1 b''
instrument_type |S32 b'radar'
time_coverage_start |S32 b'2008-06-04T00:15:03Z'
time_coverage_end |S32 b'2008-06-04T00:22:17Z'
latitude float64 22.53
longitude float64 120.4
altitude float64 45.0
sweep_fixed_angle (sweep) float32 0.4999 1.0986 1.8018 ... 9.1022 12.7991
sweep_group_name (sweep) <U7 'sweep_1' 'sweep_2' ... 'sweep_8' 'sweep_9'
Attributes:
Conventions: CF/Radial instrument_parameters radar_parameters rad...
version: 1.2
title: TIMREX
institution:
references:
source:
history:
comment:
instrument_name: SPOLRVP8
site_name:
scan_name:
scan_id: 0
platform_is_mobile: false
n_gates_vary: false- sweep: 9
- volume_number()int32...
- standard_name :
- data_volume_index_number
array(36, dtype=int32)
- platform_type()|S32...
- standard_name :
- platform_type
- options :
- fixed, vehicle, ship, aircraft_fore, aircraft_aft, aircraft_tail, aircraft_belly, aircraft_roof, aircraft_nose, satellite_orbit, satellite_geostat
array(b'fixed', dtype='|S32')
- primary_axis()|S32...
- standard_name :
- primary_axis_of_rotation
- options :
- axis_z, axis_y, axis_x
array(b'axis_z', dtype='|S32')
- status_xml()|S1...
- standard_name :
- status_xml
array(b'', dtype='|S1')
- instrument_type()|S32...
- standard_name :
- type_of_instrument
- options :
- radar, lidar
- meta_group :
- instrument_parameters
array(b'radar', dtype='|S32')
- time_coverage_start()|S32...
- standard_name :
- data_volume_start_time_utc
- comment :
- ray times are relative to start time in secs
array(b'2008-06-04T00:15:03Z', dtype='|S32')
- time_coverage_end()|S32...
- standard_name :
- data_volume_end_time_utc
array(b'2008-06-04T00:22:17Z', dtype='|S32')
- latitude()float64...
- standard_name :
- latitude
- units :
- degrees_north
array(22.526699)
- longitude()float64...
- standard_name :
- longitude
- units :
- degrees_east
array(120.433502)
- altitude()float64...
- standard_name :
- altitude
- units :
- meters
- positive :
- up
array(45.000002)
- sweep_fixed_angle(sweep)float32...
- standard_name :
- beam_target_fixed_angle
- units :
- degrees
array([ 0.4999, 1.0986, 1.8018, 2.5983, 3.598 , 4.7021, 6.4984, 9.1022, 12.7991], dtype=float32) - sweep_group_name(sweep)<U7'sweep_1' 'sweep_2' ... 'sweep_9'
array(['sweep_1', 'sweep_2', 'sweep_3', 'sweep_4', 'sweep_5', 'sweep_6', 'sweep_7', 'sweep_8', 'sweep_9'], dtype='<U7')
- Conventions :
- CF/Radial instrument_parameters radar_parameters radar_calibration geometry_correction
- version :
- 1.2
- title :
- TIMREX
- institution :
- references :
- source :
- history :
- comment :
- instrument_name :
- SPOLRVP8
- site_name :
- scan_name :
- scan_id :
- 0
- platform_is_mobile :
- false
- n_gates_vary :
- false
Inspect sweep group(s)¶
[26]:
cf2['sweep_1']
[26]:
<xarray.Dataset>
Dimensions: (range: 996, time: 482)
Coordinates:
sweep_mode <U20 'azimuth_surveillance'
* time (time) datetime64[ns] 2008-06-04T00:15:03 ... 2008-06...
* range (range) float32 150.0 300.0 ... 149250.0 149400.0
azimuth (time) float32 121.5 122.25 123.0 ... 121.5 122.25
elevation (time) float32 0.379 0.2362 0.1648 ... 0.5109 0.5109
longitude float64 120.4
latitude float64 22.53
altitude float64 45.0
x (time, range) float32 127.89255 255.78506 ... 126313.25
y (time, range) float32 -78.37265 -156.74529 ... -79697.73
z (time, range) float32 45.0 46.0 47.0 ... 2685.0 2689.0
gr (time, range) float32 149.37346 299.36935 ... 149353.88
rays (time, range) float32 121.5 121.5 ... 122.25 122.25
bins (time, range) float32 150.0 300.0 ... 149250.0 149400.0
Data variables:
sweep_number int32 0
polarization_mode |S32 b'not_set'
prt_mode |S32 b'not_set'
follow_mode |S32 b'not_set'
fixed_angle float32 0.4999
target_scan_rate float32 -9999.0
pulse_width (time) timedelta64[ns] 00:00:00 00:00:00 ... 00:00:00
prt (time) timedelta64[ns] -1 days +21:13:21 ... -1 days ...
nyquist_velocity (time) float32 26.925 26.925 26.925 ... 26.925 26.925
unambiguous_range (time) float32 150000.0 150000.0 ... 150000.0 150000.0
antenna_transition (time) int8 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
n_samples (time) int32 192 192 192 192 192 ... 192 192 192 192 192
r_calib_index (time) int8 -1 -1 -1 -1 -1 -1 -1 ... -1 -1 -1 -1 -1 -1
scan_rate (time) float32 -32768.0 -32768.0 ... -32768.0 -32768.0
DBZ (time, range) float32 ...
VR (time, range) float32 ...- range: 996
- time: 482
- sweep_mode()<U20'azimuth_surveillance'
array('azimuth_surveillance', dtype='<U20') - time(time)datetime64[ns]2008-06-04T00:15:03 ... 2008-06-...
- standard_name :
- time
- long_name :
- time in seconds since volume start
- comment :
- times are relative to the volume start_time
array(['2008-06-04T00:15:03.000000000', '2008-06-04T00:15:03.000000000', '2008-06-04T00:15:03.000000000', ..., '2008-06-04T00:15:49.000000000', '2008-06-04T00:15:50.000000000', '2008-06-04T00:15:50.000000000'], dtype='datetime64[ns]') - range(range)float32150.0 300.0 ... 149250.0 149400.0
- standard_name :
- range_to_center_of_measurement_volume
- long_name :
- Range from instrument to center of gate
- units :
- meters
- spacing_is_constant :
- true
- meters_to_center_of_first_gate :
- 150.00000596046448
- meters_between_gates :
- 150.00000596046448
array([ 150. , 300. , 450.00003, ..., 149100. , 149250. , 149400. ], dtype=float32) - azimuth(time)float32121.5 122.25 123.0 ... 121.5 122.25
- standard_name :
- beam_azimuth_angle
- units :
- degrees
array([121.5 , 122.25, 123. , ..., 120.75, 121.5 , 122.25], dtype=float32)
- elevation(time)float320.379 0.2362 ... 0.5109 0.5109
- standard_name :
- beam_elevation_angle
- units :
- degrees
- positive :
- up
array([0.379 , 0.2362, 0.1648, ..., 0.5109, 0.5109, 0.5109], dtype=float32)
- longitude()float64120.4
- standard_name :
- longitude
- units :
- degrees_east
array(120.433502)
- latitude()float6422.53
- standard_name :
- latitude
- units :
- degrees_north
array(22.526699)
- altitude()float6445.0
- standard_name :
- altitude
- units :
- meters
- positive :
- up
array(45.000002)
- x(time, range)float32127.89255 255.78506 ... 126313.25
array([[1.27892548e+02, 2.55785065e+02, 3.83677582e+02, ..., 1.27097430e+05, 1.27225250e+05, 1.27353055e+05], [1.26857414e+02, 2.53714798e+02, 3.80572205e+02, ..., 1.26074242e+05, 1.26201039e+05, 1.26327852e+05], [1.25799408e+02, 2.51598816e+02, 3.77398163e+02, ..., 1.25025484e+05, 1.25151227e+05, 1.25276992e+05], ..., [1.28905136e+02, 2.57810242e+02, 3.86715332e+02, ..., 1.28098570e+05, 1.28227383e+05, 1.28356219e+05], [1.27890244e+02, 2.55780472e+02, 3.83670654e+02, ..., 1.27090023e+05, 1.27217828e+05, 1.27345641e+05], [1.26853439e+02, 2.53706848e+02, 3.80560242e+02, ..., 1.26059703e+05, 1.26186477e+05, 1.26313250e+05]], dtype=float32) - y(time, range)float32-78.37265 -156.74529 ... -79697.73
array([[-7.8372650e+01, -1.5674529e+02, -2.3511792e+02, ..., -7.7885406e+04, -7.7963734e+04, -7.8042047e+04], [-8.0041069e+01, -1.6008212e+02, -2.4012320e+02, ..., -7.9546922e+04, -7.9626922e+04, -7.9706945e+04], [-8.1695091e+01, -1.6339018e+02, -2.4508525e+02, ..., -8.1192500e+04, -8.1274164e+04, -8.1355836e+04], ..., [-7.6690506e+01, -1.5338100e+02, -2.3007146e+02, ..., -7.6210641e+04, -7.6287281e+04, -7.6363930e+04], [-7.8371239e+01, -1.5674246e+02, -2.3511368e+02, ..., -7.7880867e+04, -7.7959188e+04, -7.8037508e+04], [-8.0038559e+01, -1.6007710e+02, -2.4011563e+02, ..., -7.9537750e+04, -7.9617734e+04, -7.9697727e+04]], dtype=float32) - z(time, range)float3245.0 46.0 47.0 ... 2685.0 2689.0
array([[ 45., 46., 47., ..., 2338., 2342., 2346.], [ 45., 46., 46., ..., 1967., 1970., 1973.], [ 45., 45., 46., ..., 1781., 1784., 1787.], ..., [ 46., 47., 48., ..., 2681., 2685., 2689.], [ 46., 47., 48., ..., 2681., 2685., 2689.], [ 46., 47., 48., ..., 2681., 2685., 2689.]], dtype=float32) - gr(time, range)float32149.37346 299.36935 ... 149353.88
array([[1.4937346e+02, 2.9936935e+02, 4.4936523e+02, ..., 1.4906277e+05, 1.4921267e+05, 1.4936256e+05], [1.4937546e+02, 2.9937335e+02, 4.4937128e+02, ..., 1.4907127e+05, 1.4922119e+05, 1.4937112e+05], [1.4937625e+02, 2.9937485e+02, 4.4937335e+02, ..., 1.4907517e+05, 1.4922511e+05, 1.4937506e+05], ..., [1.4937088e+02, 2.9936407e+02, 4.4935724e+02, ..., 1.4905408e+05, 1.4920397e+05, 1.4935389e+05], [1.4937076e+02, 2.9936395e+02, 4.4935712e+02, ..., 1.4905408e+05, 1.4920397e+05, 1.4935388e+05], [1.4937076e+02, 2.9936395e+02, 4.4935712e+02, ..., 1.4905406e+05, 1.4920397e+05, 1.4935388e+05]], dtype=float32) - rays(time, range)float32121.5 121.5 121.5 ... 122.25 122.25
array([[121.5 , 121.5 , 121.5 , ..., 121.5 , 121.5 , 121.5 ], [122.25, 122.25, 122.25, ..., 122.25, 122.25, 122.25], [123. , 123. , 123. , ..., 123. , 123. , 123. ], ..., [120.75, 120.75, 120.75, ..., 120.75, 120.75, 120.75], [121.5 , 121.5 , 121.5 , ..., 121.5 , 121.5 , 121.5 ], [122.25, 122.25, 122.25, ..., 122.25, 122.25, 122.25]], dtype=float32) - bins(time, range)float32150.0 300.0 ... 149250.0 149400.0
array([[ 150. , 300. , 450.00003, ..., 149100. , 149250. , 149400. ], [ 150. , 300. , 450.00003, ..., 149100. , 149250. , 149400. ], [ 150. , 300. , 450.00003, ..., 149100. , 149250. , 149400. ], ..., [ 150. , 300. , 450.00003, ..., 149100. , 149250. , 149400. ], [ 150. , 300. , 450.00003, ..., 149100. , 149250. , 149400. ], [ 150. , 300. , 450.00003, ..., 149100. , 149250. , 149400. ]], dtype=float32)
- sweep_number()int32...
- standard_name :
- sweep_index_number_0_based
array(0, dtype=int32)
- polarization_mode()|S32...
- standard_name :
- polarization_mode_for_sweep
- options :
- horizontal, vertical, hv_alt, hv_sim, circular
- meta_group :
- radar_parameters
array(b'not_set', dtype='|S32')
- prt_mode()|S32...
- standard_name :
- transmit_pulse_mode
- options :
- fixed, staggered, dual
- meta_group :
- radar_parameters
array(b'not_set', dtype='|S32')
- follow_mode()|S32...
- standard_name :
- follow_mode_for_scan_strategy
- options :
- none, sun, vehicle, aircraft, target, manual
- meta_group :
- instrument_parameters
array(b'not_set', dtype='|S32')
- fixed_angle()float32...
- standard_name :
- beam_target_fixed_angle
- units :
- degrees
array(0.4999, dtype=float32)
- target_scan_rate()float32...
- standard_name :
- target_scan_rate_for_sweep
- units :
- degrees per second
array(-9999., dtype=float32)
- pulse_width(time)timedelta64[ns]...
- standard_name :
- transmitter_pulse_width
- meta_group :
- instrument_parameters
array([0, 0, 0, ..., 0, 0, 0], dtype='timedelta64[ns]')
- prt(time)timedelta64[ns]...
- standard_name :
- pulse_repetition_frequency
- meta_group :
- instrument_parameters
array([-9999000000000, -9999000000000, -9999000000000, ..., -9999000000000, -9999000000000, -9999000000000], dtype='timedelta64[ns]') - nyquist_velocity(time)float32...
- standard_name :
- unambiguous_doppler_velocity
- units :
- meters per second
- meta_group :
- instrument_parameters
array([26.925, 26.925, 26.925, ..., 26.925, 26.925, 26.925], dtype=float32)
- unambiguous_range(time)float32...
- standard_name :
- unambiguous_range
- units :
- meters
- meta_group :
- instrument_parameters
array([150000., 150000., 150000., ..., 150000., 150000., 150000.], dtype=float32) - antenna_transition(time)int8...
- standard_name :
- antenna_is_in_transition_between_sweeps
- comment :
- 1 if antenna is in transition, 0 otherwise
array([0, 0, 0, ..., 0, 0, 0], dtype=int8)
- n_samples(time)int32...
- standard_name :
- number_of_samples_used_to_compute_moments
- meta_group :
- instrument_parameters
array([192, 192, 192, ..., 192, 192, 192], dtype=int32)
- r_calib_index(time)int8...
- standard_name :
- calibration_data_array_index_per_ray
- meta_group :
- radar_calibration
- comment :
- This is the index for the calibration which applies to this ray
array([-1, -1, -1, ..., -1, -1, -1], dtype=int8)
- scan_rate(time)float32...
- standard_name :
- antenna_angle_scan_rate
- units :
- degrees per second
- meta_group :
- instrument_parameters
array([-32768., -32768., -32768., ..., -32768., -32768., -32768.], dtype=float32) - DBZ(time, range)float32...
- long_name :
- Computed Horizontal Co-polar Reflectivit
- standard_name :
- equivalent_reflectivity_factor
- units :
- dBZ
- threshold_field_name :
- threshold_value :
- -9999.0
- sampling_ratio :
- 1.0
- grid_mapping :
- grid_mapping
[480072 values with dtype=float32]
- VR(time, range)float32...
- long_name :
- Computed Velocity
- standard_name :
- radial_velocity_of_scatterers_away_from_instrument
- units :
- m/s
- threshold_field_name :
- threshold_value :
- -9999.0
- sampling_ratio :
- 1.0
- grid_mapping :
- grid_mapping
[480072 values with dtype=float32]
Inspect radar moments¶
[27]:
cf2['sweep_1'].DBZ
[27]:
<xarray.DataArray 'DBZ' (time: 482, range: 996)>
[480072 values with dtype=float32]
Coordinates:
sweep_mode <U20 'azimuth_surveillance'
* time (time) datetime64[ns] 2008-06-04T00:15:03 ... 2008-06-04T00:1...
* range (range) float32 150.0 300.0 450.00003 ... 149250.0 149400.0
azimuth (time) float32 121.5 122.25 123.0 123.75 ... 120.75 121.5 122.25
elevation (time) float32 0.379 0.2362 0.1648 ... 0.5109 0.5109 0.5109
longitude float64 120.4
latitude float64 22.53
altitude float64 45.0
x (time, range) float32 127.89255 255.78506 ... 126313.25
y (time, range) float32 -78.37265 -156.74529 ... -79697.73
z (time, range) float32 45.0 46.0 47.0 ... 2681.0 2685.0 2689.0
gr (time, range) float32 149.37346 299.36935 ... 149353.88
rays (time, range) float32 121.5 121.5 121.5 ... 122.25 122.25 122.25
bins (time, range) float32 150.0 300.0 ... 149250.0 149400.0
Attributes:
long_name: Computed Horizontal Co-polar Reflectivit
standard_name: equivalent_reflectivity_factor
units: dBZ
threshold_field_name:
threshold_value: -9999.0
sampling_ratio: 1.0
grid_mapping: grid_mapping- time: 482
- range: 996
- ...
[480072 values with dtype=float32]
- sweep_mode()<U20'azimuth_surveillance'
array('azimuth_surveillance', dtype='<U20') - time(time)datetime64[ns]2008-06-04T00:15:03 ... 2008-06-...
- standard_name :
- time
- long_name :
- time in seconds since volume start
- comment :
- times are relative to the volume start_time
array(['2008-06-04T00:15:03.000000000', '2008-06-04T00:15:03.000000000', '2008-06-04T00:15:03.000000000', ..., '2008-06-04T00:15:49.000000000', '2008-06-04T00:15:50.000000000', '2008-06-04T00:15:50.000000000'], dtype='datetime64[ns]') - range(range)float32150.0 300.0 ... 149250.0 149400.0
- standard_name :
- range_to_center_of_measurement_volume
- long_name :
- Range from instrument to center of gate
- units :
- meters
- spacing_is_constant :
- true
- meters_to_center_of_first_gate :
- 150.00000596046448
- meters_between_gates :
- 150.00000596046448
array([ 150. , 300. , 450.00003, ..., 149100. , 149250. , 149400. ], dtype=float32) - azimuth(time)float32121.5 122.25 123.0 ... 121.5 122.25
- standard_name :
- beam_azimuth_angle
- units :
- degrees
array([121.5 , 122.25, 123. , ..., 120.75, 121.5 , 122.25], dtype=float32)
- elevation(time)float320.379 0.2362 ... 0.5109 0.5109
- standard_name :
- beam_elevation_angle
- units :
- degrees
- positive :
- up
array([0.379 , 0.2362, 0.1648, ..., 0.5109, 0.5109, 0.5109], dtype=float32)
- longitude()float64120.4
- standard_name :
- longitude
- units :
- degrees_east
array(120.433502)
- latitude()float6422.53
- standard_name :
- latitude
- units :
- degrees_north
array(22.526699)
- altitude()float6445.0
- standard_name :
- altitude
- units :
- meters
- positive :
- up
array(45.000002)
- x(time, range)float32127.89255 255.78506 ... 126313.25
array([[1.27892548e+02, 2.55785065e+02, 3.83677582e+02, ..., 1.27097430e+05, 1.27225250e+05, 1.27353055e+05], [1.26857414e+02, 2.53714798e+02, 3.80572205e+02, ..., 1.26074242e+05, 1.26201039e+05, 1.26327852e+05], [1.25799408e+02, 2.51598816e+02, 3.77398163e+02, ..., 1.25025484e+05, 1.25151227e+05, 1.25276992e+05], ..., [1.28905136e+02, 2.57810242e+02, 3.86715332e+02, ..., 1.28098570e+05, 1.28227383e+05, 1.28356219e+05], [1.27890244e+02, 2.55780472e+02, 3.83670654e+02, ..., 1.27090023e+05, 1.27217828e+05, 1.27345641e+05], [1.26853439e+02, 2.53706848e+02, 3.80560242e+02, ..., 1.26059703e+05, 1.26186477e+05, 1.26313250e+05]], dtype=float32) - y(time, range)float32-78.37265 -156.74529 ... -79697.73
array([[-7.8372650e+01, -1.5674529e+02, -2.3511792e+02, ..., -7.7885406e+04, -7.7963734e+04, -7.8042047e+04], [-8.0041069e+01, -1.6008212e+02, -2.4012320e+02, ..., -7.9546922e+04, -7.9626922e+04, -7.9706945e+04], [-8.1695091e+01, -1.6339018e+02, -2.4508525e+02, ..., -8.1192500e+04, -8.1274164e+04, -8.1355836e+04], ..., [-7.6690506e+01, -1.5338100e+02, -2.3007146e+02, ..., -7.6210641e+04, -7.6287281e+04, -7.6363930e+04], [-7.8371239e+01, -1.5674246e+02, -2.3511368e+02, ..., -7.7880867e+04, -7.7959188e+04, -7.8037508e+04], [-8.0038559e+01, -1.6007710e+02, -2.4011563e+02, ..., -7.9537750e+04, -7.9617734e+04, -7.9697727e+04]], dtype=float32) - z(time, range)float3245.0 46.0 47.0 ... 2685.0 2689.0
array([[ 45., 46., 47., ..., 2338., 2342., 2346.], [ 45., 46., 46., ..., 1967., 1970., 1973.], [ 45., 45., 46., ..., 1781., 1784., 1787.], ..., [ 46., 47., 48., ..., 2681., 2685., 2689.], [ 46., 47., 48., ..., 2681., 2685., 2689.], [ 46., 47., 48., ..., 2681., 2685., 2689.]], dtype=float32) - gr(time, range)float32149.37346 299.36935 ... 149353.88
array([[1.4937346e+02, 2.9936935e+02, 4.4936523e+02, ..., 1.4906277e+05, 1.4921267e+05, 1.4936256e+05], [1.4937546e+02, 2.9937335e+02, 4.4937128e+02, ..., 1.4907127e+05, 1.4922119e+05, 1.4937112e+05], [1.4937625e+02, 2.9937485e+02, 4.4937335e+02, ..., 1.4907517e+05, 1.4922511e+05, 1.4937506e+05], ..., [1.4937088e+02, 2.9936407e+02, 4.4935724e+02, ..., 1.4905408e+05, 1.4920397e+05, 1.4935389e+05], [1.4937076e+02, 2.9936395e+02, 4.4935712e+02, ..., 1.4905408e+05, 1.4920397e+05, 1.4935388e+05], [1.4937076e+02, 2.9936395e+02, 4.4935712e+02, ..., 1.4905406e+05, 1.4920397e+05, 1.4935388e+05]], dtype=float32) - rays(time, range)float32121.5 121.5 121.5 ... 122.25 122.25
array([[121.5 , 121.5 , 121.5 , ..., 121.5 , 121.5 , 121.5 ], [122.25, 122.25, 122.25, ..., 122.25, 122.25, 122.25], [123. , 123. , 123. , ..., 123. , 123. , 123. ], ..., [120.75, 120.75, 120.75, ..., 120.75, 120.75, 120.75], [121.5 , 121.5 , 121.5 , ..., 121.5 , 121.5 , 121.5 ], [122.25, 122.25, 122.25, ..., 122.25, 122.25, 122.25]], dtype=float32) - bins(time, range)float32150.0 300.0 ... 149250.0 149400.0
array([[ 150. , 300. , 450.00003, ..., 149100. , 149250. , 149400. ], [ 150. , 300. , 450.00003, ..., 149100. , 149250. , 149400. ], [ 150. , 300. , 450.00003, ..., 149100. , 149250. , 149400. ], ..., [ 150. , 300. , 450.00003, ..., 149100. , 149250. , 149400. ], [ 150. , 300. , 450.00003, ..., 149100. , 149250. , 149400. ], [ 150. , 300. , 450.00003, ..., 149100. , 149250. , 149400. ]], dtype=float32)
- long_name :
- Computed Horizontal Co-polar Reflectivit
- standard_name :
- equivalent_reflectivity_factor
- units :
- dBZ
- threshold_field_name :
- threshold_value :
- -9999.0
- sampling_ratio :
- 1.0
- grid_mapping :
- grid_mapping
Create simple plot¶
[28]:
cf2['sweep_1'].DBZ.plot()
[28]:
<matplotlib.collections.QuadMesh at 0x7fdf1bf18820>
[29]:
cf2['sweep_1'].DBZ.plot.pcolormesh(x='x', y='y', add_labels=False)
pl.gca().set_aspect('equal')
Use wradlib DataArray connector¶
[30]:
pm = cf2['sweep_1'].DBZ.wradlib.plot_ppi()
[31]:
pm = cf2['sweep_1'].DBZ.wradlib.plot_ppi(proj='cg')
Export data to Cf/Radial2 and ODIM_H5¶
[32]:
cf2.to_cfradial2('timrex_cfradial2.nc')
cf2.to_odim('timrex_cfradial_as_odim.h5')
Import again¶
[33]:
cf2a = CfRadial('timrex_cfradial2.nc', georef=True)
cf2b = OdimH5('timrex_cfradial_as_odim.h5', standard='cf', georef=True)
[34]:
cf2a['sweep_1'].DBZ.plot.pcolormesh(x='x', y='y', add_labels=False)
pl.gca().set_aspect('equal')
[35]:
cf2b['sweep_1'].DBZ.plot.pcolormesh(x='x', y='y', add_labels=False)
pl.gca().set_aspect('equal')
Check equality¶
For Cf/Radial there are issues with nan, which need to be fixed. For the ODIM_H5 intercomparison there are too problems with nan and issues with attributes.
[36]:
xr.testing.assert_equal(cf2.root, cf2a.root)
xr.testing.assert_equal(cf2['sweep_1'].drop(['DBZ', 'VR']),
cf2a['sweep_1'].drop(['DBZ', 'VR']))
xr.testing.assert_allclose(cf2.root.time_coverage_start,
cf2b.root.time_coverage_start)