Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addition of qvp functions from MeteoSwiss Py-ART + support of demixing in hydroclass_semisupervised #1618

Merged
merged 17 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/correct/plot_attenuation.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
for a polarimetric radar using a Z-PHI method implemented in Py-ART.

"""

print(__doc__)

# Author: Jonathan J. Helmus ([email protected])
Expand Down
1 change: 1 addition & 0 deletions examples/correct/plot_dealias.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
In this example doppler velocities are dealiased using the ial condition of the dealiasing,
using the region-based dealiasing algorithm in Py-ART.
"""

print(__doc__)

# Author: Jonathan J. Helmus ([email protected])
Expand Down
1 change: 1 addition & 0 deletions examples/io/plot_nexrad_data_aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
and plot quick looks of the datasets.

"""

print(__doc__)

# Author: Max Grover ([email protected])
Expand Down
1 change: 1 addition & 0 deletions examples/io/plot_older_nexrad_data_aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
to 2008 that are missing some coordinate metadata.

"""

print(__doc__)


Expand Down
1 change: 1 addition & 0 deletions examples/mapping/plot_compare_two_radars_gatemapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
another radar in Antenna coordinates and compare the fields.

"""

print(__doc__)

# Author: Max Grover ([email protected]) and Bobby Jackson ([email protected])
Expand Down
1 change: 1 addition & 0 deletions examples/mapping/plot_grid_single_sweep_ppi.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
negligible at low elevation angles common to PPI sweeps.

"""

print(__doc__)

# =====================
Expand Down
1 change: 1 addition & 0 deletions examples/mapping/plot_map_one_radar_to_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
Cartesian grid.

"""

print(__doc__)

# Author: Jonathan J. Helmus ([email protected])
Expand Down
1 change: 1 addition & 0 deletions examples/mapping/plot_map_two_radars_to_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
coordinates to a Cartesian grid.

"""

print(__doc__)

# Author: Jonathan J. Helmus ([email protected])
Expand Down
1 change: 1 addition & 0 deletions examples/plotting/plot_choose_a_colormap.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
and how to add them to your own plots.

"""

print(__doc__)

# Author: Max Grover ([email protected])
Expand Down
1 change: 1 addition & 0 deletions examples/plotting/plot_cross_section.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
of your radar grid using the GridMapDisplay

"""

print(__doc__)

# Author: Max Grover ([email protected])
Expand Down
1 change: 1 addition & 0 deletions examples/plotting/plot_modify_colorbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
within a Py-ART display object.

"""

print(__doc__)

# Author: Joe O'Brien ([email protected])
Expand Down
1 change: 1 addition & 0 deletions examples/plotting/plot_nexrad_multiple_moments.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
NEXRAD Archive file.

"""

print(__doc__)

# Author: Jonathan J. Helmus ([email protected])
Expand Down
1 change: 1 addition & 0 deletions examples/plotting/plot_nexrad_reflectivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
NEXRAD file.

"""

print(__doc__)

# Author: Jonathan J. Helmus ([email protected])
Expand Down
1 change: 1 addition & 0 deletions examples/plotting/plot_ppi_cfradial.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
An example which creates a PPI plot of a Cfradial file.

"""

print(__doc__)

# Author: Max Grover ([email protected])
Expand Down
1 change: 1 addition & 0 deletions examples/plotting/plot_ppi_mdv.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
An example which creates a PPI plot of a MDV file using a RadarDisplay object.

"""

print(__doc__)

# Author: Jonathan J. Helmus ([email protected])
Expand Down
1 change: 1 addition & 0 deletions examples/plotting/plot_rhi_cfradial.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
a RadarDisplay object.

"""

print(__doc__)

# Author: Jonathan J. Helmus ([email protected])
Expand Down
1 change: 1 addition & 0 deletions examples/plotting/plot_rhi_cfradial_singlescan.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
a RadarDisplay object.

"""

print(__doc__)

import matplotlib.pyplot as plt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
and adding differnential Reflectivity contours from the same MDV file.

"""

print(__doc__)

# Author: Cory Weber ([email protected])
Expand Down
1 change: 1 addition & 0 deletions examples/plotting/plot_rhi_data_overlay.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
and adding Reflectivity contours from the same MDV file.

"""

print(__doc__)

# Author: Cory Weber ([email protected])
Expand Down
1 change: 1 addition & 0 deletions examples/plotting/plot_rhi_mdv.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
An example which creates a RHI plot of a MDV file using a RadarDisplay object.

"""

print(__doc__)

# Author: Jonathan J. Helmus ([email protected])
Expand Down
1 change: 1 addition & 0 deletions examples/plotting/plot_rhi_two_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
included in the two panels are reflectivity and doppler velocity.

"""

print(__doc__)

# Author: Max Grover ([email protected])
Expand Down
1 change: 1 addition & 0 deletions examples/plotting/plot_xsect.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
of PPI scans and plots both cross sections.

"""

print(__doc__)

