Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AossTower
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MetObs
AossTower
Commits
64c9d588
Verified
Commit
64c9d588
authored
6 years ago
by
David Hoese
Browse files
Options
Downloads
Patches
Plain Diff
Add incomplete wunderground logic to influxdb script
parent
4c7954b3
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
aosstower/level_00/influxdb.py
+18
-0
18 additions, 0 deletions
aosstower/level_00/influxdb.py
with
18 additions
and
0 deletions
aosstower/level_00/influxdb.py
+
18
−
0
View file @
64c9d588
...
@@ -73,6 +73,12 @@ def main():
...
@@ -73,6 +73,12 @@ def main():
help
=
'
each occurrence increases verbosity 1 level through ERROR-WARNING-INFO-DEBUG
'
)
help
=
'
each occurrence increases verbosity 1 level through ERROR-WARNING-INFO-DEBUG
'
)
parser
.
add_argument
(
'
--sleep-interval
'
,
type
=
float
,
parser
.
add_argument
(
'
--sleep-interval
'
,
type
=
float
,
help
=
"
Seconds to wait between submitting each record
"
)
help
=
"
Seconds to wait between submitting each record
"
)
# parser.add_argument('--weather-underground', action='store_true',
# help="Send new records to wunderground.com")
# parser.add_argument('--wu-id', default='KWIMADIS52',
# help='Weather underground station ID')
# parser.add_argument('--wu-password-file', default='/home/metobs/wunderground_password.txt',
# help='File containing the password for the weather underground upload')
parser
.
add_argument
(
'
src
'
,
help
=
'
Level 0 raw data file
'
)
parser
.
add_argument
(
'
src
'
,
help
=
'
Level 0 raw data file
'
)
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
...
@@ -84,6 +90,10 @@ def main():
...
@@ -84,6 +90,10 @@ def main():
station_tags
=
STATIONS
[
args
.
station
]
station_tags
=
STATIONS
[
args
.
station
]
symbols
=
SYMBOL_CONVERSIONS
symbols
=
SYMBOL_CONVERSIONS
# wu_pw = None
# if args.weather_underground:
# wu_pw = open(args.wu_password_file, 'r').read().strip()
if
args
.
ldmp
:
if
args
.
ldmp
:
from
aosstower.level_00.parser
import
ldmp_generator
from
aosstower.level_00.parser
import
ldmp_generator
record_gen
=
ldmp_generator
(
args
.
src
,
args
.
tables
)
record_gen
=
ldmp_generator
(
args
.
src
,
args
.
tables
)
...
@@ -102,6 +112,14 @@ def main():
...
@@ -102,6 +112,14 @@ def main():
'
http://{host}:{port:d}/write?db={dbname}
'
.
format
(
host
=
args
.
host
,
port
=
args
.
port
,
dbname
=
args
.
dbname
),
'
http://{host}:{port:d}/write?db={dbname}
'
.
format
(
host
=
args
.
host
,
port
=
args
.
port
,
dbname
=
args
.
dbname
),
data
=
'
\n
'
.
join
(
lines
))
data
=
'
\n
'
.
join
(
lines
))
resp
.
raise_for_status
()
resp
.
raise_for_status
()
if
wu_pw
and
args
.
ldmp
:
stamp
=
record
[
'
timestamp
'
].
isoformat
(
'
+
'
)
record_parameters
=
"
dateutc={stamp}6&winddir={winddir:d}&windspeedmph={windspeed:0.1f}&windgustmph={gust}&humidity=64&tempf=70.5&baromin=29.742&dewptf=57.9&solarradiation=0.5&rainin=0.00&dailyrainin=0.00
"
.
format
(
stamp
=
stamp
,
winddir
=
int
(
record
[
'
wind_dir
'
]),
)
resp
=
requests
.
post
(
'
http://weatherstation.wunderground.com/weatherstation/updateweatherstation.php?ID={wu_id}&PASSWORD={wu_pw}&action=updateraw&dateutc=2017-04-16+01:54:46&winddir=198&windspeedmph=14.7&windgustmph=21.7&humidity=64&tempf=70.5&baromin=29.742&dewptf=57.9&solarradiation=0.5&rainin=0.00&dailyrainin=0.00&softwaretype=SSEC-RIG
'
)
if
args
.
sleep_interval
:
if
args
.
sleep_interval
:
time
.
sleep
(
args
.
sleep_interval
)
time
.
sleep
(
args
.
sleep_interval
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment