Skip to content

Commit

Permalink
Merge pull request #196 from akrherz/230928
Browse files Browse the repository at this point in the history
Non-func sundry stuff
  • Loading branch information
akrherz authored Nov 9, 2023
2 parents 1439e4a + 5fe59fd commit d6b8371
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 24 deletions.
7 changes: 2 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
repos:
- repo: https://github.com/python/black
rev: 23.9.1
hooks:
- id: black
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: "v0.0.291"
rev: "v0.1.5"
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[tool.black]
line-length = 79

[tool.ruff]
line-length = 79
select = ["E", "F", "I"]
target-version = "py39"

3 changes: 2 additions & 1 deletion scripts/cligen/daily_clifile_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,9 @@ def load_iemre(nc, data, valid):
nn = NearestNDInterpolator(
(np.ravel(lons), np.ravel(lats)), np.ravel(ncdata)
)
# 30 found to be too high (13 Sep 2008)
data["wind"][:] = iemre_bounds_check(
"wind_speed", nn(data["lon"], data["lat"]), 0, 30
"wind_speed", nn(data["lon"], data["lat"]), 0, 40
)


Expand Down
4 changes: 1 addition & 3 deletions scripts/gridorder/flowpath_attrs.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@
102802010404
102802010209
070801010701
070801010702""".split(
"\n"
)
070801010702""".split("\n")
SCEN2CODE = [None, 12, 13, 14, 0, 15, 16]


Expand Down
8 changes: 3 additions & 5 deletions scripts/plots/plot_huc12_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ def main(argv):
index_col="id",
)
ofes["del_tonnes"] = oferesults["delivery_2010[t/a/yr]"] * 2.24
# fields["color"] = '#EEEEEE'
# fields.loc[fields["fbndid"].isin(ofes["fbndid"]), "color"] = '#00cc00'
# fields.loc[fields["isag"] & fields["color"] == "#EEEEEE", "color"] = '#cc0000'
extent = df.total_bounds
buffer = 0.01
huc10 = df.dissolve(aggfunc="mean").copy()
Expand All @@ -91,8 +88,9 @@ def main(argv):
logo="dep",
nocaption=True,
title="DEP 2010 Iowa Hillslope Soil Delivery",
subtitle=f"Iowa Avg: {huc10['del_tonnes'].values[0]:.2f} tonnes/hectare"
# subtitle="HUC12: 071000081505. Note: Flowpath/OFE size not to scale.",
subtitle=(
f"Iowa Avg: {huc10['del_tonnes'].values[0]:.2f} tonnes/hectare"
),
)
cmap = mpcolors.ListedColormap(
"#FFFF80 #FCDD60 #E69729 #B35915 #822507".split(),
Expand Down
8 changes: 2 additions & 6 deletions scripts/tillage/flowpath2prj.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,7 @@ def do_flowpath(zone, huc_12, fid, fpath):
res["slpdata"] = slpdata

for d, s in zip(soillengths, soils):
res[
"soils"
] += """ %s {
res["soils"] += """ %s {
Distance = %.3f
File = "/i/0/sol_input/MWDEP_%s.SOL"
}\n""" % (
Expand Down Expand Up @@ -304,9 +302,7 @@ def do_flowpath(zone, huc_12, fid, fpath):
res["managements"] = ""

for d, s in zip(manlengths, mans):
res[
"managements"
] += """ %s {
res["managements"] += """ %s {
Distance = %.3f
File = "%s"
}\n""" % (
Expand Down
7 changes: 6 additions & 1 deletion scripts/util/yearly_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,16 @@ def main(argv):
ha="center",
)
ax.axhline(
df["detachment_ta"].mean(), label="mean", zorder=5, color="k", lw=1.5
df["detachment_ta"].mean(),
label=f"mean {df['detachment_ta'].mean():.2f}",
zorder=5,
color="k",
lw=1.5,
)
ax.legend(loc="best")
ax.grid(True)
ax.set_xlim(df.index.values[0] - 0.5, df.index.values[-1] + 0.5)
ax.set_ylim(0, 3.5)
ax.set_ylabel("Yearly Detatchment [tons/acre]")
ax.set_title(
f"{state_names[state]} Daily Erosion Project Iowa's Yearly Detachment"
Expand Down

0 comments on commit d6b8371

Please sign in to comment.