Skip to content

Commit

Permalink
mnt: address lint
Browse files Browse the repository at this point in the history
  • Loading branch information
akrherz committed Feb 9, 2024
1 parent adacbf2 commit 7ca36f9
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 28 deletions.
3 changes: 2 additions & 1 deletion scripts/dbutil/add_iem_data_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"""
import datetime

from pyiem.util import get_dbconnc, logger
from pyiem.database import get_dbconnc
from pyiem.util import logger

LOG = logger()

Expand Down
3 changes: 2 additions & 1 deletion scripts/dbutil/add_summary_entries.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
import datetime
import sys

from pyiem.util import get_dbconn, logger
from pyiem.database import get_dbconn
from pyiem.util import logger

LOG = logger()

Expand Down
3 changes: 2 additions & 1 deletion scripts/dbutil/clean_afos.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
called from RUN_2AM.sh
"""

from pyiem.database import get_dbconn
from pyiem.reference import state_names
from pyiem.util import get_dbconn, logger
from pyiem.util import logger

LOG = logger()

Expand Down
3 changes: 2 additions & 1 deletion scripts/dbutil/clean_mos.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
Run from `RUN_2AM.sh` script.
"""

from pyiem.util import get_dbconn, logger
from pyiem.database import get_dbconn
from pyiem.util import logger

LOG = logger()

Expand Down
3 changes: 2 additions & 1 deletion scripts/dbutil/clean_telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"""
from datetime import datetime, timedelta

from pyiem.util import get_dbconnc, logger
from pyiem.database import get_dbconnc
from pyiem.util import logger

LOG = logger()

Expand Down
3 changes: 2 additions & 1 deletion scripts/dbutil/clean_unknown_hads.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
Run from RUN_2AM.sh
"""

from pyiem.util import get_dbconn, logger
from pyiem.database import get_dbconn
from pyiem.util import logger

LOG = logger()

Expand Down
44 changes: 22 additions & 22 deletions scripts/iemre/daily_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,28 +133,28 @@ def copy_iemre_hourly(ts, ds):
ds[vname].values = res

# One off
for vname in ["wind_speed"]:
hours = 0
runningsum = None
for pair in pairs:
ncfn = iemre.get_hourly_ncname(pair[0].year)
tidx1 = iemre.hourly_offset(pair[0])
tidx2 = iemre.hourly_offset(pair[1])
with ncopen(ncfn, timeout=600) as nc:
uwnd = nc.variables["uwnd"]
vwnd = nc.variables["vwnd"]
for offset in range(tidx1, tidx2 + 1):
val = (uwnd[offset] ** 2 + vwnd[offset] ** 2) ** 0.5
if val.mask.all():
LOG.info("No wind for offset: %s", offset)
continue
if runningsum is None:
runningsum = val
else:
runningsum += val
hours += 1
if hours > 0:
ds["wind_speed"].values = runningsum / hours
hours = 0
runningsum = None
for pair in pairs:
ncfn = iemre.get_hourly_ncname(pair[0].year)
tidx1 = iemre.hourly_offset(pair[0])
tidx2 = iemre.hourly_offset(pair[1])
with ncopen(ncfn, timeout=600) as nc:
uwnd = nc.variables["uwnd"]
vwnd = nc.variables["vwnd"]
for offset in range(tidx1, tidx2 + 1):
val = (uwnd[offset] ** 2 + vwnd[offset] ** 2) ** 0.5
if val.mask.all():
LOG.info("No wind for offset: %s", offset)
continue
if runningsum is None:
runningsum = val
else:
runningsum += val
hours += 1
if hours > 0:
ds["wind_speed"].values = runningsum / hours
# -----------------------------------------------------------------
for vname in (
"high_tmpk low_tmpk p01d high_soil4t avg_dwpk "
"low_soil4t high_tmpk_12z low_tmpk_12z p01d_12z"
Expand Down

0 comments on commit 7ca36f9

Please sign in to comment.