Commit 170d3e00 authored by Bruce Flynn's avatar Bruce Flynn

small formatting changes

parent 00de7b71
Pipeline #1504 failed with stage
in 1 minute and 25 seconds
......@@ -158,13 +158,15 @@ def get_q1h_slice(stations, symbols, start, end, avg=None):
def _get_slice(type_, stations, symbols, start, end, avg):
"""
Get a slice of data for all station/symbol combinations. Data will be returned
for all combinations whether present or not and filled with NaN where not avialable.
Get a slice of data for all station/symbol combinations. Data will be
returned for all combinations whether present or not and filled with NaN
where not avialable.
:param type_: A supported data type, e.g., rdr, or q1h
:param stations: A list of station names
:param symbols: List of supported symbol names, currently 'air_temp', 'vtempdiff',
'rh', 'pressure', 'wind_dir', 'wind_spd'.
:param symbols:
List of supported symbol names, currently 'air_temp', 'vtempdiff', 'rh',
'pressure', 'wind_dir', 'wind_spd'.
:param start: Inclusive start datetime
:param end: Inclusive end datetime
:param avg: Averaging interval in seconds
......@@ -172,7 +174,8 @@ def _get_slice(type_, stations, symbols, start, end, avg):
table_name = _data_table_name(type_)
select = sql.text("""
SELECT
series.stamp, air_temp, vtempdiff, rh, pressure, _wind_vector_east, _wind_vector_north
series.stamp, air_temp, vtempdiff, rh, pressure, _wind_vector_east,
_wind_vector_north
FROM (
SELECT name as station, stamp FROM
(SELECT generate_series(:start, :end, :interval) as stamp) stamps
......@@ -212,7 +215,8 @@ def _get_slice(type_, stations, symbols, start, end, avg):
dat = np.concatenate((stamps, dat[:, :4], wind_dir, wind_spd), axis=1)
# return only the columns for the requested sensors
all_sensors = ['air_temp', 'vtempdiff', 'rh', 'pressure', 'wind_dir', 'wind_spd']
all_sensors = ['air_temp', 'vtempdiff', 'rh', 'pressure', 'wind_dir',
'wind_spd']
colidxs = [0] + [all_sensors.index(s) + 1 for s in symbols]
return dat[:, colidxs]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment