Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jan 13, 2025
1 parent 0cc5c5d commit 9236971
Show file tree
Hide file tree
Showing 15 changed files with 18 additions and 31 deletions.
4 changes: 1 addition & 3 deletions scripts/biomass/huc12_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ def main():
nologo=True,
subtitle="1 Jan 2014 thru 31 Dec 2014",
caption="Daily Erosion Project",
title=(
"Harvest Index 0.8 Change in 2014 Soil Delivery " "from Baseline"
),
title=("Harvest Index 0.8 Change in 2014 Soil Delivery from Baseline"),
)

cursor.execute(
Expand Down
2 changes: 1 addition & 1 deletion scripts/cligen/daily_clifile_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ def _cb_lp(args):
def bpstr(ts, accum):
"""Make a string representation of this breakpoint and accumulation"""
# Need four decimals for accurate reproduction
return f"{ts.hour:02.0f}.{(ts.minute / 60. * 10000.):04.0f} {accum:.2f}"
return f"{ts.hour:02.0f}.{(ts.minute / 60.0 * 10000.0):04.0f} {accum:.2f}"


def compute_breakpoint(ar, accumThreshold=2.0, intensityThreshold=1.0):
Expand Down
2 changes: 1 addition & 1 deletion scripts/cligen/exercise.py
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ def edit(bpdata):
pos2 = o.find("12\t6\t2015")
out = open("/i/0/cli/095x041/094.86x040.84.cli", "w")
newdata = (
"11\t6\t2015\t%(points)s\t25.0\t20.0\t269\t4.2\t0\t20.0\n" "%(bp)s\n"
"11\t6\t2015\t%(points)s\t25.0\t20.0\t269\t4.2\t0\t20.0\n%(bp)s\n"
) % dict(points=len(bpdata), bp=("\n".join(bpdata)))
out.write(o[:pos1] + newdata + o[pos2:])
out.close()
Expand Down
2 changes: 1 addition & 1 deletion scripts/cligen/qc_summarize.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def do_qc(fn, df, year):
df2 = df.loc[slice(datetime.date(year, 1, 1), datetime.date(year, 1, 31))][
["diff_precip", "pcpn_in", "iemre_precip", "stage4_precip"]
].sort_values(by="diff_precip")
print(" --- Daily values for month " "")
print(" --- Daily values for month ")
print(df2)


Expand Down
4 changes: 1 addition & 3 deletions scripts/climatechange/figure2.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@

def main():
"""Go Main Go."""
title = (
"Change in Hillslope Soil Loss\n" "by -/+ 14 Day Precipitation Shift"
)
title = "Change in Hillslope Soil Loss\nby -/+ 14 Day Precipitation Shift"
(fig, ax) = figure_axes(
logo="dep",
title=title,
Expand Down
2 changes: 1 addition & 1 deletion scripts/dynamic_tillage/map_myhucs.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def main():
logo="dep",
title="HUC12s Selected for Erosion Sensitivity Test",
subtitle=(
f"{len(hucdf.index)} HUC12s selected over " f"{len(mlras)} MLRAs"
f"{len(hucdf.index)} HUC12s selected over {len(mlras)} MLRAs"
),
nocaption=True,
)
Expand Down
8 changes: 2 additions & 6 deletions scripts/dynamic_tillage/nass_comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,10 +381,7 @@ def plot_accum(
def plot_v2(ax2, crop, year, district, state):
"""Plot v2."""
v2df = pd.read_csv(
(
f"plotsv2/{crop}_{year}_{district if state is None else state}"
".csv"
),
(f"plotsv2/{crop}_{year}_{district if state is None else state}.csv"),
parse_dates=["valid"],
)
v2df["valid"] = v2df["valid"].dt.date
Expand Down Expand Up @@ -474,8 +471,7 @@ def main(
fig = figure(
logo="dep",
title=(
f"{year} DEP Dynamic Tillage {crop.capitalize()} "
"Planting Progress"
f"{year} DEP Dynamic Tillage {crop.capitalize()} Planting Progress"
),
subtitle=f"Comparison with USDA NASS Weekly Progress for {title}",
figsize=(10.24, 7.68),
Expand Down
4 changes: 1 addition & 3 deletions scripts/dynamic_tillage/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,7 @@ def edit_rotfile(year, huc12, row):
thisdt = dates.pop(0)
if thisdt is None:
thisdt = row["plant"]
lines[i] = (
f"{thisdt:%-m %-d} {yearindex} " f"{' '.join(tokens[3:])}\n"
)
lines[i] = f"{thisdt:%-m %-d} {yearindex} {' '.join(tokens[3:])}\n"
with open(rotfn, "w", encoding="ascii") as fh:
fh.write("".join(lines))

Expand Down
2 changes: 1 addition & 1 deletion scripts/gridorder/huc12_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
axisbg="white",
nologo=True,
subtitle="1 Jan 2007 thru 31 Dec 2016",
title=("Grid Order %s minus Grid Order %s " "Soil Delivery")
title=("Grid Order %s minus Grid Order %s Soil Delivery")
% (titles2[scenario1], titles2[scenario2]),
)

Expand Down
4 changes: 1 addition & 3 deletions scripts/import/create_website_mask.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ def main():

fig.savefig("depdomain.png")
with open("depdomain.wld", "w", encoding="utf-8") as fp:
fp.write(
"2000.\n" "0.0\n" "0.0\n" "-2000.\n" f"{ulx:.2f}\n" f"{uly:.2f}\n"
)
fp.write(f"2000.\n0.0\n0.0\n-2000.\n{ulx:.2f}\n{uly:.2f}\n")
# Now make white color transparent
subprocess.call(
[
Expand Down
6 changes: 3 additions & 3 deletions scripts/import/flowpath2prj.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,15 @@ def do_rotation(scenario, zone, rotfn, landuse: str, management):
# Created with scripts/import/flowpath2prj.py
#
Version = 98.7
Name = {data['name']}
Name = {data["name"]}
Description {{
}}
Color = 0 255 0
LandUse = 1
InitialConditions = {data['initcond']}
InitialConditions = {data["initcond"]}
Operations {{
{data['yearly']}
{data["yearly"]}
}}
"""
)
Expand Down
2 changes: 1 addition & 1 deletion scripts/plots/yearly_avg_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def main(argv):
f"""
WITH data as (
SELECT huc_12, extract(year from valid) as yr,
sum({v.replace('_metric', '')}) as d from results_by_huc12
sum({v.replace("_metric", "")}) as d from results_by_huc12
WHERE scenario = %s and valid >= %s and valid <= %s
GROUP by huc_12, yr),
Expand Down
2 changes: 1 addition & 1 deletion scripts/switchgrass/modify_for_switchgrass.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def main(argv):
and line.find('File = "IDEP2/') > 0
):
lines[i] = (
" File = " '"IDEP2/CSCAP/SWITCHGRASS.rot"\n'
' File = "IDEP2/CSCAP/SWITCHGRASS.rot"\n'
)
fp = open(newfn, "w")
fp.write("".join(lines))
Expand Down
3 changes: 1 addition & 2 deletions scripts/tillage/residue_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ def main():
]
fig, ax = figure_axes(
title=(
"2017-2022 Distribution of Residue "
"Cover Estimate after Given Crop"
"2017-2022 Distribution of Residue Cover Estimate after Given Crop"
),
logo="dep",
figsize=(8, 6),
Expand Down
2 changes: 1 addition & 1 deletion scripts/ucs/huc12_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
axisbg="white",
nologo=True,
subtitle="1 Jan 2008 thru 31 Dec 2015",
title=("UCS %s Year %s Scenario Change in Soil Delivery " "from Baseline")
title=("UCS %s Year %s Scenario Change in Soil Delivery from Baseline")
% (titles2[scenario], nt.get(scenario, "")),
)

Expand Down

0 comments on commit 9236971

Please sign in to comment.