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 /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (1.0.1)
Requirement already satisfied: xarray==2024.3.0 in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (2024.3.0)
Requirement already satisfied: xarray-datatree==0.0.14 in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (0.0.14)
Requirement already satisfied: ray in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (2.49.2)
Requirement already satisfied: numpy>=1.23 in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (from xarray==2024.3.0) (2.4.6)
Requirement already satisfied: packaging>=22 in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (from xarray==2024.3.0) (26.2)
Requirement already satisfied: pandas>=1.5 in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (from xarray==2024.3.0) (3.0.3)
Requirement already satisfied: xrft>=0.3 in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (from lidarwind) (1.0.1)
Requirement already satisfied: netCDF4>=1.5 in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (from lidarwind) (1.7.4)
Requirement already satisfied: matplotlib>=3.4.3 in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (from lidarwind) (3.10.9)
Requirement already satisfied: click>=8.1.2 in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (from lidarwind) (8.4.1)
Requirement already satisfied: gdown>=4.5.1 in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (from lidarwind) (6.0.0)
Requirement already satisfied: pooch>=1.6 in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (from lidarwind) (1.9.0)
Requirement already satisfied: filelock in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (from ray) (3.29.0)
Requirement already satisfied: jsonschema in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (from ray) (4.26.0)
Requirement already satisfied: msgpack<2.0.0,>=1.0.0 in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (from ray) (1.1.2)
Requirement already satisfied: protobuf>=3.20.3 in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (from ray) (7.35.0)
Requirement already satisfied: pyyaml in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (from ray) (6.0.3)
Requirement already satisfied: requests in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (from ray) (2.34.2)
Requirement already satisfied: beautifulsoup4 in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (from gdown>=4.5.1->lidarwind) (4.14.3)
Requirement already satisfied: tqdm in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (from gdown>=4.5.1->lidarwind) (4.67.3)
Requirement already satisfied: contourpy>=1.0.1 in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (from matplotlib>=3.4.3->lidarwind) (1.3.3)
Requirement already satisfied: cycler>=0.10 in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (from matplotlib>=3.4.3->lidarwind) (0.12.1)
Requirement already satisfied: fonttools>=4.22.0 in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (from matplotlib>=3.4.3->lidarwind) (4.63.0)
Requirement already satisfied: kiwisolver>=1.3.1 in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (from matplotlib>=3.4.3->lidarwind) (1.5.0)
Requirement already satisfied: pillow>=8 in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (from matplotlib>=3.4.3->lidarwind) (12.2.0)
Requirement already satisfied: pyparsing>=3 in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (from matplotlib>=3.4.3->lidarwind) (3.3.2)
Requirement already satisfied: python-dateutil>=2.7 in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (from matplotlib>=3.4.3->lidarwind) (2.9.0.post0)
Requirement already satisfied: cftime in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (from netCDF4>=1.5->lidarwind) (1.6.5)
Requirement already satisfied: certifi in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (from netCDF4>=1.5->lidarwind) (2026.5.20)
Requirement already satisfied: platformdirs>=2.5.0 in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (from pooch>=1.6->lidarwind) (4.9.6)
Requirement already satisfied: six>=1.5 in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (from python-dateutil>=2.7->matplotlib>=3.4.3->lidarwind) (1.17.0)
Requirement already satisfied: charset_normalizer<4,>=2 in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (from requests->ray) (3.4.7)
Requirement already satisfied: idna<4,>=2.5 in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (from requests->ray) (3.15)
Requirement already satisfied: urllib3<3,>=1.26 in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (from requests->ray) (2.7.0)
Requirement already satisfied: dask in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (from xrft>=0.3->lidarwind) (2026.3.0)
Requirement already satisfied: scipy in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (from xrft>=0.3->lidarwind) (1.17.1)
Requirement already satisfied: soupsieve>=1.6.1 in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (from beautifulsoup4->gdown>=4.5.1->lidarwind) (2.8.3)
Requirement already satisfied: typing-extensions>=4.0.0 in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (from beautifulsoup4->gdown>=4.5.1->lidarwind) (4.15.0)
Requirement already satisfied: cloudpickle>=3.0.0 in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (from dask->xrft>=0.3->lidarwind) (3.1.2)
Requirement already satisfied: fsspec>=2021.09.0 in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (from dask->xrft>=0.3->lidarwind) (2026.4.0)
Requirement already satisfied: partd>=1.4.0 in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (from dask->xrft>=0.3->lidarwind) (1.4.2)
Requirement already satisfied: toolz>=0.12.0 in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (from dask->xrft>=0.3->lidarwind) (1.1.0)
Requirement already satisfied: locket in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (from partd>=1.4.0->dask->xrft>=0.3->lidarwind) (1.0.0)
Requirement already satisfied: attrs>=22.2.0 in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (from jsonschema->ray) (26.1.0)
Requirement already satisfied: jsonschema-specifications>=2023.03.6 in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (from jsonschema->ray) (2025.9.1)
Requirement already satisfied: referencing>=0.28.4 in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (from jsonschema->ray) (0.37.0)
Requirement already satisfied: rpds-py>=0.25.0 in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/site-packages (from jsonschema->ray) (0.30.0)
Requirement already satisfied: PySocks!=1.5.7,>=1.5.6 in /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/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)
/Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/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-05-22 13:51:22,765	INFO util.py:154 -- Missing packages: ['ipywidgets']. Run `pip install -U ipywidgets`, then restart the notebook server for rich notebook output.
2026-05-22 13:51:27,411	INFO worker.py:1951 -- Started a local Ray instance.
Out[2]:
Python version: 3.12.13
Ray version: 2.49.2
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
/Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/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 get_cmap():

    """
    loading the special cyclic colormap
    """

    colPath = 'sample_data/cyclic_mrybm.txt'
    colData = np.loadtxt(colPath)

    colData = np.clip(colData, 0, 1)
    cmap = LinearSegmentedColormap.from_list('my_colormap', colData)

    return cmap
