From f81f60a125b82cc33d3721691ba9d6912de58038 Mon Sep 17 00:00:00 2001 From: akrherz Date: Tue, 25 Feb 2025 08:13:53 -0600 Subject: [PATCH 1/4] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20Update=20eslint?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 050adbfa1..ce6b12a21 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ ci: autoupdate_schedule: quarterly repos: - repo: https://github.com/pre-commit/mirrors-eslint - rev: 'v9.20.1' + rev: 'v9.21.0' hooks: - id: eslint - repo: https://github.com/astral-sh/ruff-pre-commit From 077ee5ac7ab4f92fd5cb60c9ee73bf501acebec9 Mon Sep 17 00:00:00 2001 From: akrherz Date: Tue, 25 Feb 2025 09:16:54 -0600 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=8E=A8=20Separate=20out=20js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/sites/hist.js | 5 +++++ htdocs/sites/hist.phtml | 16 +++++----------- 2 files changed, 10 insertions(+), 11 deletions(-) create mode 100644 htdocs/sites/hist.js diff --git a/htdocs/sites/hist.js b/htdocs/sites/hist.js new file mode 100644 index 000000000..52fe2e2f8 --- /dev/null +++ b/htdocs/sites/hist.js @@ -0,0 +1,5 @@ +/* global $ */ + +$(document).ready(() => { + $("#thetable").DataTable(); +}); \ No newline at end of file diff --git a/htdocs/sites/hist.phtml b/htdocs/sites/hist.phtml index df855e94d..a0feb02ea 100644 --- a/htdocs/sites/hist.phtml +++ b/htdocs/sites/hist.phtml @@ -1,5 +1,4 @@ {$lstr}{$title} {$nstr} SundayMondayTuesdayWednesday ThursdayFridaySaturday -EOF; +EOM; // Handle the first week $now = $sts; @@ -322,12 +321,12 @@ $htmlout .= <<< EOM exists as well.

EOM; -$content = <<
-EOF; +EOM; $startyear = 2002; if (!is_null($metadata["archive_begin"])) { $startyear = $metadata["archive_begin"]->format("Y"); @@ -365,11 +364,6 @@ $t->headextra = <<jsextra = << - - + EOM; $t->render('sites.phtml'); From 3405a820573bc3a19c24b6a79d7dc249f303e9ed Mon Sep 17 00:00:00 2001 From: akrherz Date: Tue, 25 Feb 2025 09:19:41 -0600 Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=9A=9A=20Move=20mesosite=20db=20shard?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/util/set_iemdb_etc_hosts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/util/set_iemdb_etc_hosts.py b/scripts/util/set_iemdb_etc_hosts.py index 186ae39d2..6f328c5f4 100644 --- a/scripts/util/set_iemdb_etc_hosts.py +++ b/scripts/util/set_iemdb_etc_hosts.py @@ -26,7 +26,7 @@ "-isuag": IPS[DB1], "-kcci": IPS[DB1], "-mesonet": IPS[DB1], - "-mesosite": IPS[DB1], + "-mesosite": IPS[DB2], # needs 10g "-mos": IPS[DB1], "-nc1018": IPS[DB1], "-nldn": IPS[DB2], From 3f2cde77a4e2b6b7286796e39ca6e1de460e0b17 Mon Sep 17 00:00:00 2001 From: akrherz Date: Tue, 25 Feb 2025 09:44:05 -0600 Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=90=9B=20Fix=20wfo3/wfo4=20and=20othe?= =?UTF-8?q?r=20bugs=20for=20yearly=20counts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://mesonet.agron.iastate.edu/vtec/yearly_counts.php closes #1124 --- htdocs/vtec/yearly_counts.php | 45 +++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/htdocs/vtec/yearly_counts.php b/htdocs/vtec/yearly_counts.php index c95fd7b87..f13a593bf 100644 --- a/htdocs/vtec/yearly_counts.php +++ b/htdocs/vtec/yearly_counts.php @@ -6,21 +6,23 @@ require_once "../../include/vtec.php"; require_once "../../include/network.php"; require_once "../../include/forms.php"; +require_once "../../include/imagemaps.php"; $nt = new NetworkTable("WFO"); $clobber = isset($_REQUEST["clobber"]); -$wfo = isset($_REQUEST["wfo"]) ? strtoupper(substr(xssafe($_REQUEST["wfo"]), 0, 3)) : null; +$wfo = isset($_REQUEST["wfo"]) ? strtoupper(substr(xssafe($_REQUEST["wfo"]), 0, 4)) : "_ALL"; +$wfo3 = unrectify_wfo($wfo); $phenomena = isset($_REQUEST["phenomena"]) ? strtoupper(substr(xssafe($_REQUEST["phenomena"]), 0, 2)) : null; $significance = isset($_REQUEST["significance"]) ? strtoupper(substr(xssafe($_REQUEST["significance"]), 0, 1)) : null; $wfoLimiter = ""; $wfoMsg = "Data for all WFOs shown"; -if ($wfo) { - $wfoLimiter = " and wfo = '{$wfo}' "; +if ($wfo != "_ALL") { + $wfoLimiter = " and wfo = '{$wfo3}' "; $wfoMsg = "Data for only $wfo shown"; } -$p1 = make_select("phenomena", $phenomena, $vtec_phenomena); -$s1 = make_select("significance", $significance, $vtec_significance); +$p1 = make_select("phenomena", $phenomena, $vtec_phenomena, $showvalue = TRUE); +$s1 = make_select("significance", $significance, $vtec_significance, $showvalue = TRUE); $t = new MyView(); $t->title = "VTEC Yearly Event Counts"; @@ -34,12 +36,13 @@ function get_data() $dbconn, " SELECT yr, phenomena, significance, count(*) from - (SELECT distinct extract(year from issue) as yr, wfo, + (SELECT distinct vtec_year as yr, wfo, phenomena, significance, eventid from warnings WHERE significance is not null and phenomena is not null and issue > '1980-01-01' $wfoLimiter) as foo GROUP by yr, phenomena, significance - "); + " + ); $data = array(); $pcodes = array(); @@ -64,12 +67,13 @@ function get_data2() $dbconn, " WITH data as ( - SELECT distinct wfo, eventid, extract(year from issue) as yr + SELECT distinct wfo, eventid, vtec_year as yr from warnings where phenomena = '$phenomena' and significance = '$significance' ) SELECT wfo, yr, count(*) from data GROUP by wfo, yr - "); + " + ); $data = array(); for ($i = 0; $row = pg_fetch_assoc($rs); $i++) { @@ -99,7 +103,7 @@ function get_data2() $table = << - PSPhenomenaSignificance + PSPhenomenaSignificance EOF; $years = array_keys($data); asort($years); @@ -144,7 +148,7 @@ function get_data2() $table = << - WFOWFO Name + WFOWFO Name EOF; $years = array_keys($data); asort($years); @@ -154,14 +158,15 @@ function get_data2() $table .= "\n"; foreach ($nt->table as $key => $val) { + $wfo3 = unrectify_wfo($key); $table .= sprintf( "%s%s", $key, $val["name"] ); foreach ($years as $i => $yr) { - if (array_key_exists($key, $data[$yr])) { - $table .= sprintf("%s", $data[$yr][$key]); + if (array_key_exists($wfo3, $data[$yr])) { + $table .= sprintf("%s", $data[$yr][$wfo3]); } else { $table .= "0"; } @@ -197,18 +202,18 @@ function get_data2() your favorite spreadsheet program for further analysis... $cachedwarning - +

Option 1: All VTEC Events by Year

Limit Numbers by WFO: EOF; -$content .= "