Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jan 28, 2025
1 parent 53e9615 commit 97d687e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
16 changes: 7 additions & 9 deletions gpm/gv/routines.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,8 @@ def plot_quicklook(
"zFactorFinalNearSurface",
"precipRateNearSurface",
]



def retrieve_ds_sr(start_time, end_time, extent_gr, download_sr=False):
# Define GPM settings
product_type = "RS"
Expand Down Expand Up @@ -744,15 +745,12 @@ def volume_matching(
# Define start_time and end_time for searching SR data
start_time = gr_min_time - np.timedelta64(10, "m")
end_time = gr_max_time + np.timedelta64(10, "m")

ds_sr = retrieve_ds_sr(start_time=start_time,
end_time=end_time,
extent_gr=extent_gr,
download_sr=download_sr)

ds_sr = retrieve_ds_sr(start_time=start_time, end_time=end_time, extent_gr=extent_gr, download_sr=download_sr)
else:
try:
ds_sr = ds_sr.gpm.crop(extent=extent_gr)
except Exception:
except Exception:
# GR extent is not withing SR swath
return None

Expand Down Expand Up @@ -1247,10 +1245,10 @@ def volume_matching(
gdf_match = gdf_match[~gdf_match["GR_counts"].isna()]
gdf_match = gdf_match[~gdf_match["GR_Z_mean"].isna()]

# Return None if nothing left
# Return None if nothing left
if len(gdf_match) == 0:
return None

# Compute ratio SR/GR volume
gdf_match["VolumeRatio"] = gdf_match["SR_gate_volume_sum"] / gdf_match["GR_gate_volume_sum"]

Expand Down
4 changes: 2 additions & 2 deletions gpm/gv/xradar/methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
get_projection_corners_from_centroids,
get_quadmesh_from_corners,
)
from gpm.utils.remapping import reproject_coords
from gpm.utils.geospatial import merge_extents
from gpm.utils.remapping import reproject_coords


def resolution_at_range(xr_obj, azimuth_beamwidth, elevation_beamwidth):
Expand Down Expand Up @@ -212,7 +212,7 @@ def get_datatree_extent(dt, max_distance=None, crs=None):
get_extent(dt[sweep].to_dataset(), max_distance=max_distance, crs=crs) for sweep in get_datatree_sweeps(dt)
]
return merge_extents(list_extent)


def get_maximum_horizontal_distance(xr_obj):
"""Return the horizontal distance from the last gate."""
Expand Down

0 comments on commit 97d687e

Please sign in to comment.