In [5]:
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 [6]:
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 [7]:
@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 [18]:
%%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"
# url = "https://ruisdael.citg.tudelft.nl/ruisdael_data/ccres/sample.gz"
gdown.download(url, "tmp_data/sample.gz", quiet=False)

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

# creating the sample data directory
with tarfile.open('tmp_data/sample.tar', 'r') as tar:
    tar.extractall("tmp_data")
Downloading...
From (original): https://drive.google.com/uc?id=1086J-Enc-MVYzQDi1Up_rFfdfKo9C4jw
From (redirected): https://drive.google.com/uc?id=1086J-Enc-MVYzQDi1Up_rFfdfKo9C4jw&confirm=t&uuid=f55d59ec-9980-4b09-b019-c00a8f1e6bb4
To: /Users/jdiasneto/Projects/actris_training/tmp_data/sample.gz
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████| 467M/467M [09:40<00:00, 803kB/s]
<timed exec>:13: DeprecationWarning: Python 3.14 will, by default, filter extracted tar archives and reject files or modify their metadata. Use the filter argument to control this behavior.
CPU times: user 11.4 s, sys: 15.9 s, total: 27.4 s
Wall time: 9min 49s

Step 5: Retrieving wind¶

In [9]:
# creating a list of all PPI files
file_list = sorted(glob.glob("tmp_data/sample/*PPI*nc"))
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: 999
In [10]:
%%time

# runing the wind retrieval over the chunks
# parallel code
futures = [process_one_chunck.remote(c) for c in file_list_chunks]
wind = xr.merge(ray.get(futures))
(pid=13885) /Users/jdiasneto/miniforge3/envs/ccres/lib/python3.12/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=13885)   from pkg_resources import DistributionNotFound, get_distribution
(process_one_chunck pid=13884) This file has a problem: tmp_data/sample/BaseN_220517_135941_P01_PPI.LV1.nc
CPU times: user 1.31 s, sys: 1.54 s, total: 2.85 s
Wall time: 9min 13s

Step 6: Visualising the results¶

