Skip to content

Commit

Permalink
check ruff check
Browse files Browse the repository at this point in the history
  • Loading branch information
jensdebruijn committed Sep 25, 2024
1 parent 58db328 commit eef0250
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: chartboost/ruff-action@v1
# - uses: chartboost/ruff-action@v1
- uses: chartboost/ruff-action@v1
with:
args: 'format --check'
28 changes: 16 additions & 12 deletions geb/agents/crop_farmers.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def withdraw_channel(
):
# channel abstraction
channel_abstraction_cell_m3 = min(
available_channel_storage_m3[grid_cell],
max(available_channel_storage_m3[grid_cell] - 100, 0),
irrigation_water_demand_field * cell_area[field],
)
assert channel_abstraction_cell_m3 >= 0
Expand Down Expand Up @@ -532,17 +532,17 @@ def abstract_water(
)

if surface_irrigated[farmer]:
irrigation_water_demand_field = withdraw_channel(
available_channel_storage_m3=available_channel_storage_m3,
grid_cell=grid_cell,
cell_area=cell_area,
field=field,
farmer=farmer,
water_withdrawal_m=water_withdrawal_m,
irrigation_water_demand_field=irrigation_water_demand_field,
remaining_irrigation_limit_m3=remaining_irrigation_limit_m3,
channel_abstraction_m3_by_farmer=channel_abstraction_m3_by_farmer,
)
# irrigation_water_demand_field = withdraw_channel(
# available_channel_storage_m3=available_channel_storage_m3,
# grid_cell=grid_cell,
# cell_area=cell_area,
# field=field,
# farmer=farmer,
# water_withdrawal_m=water_withdrawal_m,
# irrigation_water_demand_field=irrigation_water_demand_field,
# remaining_irrigation_limit_m3=remaining_irrigation_limit_m3,
# channel_abstraction_m3_by_farmer=channel_abstraction_m3_by_farmer,
# )
assert water_withdrawal_m[field] >= 0

# command areas
Expand Down Expand Up @@ -1613,6 +1613,10 @@ def abstract_water(
assert (available_groundwater_m3 >= 0).all()
assert (available_reservoir_storage_m3 >= 0).all()

self.activation_order_by_elevation_ = AgentArray(
self.activation_order_by_elevation, max_n=self.max_n
)

if __debug__:
irrigation_limit_pre = self.remaining_irrigation_limit_m3.copy()
available_channel_storage_m3_pre = available_channel_storage_m3.copy()
Expand Down

0 comments on commit eef0250

Please sign in to comment.