Skip to content

Commit

Permalink
Merge pull request #1039 from akrherz/241222
Browse files Browse the repository at this point in the history
📝 Sundry updates per review
  • Loading branch information
akrherz authored Dec 25, 2024
2 parents 931ebec + 061c617 commit e3a4fd9
Show file tree
Hide file tree
Showing 11 changed files with 48 additions and 48 deletions.
4 changes: 2 additions & 2 deletions data/wms/nexrad/n0q-t.map
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ LAYER
"wms_title" "NEXRAD BASE REFLECT"
"wms_srs" "EPSG:4326 EPSG:900913 EPSG:102100 EPSG:3857"
"wms_extent" "-171 15 -66 70"
"wms_timeextent" "2011-02-16/2024-12-31/PT5M"
"wms_timeextent" "2011-02-16/2025-12-31/PT5M"
"wms_timeitem" "datetime"
"wms_timedefault" "2011-02-21T19:30:00Z"
END
Expand All @@ -78,7 +78,7 @@ LAYER
"wms_title" "NEXRAD BASE REFLECT"
"wms_srs" "EPSG:4326 EPSG:900913 EPSG:102100 EPSG:3857"
"wms_extent" "-171 15 -66 70"
"wms_timeextent" "2011-02-16/2024-12-31/PT5M"
"wms_timeextent" "2011-02-16/2025-12-31/PT5M"
"wms_timeitem" "datetime"
"wms_timedefault" "2011-02-21T19:30:00Z"
END
Expand Down
4 changes: 2 additions & 2 deletions data/wms/nexrad/n0r-t.map
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ LAYER
"wms_title" "NEXRAD BASE REFLECT"
"wms_srs" "EPSG:4326 EPSG:900913 EPSG:102100 EPSG:3857"
"wms_extent" "-126 24 -66 50"
"wms_timeextent" "1995-01-01/2024-12-31/PT5M"
"wms_timeextent" "1995-01-01/2025-12-31/PT5M"
"wms_timeitem" "datetime"
"wms_timedefault" "2006-06-23T03:10:00Z"
END
Expand All @@ -80,7 +80,7 @@ LAYER
"wms_title" "NEXRAD BASE REFLECT"
"wms_srs" "EPSG:4326 EPSG:900913 EPSG:102100 EPSG:3857"
"wms_extent" "-126 24 -66 50"
"wms_timeextent" "1995-01-01/2024-12-31/PT5M"
"wms_timeextent" "1995-01-01/2025-12-31/PT5M"
"wms_timeitem" "datetime"
"wms_timedefault" "2006-06-23T03:10:00Z"
END
Expand Down
14 changes: 7 additions & 7 deletions htdocs/js/iemss.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ var htmlInterface = ['<div class="panel panel-default">',
'</div><!-- End of panel-body -->',
'</div><!-- End of panel -->'];

var map, selectedFeature, selectControl, geojson, geojsonSource, network;
var map, selectedFeature, geojson, geojsonSource, network;

