-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Description
Hi all. I just got a file in "cfradial2" format. It contains groups instead a single netcdf. Do we need to create a new backend for this kind of files or we can addapt cfradial1 backend. Attached, you will find a copy of the file
import xradar as xd
path = "radar-cfradial2.nc"
radar = xd.io.open_cfradial1_datatree(path)returns this error
Traceback (most recent call last):
File "/media/alfonso/drive/Alfonso/python/demos/era5-ingestion/truweather.py", line 23, in <module>
radar = xd.io.open_cfradial1_datatree(path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/alfonso/mambaforge/envs/raw2zarr-dev/lib/python3.12/site-packages/xradar/io/backends/cfradial1.py", line 355, in open_cfradial1_datatree
"/": _get_required_root_dataset(ds, optional=optional),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/alfonso/mambaforge/envs/raw2zarr-dev/lib/python3.12/site-packages/xradar/io/backends/cfradial1.py", line 82, in _get_required_root_dataset
root = root.rename_vars(
^^^^^^^^^^^^^^^^^
File "/home/alfonso/mambaforge/envs/raw2zarr-dev/lib/python3.12/site-packages/xarray/core/dataset.py", line 4234, in rename_vars
raise ValueError(
ValueError: cannot rename 'sweep_number' because it is not a variable or coordinate in this datasetthis is because is a Netcdf file with nested groups. we can check it out using xarray.open_groups or xarray.open_datatree
groups = xr.open_groups(path)
print(groups)
{'/': <xarray.Dataset> Size: 40B
Dimensions: (nsweep: 1)
Dimensions without coordinates: nsweep
Data variables:
sweep_group_name (nsweep) <U10 40B ...
Attributes:
Conventions: CF-1.7, Cf/Radial
version: 2.0
title: Radar CfRadial2 Dataset
history: Updated CfRadial2 on 2025-05-01T00:46:09.040110Z
RadarName: denton.tx
Latitude: 33.25355
Longitude: -97.15204
Height: 224.0,
'/sweep_0000': <xarray.Dataset> Size: 27MB
Dimensions: (ntime: 723, nrange: 1003)
Dimensions without coordinates: ntime, nrange
Data variables: (12/19)
time_us (ntime) datetime64[ns] 6kB ...
range_m (nrange) float64 8kB ...
azimuth_deg (ntime) float64 6kB ...
elevation_deg (ntime) float64 6kB ...
range_gate_width_mm (ntime) float64 6kB ...
start_range_mm (ntime) float64 6kB ...
... ...
specific_differential_phase (ntime, nrange) float32 3MB ...
radial_velocity_mps (ntime, nrange) float32 3MB ...
signal_to_noise_ratio_db (ntime, nrange) float32 3MB ...
spectral_width_mps (ntime, nrange) float32 3MB ...
filtering (ntime, nrange) int8 725kB ...
rain_rate_mmhr (ntime, nrange) float32 3MB ...
Attributes:
NumGates: 1003
ScanType: 2
AntennaGain: 33.0
AntennaBeamwidth: 2.7
PosVelocity: 15.0}Let me know your thoughts.
File can be found in this link
Metadata
Metadata
Assignees
Labels
No labels