Skip to content

Commit 0f2c287

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 3bc0031 commit 0f2c287

File tree

10 files changed

+34
-34
lines changed

10 files changed

+34
-34
lines changed

docs/tutorials/ADCP_data_tutorial.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
" {\"long_name\": \"distance to coast\", \"units\": \"m\", \"positive\": \"shoreward\"}\n",
129129
")\n",
130130
"peru = peru.set_coords(\"s\").sortby(\"s\")\n",
131-
"print(f\"max distance from coast: {abs(peru.s.min()).data/1000:.2f} km\")"
131+
"print(f\"max distance from coast: {abs(peru.s.min()).data / 1000:.2f} km\")"
132132
]
133133
},
134134
{

docs/tutorials/CTD_data_tutorial.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,12 +263,12 @@
263263
"source": [
264264
"# Fill the dataset with values from the csv files.\n",
265265
"for ob in range(5): # loop through files\n",
266-
" header = pd.read_csv(f\"Japan/CTD_Japan_station_{ob+1}.csv\", nrows=7, header=None)\n",
266+
" header = pd.read_csv(f\"Japan/CTD_Japan_station_{ob + 1}.csv\", nrows=7, header=None)\n",
267267
" ctd.lon[ob] = header.iloc[0, 1]\n",
268268
" ctd.lat[ob] = header.iloc[1, 1]\n",
269269
" ctd.start_time[ob] = header.iloc[2, 1]\n",
270270
" ctd.end_time[ob] = header.iloc[3, 1]\n",
271-
" data = pd.read_csv(f\"Japan/CTD_Japan_station_{ob+1}.csv\", skiprows=4)\n",
271+
" data = pd.read_csv(f\"Japan/CTD_Japan_station_{ob + 1}.csv\", skiprows=4)\n",
272272
" ctd.P[:, ob] = data[\"pressure [hPa]\"]\n",
273273
" ctd.T[:, ob] = data[\"temperature [degC]\"]\n",
274274
" ctd.S[:, ob] = data[\"salinity [g kg-1]\"]"

docs/tutorials/Drifter_data_tutorial.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
" Drifter(\n",
8585
" Spacetime(\n",
8686
" Location(latitude=-30, longitude=lon),\n",
87-
" time=np.datetime64(f\"2023-07-{i+2:02d} 00:00:00\"),\n",
87+
" time=np.datetime64(f\"2023-07-{i + 2:02d} 00:00:00\"),\n",
8888
" ),\n",
8989
" depth=0.0,\n",
9090
" lifetime=timedelta(days=90),\n",

src/virtualship/expedition/do_expedition.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ def do_expedition(expedition_dir: str | Path, input_data: Path | None = None) ->
8585
os.makedirs(expedition_dir.joinpath("results"))
8686

8787
# calculate expedition cost in US$
88-
assert (
89-
schedule.waypoints[0].time is not None
90-
), "First waypoint has no time. This should not be possible as it should have been verified before."
88+
assert schedule.waypoints[0].time is not None, (
89+
"First waypoint has no time. This should not be possible as it should have been verified before."
90+
)
9191
time_past = schedule_results.time - schedule.waypoints[0].time
9292
cost = expedition_cost(schedule_results, time_past)
9393
with open(expedition_dir.joinpath("results", "cost.txt"), "w") as file:

src/virtualship/expedition/simulate_schedule.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ def __init__(
8383
self._ship_config = ship_config
8484
self._schedule = schedule
8585

86-
assert (
87-
self._schedule.waypoints[0].time is not None
88-
), "First waypoint must have a time. This should have been verified before calling this function."
86+
assert self._schedule.waypoints[0].time is not None, (
87+
"First waypoint must have a time. This should have been verified before calling this function."
88+
)
8989
self._time = schedule.waypoints[0].time
9090
self._location = schedule.waypoints[0].location
9191

tests/instruments/test_adcp.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,12 @@ def test_simulate_adcp(tmpdir) -> None:
107107
for var in ["lat", "lon"]:
108108
obs_value = obs[var].values.item()
109109
exp_value = exp[var]
110-
assert np.isclose(
111-
obs_value, exp_value
112-
), f"Observation incorrect {vert_loc=} {obs_i=} {var=} {obs_value=} {exp_value=}."
110+
assert np.isclose(obs_value, exp_value), (
111+
f"Observation incorrect {vert_loc=} {obs_i=} {var=} {obs_value=} {exp_value=}."
112+
)
113113
for var in ["V", "U"]:
114114
obs_value = obs[var].values.item()
115115
exp_value = exp[var][vert_loc]
116-
assert np.isclose(
117-
obs_value, exp_value
118-
), f"Observation incorrect {vert_loc=} {i=} {var=} {obs_value=} {exp_value=}."
116+
assert np.isclose(obs_value, exp_value), (
117+
f"Observation incorrect {vert_loc=} {i=} {var=} {obs_value=} {exp_value=}."
118+
)

tests/instruments/test_ctd.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,6 @@ def test_simulate_ctds(tmpdir) -> None:
132132
for var in ["salinity", "temperature", "lat", "lon"]:
133133
obs_value = obs[var].values.item()
134134
exp_value = exp[var]
135-
assert np.isclose(
136-
obs_value, exp_value
137-
), f"Observation incorrect {ctd_i=} {loc=} {var=} {obs_value=} {exp_value=}."
135+
assert np.isclose(obs_value, exp_value), (
136+
f"Observation incorrect {ctd_i=} {loc=} {var=} {obs_value=} {exp_value=}."
137+
)

tests/instruments/test_drifter.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,14 @@ def test_simulate_drifters(tmpdir) -> None:
7373
# Check if drifters are moving
7474
# lat, lon, should be increasing values (with the above positive VU fieldset)
7575
dlat = np.diff(results.sel(trajectory=traj)["lat"].values)
76-
assert np.all(
77-
dlat[np.isfinite(dlat)] > 0
78-
), f"Drifter is not moving over y {drifter_i=}"
76+
assert np.all(dlat[np.isfinite(dlat)] > 0), (
77+
f"Drifter is not moving over y {drifter_i=}"
78+
)
7979
dlon = np.diff(results.sel(trajectory=traj)["lon"].values)
80-
assert np.all(
81-
dlon[np.isfinite(dlon)] > 0
82-
), f"Drifter is not moving over x {drifter_i=}"
80+
assert np.all(dlon[np.isfinite(dlon)] > 0), (
81+
f"Drifter is not moving over x {drifter_i=}"
82+
)
8383
temp = results.sel(trajectory=traj)["temperature"].values
84-
assert np.all(
85-
temp[np.isfinite(temp)] == CONST_TEMPERATURE
86-
), f"measured temperature does not match {drifter_i=}"
84+
assert np.all(temp[np.isfinite(temp)] == CONST_TEMPERATURE), (
85+
f"measured temperature does not match {drifter_i=}"
86+
)

tests/instruments/test_ship_underwater_st.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,6 @@ def test_simulate_ship_underwater_st(tmpdir) -> None:
9797
for var in ["S", "T", "lat", "lon"]:
9898
obs_value = obs[var].values.item()
9999
exp_value = exp[var]
100-
assert np.isclose(
101-
obs_value, exp_value
102-
), f"Observation incorrect {i=} {var=} {obs_value=} {exp_value=}."
100+
assert np.isclose(obs_value, exp_value), (
101+
f"Observation incorrect {i=} {var=} {obs_value=} {exp_value=}."
102+
)

tests/instruments/test_xbt.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,6 @@ def test_simulate_xbts(tmpdir) -> None:
126126
for var in ["temperature", "lat", "lon"]:
127127
obs_value = obs[var].values.item()
128128
exp_value = exp[var]
129-
assert np.isclose(
130-
obs_value, exp_value
131-
), f"Observation incorrect {xbt_i=} {loc=} {var=} {obs_value=} {exp_value=}."
129+
assert np.isclose(obs_value, exp_value), (
130+
f"Observation incorrect {xbt_i=} {loc=} {var=} {obs_value=} {exp_value=}."
131+
)

0 commit comments

Comments
 (0)