In [14]:
# checking the wind dataset
wind
Out[14]:
<xarray.Dataset> Size: 15MB
Dimensions:                    (range: 339, chirp: 3, mean_time: 998)
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] 8kB 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 3MB 238.3 ... nan
    horizontal_wind_speed      (mean_time, range) float64 3MB 6.283 ... nan
    meridional_wind            (mean_time, range) float64 3MB 3.305 ... nan
    zonal_wind                 (mean_time, range) float64 3MB -5.343 ... nan
    start_scan                 (mean_time) datetime64[ns] 8kB 2022-05-17T00:0...
    end_scan                   (mean_time) datetime64[ns] 8kB 2022-05-17T00:0...
    zdr_max                    (mean_time, range) float32 1MB 5.711 ... nan
    nan_percentual             (mean_time, range) float64 3MB 91.14 ... 100.0
    chirp_start                (mean_time, chirp) float32 12kB 111.8 ... 2.03...
    chirp_end                  (mean_time, chirp) float32 12kB 581.3 ... 1.19...
    chirp_azimuth_bias         (mean_time, chirp) float64 24kB 0.0 0.0 ... 0.0
    azm_seq                    (mean_time) float64 8kB 1.0 -1.0 1.0 ... -1.0 1.0
xarray.Dataset
    • range: 339
    • chirp: 3
    • mean_time: 998
    • 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-17T23:56:41.901662337',
             '2022-05-17T23:58:12.698545454', '2022-05-17T23:59:37.704797464'],
            shape=(998,), 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],
             ...,
             [205.0047082 , 201.07519879, 194.0902509 , ...,          nan,
                       nan,          nan],
             [198.72858018, 192.80239896, 200.7374128 , ...,          nan,
                       nan,          nan],
             [200.8127696 , 199.54313254, 208.60521263, ...,          nan,
                       nan,          nan]], shape=(998, 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],
             ...,
             [5.0335336 , 3.90667231, 4.08425327, ...,        nan,        nan,
                     nan],
             [4.4667048 , 4.18641531, 3.71849188, ...,        nan,        nan,
                     nan],
             [4.59766567, 4.83831679, 4.59585848, ...,        nan,        nan,
                     nan]], shape=(998, 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],
             ...,
             [ 4.56175588,  3.64535217,  3.9613722 , ...,         nan,
                      nan,         nan],
             [ 4.23019381,  4.08234135,  3.47758202, ...,         nan,
                      nan,         nan],
             [ 4.29765194,  4.55958104,  4.03488533, ...,         nan,
                      nan,         nan]], shape=(998, 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],
             ...,
             [-2.12763808, -1.40481176, -0.99431138, ...,         nan,
                      nan,         nan],
             [-1.43419386, -0.92766495, -1.3166644 , ...,         nan,
                      nan,         nan],
             [-1.63362096, -1.61849627, -2.20036713, ...,         nan,
                      nan,         nan]], shape=(998, 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-17T23:05:47.470000000', '2022-05-17T23:07:15.480000000',
             '2022-05-17T23:08:40.520000000', '2022-05-17T23:10:06.540000000',
             '2022-05-17T23:11:34.620000000', '2022-05-17T23:12:59.661000064',
             '2022-05-17T23:14:25.690999936', '2022-05-17T23:15:50.730999936',
             '2022-05-17T23:17:15.771000064', '2022-05-17T23:18:40.800999936',
             '2022-05-17T23:20:06.840999936', '2022-05-17T23:21:31.881000064',
             '2022-05-17T23:23:03.751000064', '2022-05-17T23:24:27.812000000',
             '2022-05-17T23:25:54.822000000', '2022-05-17T23:27:19.872000000',
             '2022-05-17T23:28:44.912000000', '2022-05-17T23:30:09.952000000',
             '2022-05-17T23:31:35.982000000', '2022-05-17T23:33:02.002000000',
             '2022-05-17T23:34:27.052000000', '2022-05-17T23:35:53.072999936',
             '2022-05-17T23:37:18.113000064', '2022-05-17T23:38:43.162999936',
             '2022-05-17T23:40:15.922999936', '2022-05-17T23:41:41.963000064',
             '2022-05-17T23:43:10.973000064', '2022-05-17T23:44:37.993000064',
             '2022-05-17T23:46:02.052999936', '2022-05-17T23:47:29.062999936',
             '2022-05-17T23:48:55.104000000', '2022-05-17T23:50:20.134000000',
             '2022-05-17T23:51:46.164000000', '2022-05-17T23:53:12.194000000',
             '2022-05-17T23:54:37.234000000', '2022-05-17T23:56:04.254000000',
             '2022-05-17T23:57:35.044000000', '2022-05-17T23:58:59.094000000'],
            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-17T23:07:03.750000000', '2022-05-17T23:08:31.760000000',
             '2022-05-17T23:09:56.800000000', '2022-05-17T23:11:22.830000000',
             '2022-05-17T23:12:50.901000064', '2022-05-17T23:14:15.940999936',
             '2022-05-17T23:15:40.980999936', '2022-05-17T23:17:06.021000064',
             '2022-05-17T23:18:32.050999936', '2022-05-17T23:19:57.090999936',
             '2022-05-17T23:21:22.131000064', '2022-05-17T23:22:48.161000064',
             '2022-05-17T23:24:19.052000000', '2022-05-17T23:25:45.082000000',
             '2022-05-17T23:27:11.112000000', '2022-05-17T23:28:36.152000000',
             '2022-05-17T23:30:01.192000000', '2022-05-17T23:31:27.222000000',
             '2022-05-17T23:32:53.252000000', '2022-05-17T23:34:18.292000000',
             '2022-05-17T23:35:43.332000000', '2022-05-17T23:37:08.373000064',
             '2022-05-17T23:38:34.402999936', '2022-05-17T23:40:00.432999936',
             '2022-05-17T23:41:32.213000064', '2022-05-17T23:42:57.263000064',
             '2022-05-17T23:44:26.263000064', '2022-05-17T23:45:53.292999936',
             '2022-05-17T23:47:19.322999936', '2022-05-17T23:48:45.354000000',
             '2022-05-17T23:50:11.384000000', '2022-05-17T23:51:37.414000000',
             '2022-05-17T23:53:03.444000000', '2022-05-17T23:54:28.484000000',
             '2022-05-17T23:55:54.514000000', '2022-05-17T23:57:19.554000000',
             '2022-05-17T23:58:50.344000000', '2022-05-18T00:00:16.220000000'],
            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],
             ...,
             [14.76755  , 11.638977 ,  7.3500752, ...,        nan,        nan,
                     nan],
             [11.870849 , 11.329966 ,  9.964716 , ...,        nan,        nan,
                     nan],
             [13.8481045, 14.051331 ,  6.487965 , ...,        nan,        nan,
                     nan]], shape=(998, 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.        ],
             ...,
             [ 79.22077922,  80.51948052,  84.41558442, ..., 100.        ,
              100.        , 100.        ],
             [ 63.63636364,  74.02597403,  76.62337662, ..., 100.        ,
              100.        , 100.        ],
             [ 68.35443038,  68.35443038,  73.41772152, ..., 100.        ,
              100.        , 100.        ]], shape=(998, 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=(998, 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=(998, 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=(998, 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.,  1., -1.,  1.,
             -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,
              1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1.,
             -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,
              1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1.,
             -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,
              1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1.,
             -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,
              1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1.,
             -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -1.,  1., -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 23:46:40.681987347',
                     '2022-05-17 23:48:07.206666669',
                     '2022-05-17 23:49:33.238358974',
                     '2022-05-17 23:50:58.771721518',
                     '2022-05-17 23:52:24.801721518',
                     '2022-05-17 23:53:50.336307692',
                     '2022-05-17 23:55:15.871721518',
                     '2022-05-17 23:56:41.901662337',
                     '2022-05-17 23:58:12.698545454',
                     '2022-05-17 23:59:37.704797464'],
                    dtype='datetime64[ns]', name='mean_time', length=998, freq=None))
In [15]:
# plotting wind speed and direction
plt.figure(figsize=(15,6))
wind.horizontal_wind_speed.where(wind.nan_percentual<50).plot(y="range", cmap="turbo", vmin=0, vmax=20)
plt.show()

plt.figure(figsize=(15,6))
wind.horizontal_wind_direction.where(wind.nan_percentual<50).plot(y="range", cmap="hsv", vmin=0, vmax=360)
plt.show()
No description has been provided for this image
No description has been provided for this image
In [16]:
# plotting the maximum ZDR from each scan
plt.figure(figsize=(15,6))
wind.zdr_max.where(wind.nan_percentual<50).plot(y="range", cmap="turbo", vmin=0, vmax=7)
plt.show()
No description has been provided for this image
In [ ]:
# output example
# wind.to_netcdf('sample_data/trial_horizontal_wind.nc')