Skip to content

Commit

Permalink
ADD: add new function compute_refl_from_zdr
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfidan committed Oct 21, 2024
1 parent 7e5b5b4 commit 6ada752
Show file tree
Hide file tree
Showing 9 changed files with 3,822 additions and 1,327 deletions.
22 changes: 22 additions & 0 deletions doc/source/examples/index.rst.new
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@


.. _sphx_glr_examples:

Example Gallery
===============

The files used in these examples are available for download_.

.. _download: https://adc.arm.gov/pyart/example_data/



.. raw:: html

<div class="sphx-glr-thumbnails">


.. raw:: html

</div>

1,134 changes: 871 additions & 263 deletions pyart/correct/_fast_edge_finder.c

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyart/correct/_unwrap_1d.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1,303 changes: 952 additions & 351 deletions pyart/io/_sigmetfile.c

Large diffs are not rendered by default.

1,514 changes: 1,059 additions & 455 deletions pyart/map/ckdtree.c

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions pyart/retrieve/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
compute_snr
compute_l
compute_cdr
compute_refl_from_zdr
compute_noisedBZ
compute_signal_power
get_coeff_attg
Expand Down Expand Up @@ -228,6 +229,7 @@
from .simple_moment_calculations import compute_rcs, compute_rcs_from_pr # noqa
from .simple_moment_calculations import compute_radial_noise_hs # noqa
from .simple_moment_calculations import compute_radial_noise_ivic # noqa
from .simple_moment_calculations import compute_refl_from_zdr # noqa
from .qpe import est_rain_rate_z, est_rain_rate_zpoly, est_rain_rate_kdp # noqa
from .qpe import est_rain_rate_a, est_rain_rate_zkdp, est_rain_rate_za # noqa
from .qpe import est_rain_rate_hydro # noqa
Expand Down
1,122 changes: 865 additions & 257 deletions pyart/retrieve/_gecsx_functions_cython.c

Large diffs are not rendered by default.

50 changes: 50 additions & 0 deletions pyart/retrieve/simple_moment_calculations.py
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,56 @@ def compute_cdr(radar, rhohv_field=None, zdr_field=None, cdr_field=None):
return cdr


def compute_refl_from_zdr(radar, zdr_field=None, refl_field=None, ort_refl_field=None):
"""
Computes the reflectivity at the orthogonal polarization
from zdr and the reflectivity at a given polarization
Parameters
----------
radar : Radar
Radar object.
zdr_field : str, optional
Name of the ZDR field.
refl_field : str, optional
Name of the refl field.
ort_refl_field : str, optional
Name of the refl field at orthogonal polarization.
Returns
-------
ort_refl : dict
refl field at orthogonal polarization.
"""
# parse the field parameters
if refl_field is None:
refl_field = get_field_name("reflectivity")
if zdr_field is None:
zdr_field = get_field_name("differential_reflectivity")
if ort_refl_field is None:
if refl_field.endswith('_vv'):
ort_refl_field = get_field_name("reflectivity")
else:
ort_refl_field = get_field_name("reflectivity_vv")

# extract fields from radar
radar.check_field_exists(refl_field)
radar.check_field_exists(zdr_field)

refl = radar.fields[refl_field]["data"]
zdrdB = radar.fields[zdr_field]["data"]

if refl_field.endswith('_vv'):
ort_refl_data = refl + zdrdB
else:
ort_refl_data = refl - zdrdB

ort_refl = get_metadata(ort_refl_field)
ort_refl["data"] = ort_refl_data

return ort_refl

def compute_bird_density(
radar, sigma_bird=11, vol_refl_field=None, bird_density_field=None
):
Expand Down
Binary file added tests/aux_io/grid_odim.h5
Binary file not shown.

0 comments on commit 6ada752

Please sign in to comment.