All Projects → CyanideCN → Pycinrad

CyanideCN / Pycinrad

Licence: gpl-3.0
Decode CINRAD (China New Generation Weather Radar) data and visualize.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Pycinrad

Usiigaci
Usiigaci: stain-free cell tracking in phase contrast microscopy enabled by supervised machine learning
Stars: ✭ 139 (-30.5%)
Mutual labels:  matplotlib
Python Quickui
Scientific One-Liner Interactive GUI Library
Stars: ✭ 153 (-23.5%)
Mutual labels:  matplotlib
Data Science Types
Mypy stubs, i.e., type information, for numpy, pandas and matplotlib
Stars: ✭ 180 (-10%)
Mutual labels:  matplotlib
Data Analysis
主要是爬虫与数据分析项目总结,外加建模与机器学习,模型的评估。
Stars: ✭ 142 (-29%)
Mutual labels:  matplotlib
Cmasher
Scientific colormaps for making accessible, informative and 'cmashing' plots
Stars: ✭ 149 (-25.5%)
Mutual labels:  matplotlib
Matplotlib Tutorial
Matplotlib tutorial for beginner
Stars: ✭ 2,232 (+1016%)
Mutual labels:  matplotlib
Ml Cheatsheet
A constantly updated python machine learning cheatsheet
Stars: ✭ 136 (-32%)
Mutual labels:  matplotlib
Pylustrator
Visualisations of data are at the core of every publication of scientific research results. They have to be as clear as possible to facilitate the communication of research. As data can have different formats and shapes, the visualisations often have to be adapted to reflect the data as well as possible. We developed Pylustrator, an interface to directly edit python generated matplotlib graphs to finalize them for publication. Therefore, subplots can be resized and dragged around by the mouse, text and annotations can be added. The changes can be saved to the initial plot file as python code.
Stars: ✭ 192 (-4%)
Mutual labels:  matplotlib
Machine Learning With Python
Practice and tutorial-style notebooks covering wide variety of machine learning techniques
Stars: ✭ 2,197 (+998.5%)
Mutual labels:  matplotlib
Matplotlib Doc Zh
📖 [译] Matplotlib 用户指南
Stars: ✭ 178 (-11%)
Mutual labels:  matplotlib
Rl Book Challenge
self-studying the Sutton & Barto the hard way
Stars: ✭ 146 (-27%)
Mutual labels:  matplotlib
Plotbitrate
FFProbe Bitrate Graph
Stars: ✭ 148 (-26%)
Mutual labels:  matplotlib
Qbstyles
QuantumBlack Matplotlib styles
Stars: ✭ 166 (-17%)
Mutual labels:  matplotlib
Deep Learning Resources
A Collection of resources I have found useful on my journey finding my way through the world of Deep Learning.
Stars: ✭ 141 (-29.5%)
Mutual labels:  matplotlib
Tftb
A Python module for time-frequency analysis
Stars: ✭ 185 (-7.5%)
Mutual labels:  matplotlib
Zhihu Spider
一个获取知乎用户主页信息的多线程Python爬虫程序。
Stars: ✭ 137 (-31.5%)
Mutual labels:  matplotlib
Visualize ml
Python package for consolidated and extensive Univariate,Bivariate Data Analysis and Visualization catering to both categorical and continuous datasets.
Stars: ✭ 160 (-20%)
Mutual labels:  matplotlib
Matplotlib 3d
Experimental 3D axis for matplotlib
Stars: ✭ 198 (-1%)
Mutual labels:  matplotlib
Rootpy
A pythonic interface for the ROOT libraries on top of the PyROOT bindings.
Stars: ✭ 186 (-7%)
Mutual labels:  matplotlib
Scientific Visualization Book
An open access book on scientific visualization using python and matplotlib
Stars: ✭ 6,336 (+3068%)
Mutual labels:  matplotlib

PyCINRAD

Codacy Badge Code style: black Downloads DOI

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

中文说明

example folder contains detailed examples!

Installation

PyCINRAD supports Python version 3.5 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.

from cinrad.io import CinradReader, StandardData
f = CinradReader(your_radar_file) #Old version data
f = StandardData(your_radar_file) #New standard 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.

>>> print(data)
<xarray.Dataset>
Dimensions:    (azimuth: 366, distance: 920)
Coordinates:
  * azimuth    (azimuth) float32 0.14084807 0.15812683 ... 0.12601277 0.14381513
  * distance   (distance) float64 0.25 0.5 0.75 1.0 ... 229.2 229.5 229.8 230.0
Data variables:
    ZDR        (azimuth, distance) float64 nan nan nan nan ... nan nan nan nan
    longitude  (azimuth, distance) float64 120.2 120.2 120.2 ... 120.6 120.6
    latitude   (azimuth, distance) float64 35.99 35.99 36.0 ... 38.04 38.04
    height     (azimuth, distance) float64 0.1771 0.1792 0.1814 ... 5.218 5.227
Attributes:
    elevation:        0.48339844
    range:            230
    scan_time:        2020-05-17 11:00:28
    site_code:        Z9532
    site_name:        青岛
    site_longitude:   120.23028
    site_latitude:    35.98861
    tangential_reso:  0.25
    nyquist_vel:      8.37801
    task:             VCP21D

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

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

xarray also makes interpolation very convenient.

>>> data.interp(azimuth=np.deg2rad(300), distance=180)
<xarray.Dataset>
Dimensions:    ()
Coordinates:
    azimuth    float64 5.236
    distance   int32 180
Data variables:
    ZDR        float64 0.3553
    longitude  float64 118.5
    latitude   float64 36.8
    height     float64 3.6
Attributes:
    elevation:        0.48339844
    range:            230
    scan_time:        2020-05-17 11:00:28
    site_code:        Z9532
    site_name:        青岛
    site_longitude:   120.23028
    site_latitude:    35.98861
    tangential_reso:  0.25
    nyquist_vel:      8.37801
    task:             VCP21D

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.PUP provides functions to decode PUP data. The extracted data can be further used to create PPI.

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

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

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:

r_list = [f.get_data(i, 230, 'REF') for i in f.angleindex_r]
# or
r_list = list(f.iter_tilt(230, 'REF'))

VCS

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

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.

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)

import cinrad
#(some codes omitted)
v = f.get_data(1, 230, 'VEL')
v_corrected = 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.

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 control the background color black or white
add_city_names annotate name of city on the plot

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

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

Plot range rings on the PPI plot.

PPI.plot_cross_section(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.storm_track_info(self, filepath)

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

Gallery

PPI reflectivity

PPI 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!

If you have questions or advise about this program, you can create an issue or email me at [email protected].

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].