aboutsummaryrefslogtreecommitdiffstats
path: root/fnme/station.py
diff options
context:
space:
mode:
authorAlex Schofield <git@ajschof.me>2026-05-04 20:58:05 +0100
committerAlex Schofield <git@ajschof.me>2026-05-04 20:58:05 +0100
commit754f7dc26ddc82a11c45a114cbdd49c17786ae7b (patch)
tree28ba577fbcade97848819b71832df97b54151720 /fnme/station.py
parent683d05d4f77d1ddf0d753c627610aed0f1a4eaae (diff)
downloadfuelnearme-754f7dc26ddc82a11c45a114cbdd49c17786ae7b.tar.gz
fuelnearme-754f7dc26ddc82a11c45a114cbdd49c17786ae7b.zip
remove arg radius parsing from process_stations()
Diffstat (limited to 'fnme/station.py')
-rw-r--r--fnme/station.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/fnme/station.py b/fnme/station.py
index 6cfc5d1..82d17cc 100644
--- a/fnme/station.py
+++ b/fnme/station.py
@@ -1,4 +1,3 @@
-import argparse
import math
from typing import Any, Dict, List, Tuple
@@ -9,13 +8,13 @@ from fnme.constants import SORT_KV
def process_stations(
- dframe: pd.DataFrame, arguments: argparse.Namespace, loc: Tuple[float, float]
+ dframe: pd.DataFrame, rad: int, loc: Tuple[float, float]
) -> List[Dict[str, Any]]:
def bounding_box() -> pd.DataFrame:
lat, lon = loc
- deg_lat = arguments.radius / 69.0
- deg_lon = arguments.radius / (69.0 * math.cos(math.radians(lat)))
+ deg_lat = rad / 69.0
+ deg_lon = rad / (69.0 * math.cos(math.radians(lat)))
return dframe[
dframe["forecourts.location.latitude"].between(lat - deg_lat, lat + deg_lat)
& dframe["forecourts.location.longitude"].between(
@@ -42,7 +41,7 @@ def process_stations(
df["forecourts.location.longitude"].to_numpy(),
).round(1)
- df = df[df["distance"] < arguments.radius]
+ df = df[df["distance"] < rad]
df = df.assign(
e5_price=pence_to_pounds(df["forecourts.fuel_price.E5"]),
git.ajschof.me — hosted by ajschofield — powered by cgit