PyCINRAD

Decode CINRAD (China New Generation Weather Radar) data and visualize.

https://github.com/CyanideCN/PyCINRAD

Science Score: 49.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 3 DOI reference(s) in README
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.3%) to scientific vocabulary

Keywords

matplotlib meteorology python radar
Last synced: 6 months ago · JSON representation

Repository

Decode CINRAD (China New Generation Weather Radar) data and visualize.

Basic Info
  • Host: GitHub
  • Owner: CyanideCN
  • License: gpl-3.0
  • Language: Python
  • Default Branch: master
  • Homepage: https://pycinrad.cn/
  • Size: 39.3 MB
Statistics
  • Stars: 407
  • Watchers: 27
  • Forks: 166
  • Open Issues: 7
  • Releases: 27
Topics
matplotlib meteorology python radar
Created over 7 years ago · Last pushed 8 months ago
Metadata Files
Readme License

README.md

PyCINRAD

Code style: black Downloads DOI

Decode CINRAD (China New Generation Weather Radar) data and visualize.

To check out live examples and docs, visit pycinrad.cn.

中文说明

example folder contains detailed examples!

Installation

PyCINRAD supports Python version 3.9 and higher.

pip install cinrad

You can also download from github page and build from source

python setup.py install

Modules

cinrad.io

Decode CINRAD radar data.

python from cinrad.io import CinradReader, StandardData f = CinradReader(your_radar_file) #Old version data f = StandardData(your_radar_file) #New standard data (or phased array data) f.get_data(tilt, drange, dtype) #Get data f.get_raw(tilt, drange, dtype)

The get_raw method returns radar records without other geographic information.

The get_data method returns xarray.Dataset with radar records, geographic coordinates, and all extra attributes. So, all benefits of xarray can be enjoyed. Check xarray documentation for more detailed explanation.

For example, it's very convenient to save data as netcdf format. ```python

data.to_netcdf('1.nc') ```

xarray also makes interpolation very convenient. ```python

data.interp(azimuth=np.deg2rad(300), distance=180) ```

For single-tilt data (i.e. files that contain only one elevation angle), cinrad.io.StandardData.merge can merge these files to a file contains full volumetric scan.

Export data to Py-ART defined class

Convert data structure defined in this module into pyart.core.Radar is very simple. cinrad.io.export has a function standard_data_to_pyart, which can take cinrad.io.StandardData as input and return pyart.core.Radar as output.

example folder contains a simple demo about this.

Decode PUP data and SWAN data

cinrad.io.StandardPUP provides functions to decode Standard PUP(rose) data. The extracted data can be further used to create PPI.

cinrad.io.SWAN provides similar interface to decode SWAN data.

python from cinrad.io import StandardPUP f = StandardPUP(your_radar_file) data = f.get_data()

Decode phased array radar data

cinrad.io.PhasedArrayData provides similar interface to decode level 2 data from phased array radar with old format.

python from cinrad.io import PhasedArrayData f = PhasedArrayData(your_radar_file) data = f.get_data(0, 40, 'REF')

cinrad.utils

This submodule provides some useful algorithms in radar meteorology. All functions only accept numpy.ndarray as input data. This submodule extends the usage of this program, as these functions can accept customized data rather than only the data decoded by cinrad.io.

cinrad.calc

For direct computation of decoded data, cinrad.calc provides functions that simplify the process of calculation. For functions contained in this submodule, only a list of reflectivity data is required as the argument.

Code to generate the required list:

```python rlist = [f.getdata(i, 230, 'REF') for i in f.angleindex_r]

or

