Skip to content

Commit

Permalink
Merge pull request #1099 from akrherz/250207
Browse files Browse the repository at this point in the history
Omnibus
  • Loading branch information
akrherz authored Feb 8, 2025
2 parents 52b3bd7 + 7d68a95 commit 17b693c
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 34 deletions.
30 changes: 30 additions & 0 deletions .github/ci_db_testdata.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"""Update The Test Database.
The test database instance for CI has static data for testing. This is static
from the time of the docker image build. This script runs from GHA and does
some mucking with the database to improve coverage.
"""

from pyiem.database import get_sqlalchemy_conn, sql_helper


def main():
"""Go Main."""
with get_sqlalchemy_conn("id3b") as conn:
conn.execute(
sql_helper("""
update ldm_product_log SET
entered_at = now() - ('2024-12-03 19:30+00'::timestamptz - entered_at),
valid_at = now() - ('2024-12-03 19:30+00'::timestamptz - valid_at),
wmo_valid_at = now() -
('2024-12-03 19:30+00'::timestamptz - wmo_valid_at)
where entered_at between '2024-12-03 16:00+00'
and '2024-12-03 20:00+00'
""")
)
conn.commit()


if __name__ == "__main__":
main()
1 change: 1 addition & 0 deletions .github/setupdata.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Ensure we error out
set -x -e
# Paths are setup in setuppaths.sh
python .github/ci_db_testdata.py
python scripts/dbutil/sync_stations.py
python scripts/mrms/init_daily_mrms.py --year=2024
python scripts/mrms/init_mrms_dailyc.py
Expand Down
32 changes: 11 additions & 21 deletions htdocs/GIS/apps/rview/warnings.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
function addTime() {
const d = new Date();
document.form.tzoff.value = (d.getTimezoneOffset() * 60);
}

