OrderedDict([(‘time_coverage_start’,
OrderedDict([(‘data’,
array(‘2023-12-3T0:14:49Z’, dtype=‘<U3960’))])),
(‘time_coverage_end’,
OrderedDict([(‘data’, array(‘’, dtype=‘<U3960’))])),
(‘time’,
OrderedDict([(‘standard_name’, ‘time’),
(‘long_name’, ‘time_in_seconds_since_volume_start’),
(‘units’, ‘seconds since yyyy-mm-ddThh:mm:ssZ’),
(‘calendar’, ‘gregorian’),
(‘data’,
masked_array(data=[5.55555556e-02, 1.66666667e-01, 2.77777778e-01, …,
4.39722222e+02, 4.39833333e+02, 4.39944444e+02],
mask=False,
fill_value=1e+20))])),
(‘range’,
OrderedDict([(‘standard_name’, ‘projection_range_coordinate’),
(‘long_name’, ‘range_to_measurement_volume’),
(‘units’, ‘meters’),
(‘spacing_is_constant’, ‘true’),
(‘meters_to_center_of_first_gate’, ‘true’),
(‘axis’, ‘radial_range_coordinate’),
(‘data’,
masked_array(data=[7.50000e+01, 2.25000e+02, 3.75000e+02, …,
2.39625e+05, 2.39775e+05, 2.39925e+05],
mask=False,
fill_value=1e+20))])),
(‘latitude’,
OrderedDict([(‘units’, ‘degrees_north’),
(‘data’,
masked_array(data=8.5374,
mask=False,
fill_value=1e+20))])),
(‘longitude’,
OrderedDict([(‘units’, ‘degrees_east’),
(‘data’,
masked_array(data=76.8657,
mask=False,
fill_value=1e+20))])),
(‘altitude’,
OrderedDict([(‘units’, ‘meters’),
(‘data’, masked_array(data=27.,
mask=False,
fill_value=1e+20))])),
(‘PolType’,
OrderedDict([(‘data’, array(‘Dual Zdr’, dtype=‘<U32’))])),
(‘sweep_number’,
OrderedDict([(‘data’,
masked_array(data=[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
mask=False,
fill_value=999999))])),
(‘sweep_mode’,
OrderedDict([(‘data’,
array([‘azimuth surveillance’, ‘azimuth surveillance’,
‘azimuth surveillance’, ‘azimuth surveillance’,
‘azimuth surveillance’, ‘azimuth surveillance’,
‘azimuth surveillance’, ‘azimuth surveillance’,
‘azimuth surveillance’, ‘azimuth surveillance’,
‘azimuth surveillance’], dtype=‘<U32’))])),
(‘fixed_angle’,
OrderedDict([(‘units’, ‘degrees’),
(‘data’,
masked_array(data=[ 0.5, 1. , 2. , 3. , 4. , 7. , 9. , 12. , 15. ,
18. , 21. ],
mask=False,
fill_value=1e+20,
dtype=float32))])),
(‘sweep_start_ray_index’,
OrderedDict([(‘data’,
masked_array(data=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
mask=False,
fill_value=999999))])),
(‘sweep_end_ray_index’,
OrderedDict([(‘data’,
masked_array(data=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
mask=False,
fill_value=999999))])),
(‘azimuth’,
OrderedDict([(‘standard_name’, ‘ray_azimuth_angle’),
(‘units’, ‘degrees’),
(‘long_name’, ‘azimuth_angle_from_true_north’),
(‘axis’, ‘radial_azimuth_coordinate’),
(‘data’,
masked_array(data=[ 0., 1., 2., …, 357., 358., 359.],
mask=False,
fill_value=1e+20,
dtype=float32))])),
(‘elevation’,
OrderedDict([(‘standard_name’, ‘ray_elevation_angle’),
(‘units’, ‘degrees’),
(‘long_name’,
‘elevation_angle_from_horizontal_plane’),
(‘axis’, ‘radial_azimuth_coordinate’),
(‘data’,
masked_array(data=[ 0.5, 0.5, 0.5, …, 21. , 21. , 0. ],
mask=False,
fill_value=1e+20,
dtype=float32))])),
(‘DBZ’,
OrderedDict([(‘units’, ‘dBZ’),
(‘standard_name’, ‘equivalent_reflectivity_factor’),
(‘Polarization’, ‘Horizontal’),
(‘scale_factor’, 0.5),
(‘add_offset’, -32),
(‘FillValue’, 0),
(‘coordinates’, ‘time range’),
(‘data’,
masked_array(
data=[[–, --, 42.5, …, --, --, --],
[–, --, 46.5, …, --, --, --],
[–, --, 50.5, …, --, --, --],
…,
[–, --, 12.0, …, --, --, --],
[–, --, 7.5, …, --, --, --],
[–, --, 11.5, …, --, --, --]],
mask=[[ True, True, False, …, True, True, True],
[ True, True, False, …, True, True, True],
[ True, True, False, …, True, True, True],
…,
[ True, True, False, …, True, True, True],
[ True, True, False, …, True, True, True],
[ True, True, False, …, True, True, True]],
fill_value=0.0,
dtype=float32))])),
(‘VEL’,
OrderedDict([(‘units’, ‘m/s’),
(‘standard_name’,
'radial_velocity_of_scatterers away_from_instrument’),
(‘Polarization’, ‘Horizontal’),
(‘scale_factor’, 0.18737028625000005),
(‘add_offset’, -23.983396640000006),
(‘_FillValue’, 0),
(‘coordinates’, ‘time range’),
(‘data’,
masked_array(
data=[[–, --, -0.18737030029296875, …, --, --, --],
[–, --, 0.0, …, --, --, --],
[–, --, 0.5621109008789062, …, --, --, --],
…,
[–, --, 0.0, …, --, --, --],
[–, --, 0.18737030029296875, …, --, --, --],
[–, --, -0.18737030029296875, …, --, --, --]],
mask=[[ True, True, False, …, True, True, True],
[ True, True, False, …, True, True, True],
[ True, True, False, …, True, True, True],
…,
[ True, True, False, …, True, True, True],
[ True, True, False, …, True, True, True],
[ True, True, False, …, True, True, True]],
fill_value=0.0,
dtype=float32))])),
(‘WIDTH’,
OrderedDict([(‘units’, ‘m/s’),
(‘standard_name’, ‘doppler_spectrum_width’),
(‘Polarization’, ‘Horizontal’),
(‘scale_factor’, 0.1),
(‘add_offset’, 0),
(‘_FillValue’, 0),
(‘coordinates’, ‘time range’),
(‘data’,
masked_array(
data=[[–, --, 0.6000000238418579, …, --, --, --],
[–, --, 1.0, …, --, --, --],
[–, --, 0.6000000238418579, …, --, --, --],
…,
[–, --, 0.5, …, --, --, --],
[–, --, 0.6000000238418579, …, --, --, --],
[–, --, 0.800000011920929, …, --, --, --]],
mask=[[ True, True, False, …, True, True, True],
[ True, True, False, …, True, True, True],
[ True, True, False, …, True, True, True],
…,
[ True, True, False, …, True, True, True],
[ True, True, False, …, True, True, True],
[ True, True, False, …, True, True, True]],
fill_value=0.0,
dtype=float32))])),
(‘ZDR’,
OrderedDict([(‘units’, ‘dB’),
(‘standard_name’,
‘log_differential_reflectivity_hv’),
(‘Polarization’, ‘Horizontal and Vertical’),
(‘scale_factor’, 0.05),
(‘add_offset’, -4),
(‘_FillValue’, 0),
(‘coordinates’, ‘time range’),
(‘data’,
masked_array(
data=[[–, --, 1.0500001907348633, …, --, --, --],
[–, --, 1.1500000953674316, …, --, --, --],
[–, --, -1.9500000476837158, …, --, --, --],
…,
[–, --, -1.8999998569488525, …, --, --, --],
[–, --, -3.5, …, --, --, --],
[–, --, 1.4000000953674316, …, --, --, --]],
mask=[[ True, True, False, …, True, True, True],
[ True, True, False, …, True, True, True],
[ True, True, False, …, True, True, True],
…,
[ True, True, False, …, True, True, True],
[ True, True, False, …, True, True, True],
[ True, True, False, …, True, True, True]],
fill_value=0.0,
dtype=float32))])),
(‘PHIDP’,
OrderedDict([(‘units’, ‘degrees’),
(‘standard_name’, ‘differential_phase_hv’),
(‘Polarization’, ‘Horizontal and Vertical’),
(‘scale_factor’, 0.088),
(‘add_offset’, -180.0),
(‘_FillValue’, 0),
(‘coordinates’, ‘time range’),
(‘data’,
masked_array(
data=[[–, --, -31.720001220703125, …, --, --, --],
[–, --, -31.720001220703125, …, --, --, --],
[–, --, -31.720001220703125, …, --, --, --],
…,
[–, --, -31.720001220703125, …, --, --, --],
[–, --, -31.720001220703125, …, --, --, --],
[–, --, -31.720001220703125, …, --, --, --]],
mask=[[ True, True, False, …, True, True, True],
[ True, True, False, …, True, True, True],
[ True, True, False, …, True, True, True],
…,
[ True, True, False, …, True, True, True],
[ True, True, False, …, True, True, True],
[ True, True, False, …, True, True, True]],
fill_value=0.0,
dtype=float32))])),
(‘RHOHV’,
OrderedDict([(‘units’, ‘’),
(‘standard_name’, ‘cross_correlation_ratio_hv’),
(‘Polarization’, ‘Horizontal and Vertical’),
(‘scale_factor’, 0.003921569),
(‘add_offset’, 0),
(‘_FillValue’, 0),
(‘coordinates’, ‘time range’),
(‘data’,
masked_array(
data=[[–, --, 0.6745098233222961, …, --, --, --],
[–, --, 1.0, …, --, --, --],
[–, --, 1.0, …, --, --, --],
…,
[–, --, 0.847058892250061, …, --, --, --],
[–, --, 1.0, …, --, --, --],
[–, --, 0.9568628072738647, …, --, --, --]],
mask=[[ True, True, False, …, True, True, True],
[ True, True, False, …, True, True, True],
[ True, True, False, …, True, True, True],
…,
[ True, True, False, …, True, True, True],
[ True, True, False, …, True, True, True],
[ True, True, False, …, True, True, True]],
fill_value=0.0,
dtype=float32))]))])
"this my variables and its data "
How did you read in the data? This looks like a Py-ART radar object.
i am using wradlib for reading data
import wradlib as wrl
import warnings
from mpl_toolkits.basemap import Basemap
warnings.filterwarnings(“ignore”)
import matplotlib.pyplot as plt
import numpy as np
import xradar as xd
import datatree as xt
import xarray as xr
import os
import cartopy.crs as ccrs
try:
get_ipython().run_line_magic(“matplotlib inline”)
except:
plt.ion()
import numpy as np
import matplotlib.pyplot as plt
import wradlib
Replace ‘your_file.nc’ with the actual file path
file_path = “D:\ASWIN NSA\PROJECT\TERLS\B_3-9\RCTLS_03DEC2023_001449_L2B_STD.nc”
Read the NetCDF file
data = wradlib.io.read_generic_netcdf(file_path)
data
print(“Available variables:”, list(data.keys()))
LINK FOR NC FILE AND CODING WHICH I DONE CHECK ON IT
BELOW RADAR PROPERTIES
I would suggest following the workflow outlined in the wradlib documentation, specifically the section where they talk about georeferencing the data
Okay let me try it. Thank you for the help
You may want to explore the following Notebooks where we have demonstrated handling TERLS data.
And once you have a Cf/Radial file, you can get the lats and lons:
radar = pyart.io.read_cfradial("CFRADIAL/RCTLS_03DEC2023_001206_L2B_STD.nc")
lat, lon, alt = radar.get_gate_lat_lon_alt(sweep=0)
Thanks bro i got my lat,lon.
def read_terls(file=None, outdir=None):
‘’‘TERLS Mosdac’‘’
radar = pyart.io.read_cfradial(file)
# Just open as simple xarray.Dataset, not decoding times
vol = xr.open_dataset(file, decode_times=False)
# 1./2. fix time unit and time_coverage_start
start_time = “”.join(vol.time_coverage_start.astype(str).values)
start_time = datetime.strptime(start_time, “%Y-%m-%dT%H:%M:%SZ”)
vol[“time_coverage_start”] = start_time
# time-units is wrong: “seconds since yyyy-mm-ddThh:mm:ssZ”
vol[“time”].attrs[“units”] = f"seconds since {start_time}"
radar.time[‘units’] = f"seconds since {start_time}"
# now we can decode time (!)
vol = xr.decode_cf(vol)
ele = sorted(list(set(vol.elevation.values) ^ {0}))
vele = vol.elevation
sweep_start_ray_index = [vele.where(vele==el).argmin(“time”).values.item() for el in ele]
sweep_end_ray_index = [vol.dims[“time”] -
vele.where(vele==el)[::-1].argmin(“time”).values.item() for el in ele]
# vol[“sweep_start_ray_index”].values = sweep_start_ray_index
# vol[“sweep_end_ray_index”].values = sweep_end_ray_index
radar.sweep_start_ray_index[‘data’] = np.ma.masked_array(sweep_start_ray_index)
radar.sweep_end_ray_index[‘data’] = np.ma.masked_array(sweep_end_ray_index)
if outdir is None:
outdir = “CFRADIAL”
os.makedirs(outdir, exist_ok=True)
outfile = os.path.join(outdir, os.path.basename(file))
pyart.io.write_cfradial(outfile, radar=radar)
print(f"Cfrad saved as {outfile}")
return None
" can i add WIDTH variable to create CF radial file along with that varaible"
What do you mean by width variable? Spectrum Width?
YES,Data variable name is ‘WIDTH’ and its standard name is ‘doppler_spectrum_width’ in that nc file
There is already a variable “WIDTH” in your data. Again, once you have the Cf/Radial files, you can use pyart to check your fields,
radar = pyart.io.read_cfradial("CFRADIAL/RCTLS_03DEC2023_001206_L2B_STD.nc")
lat, lon, alt = radar.get_gate_lat_lon_alt(sweep=0)
print(radar.fields.keys())
Also, check the following ERAD2022 Radar course, there are a lot of notebooks, that should give you enough information to deal with the radar data.
https://openradarscience.org/erad2022/notebooks/pyart/pyart-basics.html