This commit is contained in:
parent
3ddaf4d4ac
commit
0cf6e15964
|
@ -7,18 +7,8 @@ EarthData which is done through Selenium and the Chrome browser.
|
||||||
|
|
||||||
1. Create an account at <https://urs.earthdata.nasa.gov>
|
1. Create an account at <https://urs.earthdata.nasa.gov>
|
||||||
2. `pip install -r requirements.txt`
|
2. `pip install -r requirements.txt`
|
||||||
3. `sudo apt-get install p7zip-full redis-server`
|
3. `sudo apt-get install redis-server`
|
||||||
4. `sudo apt-get install dvipng texlive-latex-extra texlive-fonts-recommended cm-super`
|
4. `sudo systemctl enable --now redis-server`
|
||||||
5. `sudo systemctl enable --now redis-server`
|
|
||||||
|
|
||||||
### Google Chrome
|
|
||||||
|
|
||||||
If you don't have Google Chrome installed (used to log into the NASA site), here's how to install it.
|
|
||||||
|
|
||||||
```shell
|
|
||||||
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
|
|
||||||
apt install ./google-chrome-stable_current_amd64.deb
|
|
||||||
```
|
|
||||||
|
|
||||||
## Run
|
## Run
|
||||||
|
|
||||||
|
@ -29,7 +19,6 @@ LAT_RANGE_MIN=<lower range for lat bounding box> \
|
||||||
LAT_RANGE_MAX=<upper range for lat bounding box> \
|
LAT_RANGE_MAX=<upper range for lat bounding box> \
|
||||||
LON_RANGE_MIN=<lower range for lon bounding box> \
|
LON_RANGE_MIN=<lower range for lon bounding box> \
|
||||||
LON_RANGE_MAX=<upper range for lon bounding box> \
|
LON_RANGE_MAX=<upper range for lon bounding box> \
|
||||||
CDDIS_USERNAME=<username> CDDIS_PASSWORD=<password> \
|
|
||||||
MQTT_BROKER_HOST="<Home Assistant IP>" MQTT_BROKER_PORT=1883 MQTT_USERNAME="user" MQTT_PASSWORD="<password>" \
|
MQTT_BROKER_HOST="<Home Assistant IP>" MQTT_BROKER_PORT=1883 MQTT_USERNAME="user" MQTT_PASSWORD="<password>" \
|
||||||
python3 mqtt.py
|
python3 mqtt.py
|
||||||
```
|
```
|
||||||
|
@ -39,24 +28,19 @@ Example systemd service files are provided.
|
||||||
### Home Assistant MQTT Config
|
### Home Assistant MQTT Config
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
mqtt:
|
- state_topic: "space-weather/glotec"
|
||||||
- state_topic: "space-weather/vtec"
|
name: "GloTEC"
|
||||||
name: "VTEC"
|
unit_of_measurement: "(10^16) / m^-2"
|
||||||
unit_of_measurement: "(10^16 el) / m^2"
|
|
||||||
state_class: measurement
|
state_class: measurement
|
||||||
unique_id: space_weather_vtec
|
unique_id: space_weather_glotec
|
||||||
```
|
```
|
||||||
|
|
||||||
## Data
|
## Data
|
||||||
|
|
||||||
### VTEC
|
### GloTEC
|
||||||
|
|
||||||
<https://www.spaceweather.gov/products/us-total-electron-content>
|
<https://www.swpc.noaa.gov/experimental/glotec>
|
||||||
|
|
||||||
Unit: `(10^16 el) / m^2`
|
Unit: `(10^16) / m^-2`
|
||||||
|
|
||||||
VTEC, or Vertical TEC, is a specific type of TEC measurement that is taken along a path extending
|
|
||||||
vertically from the Earth's surface to the edge of the atmosphere. Essentially, VTEC is a subset of TEC, with the
|
|
||||||
difference lying in the specific path along which the measurement is taken.
|
|
||||||
|
|
||||||
Updated hourly.
|
Updated hourly.
|
|
@ -15,7 +15,7 @@ def main():
|
||||||
while True:
|
while True:
|
||||||
logging.info('Fetching latest GLOTEC data')
|
logging.info('Fetching latest GLOTEC data')
|
||||||
geojson = get_latest_glotec()
|
geojson = get_latest_glotec()
|
||||||
redis.set('latest_glotec_data', pickle.dumps(geojson))
|
redis.set('glotec', pickle.dumps(geojson))
|
||||||
logging.info('Scrape complete')
|
logging.info('Scrape complete')
|
||||||
time.sleep(1800) # 30 minutes
|
time.sleep(1800) # 30 minutes
|
||||||
|
|
||||||
|
|
|
@ -58,11 +58,11 @@ def main():
|
||||||
redis = Redis(host='localhost', port=6379, db=0)
|
redis = Redis(host='localhost', port=6379, db=0)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
data = redis.get('latest_glotec_data')
|
data = redis.get('glotec')
|
||||||
while data is None:
|
while data is None:
|
||||||
logging.warning('Redis has not been populated yet. Is cache.py running? Sleeping 10s...')
|
logging.warning('Redis has not been populated yet. Is cache.py running? Sleeping 10s...')
|
||||||
time.sleep(10)
|
time.sleep(10)
|
||||||
data = redis.get('latest_glotec_data')
|
data = redis.get('glotec')
|
||||||
geojson = pickle.loads(data)
|
geojson = pickle.loads(data)
|
||||||
|
|
||||||
utc_hr = datetime.now(timezone.utc).hour
|
utc_hr = datetime.now(timezone.utc).hour
|
||||||
|
|
Loading…
Reference in New Issue