Skip to content

Commit f41ffda

Browse files
committed
allow None for threshold, pandas fixes
1 parent 28cf9c2 commit f41ffda

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

pyxlma/lmalib/lma_intercept_rhi.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from pyxlma.coords import RadarCoordinateSystem, TangentPlaneCartesianSystem, GeographicSystem
22
import numpy as np
33
import datetime as dt
4+
import pandas as pd
45

56

67
def rcs_to_tps(radar_latitude, radar_longitude, radar_altitude, radar_azimuth):
@@ -248,12 +249,18 @@ def find_points_near_rhi(event_longitude, event_latitude, event_altitude, event_
248249
lma_dist = projected_lma[:,1]
249250
lma_alt = projected_lma[:,2]
250251

252+
if isinstance(event_time, pd.Series):
253+
event_time = event_time.values
251254
lma_times = event_time.astype('datetime64[s]').astype(dt.datetime)
252-
point_mask = (lma_dist < distance_threshold) & (np.abs(lma_times - radar_scan_time) < dt.timedelta(seconds=time_threshold))
255+
point_mask = np.ones_like(lma_range, dtype=bool)
256+
if distance_threshold is not None:
257+
point_mask = np.logical_and(point_mask, lma_dist < distance_threshold)
258+
if time_threshold is not None:
259+
point_mask = np.logical_and(point_mask,
260+
np.abs(lma_times - radar_scan_time) < dt.timedelta(seconds=time_threshold))
253261
lma_range = lma_range[point_mask]
254262
lma_dist = lma_dist[point_mask]
255263
lma_alt = lma_alt[point_mask]
256-
257264
return lma_range, lma_dist, lma_alt, point_mask
258265

259266

0 commit comments

Comments
 (0)