Skip to content

Commit

Permalink
Black reformating
Browse files Browse the repository at this point in the history
  • Loading branch information
romainsacchi committed Feb 11, 2024
1 parent 2286170 commit f25ff76
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions carculator_truck/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ def finite(array, mask_value=0):


class TruckModel(VehicleModel):

"""
This class represents the entirety of the vehicles considered, with useful attributes, such as an array that stores
all the vehicles parameters.
Expand Down Expand Up @@ -163,9 +162,9 @@ def set_cargo_mass_and_annual_mileage(self):

for s in self.array.coords["size"].values:
cycle = self.cycle if isinstance(self.cycle, str) else "Urban delivery"
self.array.loc[
dict(size=s, parameter="kilometers per year")
] = annual_mileage[cycle][s]
self.array.loc[dict(size=s, parameter="kilometers per year")] = (
annual_mileage[cycle][s]
)

def adjust_cost(self):
"""
Expand Down Expand Up @@ -958,9 +957,11 @@ def remove_energy_consumption_from_unavailable_vehicles(self):
# as a result of curb mass being too large
vals = np.asarray(
[
np.round(v[2][0], 1)
if (v[0][0] - v[1][0]) > 0
else f"-{np.round(v[2][0])}-"
(
np.round(v[2][0], 1)
if (v[0][0] - v[1][0]) > 0
else f"-{np.round(v[2][0])}-"
)
for v in (
self.array.sel(
parameter=["gross mass", "driving mass", "cargo mass"],
Expand All @@ -978,9 +979,11 @@ def remove_energy_consumption_from_unavailable_vehicles(self):
parameter="is_available",
powertrain=pt,
year=y,
value="reference"
if "reference" in self.array.coords["value"]
else 0,
value=(
"reference"
if "reference" in self.array.coords["value"]
else 0
),
).values,
vals,
"/",
Expand Down

0 comments on commit f25ff76

Please sign in to comment.