Skip to content

ghiggi/radar_api

Repository files navigation

Welcome to RADAR-API

Radars currently accessible through RADAR-API

Deployment PyPI Conda
Activity PyPI Downloads Conda Downloads
Python Versions Python Versions
Supported Systems Linux macOS Windows
Project Status Project Status
Build Status Tests Lint Docs
Linting Black Ruff Codespell
Code Coverage Coveralls Codecov
Code Quality Codefactor Codebeat Codacy Codescene
License License
Community Discourse GitHub Discussions
Citation DOI

Documentation: https://radar-api.readthedocs.io

πŸš€ Quick start

RADAR-API provides an easy-to-use python interface to find, download and read weather radar data from several meteorological services.

RADAR-API currently provides data access to the following radar networks: NEXRAD, IDEAM and FMI.

The list of available radars can be retrieved using:

import radar_api

radar_api.available_networks()
radar_api.available_radars()
radar_api.available_radars(network="NEXRAD")

Before starting using RADAR-API, we highly suggest to save into a configuration file the directory on your local disk where to save the radar data of interest.

To facilitate the creation of the RADAR-API configuration file, you can adapt and execute the following script:

import radar_api

base_dir = (
    "<path/to/directory/RADAR"  # path to the directory where to download the data
)
radar_api.define_configs(base_dir=base_dir)

# You can check that the config file has been correctly created with:
configs = radar_api.read_configs()
print(configs)

πŸ“₯ Download radar data

You can start to download radar data editing the following code example:

import radar_api

start_time = "2021-09-07 17:00:00"
end_time = "2021-09-07 17:30:00"

radar = "KMKX"
network = "NEXRAD"

filepaths = radar_api.download_files(
    network=network,
    radar=radar,
    start_time=start_time,
    end_time=end_time,
)

πŸ’« Open radar files into xarray or pyart

RADAR-API allows to read directly radar data from the cloud without the need to previously download and save the files on your disk.

RADAR-API make use of pyart and xradar readers to open the files into either an xarray object or pyart radar object.

import radar_api
import pyart

# Search for files on cloud bucket
filepaths = radar_api.find_files(
    network=network,
    radar=radar,
    start_time=start_time,
    end_time=end_time,
    protocol="s3",
)
print(filepaths)

# Define the file to open
filepath = filepaths[0]

# Open all sweeps of a radar volume into a xradar datatree
dt = radar_api.open_datatree(filepath, network=network)

# Extract the radar sweep of interest
ds = dt["sweep_0"].to_dataset()

# Open directly a single radar sweep into a xradar dataset
ds = radar_api.open_dataset(filepath, network=network, sweep="sweep_0")

# Open all sweeps of a radar volume into a pyart radar object
radar_obj = radar_api.open_pyart(filepath, network=network)

# Display the data with pyart
display = pyart.graph.RadarDisplay(radar_obj)
display.plot("reflectivity", cmap="pyart_ChaseSpectral", vmin=-20, vmax=70)
display.set_limits((-150, 150), (-150, 150))

πŸ“– Documentation

To discover RADAR-API utilities and functionalities, please read the software documentation available at https://radar-api.readthedocs.io/en/latest/.

All RADAR-API tutorials are available as Jupyter Notebooks in the tutorial directory.


πŸ› οΈ Installation

conda

RADAR-API can be installed via conda on Linux, Mac, and Windows. Install the package by typing the following command in the terminal:

conda install radar-api

In case conda-forge is not set up for your system yet, see the easy to follow instructions on conda-forge.

pip

RADAR-API can be installed also via pip on Linux, Mac, and Windows. On Windows you can install WinPython to get Python and pip running. Then, install the RADAR-API package by typing the following command in the terminal:

pip install radar-api

To install the latest development version via pip, see the documentation.

πŸ’­ Feedback and Contributing Guidelines

If you aim to contribute your data or discuss the future development of RADAR-API, we suggest to join the Open Radar Science Discourse Group.

Feel free to also open a GitHub Issue or a GitHub Discussion specific to your questions or ideas.

Citation

If you are using RADAR-API in your publication please cite our Zenodo repository:

Ghiggi Gionata. ghiggi/radar_api. Zenodo. https://doi.org/10.5281/zenodo.14743651

If you want to cite a specific software version, have a look at the Zenodo site.

License

The content of this repository is released under the terms of the MIT license.