function showControl(layerName) {
import $ from '/js/jquery.module.js';

export function showControl(layerName) {
const oldval = document.getElementById(layerName).style.display;
setLayerDisplay("layers-control", 'none');
setLayerDisplay("locations-control", 'none');
Expand All @@ -13,23 +11,15 @@ function showControl(layerName) {
setLayerDisplay(layerName, 'block');
}
}
function setLayerDisplay(layerName, d) {
if (document.getElementById) {
const w = document.getElementById(layerName);
w.style.display = d;
}
}
function flipLayerDisplay(layerName) {
if (document.getElementById) {
const w = document.getElementById(layerName);
if (w.style.display === "none") {
w.style.display = "block";
} else {
w.style.display = "none";
}
}

export function setLayerDisplay(layerName, dd) {
const ww = document.getElementById(layerName);
ww.style.display = dd;
}

$(document).ready(() => {
$(".iemselect2").select2();
$("#datawindow button").click((event) => {
const layer = $(event.target).data("control");
showControl(`${layer}-control`);
});
});
38 changes: 26 additions & 12 deletions htdocs/GIS/apps/rview/warnings.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,14 @@ if (isset($_GET["lat0"]) && isset($_GET["lon0"]) && $osite == $site) {

$t->title = "RADAR & NWS Warnings";
$jsextra = <<<EOM
<script type="text/javascript" src="warnings.js?v=2"></script>
<script type="module" src="warnings.js"></script>
<script src="/vendor/jquery-ui/{$JQUERYUI}/jquery-ui.min.js"></script>
<script language="javascript" type="text/javascript" src="/vendor/jsani/2.84/jquery.jsani.min.js"></script>
<script src="/vendor/select2/4.0.3/select2.min.js"></script>
<script language="JavaScript1.2" type="text/javascript">
$(document).ready(() => {
$(".iemselect2").select2();
});
EOM;
$headextra = <<<EOF
<link rel="stylesheet" href="/vendor/jquery-ui/{$JQUERYUI}/jquery-ui.min.css">
Expand Down Expand Up @@ -327,12 +330,16 @@ $miselect = minuteSelect($m, "minute", 5);

$achecked = ($isarchive) ? " CHECKED='CHECKED'" : "";
$dwwidth = $width + 250;
$content .= <<<EOF
$content .= <<<EOM
<div id="datawindow" style="background: #eee; width: {$dwwidth}px; z-index: 2;">
<input type="submit" value="Layers" style="background: #73FA4D;" onClick="javascript: showControl('layers-control'); return false;">
<input type="submit" value="Locations" style="background: #F2FE5A;" onClick="javascript: showControl('locations-control'); return false;">
<input type="submit" value="Time" style="background: #FF5EC4;" onClick="javascript: showControl('time-control'); return false;">
<input type="submit" value="Options" style="background: #2EA7F2;" onClick="javascript: showControl('options-control'); return false;">
<button type="button" data-control="layers" style="background: #73FA4D;">
Layers</button>
<button type="button" data-control="locations" style="background: #F2FE5A;">
Locations</button>
<button type="button" data-control="time" style="background: #FF5EC4;">
Time</button>
<button type="button" data-control="options" style="background: #2EA7F2;">
Options</button>
<input type="submit" value="Update Map">
<br />
<div id="layers-control" style="width: 450px; background: #73FA4D; display: none; z-index: 3; position: absolute; padding: 5px; margin: 2px; border: 2px solid #000;">
Expand All @@ -343,15 +350,18 @@ $content .= <<<EOF
{$lselect}
<input type="hidden" name="layers[]" value="blank">
<div style="float: right;"><input type="submit" onClick="javascript: setLayerDisplay('layers-control', 'none'); return false;" value="Save Settings"><input type="submit" value="Save + Update Map"> </div>
<div style="float: right;">
<button type="button" data-control="layers">Save Settings</button>
<input type="submit" value="Save + Update Map"> </div>
</div>
<div id="locations-control" style="width: 450px; background: #F2FE5A; display: none; z-index: 3; position: absolute; padding: 5px; margin: 2px; border: 2px solid #000;">
<strong>NWS CWSU/WFO/RFC Office:</strong><br />
{$wselect}
<br />Selecting a different office will move the display to that office.
<div style="float: right;">
<input type="submit" onClick="javascript: setLayerDisplay('locations-control', 'none'); return false;" value="Save Settings"><input type="submit" value="Save + Update Map"> </div>
<button type="button" data-control="locations">Save Settings</button>
<input type="submit" value="Save + Update Map"> </div>
</div>
<div id="time-control" style="width: 450px; background: #FF5EC4; display: none; z-index: 3; position: absolute; padding: 5px; margin: 2px; border: 2px solid #000;">
<p><strong>Select Time Zone</strong><br />
Expand All @@ -368,7 +378,9 @@ the loop.</p>
<tr><th>Time:</th><td>{$hselect}:{$miselect}</td></tr>
</table>
<p><div style="float: right;"><input type="submit" onClick="javascript: setLayerDisplay('time-control', 'none'); return false;" value="Save Settings"><input type="submit" value="Save + Update Map"> </div>
<p><div style="float: right;">
<button type="button" data-control="time">Save Settings</button>
<input type="submit" value="Save + Update Map"> </div>
</div>
<div id="options-control" style="width: 450px; background: #2EA7F2; display: none; z-index: 3; position: absolute; padding: 5px; margin: 2px; border: 2px solid #000;">
<strong>Warning geography:</strong>
Expand Down Expand Up @@ -406,9 +418,11 @@ geography associated with them. You can pick which or both to display:
<br />Time window around plot valid time to plot LSRs.
<br />{$lrselect}
{$lwselect}
<div style="float: right;"><input type="submit" onClick="javascript: setLayerDisplay('options-control', 'none'); return false;" value="Save Settings"><input type="submit" value="Save + Update Map"> </div>
<div style="float: right;">
<button type="button" data-control="options">Save Settings</button>
<input type="submit" value="Save + Update Map"> </div>
</div>
EOF;
EOM;

$heightadd = 0;
$maptitle = "IEM NEXRAD Mosaic Base Reflectivity";
Expand All @@ -425,7 +439,7 @@ if ($loop === 1 || $loop === 2) {
$memcache = new Memcached();
$memcache->addServer('iem-memcached', 11211);
// UNIX time is not unique enough, so we multiply by a random int
$fts = time() * rand(1, 100);
$fts = time() * random_int(1, 100);
$memcache->set("/GIS/apps/rview/warnings.phtml?fts={$fts}", $urls, 86400);

$content .= "</form>";
Expand Down
4 changes: 4 additions & 0 deletions htdocs/js/jquery.module.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// https://stackoverflow.com/questions/34338411

import 'https://code.jquery.com/jquery-3.7.1.min.js'
export default window.jQuery.noConflict(true)
2 changes: 1 addition & 1 deletion scripts/ingestors/cocorahs/cocorahs_data_ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def frontend(dt: Optional[datetime]):
"""Do Logic."""
if dt is not None:
dt = dt.date()
with get_sqlalchemy_conn("iem") as conn:
with get_sqlalchemy_conn("coop") as conn:
main(conn, dt)
conn.commit()

Expand Down

0 comments on commit 17b693c

Please sign in to comment.