# Author: Jonathan J. Helmus ([email protected])
Expand Down
1 change: 1 addition & 0 deletions pyart/__check_build/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
""" Module to give helpful messages to the user that did not
compile Py-ART properly.
"""

import os

INPLACE_MSG = """
Expand Down
1 change: 1 addition & 0 deletions pyart/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from .transforms import cartesian_vectors_to_geographic # noqa
from .transforms import geographic_to_cartesian # noqa
from .transforms import geographic_to_cartesian_aeqd # noqa
from .transforms import cartesian_to_antenna # noqa
from .wind_profile import HorizontalWindProfile # noqa

__all__ = [s for s in dir() if not s.startswith("_")]
29 changes: 29 additions & 0 deletions pyart/core/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,35 @@ def antenna_to_cartesian(ranges, azimuths, elevations):
return x, y, z


def cartesian_to_antenna(x, y, z):
"""
Returns antenna coordinates from Cartesian coordinates.

Parameters
----------
x, y, z : array
Cartesian coordinates in meters from the radar.

Returns
-------
ranges : array
Distances to the center of the radar gates (bins) in m.
azimuths : array
Azimuth angle of the radar in degrees. [-180., 180]
elevations : array
Elevation angle of the radar in degrees.
ke : float, optional
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see ke in the returns list, did we want to remove it from the returns doc?

Effective radius scale factor

"""
ranges = np.sqrt(x**2.0 + y**2.0 + z**2.0)
elevations = np.rad2deg(np.arctan(z / np.sqrt(x**2.0 + y**2.0)))
azimuths = np.rad2deg(np.arctan2(x, y)) # [-180, 180]
azimuths[azimuths < 0.0] += 360.0 # [0, 360]

return ranges, azimuths, elevations


def antenna_vectors_to_cartesian(ranges, azimuths, elevations, edges=False):
"""
Calculate Cartesian coordinate for gates from antenna coordinate vectors.
Expand Down
1 change: 0 additions & 1 deletion pyart/core/wind_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

"""


import numpy as np


Expand Down
6 changes: 1 addition & 5 deletions pyart/correct/phase_proc.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,7 @@ def fzl_index(fzl, ranges, elevation, radar_height):
p_r = 4.0 * Re / 3.0
z = (
radar_height
+ (
ranges**2
+ p_r**2
+ 2.0 * ranges * p_r * np.sin(elevation * np.pi / 180.0)
)
+ (ranges**2 + p_r**2 + 2.0 * ranges * p_r * np.sin(elevation * np.pi / 180.0))
** 0.5
- p_r
)
Expand Down
1 change: 1 addition & 0 deletions pyart/graph/_cm_colorblind.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Data for colorblind friendly radar colormaps

"""

import os

import numpy as np
Expand Down
1 change: 0 additions & 1 deletion pyart/graph/gridmapdisplay_basemap.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

"""


import matplotlib.pyplot as plt
import numpy as np

Expand Down
1 change: 0 additions & 1 deletion pyart/io/mdv_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

"""


import datetime
import warnings

Expand Down
1 change: 1 addition & 0 deletions pyart/io/nexrad_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Data and functions common to all types of NEXRAD files.

"""

# The functions in this module are intended to be used in other
# nexrad related modules. The functions are not and should not be
# exported into the pyart.io namespace.
Expand Down
1 change: 0 additions & 1 deletion pyart/io/nexrad_level2.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
Functions for reading NEXRAD level 2 files.
"""


# This file is part of the Py-ART, the Python ARM Radar Toolkit
# https://github.com/ARM-DOE/pyart

Expand Down
2 changes: 1 addition & 1 deletion pyart/io/nexrad_level3.py
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ def _int16_to_float16(val):
("block_length", INT4), # Length of block in bytes
("layers", INT2), # Number of data layers
("layer_divider", INT2), # Delineate data layers, -1
("layer_length", INT4) # Length of data layer in bytes
("layer_length", INT4), # Length of data layer in bytes
# Display data packets
)

Expand Down
1 change: 1 addition & 0 deletions pyart/map/gates_to_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Generate a Cartesian grid by mapping from radar gates onto the grid.

"""

import gc
import warnings

Expand Down
3 changes: 2 additions & 1 deletion pyart/retrieve/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
from .qpe import est_rain_rate_zkdp # noqa
from .qpe import est_rain_rate_zpoly # noqa
from .qpe import ZtoR # noqa
from .qvp import quasi_vertical_profile # noqa
from .qvp import quasi_vertical_profile, compute_qvp, compute_rqvp # noqa
from .qvp import compute_evp, compute_svp, compute_vp, compute_ts_along_coord # noqa
from .simple_moment_calculations import calculate_snr_from_reflectivity # noqa
from .simple_moment_calculations import calculate_velocity_texture # noqa
from .simple_moment_calculations import compute_cdr # noqa
Expand Down
1 change: 0 additions & 1 deletion pyart/retrieve/_echo_class_wt.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
atwt2d
"""


import numpy as np


Expand Down
Loading
Loading