//http://www.lessanvaezi.com/filter-select-list-options/
jQuery.fn.filterByText = function (textbox, selectSingleMatch) {
Expand Down Expand Up @@ -146,26 +146,26 @@ $().ready(() => {
$('#stations_add').click(function () {
return !$('#stations_in option:selected').remove().appendTo('#stations_out');
});
$('#stations_addall').click(function () {
$('#stations_addall').click(() => {
var ret = !$('#stations_in option').remove().appendTo('#stations_out');
$('#stations_out option').prop('selected', true);
return ret;
});
$('#stations_delall').click(function () {
$('#stations_delall').click(() => {
return !$('#stations_out option').remove().appendTo('#stations_in');
});
$('#stations_del').click(function () {
$('#stations_out option:selected').remove().appendTo('#stations_in');
$('#stations_out option').each(function (i) {
$('#stations_out option').each(function () { // this
$(this).attr("selected", "selected");
});
return false;
});

$('#iemss-sortbyid').click(function () {
$('#iemss-sortbyid').click(() => {
sortListing("id");
});
$('#iemss-sortbyname').click(function () {
$('#iemss-sortbyname').click(() => {
sortListing("name");
});

Expand Down Expand Up @@ -200,7 +200,7 @@ $().ready(() => {
})
});

geojsonSource.on('change', function (e) {
geojsonSource.on('change', () => {
if (geojsonSource.getState() == 'ready') {
$.each(geojsonSource.getFeatures(), (_index, feat) => {
var lbl = `[${feat.get('sid')}] ${feat.get('sname')}`;
Expand Down
11 changes: 6 additions & 5 deletions pylib/iemweb/autoplot/scripts/p47.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@

import pandas as pd
import seaborn as sns
from pyiem.database import get_sqlalchemy_conn
from pyiem.exceptions import NoDataFound
from pyiem.plot import figure
from pyiem.util import get_autoplot_context, get_sqlalchemy_conn
from pyiem.util import get_autoplot_context, utc

from iemweb.autoplot import ARG_STATION

Expand All @@ -33,7 +34,7 @@ def get_description():
dict(
type="year",
name="year",
default="2014",
default=utc().year,
label="Select Year to Highlight:",
),
]
Expand Down Expand Up @@ -70,8 +71,8 @@ def plotter(fdict):
f"{calendar.month_name[month]} Snowfall vs Precipitation Totals"
)
figure(title=title, apctx=ctx, fig=g.figure)
g.fig.tight_layout()
g.fig.subplots_adjust(top=0.91)
g.figure.tight_layout()
g.figure.subplots_adjust(top=0.91)
if year in df.index:
row = df.loc[year]
g.ax_joint.scatter(
Expand Down Expand Up @@ -112,4 +113,4 @@ def plotter(fdict):
g.ax_joint.set_ylabel("Snowfall Total [inch]")
g.ax_joint.set_xlabel("Precipitation Total (liquid + melted) [inch]")
g.ax_joint.legend(loc=1, scatterpoints=1)
return g.fig, df
return g.figure, df
8 changes: 4 additions & 4 deletions pylib/iemweb/autoplot/scripts100/p101.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
most frequent product.
"""

import datetime
from datetime import date

import numpy as np
import pandas as pd
Expand Down Expand Up @@ -41,7 +41,7 @@ def get_description():
dict(
type="year",
name="eyear",
default=datetime.date.today().year,
default=date.today().year,
label="End Year (inclusive):",
min=2009,
),
Expand All @@ -56,8 +56,8 @@ def plotter(fdict):
syear = ctx["syear"]
eyear = ctx["eyear"] + 1
station = ctx["station"][:4]
sts = datetime.date(syear, 1, 1)
ets = datetime.date(eyear, 1, 1)
sts = date(syear, 1, 1)
ets = date(eyear, 1, 1)
params = {
"sts": sts,
"ets": ets,
Expand Down
2 changes: 1 addition & 1 deletion pylib/iemweb/autoplot/scripts100/p109.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def get_description():
return desc


def get_count_df(ctx, varname, pstr, sts, ets):
def get_count_df(ctx, varname: str, pstr, sts, ets):
"""Oh boy, do complex things."""

emerg_extra = ""
Expand Down
13 changes: 7 additions & 6 deletions pylib/iemweb/autoplot/scripts100/p126.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"""

import calendar
import datetime
from datetime import date

import metpy.calc as mcalc
import pandas as pd
Expand All @@ -19,6 +19,7 @@
from pyiem.exceptions import NoDataFound
from pyiem.plot import figure
from pyiem.util import get_autoplot_context
from sqlalchemy import text

PDICT = {
"mixing_ratio": "Mixing Ratio [g/kg]",
Expand All @@ -34,7 +35,7 @@
def get_description():
"""Return a dict describing how to call this plotter"""
desc = {"description": __doc__, "data": True}
today = datetime.date.today()
today = date.today()
desc["arguments"] = [
dict(
type="zstation",
Expand Down Expand Up @@ -75,16 +76,16 @@ def plotter(fdict):
varname = ctx["var"]
with get_sqlalchemy_conn("asos") as conn:
df = pd.read_sql(
"""
text("""
SELECT extract(year from valid) as year,
coalesce(mslp, alti * 33.8639, 1013.25) as slp,
extract(doy from valid) as doy, tmpf, dwpf, relh from alldata
where station = %s and dwpf > -50 and dwpf < 90 and
where station = :station and dwpf > -50 and dwpf < 90 and
tmpf > -50 and tmpf < 120 and valid > '1950-01-01'
and report_type = 3
""",
"""),
conn,
params=(station,),
params={"station": station},
index_col=None,
)
if df.empty:
Expand Down
8 changes: 4 additions & 4 deletions pylib/iemweb/autoplot/scripts100/p129.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"""

import calendar
import datetime
from datetime import date

import pandas as pd
from pyiem.database import get_sqlalchemy_conn
Expand Down Expand Up @@ -79,7 +79,7 @@ def add_ctx(ctx):
GROUP by year, month ORDER by year desc, month ASC
""",
conn,
params=(level, station, datetime.date.today().replace(day=1)),
params=(level, station, date.today().replace(day=1)),
index_col=None,
)
if monthly.empty:
Expand Down Expand Up @@ -116,7 +116,7 @@ def add_ctx(ctx):
station,
ctx["_nt"].sts[station]["name"],
bs.year,
datetime.date.today().year,
date.today().year,
)
return ctx

Expand Down Expand Up @@ -229,7 +229,7 @@ def plotter(fdict):
ax.text(
idx,
row["rank"],
"%.1f" % (row["rank"],),
f"{row['rank']:.1f}",
ha="left",
color="k",
zorder=5,
Expand Down
8 changes: 2 additions & 6 deletions pylib/iemweb/autoplot/scripts100/p138.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,10 @@
import pandas as pd
from metpy.calc import wind_components, wind_direction
from metpy.units import units as munits
from pyiem.database import get_sqlalchemy_conn
from pyiem.exceptions import NoDataFound
from pyiem.plot import figure_axes
from pyiem.util import (
convert_value,
drct2text,
get_autoplot_context,
get_sqlalchemy_conn,
)
from pyiem.util import convert_value, drct2text, get_autoplot_context

UNITS = {"mph": "miles per hour", "kt": "knots", "mps": "meters per second"}
UNITCONV = {"mph": "miles / hour", "kt": "knot", "mps": "meter / second"}
Expand Down
22 changes: 11 additions & 11 deletions pylib/iemweb/autoplot/scripts100/p142.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
If you plot a statewide average, you get no USDM included.
"""

import datetime
import sys
from datetime import date, datetime, timedelta

import matplotlib.dates as mdates
import pandas as pd
Expand All @@ -38,8 +38,8 @@
def get_description():
"""Return a dict describing how to call this plotter"""
desc = {"description": __doc__, "data": True, "cache": 86400}
today = datetime.date.today()
sts = today - datetime.timedelta(days=720)
today = date.today()
sts = today - timedelta(days=720)
desc["arguments"] = [
dict(
type="station",
Expand Down Expand Up @@ -85,7 +85,7 @@ def get_description():

def underlay_usdm(axis, sts, ets, lon, lat):
"""Underlay the USDM as pretty bars, somehow"""
if ets < datetime.date(2000, 1, 1):
if ets < date(2000, 1, 1):
axis.text(
0.0,
1.03,
Expand Down Expand Up @@ -115,11 +115,11 @@ def underlay_usdm(axis, sts, ets, lon, lat):
for row in data["data"]:
if row["category"] is None:
continue
ts = datetime.datetime.strptime(row["valid"], "%Y-%m-%d")
date = datetime.date(ts.year, ts.month, ts.day)
ts = datetime.strptime(row["valid"], "%Y-%m-%d")
dt = date(ts.year, ts.month, ts.day)
axis.axvspan(
date,
date + datetime.timedelta(days=7),
dt,
dt + timedelta(days=7),
color=COLORS[row["category"]],
zorder=-3,
)
Expand Down Expand Up @@ -241,9 +241,9 @@ def plotter(fdict):

(l1,) = ax.plot(
df.index.values,
df["p1_" + pvar + "_" + how],
df[f"p1_{pvar}_{how}"],
lw=2,
label="%s Day" % (p1,),
label=f"{p1} Day",
zorder=5,
)
(l2,) = ax.plot(
Expand Down Expand Up @@ -301,7 +301,7 @@ def plotter(fdict):
)
except Exception as exp:
sys.stderr.write(str(exp))
offset = datetime.timedelta(days=2)
offset = timedelta(days=2)
ax.set_xlim(df.index.min() - offset, df.index.max() + offset)

return fig, df
2 changes: 2 additions & 0 deletions tests/iemweb/autoplot/urllist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@
/plotting/auto/plot/109/by:wfo::sdate:2023-10-01%200000::edate:2024-07-04%202359::var:count::w:set::phenomenav1:TO::significancev1:W::e:yes::cmap:jet::_r:t::dpi:100.png
/plotting/auto/plot/109/by:state::sdate:2023-10-01%200000::edate:2024-07-04%202359::var:days::w:set::phenomenav1:TO::significancev1:W::e:yes::cmap:jet::_r:t::dpi:100.png
/plotting/auto/plot/109/by:state::sdate:2023-10-01%200000::edate:2024-07-04%202359::var:days::w:all::phenomenav1:TO::significancev1:W::e:yes::cmap:jet::_r:t::dpi:100.png
/plotting/auto/plot/109/by:wfo::sdate:2024-01-01%200000::edate:2024-12-24%202359::var:days::w:set::phenomenav1:SV::significancev1:W::e:all::cmap:jet::_r:t::dpi:100.png
/plotting/auto/plot/109/by:wfo::sdate:2024-01-01%200000::edate:2024-12-24%202359::var:tpercent::w:set::phenomenav1:SV::significancev1:W::e:all::cmap:jet::_r:t::dpi:100.png
/plotting/auto/plot/111/_cb:1.txt
/plotting/auto/plot/112/_cb:1.txt
/plotting/auto/plot/113/network:IACLIMATE::station:IATAME::var:maxmin::year1:2023::sday:0101::eday:1231::_r:43::dpi:100.png
Expand Down

0 comments on commit e3a4fd9

Please sign in to comment.