Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename Edge to Link #2023

Merged
merged 6 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions core/ext/RibasimMakieExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,23 @@ function Ribasim.plot_basin_data(model::Model)
f
end

function Ribasim.plot_flow!(model::Model, ax::Axis, edge_metadata::Ribasim.EdgeMetadata)
function Ribasim.plot_flow!(model::Model, ax::Axis, link_metadata::Ribasim.LinkMetadata)
flow_data = DataFrame(Ribasim.flow_table(model))
flow_data = filter(:edge_id => ==(edge_metadata.id), flow_data)
label = "$(edge_metadata.edge[1]) → $(edge_metadata.edge[2])"
flow_data = filter(:link_id => ==(link_metadata.id), flow_data)
label = "$(link_metadata.link[1]) → $(link_metadata.link[2])"
scatterlines!(ax, flow_data.time, flow_data.flow_rate; label)
return nothing
end

function Ribasim.plot_flow(model::Model; skip_conservative_out = true)
f = Figure()
ax = Axis(f[1, 1]; xlabel = "time", ylabel = "flow rate [m³s⁻¹]")
for edge_metadata in values(model.integrator.p.graph.edge_data)
for link_metadata in values(model.integrator.p.graph.edge_data)
if skip_conservative_out &&
edge_metadata.edge[1].type in Ribasim.conservative_nodetypes
link_metadata.link[1].type in Ribasim.conservative_nodetypes
continue
end
Ribasim.plot_flow!(model, ax, edge_metadata)
Ribasim.plot_flow!(model, ax, link_metadata)
end
axislegend(ax)
f
Expand Down
6 changes: 3 additions & 3 deletions core/regression_test/regression_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ end

# Testbench for flow.arrow
@test flow.time == flow_bench.time
@test flow.edge_id == flow_bench.edge_id
@test flow.link_id == flow_bench.edge_id
@test flow.from_node_id == flow_bench.from_node_id
@test flow.to_node_id == flow_bench.to_node_id
@test all(q -> abs(q) < 0.01, flow.flow_rate - flow_bench.flow_rate)
Expand Down Expand Up @@ -167,7 +167,7 @@ end

# Testbench for flow.arrow
@test flow.time == flow_bench.time
@test flow.edge_id == flow_bench.edge_id
@test flow.link_id == flow_bench.edge_id
@test flow.from_node_id == flow_bench.from_node_id
@test flow.to_node_id == flow_bench.to_node_id
@test all(q -> abs(q) < 0.01, flow.flow_rate - flow_bench.flow_rate)
Expand Down Expand Up @@ -234,7 +234,7 @@ end

# Testbench for flow.arrow
@test flow.time == flow_bench.time
@test flow.edge_id == flow_bench.edge_id
@test flow.link_id == flow_bench.edge_id
@test flow.from_node_id == flow_bench.from_node_id
@test flow.to_node_id == flow_bench.to_node_id

Expand Down
2 changes: 1 addition & 1 deletion core/src/Ribasim.jl
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ using DiffEqCallbacks:
SavedValues,
SavingCallback

# The network defined by the Node and Edge table is converted to a graph internally.
# The network defined by the Node and Link table is converted to a graph internally.
using Graphs:
DiGraph, Edge, edges, inneighbors, nv, outneighbors, induced_subgraph, is_connected
# Convenience functionality built on top of Graphs. Used to store e.g. node and edge metadata
Expand Down
Loading