Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
polrschd.txt
22 changes: 17 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
# polrschd
Python script for predicting NOAA POES GAC transmissions.
The script will access the public NOAA schedule file at https://noaasis.noaa.gov/cemscs/polrschd.txt and parse events related to POES GAC (NOAA-15, NOAA-18, NOAA-19). It will then display the UTC time and date at which a satellite begins and ends its GAC transmission, as well as the frequency, polarization, and elevation of the satellite.
The script will access the public NOAA schedule file at https://noaasis.noaa.gov/cemscs/polrschd.txt and parse events related to POES GAC (NOAA-15, NOAA-18, NOAA-19). It will then display the UTC/local time and date at which a satellite begins and ends its GAC transmission, as well as the frequency, polarization, and elevation of the satellite.

GAC transmissions can be subsequently demodulated and decoded by [LeanHRPT-Demod](https://github.com/Xerbo/LeanHRPT-Demod/) and [LeanHRPT-Decode](https://github.com/Xerbo/LeanHRPT-Decode/tree/gac) respectively.

![thumbnail](https://github.com/sgcderek/polrschd/blob/main/thumbnail.jpeg?raw=true)

## Requirements
The script uses urllib, datetime and pyorbital. Only pyorbital is a non-default library and can be installed with pip
## Installation

Clone repository
```bash
git clone https://github.com/horsaen/polrschd.git && cd polrschd
```

Install dependencies
```bash
pip3 install -r requirements.txt
```

## Usage
Very basic usage for now; open polrschd.py3 and change the four parameters at the beginning of the file (input your latitude, longitude, altitude ASL and minimum satellite elevation).
Once configured, you can run the script and get a list of GAC transmissions available for your area. Make sure to then check the full pass with your normal prediction app (such as gpredict, Look4sat, etc.)

Edit [main.py](main.py) to set required parameters, then simply run the script
```bash
python3 main.py
```
130 changes: 130 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
import requests, os, time
from datetime import datetime
from dateutil import tz
from pyorbital.orbital import Orbital

########################################################################
########################### PREDICT SETTINGS ###########################
########################### (change these!) ###########################
########################################################################

yourLat = 0 # Your latitude
yourLon = 0 # Your longitude
yourAlt = 0 # Your altitude (meters above sea level)
minElevation = 0 # Minimum elevation of the GAC event (can be negative)
utcTime = tz.gettz('UTC') # UTC timezone
localTime = tz.gettz('UTC') # Your local timezone(as abbreviation)

########################################################################
########################################################################


# global declarations

# # https://code.it4i.cz/blender/blender-embree3/-/blob/sculpt25/tools/bcolors.py
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKCYAN = '\033[96m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'

url = "https://noaasis.noaa.gov/cemscs/polrschd.txt" # polrschd.txt URL
local = "polrschd.txt"
expire = 260000

orbitalNOAA15 = Orbital("NOAA-15")
orbitalNOAA18 = Orbital("NOAA-18")
orbitalNOAA19 = Orbital("NOAA-19")

def main():
print(f"{bcolors.OKCYAN}{bcolors.BOLD}Calculating GAC events for following conditions;{bcolors.ENDC}")
print(f"{bcolors.OKCYAN}Receiver latitude: ",yourLat,"˚")
print("Receiver longitude: ",yourLon,"˚")
print("Receiver altitude: ",yourAlt,"m")
print("Min. sat. elevation:", minElevation,f"˚{bcolors.ENDC}")

if (os.path.isfile(local)):
if (time.time() - os.path.getmtime(local)) > expire:
print("Local file expired, will download")
with open(local, 'wb') as f:
f.write(requests.get(url).content)
else:
print("Using local file")
else:
print("Local file not found, will download")
with open(local, 'wb') as f:
f.write(requests.get(url).content)

for line in open(local, 'r'): # open txt, read each line
text = line[:-1] # strip newline
date = text[0:17] # get date from line
utc = datetime.strptime(date, '%Y/%j/%H:%M:%S') # parse date from weird format YYYY/DDD/HH:MM:SS
utc = utc.replace(tzinfo=utcTime) # set timezone to UTC
dateParsed = utc.astimezone(localTime) # convert to local time
satID = text[23:25] # get satellite number from line

# parse satellite number ID into name
if (satID == "01"):
satIDParsed = "MetOp-B"
elif (satID == "02"):
satIDParsed = "MetOp-A"
elif (satID == "03"):
satIDParsed = "MetOp-C"
elif (satID == "15"):
satIDParsed = "NOAA-15"
satellite = orbitalNOAA15
elif (satID == "18"):
satIDParsed = "NOAA-18"
satellite = orbitalNOAA18
elif (satID == "19"):
satIDParsed = "NOAA-19"
satellite = orbitalNOAA19
else:
satIDParsed = satID

# Determine frequency from transmitter ID
if "LSB" in text:
txFreq = "1698.0 MHz RHCP"
elif "MSB" in text:
txFreq = "1702.5 MHz LHCP"
elif "HSB" in text:
txFreq = "1707.0 MHz RHCP"
elif "ESB" in text:
txFreq = "2247.5 MHz RHCP"
else:
txFreq = "Unknown Frequency"

# Determine type of event
if "PBK,START,GAC" in text:
eventType = "Start of GAC transmission"
elif "PBK,END,GAC" in text:
eventType = "End of GAC transmission "
else:
eventType = "other"

if ((eventType == "Start of GAC transmission") | (eventType == "End of GAC transmission ")):

# Compute observed elevation of satellite during event
elevation = (round(satellite.get_observer_look(dateParsed, yourLon, yourLat, yourAlt/1000)[1]))
elStr = str(elevation)+"°"

# Set print color
if ((elevation > 5) & (eventType == "Start of GAC transmission")):
printCol = f"{bcolors.BOLD}{bcolors.OKGREEN}"
elif ((elevation >= 0) & (eventType == "Start of GAC transmission")):
printCol = f"{bcolors.OKGREEN}"
elif ((elevation >= 0) & (eventType == "End of GAC transmission ")):
printCol = f"{bcolors.WARNING}"
else:
printCol = f"{bcolors.FAIL}"

if (elevation >= minElevation):
print(printCol, dateParsed, satIDParsed, eventType, txFreq, elStr, f"{bcolors.ENDC}")

if __name__ == "__main__":
main()
119 changes: 0 additions & 119 deletions polrschd.py3

This file was deleted.

3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pyorbital
requests
certifi