Skip to content

Commit 74dc15e

Browse files
committed
add daylight info to predicted passes table, ruff format
1 parent d3b1fe3 commit 74dc15e

4 files changed

Lines changed: 23 additions & 4 deletions

File tree

scripts/generate_satellite_paths.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,9 @@ async def fetch_all_tles(urls):
143143
time_2 = now + timedelta(days=2)
144144

145145
# Load solar ephemeris for daytime calculations
146-
eph = load('de421.bsp')
147-
earth = eph['earth']
148-
sun = eph['sun']
146+
eph = load("de421.bsp")
147+
earth = eph["earth"]
148+
sun = eph["sun"]
149149

150150

151151
def is_daytime(lat_degrees, lon_degrees, observation_time):
@@ -244,7 +244,10 @@ def get_satellite_positions(sat, start_time, end_time, step_minutes):
244244
# Use the center point of the line segment and middle time
245245
center_lat = (pt0.y + pt1.y) / 2
246246
center_lon = (pt0.x + pt1.x) / 2
247-
middle_time = group.loc[i, "timestamp"] + (group.loc[i + 1, "timestamp"] - group.loc[i, "timestamp"]) / 2
247+
middle_time = (
248+
group.loc[i, "timestamp"]
249+
+ (group.loc[i + 1, "timestamp"] - group.loc[i, "timestamp"]) / 2
250+
)
248251
daytime = is_daytime(center_lat, center_lon, middle_time)
249252

250253
path_segments.append(

src/components/PassCounter.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ import {
2020
Asterisk,
2121
Target,
2222
Navigation,
23+
Sun,
24+
Moon,
2325
} from "lucide-react";
2426
import maplibregl from "maplibre-gl";
2527

@@ -66,6 +68,7 @@ export const PassCounter = ({ mapRef }: PassCounterProps) => {
6668
<TableHead className="text-xs">Resolution</TableHead>
6769
<TableHead className="text-xs">Access</TableHead>
6870
<TableHead className="text-xs">Tasking</TableHead>
71+
<TableHead className="text-xs">Daylight</TableHead>
6972
</TableRow>
7073
</TableHeader>
7174
<TableBody>
@@ -152,6 +155,17 @@ export const PassCounter = ({ mapRef }: PassCounterProps) => {
152155
<Badge variant="outline">N/A</Badge>
153156
)}
154157
</TableCell>
158+
<TableCell className="text-xs">
159+
{pass.is_daytime !== undefined ? (
160+
<Badge
161+
variant={pass.is_daytime ? "soft-yellow" : "soft-purple"}
162+
>
163+
{pass.is_daytime ? <Sun /> : <Moon />}
164+
</Badge>
165+
) : (
166+
<Badge variant="outline">N/A</Badge>
167+
)}
168+
</TableCell>
155169
</TableRow>
156170
))}
157171
</TableBody>

src/hooks/usePassCounter.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export const usePassCounter = ({ mapRef }: UsePassCounterProps) => {
5656
data_access: props.data_access?.toString() || undefined,
5757
constellation: props.constellation?.toString() || undefined,
5858
tasking: props.tasking !== undefined ? Boolean(props.tasking) : undefined,
59+
is_daytime: props.is_daytime !== undefined ? Boolean(props.is_daytime) : undefined,
5960
};
6061
})
6162
.filter((pass): pass is VisiblePass => pass !== null);

src/store/filterStore.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export interface VisiblePass {
2525
data_access?: string;
2626
constellation?: string;
2727
tasking?: boolean;
28+
is_daytime?: boolean;
2829
}
2930

3031
interface FilterState {

0 commit comments

Comments
 (0)