Skip to content

Commit

Permalink
Merge pull request #615 from akrherz/231215-2
Browse files Browse the repository at this point in the history
mnt: sundry fixes
  • Loading branch information
akrherz authored Dec 16, 2023
2 parents 73c57c9 + de772d3 commit bbd5ed3
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 13 deletions.
3 changes: 1 addition & 2 deletions cgi-bin/request/asos.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
import datetime
import sys
from io import StringIO
from zoneinfo import ZoneInfo
from zoneinfo._common import ZoneInfoNotFoundError
from zoneinfo import ZoneInfo, ZoneInfoNotFoundError

from pyiem.network import Table as NetworkTable
from pyiem.util import get_dbconn, utc
Expand Down
3 changes: 3 additions & 0 deletions cgi-bin/request/asos1min.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ def get_station_metadata(stations) -> dict:
res = {}
for row in cursor:
res[row["id"]] = dict(name=row["name"], lon=row["lon"], lat=row["lat"])
for station in stations:
if station not in res:
raise IncompleteWebRequest(f"Unknown station provided: {station}")
pgconn.close()
return res

Expand Down
20 changes: 13 additions & 7 deletions cgi-bin/request/feel.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,26 @@
from pyiem.exceptions import IncompleteWebRequest
from pyiem.util import get_sqlalchemy_conn
from pyiem.webutil import iemapp
from sqlalchemy import text

EXL = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"


def run(sts, ets, start_response):
"""Get data!"""
params = {"sts": sts, "ets": ets}
with get_sqlalchemy_conn("other") as dbconn:
sql = """SELECT * from feel_data_daily where
valid >= %s and valid < %s ORDER by valid ASC"""
df = pd.read_sql(sql, dbconn, params=(sts, ets))

sql = """SELECT * from feel_data_hourly where
valid >= %s and valid < %s ORDER by valid ASC"""
df2 = pd.read_sql(sql, dbconn, params=(sts, ets))
sql = (
"SELECT * from feel_data_daily where "
"valid >= :sts and valid < :ets ORDER by valid ASC"
)
df = pd.read_sql(text(sql), dbconn, params=params)

sql = (
"SELECT * from feel_data_hourly where "
"valid >= :sts and valid < :ets ORDER by valid ASC"
)
df2 = pd.read_sql(text(sql), dbconn, params=params)

def fmt(val):
"""Lovely hack."""
Expand Down
7 changes: 3 additions & 4 deletions htdocs/other/index.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ $d1select = daySelect2(1, "day1");
$y2select = yearSelect2(2012, date("Y"), "year2");
$m2select = monthSelect(date("m"), "month2");
$d2select = daySelect2(date("d"), "day2");
$y12select = yearSelect2(2003, date("Y"), "year1");
$y12select = yearSelect2(2003, 2003, "year1");
$y22select = yearSelect2(2003, date("Y"), "year2");
$y13select = yearSelect2(2014, date("Y"), "year1");
$y23select = yearSelect2(2014, date("Y"), "year2");
$y13select = yearSelect2(2013, 2013, "year1");
$y23select = yearSelect2(2013, date("Y"), "year2");
$nselect = networkSelect("OT", "");

$t->content = <<<EOF
Expand All @@ -44,7 +44,6 @@ equipment has been removed.</p>
<li><a href="daily_plot.phtml?station=OT0008&year=2007&month=2&day=13">Reiman Gardens station</a>, only some limited data from 2007 for the site.</li>
</ul>
<h3>Stuart Smith Park Hydrology Learning Lab, Ames</h3>
<p>These are four ground water monitoring wells and a stream gauge located at
Expand Down

0 comments on commit bbd5ed3

Please sign in to comment.