From 1fe2beec213ab06093b78d2d16dc39f26ede4f39 Mon Sep 17 00:00:00 2001 From: William Pringle Date: Mon, 5 Aug 2024 12:59:20 -0500 Subject: [PATCH 1/2] moving carq_ref to above holland B calculation and just using that to compute it instead of needing to take the nanmean --- stormevents/nhc/track.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/stormevents/nhc/track.py b/stormevents/nhc/track.py index 3ef4ccc..47617d2 100644 --- a/stormevents/nhc/track.py +++ b/stormevents/nhc/track.py @@ -1298,16 +1298,17 @@ def clamp(n, minn, maxn): else: carq_forecast = carq_tracks[list(carq_tracks)[0]] + # Get CARQ from forecast hour 0 and isotach 34kt (i.e. the first item) + carq_ref = carq_forecast.loc[carq_forecast.forecast_hours == 0].iloc[0] + + # get the Holland B parameter for filling in central pressure relation = HollandBRelation() holland_b = relation.holland_b( - max_sustained_wind_speed=carq_forecast["max_sustained_wind_speed"], - background_pressure=carq_forecast["background_pressure"], - central_pressure=carq_forecast["central_pressure"], + max_sustained_wind_speed=carq_ref["max_sustained_wind_speed"], + background_pressure=carq_ref["background_pressure"], + central_pressure=carq_ref["central_pressure"], ) - holland_b[holland_b == numpy.inf] = numpy.nan - holland_b = numpy.nanmean(holland_b) - # Get CARQ from forecast hour 0 and isotach 34kt (i.e. the first item) carq_ref = carq_forecast.loc[carq_forecast.forecast_hours == 0].iloc[0] From 9769866b9b42de3b94b4aa0740f3240e6a407b75 Mon Sep 17 00:00:00 2001 From: William Pringle Date: Mon, 5 Aug 2024 13:03:28 -0500 Subject: [PATCH 2/2] removing duplicated line --- stormevents/nhc/track.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/stormevents/nhc/track.py b/stormevents/nhc/track.py index 47617d2..e3d4c15 100644 --- a/stormevents/nhc/track.py +++ b/stormevents/nhc/track.py @@ -1309,9 +1309,7 @@ def clamp(n, minn, maxn): central_pressure=carq_ref["central_pressure"], ) - # Get CARQ from forecast hour 0 and isotach 34kt (i.e. the first item) - carq_ref = carq_forecast.loc[carq_forecast.forecast_hours == 0].iloc[0] - + # find locations where the pertinent variables are missing columns_of_interest = forecast[ ["radius_of_maximum_winds", "central_pressure", "background_pressure"] ]