Skip to content

Commit

Permalink
mnt: roundup some pandas 2.2 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
akrherz committed Jan 23, 2024
1 parent a8e303b commit b107749
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
8 changes: 5 additions & 3 deletions htdocs/plotting/auto/scripts200/p219.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ def plotter(fdict):
"""Go"""
ctx = get_autoplot_context(fdict, get_description())
valid = ctx["valid"].replace(tzinfo=datetime.timezone.utc)
pgconn = get_dbconn("asos")

def fetch(ts):
"""Getme data."""
Expand All @@ -129,11 +128,14 @@ def fetch(ts):

df = fetch(valid)
if df.empty:
pgconn = get_dbconn("asos")
valid = taf_search(pgconn, ctx["station"], valid)
pgconn.close()
if valid is None:
raise NoDataFound("TAF data was not found!")
df = fetch(valid)
df = df.fillna(np.nan)
# prevent all nan from becoming an object
df = df.fillna(np.nan).infer_objects()
df["next_valid"] = (
df.reset_index().shift(-1)["valid"].values - df.index.values
)
Expand Down Expand Up @@ -325,4 +327,4 @@ def fetch(ts):


if __name__ == "__main__":
plotter({"station": "PGUM", "valid": "2023-09-28 0542"})
plotter({})
1 change: 1 addition & 0 deletions scripts/climodat/daily_estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from pyiem.util import get_dbconn, get_sqlalchemy_conn, logger
from sqlalchemy import text

pd.set_option("future.no_silent_downcasting", True)
LOG = logger()
NON_CONUS = ["AK", "HI", "PR", "VI", "GU", "AS"]

Expand Down
2 changes: 1 addition & 1 deletion scripts/climodat/hrrr_solarrad.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def compute(df, sids, dt, do_regions=False):
yaxis = None
# date_range is inclusive
for now in pd.date_range(
sts, sts + datetime.timedelta(hours=23), freq="1H"
sts, sts + datetime.timedelta(hours=23), freq="1h"
):
# Try the newer f01 files, which have better data!
fn = now.strftime(
Expand Down
1 change: 1 addition & 0 deletions scripts/climodat/use_acis.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
logger,
)

pd.set_option("future.no_silent_downcasting", True)
LOG = logger()
SERVICE = "http://data.rcc-acis.org/StnData"
METASERVICE = "http://data.rcc-acis.org/StnMeta"
Expand Down
1 change: 1 addition & 0 deletions scripts/isusm/agg_1minute.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import pandas as pd
from pyiem.util import get_dbconn, get_sqlalchemy_conn, logger, utc

pd.set_option("future.no_silent_downcasting", True)
LOG = logger()
TIME_FORMAT = "%Y-%m-%d %H:%M-06"

Expand Down

0 comments on commit b107749

Please sign in to comment.