CfRadial1 <-> CfRadial2#

Imports#

[1]:
import xarray as xr
from open_radar_data import DATASETS

import xradar as xd

Load Data#

[2]:
file = DATASETS.fetch("cfrad.20080604_002217_000_SPOL_v36_SUR.nc")
dtree = xd.io.open_cfradial1_datatree(file)
display(dtree)
<xarray.DatasetView> Size: 477B
Dimensions:              (sweep: 9)
Dimensions without coordinates: sweep
Data variables:
    volume_number        int32 4B ...
    platform_type        |S32 32B ...
    primary_axis         |S32 32B ...
    status_str           |S1 1B ...
    instrument_type      |S32 32B ...
    time_coverage_start  |S32 32B ...
    time_coverage_end    |S32 32B ...
    latitude             float64 8B ...
    longitude            float64 8B ...
    altitude             float64 8B ...
    sweep_group_name     (sweep) <U7 252B 'sweep_0' 'sweep_1' ... 'sweep_8'
    sweep_fixed_angle    (sweep) float32 36B ...
Attributes: (12/13)
    Conventions:         CF/Radial instrument_parameters radar_parameters rad...
    version:             1.2
    title:               TIMREX
    institution:
    references:
    source:
    ...                  ...
    comment:
    instrument_name:     SPOLRVP8
    site_name:
    scan_name:
    scan_id:             0
    platform_is_mobile:  false

Transform CF2 to CF1#

[3]:
ds = dtree.xradar.to_cfradial1_dataset()
display(ds)
<xarray.Dataset> Size: 35MB
Dimensions:                            (time: 4343, range: 996, sweep: 9,
                                        r_calib: 1)
Coordinates:
  * time                               (time) datetime64[ns] 35kB 2008-06-04T...
  * range                              (range) float32 4kB 150.0 ... 1.494e+05
Dimensions without coordinates: sweep, r_calib
Data variables: (12/99)
    pulse_width                        (time) timedelta64[ns] 35kB 00:00:00 ....
    prt                                (time) timedelta64[ns] 35kB -1 days +2...
    prt_ratio                          (time) timedelta64[ns] 35kB -1 days +2...
    nyquist_velocity                   (time) float32 17kB 26.92 26.92 ... 26.92
    unambiguous_range                  (time) float32 17kB 1.5e+05 ... 1.5e+05
    antenna_transition                 (time) int8 4kB 0 0 0 0 0 0 ... 0 0 0 0 0
    ...                                 ...
    heading_correction                 float32 4B ...
    azimuth_correction                 float32 4B ...
    elevation_correction               float32 4B ...
    roll_correction                    float32 4B ...
    rotation_correction                float32 4B ...
    latitude_correction                float32 4B ...
Attributes: (12/13)
    Conventions:         Cf/Radial
    version:             1.2
    title:               TIMREX
    institution:
    references:
    source:
    ...                  ...
    comment:
    instrument_name:     SPOLRVP8
    site_name:
    scan_name:
    scan_id:             0
    platform_is_mobile:  false

Transform CF1 to CF2#

[4]:
dtree = ds.xradar.to_cfradial2_datatree()
display(dtree)
<xarray.DatasetView> Size: 477B
Dimensions:              (sweep: 9)
Dimensions without coordinates: sweep
Data variables:
    sweep_group_name     (sweep) <U7 252B 'sweep_0' 'sweep_1' ... 'sweep_8'
    sweep_fixed_angle    (sweep) float32 36B 0.4999 1.099 1.802 ... 9.102 12.8
    volume_number        int32 4B ...
    platform_type        |S32 32B ...
    primary_axis         |S32 32B ...
    status_str           |S1 1B ...
    instrument_type      |S32 32B ...
    time_coverage_start  |S32 32B ...
    time_coverage_end    |S32 32B ...
    latitude             float64 8B ...
    longitude            float64 8B ...
    altitude             float64 8B ...
Attributes: (12/13)
    Conventions:         Cf/Radial
    version:             1.2
    title:               TIMREX
    institution:
    references:
    source:
    ...                  ...
    comment:
    instrument_name:     SPOLRVP8
    site_name:
    scan_name:
    scan_id:             0
    platform_is_mobile:  false