-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwwara-oob-maps-csv
More file actions
executable file
·42 lines (34 loc) · 872 Bytes
/
wwara-oob-maps-csv
File metadata and controls
executable file
·42 lines (34 loc) · 872 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env python
from csv import DictWriter
from decimal import Decimal
from sys import stderr, stdout
from wwara.database import coordinations
FIELDNAMES = (
"Name",
"Latitude",
"Longitude",
)
CHANNELS = list(coordinations())
LAT_LO = 45.90
LAT_HI = 49.00
LON_LO = -124.22
LON_HI = -121.32
def in_region(channel):
if not (LAT_LO < channel.latitude < LAT_HI):
return False
if not (LON_LO < channel.longitude < LON_HI):
return False
return True
def rows():
for channel in CHANNELS:
if in_region(channel):
continue
yield {
"Name": str(channel),
"Latitude": channel.latitude,
"Longitude": channel.longitude,
}
if __name__ == "__main__":
writer = DictWriter(stdout, fieldnames=FIELDNAMES)
writer.writeheader()
writer.writerows(rows())