diff --git a/htdocs/sites/scp.php b/htdocs/sites/scp.php index e21256eda..9b992ee89 100644 --- a/htdocs/sites/scp.php +++ b/htdocs/sites/scp.php @@ -36,13 +36,15 @@ $exturi = sprintf( "https://mesonet.agron.iastate.edu/" . - "api/1/scp.json?station=%s&date=%s", + "api/1/scp.json?station=%s&date=%s&tz=%s", $station, - date("Y-m-d", $date) + date("Y-m-d", $date), + $metadata["tzname"], ); $arr = array( "station" => $station, "date" => date("Y-m-d", $date), + "tz" => $metadata["tzname"], ); $json = iemws_json("scp.json", $arr); if ($json === FALSE) { @@ -88,8 +90,11 @@ function skyc($row, $i) $table = << - -SCP Valid UTC$headerASOS METAR Report + + +SCP Valid UTC +METAR Valid Local +$headerASOS METAR Report $header2Levels ftMETAR @@ -103,8 +108,9 @@ function skyc($row, $i) continue; } $table .= sprintf( - "%sZ", - gmdate("Hi", strtotime($row["utc_scp_valid"])) + "%sZ%s", + gmdate("Hi", strtotime($row["utc_scp_valid"])), + date("g:i A", strtotime($row["local_valid"])) ); foreach ($birds as $b) { $table .= sprintf( diff --git a/scripts/dl/download_narr.py b/scripts/dl/download_narr.py index 6470001ac..a80825d01 100644 --- a/scripts/dl/download_narr.py +++ b/scripts/dl/download_narr.py @@ -13,7 +13,7 @@ import click import httpx import pygrib -from pyiem.util import exponential_backoff, logger +from pyiem.util import logger LOG = logger() TMP = "/mesonet/tmp" @@ -59,10 +59,12 @@ def fetch_rda(year, month): "https://data.rda.ucar.edu/ds608.0/3HRLY/" f"{year}/NARRsfc_{year}{month:02.0f}_{day}.tar" ) - req = exponential_backoff(httpx.get, uri, timeout=30, stream=True) tmpfn = f"{TMP}/narr.tar" - with open(tmpfn, "wb") as fh: - for chunk in req.iter_content(chunk_size=1024): + with ( + httpx.stream("GET", uri, timeout=30) as resp, + open(tmpfn, "wb") as fh, + ): + for chunk in resp.iter_bytes(chunk_size=1024): if chunk: fh.write(chunk) process(tmpfn)