前言
在本文中,我们将对比两种Python雷达库,分别是pycwr和pycinrad,它们用于计算HCL(Hydrometeor Classification)产品的方法。通过对它们的功能、性能、易用性等方面进行比较,我们可以更好地了解它们各自的优势和特点。
温馨提示
由于可视化代码过长隐藏,可点击雷达系列:两种雷达库计算HCL产品方法对比运行Fork查看 🔜🔜若没有成功加载可视化图,点击运行可以查看 ps:隐藏代码在【代码已被隐藏】所在行,点击所在行,可以看到该行的最右角,会出现个三角形,点击查看即可
pycinrad
In [26]:
import cinrad
help(cinrad.calc.hydro_class)
Help on function hydro_class in module cinrad.calc:
hydro_class(z: xarray.core.dataset.Dataset, zdr: xarray.core.dataset.Dataset, rho: xarray.core.dataset.Dataset, kdp: xarray.core.dataset.Dataset, band: str = 'S') -> xarray.core.dataset.Dataset
Hydrometeor classificationArgs: z (xarray.Dataset): Reflectivity data. zdr (xarray.Dataset): Differential reflectivity data. rho (xarray.Dataset): Cross-correlation coefficient data. kdp (xarray.Dataset): Specific differential phase data. band (str): Band of the radar, default to S. Returns: xarray.Dataset: Classification result.</code></pre></div></div><figure class=""><div class="rno-markdown-img-url" style="text-align:center"><div class="rno-markdown-img-url-inner" style="width:100%"><div style="width:100%"><img src="https://cdn.static.attains.cn/app/developer-bbs/upload/1723305813504901896.png" /></div></div></div></figure><h4 id="93ao9" name="pycwr">pycwr</h4><p>In [22]:</p><div class="rno-markdown-code"><div class="rno-markdown-code-toolbar"><div class="rno-markdown-code-toolbar-info"><div class="rno-markdown-code-toolbar-item is-type"><span class="is-m-hidden">代码语言:</span>javascript</div></div><div class="rno-markdown-code-toolbar-opt"><div class="rno-markdown-code-toolbar-copy"><i class="icon-copy"></i><span class="is-m-hidden">复制</span></div></div></div><div class="developer-code-block"><pre class="prism-token token line-numbers language-javascript"><code class="language-javascript" style="margin-left:0"></code></pre></div></div><div class="rno-markdown-code"><div class="rno-markdown-code-toolbar"><div class="rno-markdown-code-toolbar-info"><div class="rno-markdown-code-toolbar-item is-type"><span class="is-m-hidden">代码语言:</span>javascript</div></div><div class="rno-markdown-code-toolbar-opt"><div class="rno-markdown-code-toolbar-copy"><i class="icon-copy"></i><span class="is-m-hidden">复制</span></div></div></div><div class="developer-code-block"><pre class="prism-token token line-numbers language-javascript"><code class="language-javascript" style="margin-left:0">from pycwr.io import read_auto
from pycwr.retrieve.HID import fhc_HCL
import matplotlib.pyplot as plt
import numpy as np
from pycwr.draw.RadarPlot import plot_xy, add_rings
import pandas as pd
In [23]:
help(fhc_HCL)
Help on function fhc_HCL in module pycwr.retrieve.HID:
fhc_HCL(dBZ=None, ZDR=None, KDP=None, CC=None, LDR=None, T=None, method='hybrid', band='C', weights={'dBZ': 1.5, 'ZDR': 0.8, 'KDP': 1.0, 'CC': 0.8, 'LDR': 0, 'T': 0})
Does FHC for warm-season precip. using beta function for Fuzzy Logic
HCL types: Species #:
Drizzle 1
Rain 2
Ice Crystals 3
Dry Aggregates Snow 4
Wet Snow 5
Vertical Ice 6
Low-Density Graupel 7
High-Density Graupel 8
Hail 9
Big Drops 10
-------------------------------
cite{Dolan, Brenda , et al. "A Robust C-Band Hydrometeor Identification Algorithm and Application to
a Long-Term Polarimetric Radar Dataset." Journal of Applied Meteorology and Climatology 52.9(2013):2162-2186.}
:param weights:
:param dBZ: Input reflectivity scalar/array
:param ZDR: Input differential reflectivity scalar/array
:param KDP: Input specific differential phase scalar/array
:param CC: Input cross correlation ratio scalar/array
:param LDR: Input linear depolarization ratio scalar/array
:param T: Input temperature scalar/array
:param method: Currently support 'hybrid' or 'linear' methods; hybrid preferred
:param band: 'X', 'C', or 'S'
:return: hydrometeor species [1-10]代码语言:javascript复制/opt/conda/lib/python3.9/site-packages/pycwr/draw/RadarPlot.py:673: UserWarning: The input coordinates to pcolormesh are interpreted as cell centers, but are not monotonically increasing or decreasing. This may lead to incorrectly calculated cell edges, in which case, please supply explicit cell edges to pcolormesh.
gci = ax.pcolormesh(x / 1000., y / 1000., data, cmap=cmaps, </code>函数
功能
性能
易用性
cinrad
该函数用于进行气象雷达的气象分型,根据给定的反射率、差分反射率、相关系数和比相移等数据,对气象目标进行分类。
该函数功能丰富,可根据多种参数进行气象目标的分类,返回结果为xarray.Dataset类型的数据,便于进一步处理。
对于熟悉xarray和雷达数据处理的用户来说,易用性较好。对于初学者可能需要一定时间来理解参数的含义和使用方法。
pycwr
该函数用于进行C/S/X波段雷达的云水获取,根据给定的反射率、差分反射率、比相移、相关系数、线偏振比和温度等数据,对云水类型进行识别。
该函数支持多种输入参数,并提供了权重参数以调节不同物理量对结果的影响,返回值为1到10之间的整数,对应不同的云水类型。
该函数的易用性较好,通过传入所需的雷达参数即可快速获得云水类型的识别结果。