Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MetObsAPI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
MetObsAPI
Commits
2e8b79ed
Unverified
Commit
2e8b79ed
authored
8 years ago
by
David Hoese
Browse files
Options
Downloads
Patches
Plain Diff
Change retrieval of wind_speed to assume it's in the database
parent
6a6189d9
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
metobsapi/modifyData.py
+5
-13
5 additions, 13 deletions
metobsapi/modifyData.py
metobsapi/queryInflux.py
+0
-1
0 additions, 1 deletion
metobsapi/queryInflux.py
with
5 additions
and
14 deletions
metobsapi/modifyData.py
+
5
−
13
View file @
2e8b79ed
...
...
@@ -59,10 +59,8 @@ def handle_symbols(symbols):
if
not
trans
:
raise
ValueError
(
"
Unknown site/instrument: {},{}
"
.
format
(
site
,
inst
))
influx_name
=
trans
.
get
(
s
)
if
s
in
(
'
wind_speed
'
,
'
wind_direction
'
)
:
if
s
==
"
wind_direction
"
:
add_winds
.
add
((
site
,
inst
))
# ret.setdefault((site, inst), []).append((None, 'wind_east'))
# ret.setdefault((site, inst), []).append((None, 'wind_north'))
elif
influx_name
is
None
:
raise
ValueError
(
"
Unknown symbol: {}
"
.
format
(
symbol
))
...
...
@@ -153,10 +151,6 @@ def handle_json(frame, symbols, epoch, order='columns', **kwargs):
def
handle_xml
(
frame
,
symbols
,
epoch
,
sep
=
'
,
'
,
**
kwargs
):
doc
=
Document
()
if
not
sep
:
sep
=
'
,
'
header
=
'
metobs
'
timeStamps
=
list
(
frame
.
columns
.
values
)
...
...
@@ -224,22 +218,20 @@ def handle_xml(frame, symbols, epoch, sep=',', **kwargs):
def
handle_influxdb_result
(
result
,
symbols
,
interval
):
frames
=
[]
# TODO: Round symbol values
# TODO: Mask invalid values
for
si
,
(
req_syms
,
influx_symbs
)
in
symbols
.
items
():
data_points
=
result
.
get_points
(
'
metobs_
'
+
interval
,
tags
=
{
'
site
'
:
si
[
0
],
'
inst
'
:
si
[
1
]})
frame
=
pd
.
DataFrame
(
data_points
,
columns
=
[
'
time
'
]
+
influx_symbs
)
frame
.
set_index
(
'
time
'
,
inplace
=
True
)
frame
.
fillna
(
value
=
np
.
nan
,
inplace
=
True
)
if
influx_symbs
[
-
1
]
==
'
wind_north
'
:
# remove winds
if
'
wind_speed
'
in
frame
.
columns
:
frame
[
'
wind_speed
'
]
=
round_value
(
np
.
hypot
(
frame
[
'
wind_east
'
],
frame
[
'
wind_north
'
]),
'
wind_speed
'
)
# remove wind components
if
'
wind_dir
'
in
frame
.
columns
:
frame
[
'
wind_direction
'
]
=
round_value
(
np
.
rad2deg
(
np
.
arctan2
(
frame
[
'
wind_east
'
],
frame
[
'
wind_north
'
]))
,
'
wind_direction
'
)
frame
[
'
wind_direction
'
]
=
np
.
rad2deg
(
np
.
arctan2
(
frame
[
'
wind_east
'
],
frame
[
'
wind_north
'
]))
frame
=
frame
.
iloc
[:,
:
-
2
]
frame
.
columns
=
req_syms
[:
-
2
]
else
:
frame
.
columns
=
req_syms
frame
=
frame
.
round
({
s
:
ROUNDING
.
get
(
s
,
1
)
for
s
in
frame
.
columns
})
frames
.
append
(
frame
)
frame
=
pd
.
concat
(
frames
,
axis
=
1
,
copy
=
False
)
return
frame
...
...
This diff is collapsed.
Click to expand it.
metobsapi/queryInflux.py
+
0
−
1
View file @
2e8b79ed
...
...
@@ -16,7 +16,6 @@ def parse_dt(d):
def
query
(
site
,
inst
,
symbols
,
begin
,
end
,
value
,
epoch
):
host
=
'
metobs01
'
host
=
'
localhost
'
port
=
8086
username
=
'
root
'
password
=
'
root
'
...
...
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