Wind retrievel for RPG radar data (parallel)¶

lidarwind is the package name used to retrieve wind profiles from the radar PPI scans. The package was initially developed to process wind lidar data (https://doi.org/10.21105/joss.04852). Because the physical principle of retrieving wind from lidar and radar observations is the same, lidarwind was extended to support the RPG radar data. Below, you will find an example of lidarwind applied to RPG PPI radar data.

You can find more information about lidarwind at: https://lidarwind.readthedocs.io/

Steps:¶

  1. Dependence installation
  2. Importing the required packages
  3. Defining useful functions
  4. Getting sample data
  5. Retrieving wind
  6. Visualising the results

Step 1: Dependence installation¶

The cell below installs all the required Python packages for running the wind retrieval (lidarwind).

InĀ [1]:
pip install lidarwind xarray==2024.3.0 xarray-datatree==0.0.14 "setuptools<82" ray
Requirement already satisfied: lidarwind in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (1.0.1)
Requirement already satisfied: xarray==2024.3.0 in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (2024.3.0)
Requirement already satisfied: xarray-datatree==0.0.14 in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (0.0.14)
Requirement already satisfied: setuptools<82 in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (81.0.0)
Requirement already satisfied: ray in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (2.55.1)
Requirement already satisfied: numpy>=1.23 in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (from xarray==2024.3.0) (2.4.6)
Requirement already satisfied: packaging>=22 in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (from xarray==2024.3.0) (26.2)
Requirement already satisfied: pandas>=1.5 in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (from xarray==2024.3.0) (3.0.3)
Requirement already satisfied: xrft>=0.3 in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (from lidarwind) (1.0.1)
Requirement already satisfied: netCDF4>=1.5 in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (from lidarwind) (1.7.4)
Requirement already satisfied: matplotlib>=3.4.3 in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (from lidarwind) (3.10.9)
Requirement already satisfied: click>=8.1.2 in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (from lidarwind) (8.4.1)
Requirement already satisfied: gdown>=4.5.1 in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (from lidarwind) (6.0.0)
Requirement already satisfied: pooch>=1.6 in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (from lidarwind) (1.9.0)
Requirement already satisfied: filelock in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (from ray) (3.29.0)
Requirement already satisfied: jsonschema in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (from ray) (4.26.0)
Requirement already satisfied: msgpack<2.0.0,>=1.0.0 in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (from ray) (1.1.2)
Requirement already satisfied: protobuf>=3.20.3 in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (from ray) (7.35.0)
Requirement already satisfied: pyyaml in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (from ray) (6.0.3)
Requirement already satisfied: requests in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (from ray) (2.34.2)
Requirement already satisfied: beautifulsoup4 in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (from gdown>=4.5.1->lidarwind) (4.14.3)
Requirement already satisfied: tqdm in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (from gdown>=4.5.1->lidarwind) (4.67.3)
Requirement already satisfied: contourpy>=1.0.1 in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (from matplotlib>=3.4.3->lidarwind) (1.3.3)
Requirement already satisfied: cycler>=0.10 in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (from matplotlib>=3.4.3->lidarwind) (0.12.1)
Requirement already satisfied: fonttools>=4.22.0 in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (from matplotlib>=3.4.3->lidarwind) (4.63.0)
Requirement already satisfied: kiwisolver>=1.3.1 in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (from matplotlib>=3.4.3->lidarwind) (1.5.0)
Requirement already satisfied: pillow>=8 in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (from matplotlib>=3.4.3->lidarwind) (12.2.0)
Requirement already satisfied: pyparsing>=3 in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (from matplotlib>=3.4.3->lidarwind) (3.3.2)
Requirement already satisfied: python-dateutil>=2.7 in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (from matplotlib>=3.4.3->lidarwind) (2.9.0.post0)
Requirement already satisfied: cftime in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (from netCDF4>=1.5->lidarwind) (1.6.5)
Requirement already satisfied: certifi in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (from netCDF4>=1.5->lidarwind) (2026.5.20)
Requirement already satisfied: platformdirs>=2.5.0 in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (from pooch>=1.6->lidarwind) (4.9.6)
Requirement already satisfied: six>=1.5 in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (from python-dateutil>=2.7->matplotlib>=3.4.3->lidarwind) (1.17.0)
Requirement already satisfied: charset_normalizer<4,>=2 in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (from requests->ray) (3.4.7)
Requirement already satisfied: idna<4,>=2.5 in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (from requests->ray) (3.15)
Requirement already satisfied: urllib3<3,>=1.26 in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (from requests->ray) (2.7.0)
Requirement already satisfied: dask in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (from xrft>=0.3->lidarwind) (2026.3.0)
Requirement already satisfied: scipy in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (from xrft>=0.3->lidarwind) (1.17.1)
Requirement already satisfied: soupsieve>=1.6.1 in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (from beautifulsoup4->gdown>=4.5.1->lidarwind) (2.8.3)
Requirement already satisfied: typing-extensions>=4.0.0 in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (from beautifulsoup4->gdown>=4.5.1->lidarwind) (4.15.0)
Requirement already satisfied: cloudpickle>=3.0.0 in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (from dask->xrft>=0.3->lidarwind) (3.1.2)
Requirement already satisfied: fsspec>=2021.09.0 in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (from dask->xrft>=0.3->lidarwind) (2026.4.0)
Requirement already satisfied: partd>=1.4.0 in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (from dask->xrft>=0.3->lidarwind) (1.4.2)
Requirement already satisfied: toolz>=0.12.0 in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (from dask->xrft>=0.3->lidarwind) (1.1.0)
Requirement already satisfied: locket in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (from partd>=1.4.0->dask->xrft>=0.3->lidarwind) (1.0.0)
Requirement already satisfied: attrs>=22.2.0 in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (from jsonschema->ray) (26.1.0)
Requirement already satisfied: jsonschema-specifications>=2023.03.6 in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (from jsonschema->ray) (2025.9.1)
Requirement already satisfied: referencing>=0.28.4 in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (from jsonschema->ray) (0.37.0)
Requirement already satisfied: rpds-py>=0.25.0 in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (from jsonschema->ray) (0.30.0)
Requirement already satisfied: PySocks!=1.5.7,>=1.5.6 in /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages (from requests[socks]->gdown>=4.5.1->lidarwind) (1.7.1)
Note: you may need to restart the kernel to use updated packages.
InĀ [Ā ]:
 

Step 2: Importing required packages¶

InĀ [2]:
# genneral imports
import os
import gdown
import gzip
import tarfile
import glob

import numpy as np
import xarray as xr

import matplotlib.pyplot as plt

# ray is useful if you want to run the code in parallel
import ray

# number of cpus to be used:
# if you are using your own machine you can set the cpu_number to half of the total cpus minus 1
cpu_number = int(os.cpu_count()/2)
ray.init(num_cpus=cpu_number, ignore_reinit_error=True)
/home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html
  from .autonotebook import tqdm as notebook_tqdm
2026-06-15 14:13:11,716	INFO util.py:154 -- Missing packages: ['ipywidgets']. Run `pip install -U ipywidgets`, then restart the notebook server for rich notebook output.
2026-06-15 14:13:14,081	INFO worker.py:2012 -- Started a local Ray instance.
/home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages/ray/_private/worker.py:2051: FutureWarning: Tip: In future versions of Ray, Ray will no longer override accelerator visible devices env var if num_gpus=0 or num_gpus=None (default). To enable this behavior and turn off this error message, set RAY_ACCEL_ENV_VAR_OVERRIDE_ON_ZERO=0
  warnings.warn(
Out[2]:
Python version: 3.14.5
Ray version: 2.55.1
InĀ [3]:
# importing the data processing package
import lidarwind

# checking if the version of lidarwind
# it should be 0.2.4
print(f"lidarwind version: {lidarwind.__version__}")

# importing the rpg radar related modules
from lidarwind.preprocessing import rpg_radar
from lidarwind.postprocessing import post_rpg_radar
/home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages/lidarwind/__init__.py:8: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
  from pkg_resources import DistributionNotFound, get_distribution
lidarwind version: 1.0.1

Step 3: Defining useful functions¶

InĀ [4]:
def chunks(lst, n):
    """
    Yield successive n-sized chunks from lst.
    """

    for i in range(0, len(lst), n):
        yield lst[i:i + n]
InĀ [5]:
def process_one_file(file_name):
    """
    Function to process a single radar file
    """

    ds = xr.open_dataset(file_name)
    ds = rpg_radar.rpg_slanted_radial_velocity_4_fft(ds)
    tmp_wind = post_rpg_radar.get_horizontal_wind(ds)

    return tmp_wind
InĀ [6]:
@ray.remote #<-- comment this line if you want to use the serial version
def process_one_chunck(one_chunk):
    """
    Function to process one chunck of file list
    """

    tmp_data_list = []
    for f in one_chunk:

        try:
            tmp_data_list.extend([process_one_file(f)])

        except:
            print(f"This file has a problem: {f}")
            pass

    wind = xr.merge(tmp_data_list)

    return wind

Step 4: Getting sample data¶

InĀ [7]:
%%time
# downloading sample data: PPI scans from the RPG Ka-Band radar (17.05.2022)
# url = "https://drive.google.com/uc?export=download&id=1086J-Enc-MVYzQDi1Up_rFfdfKo9C4jw"
sample_file = 'sample_clara_35'
url = f"https://ruisdael.citg.tudelft.nl/ruisdael_data/ccres/wind_retrieval/{sample_file}.tar.gz"
gdown.download(url, f"tmp_data/{sample_file}.tar.gz", quiet=False)

# extracting the sample data
with gzip.open(f"tmp_data/{sample_file}.tar.gz", 'rb') as f_in:
    with open(f"tmp_data/{sample_file}.tar", 'wb') as f_out:
        f_out.write(f_in.read())

# creating the sample data directory
with tarfile.open(f'tmp_data/{sample_file}.tar', 'r') as tar:
    tar.extractall("tmp_data")
Downloading...
From: https://ruisdael.citg.tudelft.nl/ruisdael_data/ccres/wind_retrieval/sample_clara_35.tar.gz
To: /home/jdiasneto/Projects/ccres_training/tmp_data/sample_clara_35.tar.gz
100%|ā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆ| 181M/181M [00:02<00:00, 64.4MB/s]
CPU times: user 766 ms, sys: 871 ms, total: 1.64 s
Wall time: 4.02 s

Step 5: Retrieving wind¶

InĀ [8]:
# creating a list of all PPI files
file_list = sorted(glob.glob(f"tmp_data/{sample_file}/*PPI*nc"))
file_list = sorted(file_list)

print(f"Number of files: {len(file_list)}")

# splitting the list of files in chuncks
# the number of chunks is equal to the number of CPUs used for processing the data
file_list_chunks = list(chunks(file_list, int(len(file_list)/cpu_number)))
Number of files: 374
InĀ [9]:
%%time

# runing the wind retrieval over the chunks
# parallel code
futures = [process_one_chunck.remote(c) for c in file_list_chunks]
wind_ds = xr.merge(ray.get(futures))
(pid=791434) /home/jdiasneto/miniforge3/envs/ccres/lib/python3.14/site-packages/lidarwind/__init__.py:8: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
(pid=791434)   from pkg_resources import DistributionNotFound, get_distribution
CPU times: user 136 ms, sys: 39.5 ms, total: 175 ms
Wall time: 38.3 s

Step 6: Visualising the results¶

InĀ [10]:
# checking the wind dataset
wind_ds
Out[10]:
<xarray.Dataset> Size: 6MB
Dimensions:                    (range: 339, chirp: 3, mean_time: 374)
Coordinates:
  * range                      (range) float32 1kB 108.0 129.6 ... 1.157e+04
  * chirp                      (chirp) int64 24B 1 2 3
  * mean_time                  (mean_time) datetime64[ns] 3kB 2022-05-17T00:0...
    elevation                  float32 4B 74.99
    freq_azimuth               float64 8B 0.002778
    azimuth_length             int64 8B 72
Data variables:
    horizontal_wind_direction  (mean_time, range) float64 1MB 238.3 ... nan
    horizontal_wind_speed      (mean_time, range) float64 1MB 6.283 ... nan
    meridional_wind            (mean_time, range) float64 1MB 3.305 ... nan
    zonal_wind                 (mean_time, range) float64 1MB -5.343 ... nan
    start_scan                 (mean_time) datetime64[ns] 3kB 2022-05-17T00:0...
    end_scan                   (mean_time) datetime64[ns] 3kB 2022-05-17T00:0...
    zdr_max                    (mean_time, range) float32 507kB 5.711 ... nan
    nan_percentual             (mean_time, range) float64 1MB 91.14 ... 100.0
    chirp_start                (mean_time, chirp) float32 4kB 111.8 ... 2.033...
    chirp_end                  (mean_time, chirp) float32 4kB 581.3 ... 1.197...
    chirp_azimuth_bias         (mean_time, chirp) float64 9kB 0.0 0.0 ... 0.0
    azm_seq                    (mean_time) float64 3kB 1.0 -1.0 1.0 ... 1.0 -1.0
xarray.Dataset
    • range: 339
    • chirp: 3
    • mean_time: 374
    • range
      (range)
      float32
      108.0 129.6 ... 1.153e+04 1.157e+04
      units :
      m
      name :
      range
      comment :
      height estimated from the original range and elevation
      array([  107.98101,   129.57721,   151.1734 , ..., 11493.517  , 11529.889  ,
             11566.26   ], shape=(339,), dtype=float32)
    • chirp
      (chirp)
      int64
      1 2 3
      array([1, 2, 3])
    • mean_time
      (mean_time)
      datetime64[ns]
      2022-05-17T00:01:51.098481012 .....
      comment :
      mean time (seconds) from each PPI scan
      array(['2022-05-17T00:01:51.098481012', '2022-05-17T00:03:24.370250000',
             '2022-05-17T00:04:50.899113924', ..., '2022-05-17T08:56:37.892607594',
             '2022-05-17T08:58:04.417205128', '2022-05-17T08:59:35.720181821'],
            shape=(374,), dtype='datetime64[ns]')
    • elevation
      ()
      float32
      74.99
      Name :
      Elevation
      Units :
      deg
      array(74.99, dtype=float32)
    • freq_azimuth
      ()
      float64
      0.002778
      spacing :
      0.002777777777777782
      direct_lag :
      180
      array(0.00277778)
    • azimuth_length
      ()
      int64
      72
      comment :
      size of the azimuth coordinate
      array(72)
    • horizontal_wind_direction
      (mean_time, range)
      float64
      238.3 273.0 231.4 ... nan nan nan
      name :
      wind direction
      units :
      deg
      comments :
      horizontal wind direction retrived using the FFT method with respect to true north
      info :
      0=wind coming from the north, 90=east, 180=south, 270=west
      array([[238.26096599, 273.02475168, 231.35451102, ...,          nan,
                       nan,          nan],
             [239.06008629, 240.06106835, 264.13452264, ...,          nan,
                       nan,          nan],
             [249.05189886, 241.56486228, 268.20838391, ...,          nan,
                       nan,          nan],
             ...,
             [ 86.12905163,  90.19023805,  92.18313737, ...,          nan,
                       nan,          nan],
             [106.55059399, 110.87825494, 120.38178403, ...,          nan,
                       nan,          nan],
             [ 83.55465631,  92.56070586,  84.95571432, ...,          nan,
                       nan,          nan]], shape=(374, 339))
    • horizontal_wind_speed
      (mean_time, range)
      float64
      6.283 4.839 6.391 ... nan nan nan
      name :
      wind speed
      units :
      m s-1
      comments :
      horizontal wind speed retrived using the FFT method
      array([[6.28276315, 4.83860438, 6.39080926, ...,        nan,        nan,
                     nan],
             [8.02256512, 8.4663337 , 7.68287435, ...,        nan,        nan,
                     nan],
             [7.67640788, 7.02767344, 6.51751396, ...,        nan,        nan,
                     nan],
             ...,
             [3.35722852, 4.03074025, 4.81323898, ...,        nan,        nan,
                     nan],
             [3.58564431, 3.31800667, 3.23374156, ...,        nan,        nan,
                     nan],
             [3.07991792, 3.01295807, 3.17121615, ...,        nan,        nan,
                     nan]], shape=(374, 339))
    • meridional_wind
      (mean_time, range)
      float64
      3.305 -0.2553 3.991 ... nan nan nan
      name :
      meridional wind
      units :
      m s-1
      comments :
      meridional wind retrieved using the FFT method
      array([[ 3.30505486, -0.25532037,  3.99105958, ...,         nan,
                      nan,         nan],
             [ 4.12471262,  4.22534962,  0.78513733, ...,         nan,
                      nan,         nan],
             [ 2.74448592,  3.34632215,  0.20376684, ...,         nan,
                      nan,         nan],
             ...,
             [-0.22664452,  0.01338316,  0.18335416, ...,         nan,
                      nan,         nan],
             [ 1.02141346,  1.18248257,  1.63549558, ...,         nan,
                      nan,         nan],
             [-0.3457373 ,  0.13461255, -0.27883142, ...,         nan,
                      nan,         nan]], shape=(374, 339))
    • zonal_wind
      (mean_time, range)
      float64
      -5.343 -4.832 -4.991 ... nan nan
      name :
      zonal wind
      units :
      m s-1
      comments :
      zonal wind retrieved using the FFT method
      array([[-5.34319428, -4.83186339, -4.99138121, ...,         nan,
                      nan,         nan],
             [-6.88100987, -7.33656779, -7.64265122, ...,         nan,
                      nan,         nan],
             [-7.16903305, -6.17983188, -6.51432785, ...,         nan,
                      nan,         nan],
             ...,
             [ 3.34956947,  4.03071804,  4.80974539, ...,         nan,
                      nan,         nan],
             [ 3.43708593,  3.10014568,  2.78966641, ...,         nan,
                      nan,         nan],
             [ 3.06045097,  3.00994946,  3.15893414, ...,         nan,
                      nan,         nan]], shape=(374, 339))
    • start_scan
      (mean_time)
      datetime64[ns]
      2022-05-17T00:01:12.460000 ... 2...
      Name :
      Time
      Units :
      Number of seconds since 1/1/2001 00:00:00 [UTC]
      array(['2022-05-17T00:01:12.460000000', '2022-05-17T00:02:45.230000000',
             '2022-05-17T00:04:12.270000000', '2022-05-17T00:05:39.290000000',
             '2022-05-17T00:07:04.320000000', '2022-05-17T00:08:30.350000000',
             '2022-05-17T00:09:55.400000000', '2022-05-17T00:11:21.420000000',
             '2022-05-17T00:12:47.450999936', '2022-05-17T00:14:13.491000064',
             '2022-05-17T00:15:38.521000064', '2022-05-17T00:17:04.550999936',
             '2022-05-17T00:18:30.580999936', '2022-05-17T00:20:03.371000064',
             '2022-05-17T00:21:29.401000064', '2022-05-17T00:22:54.430999936',
             '2022-05-17T00:24:20.472000000', '2022-05-17T00:25:46.502000000',
             '2022-05-17T00:27:12.532000000', '2022-05-17T00:28:38.572000000',
             '2022-05-17T00:30:04.602000000', '2022-05-17T00:31:29.642000000',
             '2022-05-17T00:32:54.672000000', '2022-05-17T00:34:20.712000000',
             '2022-05-17T00:35:46.743000064', '2022-05-17T00:37:18.513000064',
             '2022-05-17T00:38:43.562999936', '2022-05-17T00:40:09.713000064',
             '2022-05-17T00:41:35.893000064', '2022-05-17T00:43:01.922999936',
             '2022-05-17T00:44:27.952999936', '2022-05-17T00:45:53.983000064',
             '2022-05-17T00:47:20.032999936', '2022-05-17T00:48:46.054000000',
             '2022-05-17T00:50:11.104000000', '2022-05-17T00:51:36.144000000',
             '2022-05-17T00:53:02.194000000', '2022-05-17T00:54:33.964000000',
             '2022-05-17T00:56:00.014000000', '2022-05-17T00:57:26.034000000',
      ...
             '2022-05-17T08:05:39.590000000', '2022-05-17T08:07:10.370000000',
             '2022-05-17T08:08:35.440000000', '2022-05-17T08:10:01.480000000',
             '2022-05-17T08:11:27.510000000', '2022-05-17T08:12:53.560999936',
             '2022-05-17T08:14:18.600999936', '2022-05-17T08:15:45.621000064',
             '2022-05-17T08:17:10.671000064', '2022-05-17T08:18:35.710999936',
             '2022-05-17T08:20:00.751000064', '2022-05-17T08:21:26.781000064',
             '2022-05-17T08:22:53.800999936', '2022-05-17T08:24:25.592000000',
             '2022-05-17T08:25:50.652000000', '2022-05-17T08:27:16.682000000',
             '2022-05-17T08:28:41.722000000', '2022-05-17T08:30:07.762000000',
             '2022-05-17T08:31:35.772000000', '2022-05-17T08:33:01.802000000',
             '2022-05-17T08:34:26.842000000', '2022-05-17T08:35:52.873000064',
             '2022-05-17T08:37:17.912999936', '2022-05-17T08:38:44.932999936',
             '2022-05-17T08:40:09.983000064', '2022-05-17T08:41:42.753000064',
             '2022-05-17T08:43:07.812999936', '2022-05-17T08:44:33.963000064',
             '2022-05-17T08:45:59.003000064', '2022-05-17T08:47:26.013000064',
             '2022-05-17T08:48:51.054000000', '2022-05-17T08:50:16.114000000',
             '2022-05-17T08:51:42.144000000', '2022-05-17T08:53:09.184000000',
             '2022-05-17T08:54:34.224000000', '2022-05-17T08:55:59.254000000',
             '2022-05-17T08:57:26.274000000', '2022-05-17T08:58:58.054000000'],
            dtype='datetime64[ns]')
    • end_scan
      (mean_time)
      datetime64[ns]
      2022-05-17T00:02:29.740000 ... 2...
      Name :
      Time
      Units :
      Number of seconds since 1/1/2001 00:00:00 [UTC]
      array(['2022-05-17T00:02:29.740000000', '2022-05-17T00:04:03.510000000',
             '2022-05-17T00:05:29.540000000', '2022-05-17T00:06:55.570000000',
             '2022-05-17T00:08:21.600000000', '2022-05-17T00:09:46.640000000',
             '2022-05-17T00:11:12.670000000', '2022-05-17T00:12:37.710999936',
             '2022-05-17T00:14:03.741000064', '2022-05-17T00:15:29.771000064',
             '2022-05-17T00:16:55.800999936', '2022-05-17T00:18:22.820999936',
             '2022-05-17T00:19:47.860999936', '2022-05-17T00:21:19.651000064',
             '2022-05-17T00:22:45.680999936', '2022-05-17T00:24:10.722000000',
             '2022-05-17T00:25:36.752000000', '2022-05-17T00:27:02.792000000',
             '2022-05-17T00:28:28.822000000', '2022-05-17T00:29:54.852000000',
             '2022-05-17T00:31:19.892000000', '2022-05-17T00:32:44.932000000',
             '2022-05-17T00:34:10.962000000', '2022-05-17T00:35:36.992000000',
             '2022-05-17T00:37:03.023000064', '2022-05-17T00:38:34.812999936',
             '2022-05-17T00:39:59.863000064', '2022-05-17T00:41:25.993000064',
             '2022-05-17T00:42:52.172999936', '2022-05-17T00:44:18.202999936',
             '2022-05-17T00:45:44.233000064', '2022-05-17T00:47:10.263000064',
             '2022-05-17T00:48:36.314000000', '2022-05-17T00:50:01.354000000',
             '2022-05-17T00:51:27.384000000', '2022-05-17T00:52:53.424000000',
             '2022-05-17T00:54:18.474000000', '2022-05-17T00:55:50.254000000',
             '2022-05-17T00:57:16.294000000', '2022-05-17T00:58:42.324000000',
      ...
             '2022-05-17T08:06:54.880000000', '2022-05-17T08:08:25.670000000',
             '2022-05-17T08:09:51.720000000', '2022-05-17T08:11:17.760000000',
             '2022-05-17T08:12:43.800999936', '2022-05-17T08:14:09.840999936',
             '2022-05-17T08:15:35.881000064', '2022-05-17T08:17:00.921000064',
             '2022-05-17T08:18:26.950999936', '2022-05-17T08:19:52.001000064',
             '2022-05-17T08:21:18.031000064', '2022-05-17T08:22:44.060999936',
             '2022-05-17T08:24:10.092000000', '2022-05-17T08:25:40.902000000',
             '2022-05-17T08:27:06.932000000', '2022-05-17T08:28:32.962000000',
             '2022-05-17T08:29:58.992000000', '2022-05-17T08:31:24.042000000',
             '2022-05-17T08:32:52.062000000', '2022-05-17T08:34:18.092000000',
             '2022-05-17T08:35:44.122000000', '2022-05-17T08:37:09.162999936',
             '2022-05-17T08:38:35.192999936', '2022-05-17T08:40:01.223000064',
             '2022-05-17T08:41:27.263000064', '2022-05-17T08:42:58.052999936',
             '2022-05-17T08:44:24.093000064', '2022-05-17T08:45:50.243000064',
             '2022-05-17T08:47:16.273000064', '2022-05-17T08:48:42.304000000',
             '2022-05-17T08:50:07.344000000', '2022-05-17T08:51:33.384000000',
             '2022-05-17T08:52:59.424000000', '2022-05-17T08:54:24.474000000',
             '2022-05-17T08:55:50.504000000', '2022-05-17T08:57:16.534000000',
             '2022-05-17T08:58:42.564000000', '2022-05-17T09:00:13.430000000'],
            dtype='datetime64[ns]')
    • zdr_max
      (mean_time, range)
      float32
      5.711 5.635 11.11 ... nan nan nan
      Name :
      Maximum ZDR
      units :
      dB
      Comment :
      Maximum ZDR per complete PPI scan
      array([[ 5.710735 ,  5.6347203, 11.111607 , ...,        nan,        nan,
                     nan],
             [ 9.371054 ,  2.6746783,  5.725346 , ...,        nan,        nan,
                     nan],
             [10.791488 , 10.899869 , 10.957868 , ...,        nan,        nan,
                     nan],
             ...,
             [ 7.035514 ,  9.615642 ,  7.2303047, ...,        nan,        nan,
                     nan],
             [ 5.98163  ,  5.1708813,  7.303567 , ...,        nan,        nan,
                     nan],
             [ 4.9368873,  5.7784424,  8.640238 , ...,        nan,        nan,
                     nan]], shape=(374, 339), dtype=float32)
    • nan_percentual
      (mean_time, range)
      float64
      91.14 94.94 93.67 ... 100.0 100.0
      comment :
      Percentual of NaN per single PPI scan
      array([[ 91.13924051,  94.93670886,  93.67088608, ..., 100.        ,
              100.        , 100.        ],
             [ 88.75      ,  88.75      ,  82.5       , ..., 100.        ,
              100.        , 100.        ],
             [ 87.34177215,  89.87341772,  92.40506329, ..., 100.        ,
              100.        , 100.        ],
             ...,
             [  1.26582278,   0.        ,   0.        , ..., 100.        ,
              100.        , 100.        ],
             [  0.        ,   0.        ,   0.        , ..., 100.        ,
              100.        , 100.        ],
             [  0.        ,   0.        ,   0.        , ..., 100.        ,
              100.        , 100.        ]], shape=(374, 339))
    • chirp_start
      (mean_time, chirp)
      float32
      111.8 621.0 ... 621.0 2.033e+03
      units :
      m
      comment :
      starting height from each chirp sequence
      array([[ 111.795395,  620.987   , 2033.4624  ],
             [ 111.795395,  620.987   , 2033.4624  ],
             [ 111.795395,  620.987   , 2033.4624  ],
             ...,
             [ 111.795395,  620.987   , 2033.4624  ],
             [ 111.795395,  620.987   , 2033.4624  ],
             [ 111.795395,  620.987   , 2033.4624  ]],
            shape=(374, 3), dtype=float32)
    • chirp_end
      (mean_time, chirp)
      float32
      581.3 1.998e+03 ... 1.197e+04
      units :
      m
      comment :
      ending height from each chirp sequence
      array([[  581.33606,  1997.9583 , 11974.834  ],
             [  581.33606,  1997.9583 , 11974.834  ],
             [  581.33606,  1997.9583 , 11974.834  ],
             ...,
             [  581.33606,  1997.9583 , 11974.834  ],
             [  581.33606,  1997.9583 , 11974.834  ],
             [  581.33606,  1997.9583 , 11974.834  ]],
            shape=(374, 3), dtype=float32)
    • chirp_azimuth_bias
      (mean_time, chirp)
      float64
      0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0
      units :
      deg
      comment :
      wind direction bias correcting factor
      array([[0., 0., 0.],
             [0., 0., 0.],
             [0., 0., 0.],
             ...,
             [0., 0., 0.],
             [0., 0., 0.],
             [0., 0., 0.]], shape=(374, 3))
    • azm_seq
      (mean_time)
      float64
      1.0 -1.0 1.0 -1.0 ... -1.0 1.0 -1.0
      comment :
      1: azimuth increasing; -1: azimuth decreasing
      array([ 1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1.,
             -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,
              1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1.,
             -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,
              1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1.,
             -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,
              1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1.,
             -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,
              1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1.,
             -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,
              1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1.,
             -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,
              1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1.,
             -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,
              1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1.,
             -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,
              1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1.,
             -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,
              1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1.,
             -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,
              1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1.,
             -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,
              1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1.,
             -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,
              1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1.,
             -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,
              1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1.,
             -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,
              1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.])
    • range
      PandasIndex
      PandasIndex(Index([107.98101043701172, 129.57720947265625, 151.17340087890625,
              172.7696075439453, 194.36581420898438, 215.96202087402344,
              237.5582275390625,  259.1544189453125,  280.7506103515625,
              302.3468017578125,
             ...
               11238.9130859375,   11275.2861328125,   11311.6572265625,
               11348.0283203125,   11384.4013671875,   11420.7724609375,
                 11457.14453125,   11493.5166015625,    11529.888671875,
                11566.259765625],
            dtype='float32', name='range', length=339))
    • chirp
      PandasIndex
      PandasIndex(Index([1, 2, 3], dtype='int64', name='chirp'))
    • mean_time
      PandasIndex
      PandasIndex(DatetimeIndex(['2022-05-17 00:01:51.098481012',
                        '2022-05-17 00:03:24.370250',
                     '2022-05-17 00:04:50.899113924',
                     '2022-05-17 00:06:17.425256410',
                     '2022-05-17 00:07:42.957721518',
                     '2022-05-17 00:09:08.492307692',
                     '2022-05-17 00:10:34.028734177',
                     '2022-05-17 00:11:59.563346149',
                     '2022-05-17 00:13:25.594076928',
                     '2022-05-17 00:14:51.625230767',
                     ...
                     '2022-05-17 08:46:37.632746834',
                     '2022-05-17 08:48:04.157410256',
                     '2022-05-17 08:49:29.196564102',
                     '2022-05-17 08:50:54.744126582',
                     '2022-05-17 08:52:20.782481012',
                     '2022-05-17 08:53:46.822831168',
                     '2022-05-17 08:55:12.358871794',
                     '2022-05-17 08:56:37.892607594',
                     '2022-05-17 08:58:04.417205128',
                     '2022-05-17 08:59:35.720181821'],
                    dtype='datetime64[ns]', name='mean_time', length=374, freq=None))
InĀ [11]:
invalid_threshold = 100

# plotting wind speed and direction
plt.figure(figsize=(15,6))
wind_ds.horizontal_wind_speed.where(wind_ds.nan_percentual<invalid_threshold).plot(y="range", cmap="turbo", vmin=0, vmax=20)
plt.xlim(wind_ds['mean_time'][0], wind_ds['mean_time'][-1])
plt.show()

plt.figure(figsize=(15,6))
wind_ds.horizontal_wind_direction.where(wind_ds.nan_percentual<invalid_threshold).plot(y="range", cmap="hsv", vmin=0, vmax=360)
plt.xlim(wind_ds['mean_time'][0], wind_ds['mean_time'][-1])
plt.show()
No description has been provided for this image
No description has been provided for this image
InĀ [12]:
invalid_threshold = 50

# plotting wind speed and direction
plt.figure(figsize=(15,6))
wind_ds.horizontal_wind_speed.where(wind_ds.nan_percentual<invalid_threshold).plot(y="range", cmap="turbo", vmin=0, vmax=20)
plt.xlim(wind_ds['mean_time'][0], wind_ds['mean_time'][-1])
plt.show()

plt.figure(figsize=(15,6))
wind_ds.horizontal_wind_direction.where(wind_ds.nan_percentual<invalid_threshold).plot(y="range", cmap="hsv", vmin=0, vmax=360)
plt.xlim(wind_ds['mean_time'][0], wind_ds['mean_time'][-1])
plt.show()
No description has been provided for this image
No description has been provided for this image
InĀ [13]:
# output example
# wind.to_netcdf('sample_data/trial_horizontal_wind.nc')