rlist = list(f.itertilt(230, 'REF')) ```

VCS

cinrad.calc.VCS provides calculation of vertical cross-section for all variables.

python import cinrad from cinrad.visualize import Section f = cinrad.io.CinradReader(your_radar_file) rl = [f.get_data(i, 230, 'REF') for i in f.angleindex_r] vcs = cinrad.calc.VCS(rl) sec = vcs.get_section(start_cart=(111, 25.5), end_cart=(112, 26.7)) # pass geographic coordinates (longitude, latitude) sec = vcs.get_section(start_polar=(115, 350), end_polar=(130, 30)) # pass polar coordinates (distance, azimuth) fig = Section(sec) fig('D:\\')

Radar mosaic

cinrad.calc.GridMapper can merge different radar scans into a cartesian grid, also supports CR.

Hydrometeor classification

cinrad.calc.hydro_class uses algorithm suggested by Dolan to classify hydrometeors into 10 categories. (Requires REF, ZDR, RHO, and KDP)

cinrad.correct

This submodule provides algorithms to correct raw radar fields.

cinrad.correct.dealias

This function can unwrap the folded velocity using algorithm originated from pyart. (needs C compiler)

```python import cinrad

(some codes omitted)

v = f.getdata(1, 230, 'VEL') vcorrected = cinrad.correct.dealias(v) ```

cinrad.visualize

Visualize the data stored in acceptable format (cinrad.datastruct). It also means that you can using customized data to perform visualization, as long as the data is stored as xarray.Dataset and constructed by the same protocol (variables naming conventions, data coordinates and dimensions, etc.) For further information about this method, please see the examples contained in example folder.

python from cinrad.visualize import PPI fig = PPI(R) #Plot PPI fig('D:\\') #Pass the path to save the fig from cinrad.visualize import Section fig = Section(Slice_) #Plot VCS fig('D:\\')

The path passed into the class can either be the folder path or the file path. Also, if no path is passed, the figure will be saved at the folder named PyCINRAD in the home folder (e.g. C:\Users\tom).

Customize plot settings

The summary of args that can be passed into PPI are listed as follows.

|arg|function| |:-:|:-:| |cmap|colormaps used for plotting| |norm|norm used for plotting| |nlabel|number of labels on the colorbar| |label|labels on the colorbar| |highlight|highlight area of input name| |dpi|dpi of figure| |extent|area to plot e.g. extent=[90, 91, 29, 30]| |section|cross-section data to ppi plot| |style|background color:black/white/transparent| |add_city_names|annotate name of city on the plot|

Beside args, class PPI has some other auxiliary plotting functions.

PPI.plotrangerings(self, _range, color='white', linewidth=0.5, **kwargs)

Plot range rings on the PPI plot.

PPI.plotcrosssection(self, data, ymax=None)

Plot VCS section under the PPI plot.

This function is very similar to vcs argument of class PPI, but the range of y-axis can be adjusted only by this function.

PPI.stormtrackinfo(self, filepath)

Plot PUP STI product on the current PPI map, including past positions, current position, and forecast positions.

Gallery

PPI reflectivity

PPI reflectivity

Phased array radar reflectivity

Phased array radar reflectivity

PPI reflectivity combined with cross-section

PPI reflectivity combined with cross-section

Cross-section

Cross-section

Cross-section other than reflectivity

ZDR cross-section

RHI reflectivity

RHI reflectivity

Citation

If you use PyCINRAD in your paper, please cite PyCINRAD using the DOI below.

DOI

Papers that use plots generated by PyCINRAD

  1. Recognition and Analysis of Biological Echo Using WSR-88D Dual-polarization Weather Radar in Nanhui of Shanghai doi: 10.16765/j.cnki.1673-7148.2019.03.015

Notes

The hydrometeor classfication algorithm comes from Dolan, B., S. A. Rutledge, S. Lim, V. Chandrasekar, and M. Thurai, 2013: A Robust C-Band Hydrometeor Identification Algorithm and Application to a Long-Term Polarimetric Radar Dataset. J. Appl. Meteor. Climatol., 52, 2162–2186, https://doi.org/10.1175/JAMC-D-12-0275.1.

If you are interested in this program, you can join the developers of this program. Any contribution is appreciated!

Owner

  • Login: CyanideCN
  • Kind: user
  • Company: University of California, Santa Barbara

B.S. in Chemistry. Meteorology enthusiast

GitHub Events

Total
  • Issues event: 7
  • Watch event: 35
  • Delete event: 1
  • Issue comment event: 6
  • Push event: 11
  • Pull request event: 15
  • Fork event: 7
  • Create event: 1
Last Year
  • Issues event: 7
  • Watch event: 35
  • Delete event: 1
  • Issue comment event: 6
  • Push event: 11
  • Pull request event: 15
  • Fork event: 7
  • Create event: 1

Committers

Last synced: 6 months ago

All Time
  • Total Commits: 469
  • Total Committers: 11
  • Avg Commits per committer: 42.636
  • Development Distribution Score (DDS): 0.205
Past Year
  • Commits: 18
  • Committers: 2
  • Avg Commits per committer: 9.0
  • Development Distribution Score (DDS): 0.389
Top Committers
Name Email Commits
CyanideCN d****7@g****m 373
CyanideCN d****7@g****m 71
youp Li 4****3@q****m 15
shevawen s****n@g****m 3
zzysupernova 4****a 1
ZhaJiMan 5****n 1
T A****n 1
PomGGMM 4****M 1
Longtsing · Wang s****s@v****m 1
Atmos.SLT l****o@f****m 1
ww ww@L****2 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 78
  • Total pull requests: 70
  • Average time to close issues: 5 months
  • Average time to close pull requests: 21 days
  • Total issue authors: 50
  • Total pull request authors: 13
  • Average comments per issue: 3.09
  • Average comments per pull request: 0.41
  • Merged pull requests: 47
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 5
  • Pull requests: 19
  • Average time to close issues: less than a minute
  • Average time to close pull requests: 27 days
  • Issue authors: 5
  • Pull request authors: 4
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.21
  • Merged pull requests: 9
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • CyanideCN (16)
  • liyuan3970 (4)
  • hehuan710 (3)
  • lovechang1986 (3)
  • wangyongtao0929 (2)
  • longtsing (2)
  • laishenggx (2)
  • boyucjz (2)
  • ty19940610 (2)
  • yliu-yb (2)
  • lingyunfeng (1)
  • Anebrithien (1)
  • taort (1)
  • q447552640 (1)
  • wwwnnn (1)
Pull Request Authors
  • pysoer (32)
  • CyanideCN (17)
  • longtsing (4)
  • shevawen (4)
  • bethroughwith (3)
  • ZhaJiMan (2)
  • sunyc1116 (2)
  • PomGGMM (1)
  • codacy-badger (1)
  • zzysupernova (1)
  • BarberQiao (1)
  • bugsuse (1)
  • Anebrithien (1)
Top Labels
Issue Labels
component:io (16) component:calc (10) component:plot (7) enhancement (6) bug (4) help wanted (4) question (3) invalid (3) duplicate (1)
Pull Request Labels
component:plot (4) component:io (1)

Packages

  • Total packages: 2
  • Total downloads: unknown
  • Total dependent packages: 0
    (may contain duplicates)
  • Total dependent repositories: 0
    (may contain duplicates)
  • Total versions: 42
proxy.golang.org: github.com/cyanidecn/pycinrad
  • Versions: 21
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.4%
Average: 5.6%
Dependent repos count: 5.8%
Last synced: 6 months ago
proxy.golang.org: github.com/CyanideCN/PyCINRAD
  • Versions: 21
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.4%
Average: 5.6%
Dependent repos count: 5.8%
Last synced: 6 months ago

Dependencies

docs/environment.yml conda
  • arm_pyart
  • cartopy
  • cython
  • matplotlib
  • metpy
  • numpy
  • pip
  • pyshp
  • python 3.7.*
  • setuptools
  • sphinx
  • sphinx_rtd_theme
  • xarray
environment.yaml conda
  • cartopy
  • cython
  • matplotlib
  • metpy
  • numpy
  • pip
  • pyshp
  • setuptools
  • xarray
requirements.txt pypi
  • cartopy >=0.15
  • cython >0.15
  • matplotlib >=2.2
  • metpy >=0.8
  • numpy *
  • pyshp *
setup.py pypi
  • cartopy >=0.15
  • matplotlib >=2.2
  • metpy >=0.8
  • pyshp *
  • vanadis *
.github/workflows/ci.yml actions
  • actions/checkout v2 composite
  • actions/upload-artifact v2 composite
  • conda-incubator/setup-miniconda v2 composite