Skip to content

Commit

Permalink
Complete rename to IHACRESBilinearNode
Browse files Browse the repository at this point in the history
  • Loading branch information
ConnectedSystems committed Dec 1, 2024
1 parent a6665a8 commit 0b666de
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 28 deletions.
19 changes: 3 additions & 16 deletions docs/src/primer.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ The spec takes the following form:
area: 130.0 # subcatchment area in km^2 (from BoM)

# Model parameters (in this case, for IHACRES)
parameters:
parameters:
d: 200.0 # millimeters
d2: 2.0 # multiplier applied to `d`
e: 1.0 # ET scaling factor, dimensionless
Expand All @@ -40,19 +40,6 @@ The spec takes the following form:
storage_coef: 2.9 # groundwater interaction factor
alpha: 0.95 # effective rainfall scaling factor
initial_storage: 0.0 # initial CMD value, CMD > 0 means there is a deficit

# additional node-specific parameters
# (unused in this example so can be ignored)
level_params:
- -3.3502 # p1
- 0.68340 # p2
- 4.50 # p3
- 5.0 # p4
- 0.35 # p5
- 1.41 # p6
- -1.45 # p7
- 6.75 # p8
- 167.845 # CTF
```
The spec is then loaded in Julia and passed into `create_network()`
Expand Down Expand Up @@ -100,11 +87,11 @@ Individual nodes can also be created programmatically:

```julia
# Programmatically create a node (from a spec)
new_node = BilinearNode("410730", network["410730"])
new_node = IHACRESBilinearNode("410730", network["410730"])
# Creating the same node manually by specifying model parameters
# Argument order: node_name, area, d, d2, e, f, a, b, storage_coef, alpha, initial cmd, initial quickflow, initial slowflow, initial gw_store
new_node = BilinearNode("410730", 130.0, 95.578, 1.743, 1.047, 1.315, 99.134, 0.259, 2.9, 0.785, 100.0, 0.0, 0.0, 0.0)
new_node = IHACRESBilinearNode("410730", 130.0, 95.578, 1.743, 1.047, 1.315, 99.134, 0.259, 2.9, 0.785, 100.0, 0.0, 0.0, 0.0)
```

Of course, model parameters may not be known in advance.
Expand Down
2 changes: 1 addition & 1 deletion src/Streamfall.jl
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ include("plotting.jl")

# Nodes
export NetworkNode, GenericNode, GenericDirectNode
export IHACRES, IHACRESNode, BilinearNode, ExpuhNode, DamNode, Climate
export IHACRES, IHACRESNode, IHACRESBilinearNode, ExpuhNode, DamNode, Climate
export create_node, GR4JNode, HyModNode, SimpleHyModNode, SYMHYDNode
export EnsembleNode, BaseEnsemble
export run_step!, run_timestep!
Expand Down
14 changes: 7 additions & 7 deletions test/data/campaspe/campaspe_network.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Not related to AWRA - previous created file.

406214:
node_type: BilinearNode
node_type: IHACRESBilinearNode
inlets:
outlets: 406201
area: 268.77 # subcatchment area in km^2
Expand All @@ -28,7 +28,7 @@


406219:
node_type: BilinearNode
node_type: IHACRESBilinearNode
inlets:
outlets: 406000
area: 1985.73
Expand Down Expand Up @@ -91,7 +91,7 @@
initial_storage: 304398.6

406201:
node_type: BilinearNode
node_type: IHACRESBilinearNode
inlets:
- 406214
- 406000
Expand Down Expand Up @@ -119,7 +119,7 @@
- 133.718

406224:
node_type: BilinearNode
node_type: IHACRESBilinearNode
inlets:
outlets: 406218
area: 220.71
Expand All @@ -145,7 +145,7 @@
- 130.984

406218:
node_type: BilinearNode
node_type: IHACRESBilinearNode
inlets:
- 406201
- 406224
Expand Down Expand Up @@ -173,7 +173,7 @@
- 120.380

406202:
node_type: BilinearNode
node_type: IHACRESBilinearNode
inlets: 406218
outlets: 406265
area: 62.78
Expand All @@ -199,7 +199,7 @@
- 104.981

406265:
node_type: BilinearNode
node_type: IHACRESBilinearNode
inlets: 406202
outlets:
area: 162.84
Expand Down
2 changes: 1 addition & 1 deletion test/data/campaspe/two_node_network.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
406219:
node_type: BilinearNode
node_type: IHACRESBilinearNode
inlets:
outlets: 406000
area: 1985.73
Expand Down
6 changes: 3 additions & 3 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ end


@testset "Ensure no NaN outputs" begin
test_node = BilinearNode(
test_node = IHACRESBilinearNode(
"Test", # name/id
1985.73, # area
200.0, # d
Expand Down Expand Up @@ -69,7 +69,7 @@ end
target_node = get_prop(sn, 1, :node)

@test target_node.area == 1985.73
@test target_node.level_params[1] == -3.3502
# @test target_node.level_params[1] == -3.3502
end


Expand All @@ -84,7 +84,7 @@ end
d::Cdouble,
d2::Cdouble,
alpha::Cdouble)::Cvoid

(mf, e_rainfall, recharge) = interim_results

@test !isnan(mf)
Expand Down

0 comments on commit 0b666de

Please sign in to comment.