Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

freq H -> h #34

Merged
merged 1 commit into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/mosa/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def classify_one(g: gpd.GeoDataFrame, *, pre: str = "", include_stats: bool = Fa
# Assuming instantaneous times, need 5 h for the 4 continuous h criteria
# but for accumulated (during previous time step), 4 is fine(?) (according to Andy)
n = 4
meets_crit_duration = duration >= pd.Timedelta(f"{n}H")
meets_crit_duration = duration >= pd.Timedelta(f"{n}h")
# TODO: ^ not really one of the 4 criteria (though needed for 1 and 2)

# Compute rainfall volume
Expand Down
4 changes: 2 additions & 2 deletions examples/mosa/run-mosa-step1.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def proc(fn, files):

if do_bench:
# WRF 1--7 Nov 2018
times = pd.date_range("2018-11-01", "2018-11-07 23:00", freq="H")
times = pd.date_range("2018-11-01", "2018-11-07 23:00", freq="h")
files = [BASE_DIR / "WY2019" / "WRF" / f"tb_rainrate_{t:%Y-%m-%d_%H}:00.nc" for t in times]

print(files[0])
Expand Down Expand Up @@ -77,7 +77,7 @@ def proc(fn, files):
fn = partial(preproc_gpm_file, out_dir=out_dir)
for wy in wys:
# The WRF file sets start in June of previous year
ts = pd.date_range(f"{wy - 1}/06/01", f"{wy}/06/01", freq="H")[:-1]
ts = pd.date_range(f"{wy - 1}/06/01", f"{wy}/06/01", freq="h")[:-1]
rfns = ts.strftime(r"%Y") + "/merg_" + ts.strftime(r"%Y%m%d%H") + "_4km-pixel.nc"
files = [BASE_DIR / "GPM" / rfn for rfn in rfns]
print(files[0])
Expand Down
2 changes: 1 addition & 1 deletion examples/mosa/run-mosa-step2.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import pandas as pd

# WRF 1--7 Nov 2018
times = pd.date_range("2018-11-01", "2018-11-07 23:00", freq="H")
times = pd.date_range("2018-11-01", "2018-11-07 23:00", freq="h")
files = [IN_DIR / f"tb_rainrate_{t:%Y-%m-%d_%H}:00_ce.parquet" for t in times]

print(files[0])
Expand Down
2 changes: 1 addition & 1 deletion examples/mosa/run-mosa-step3.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def run_gdf(fp: Path, *, bench: bool = False) -> None:
for vn in vns_non_time:
ds[vn] = ds0[vn]

times_should_be = pd.date_range(f"{wy - 1}/06/01", f"{wy}/06/01", freq="H")[:-1]
times_should_be = pd.date_range(f"{wy - 1}/06/01", f"{wy}/06/01", freq="h")[:-1]
nt_missing = 0
for t_ in times_should_be:
if t_ not in ds.time.values:
Expand Down
4 changes: 2 additions & 2 deletions tams/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def load_example_ir() -> xarray.DataArray:
ds.lat.attrs.update(long_name="Latitude")

# Times are 2006-Sep-01 00 -- 10, every 2 hours
ds["time"] = pd.date_range("2006-Sep-01", freq="2H", periods=6)
ds["time"] = pd.date_range("2006-Sep-01", freq="2h", periods=6)

return ds.ch9

Expand Down Expand Up @@ -282,7 +282,7 @@ def load_example_mpas_ug() -> xarray.Dataset:
ds["tb"] = ds.tb.where(ds.tb > 0)

# Set time (time variable in there just has elapsed hours as int)
ds["time"] = pd.date_range("2006-Sep-08 12", freq="1H", periods=ds.sizes["time"])
ds["time"] = pd.date_range("2006-Sep-08 12", freq="1h", periods=ds.sizes["time"])

# Diff accumulated precip to get mm/h
ds["precip"] = ds.precip.diff("time", label="lower")
Expand Down