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

Changed additional flow node input to list to allow various from layer to layer #342

Merged
merged 9 commits into from
Feb 26, 2021
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
- [#272](https://github.com/equinor/flownet/pull/272) Adds resampling of observation dates at requested frequency by finding nearest date among existing observation dates (i.e., no interpolated dates added)

### Changes
- [#342](https://github.com/equinor/flownet/pull/342) Additional flow nodes are now a list in the configuration file, which allows for variation in the number of addtional nodes from layer to layer.
- [#337](https://github.com/equinor/flownet/pull/337) You can now add multiple analytics workflows in your FlowNet config. This is also a breaking change in that it requires you to change the ert.analysis keyword to being a list.
- [#322](https://github.com/equinor/flownet/pull/322) RSVD input through csv files can now be done either as one table used for all EQLNUM regions, or as one table for each EQLNUM region. The csv file needs a header with column names "depth", "rs" and "eqlnum" (the latter only when multiple tables are defined).

Expand Down
22 changes: 20 additions & 2 deletions src/flownet/config_parser/_config_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,14 @@ def _to_abs_path(path: Optional[str]) -> str:
MK.AllowNone: True,
},
"additional_flow_nodes": {
MK.Type: types.Integer,
MK.Default: 100,
MK.Type: types.List,
MK.Description: "List of additional flow nodes to add for each layer.",
MK.Content: {
MK.Item: {
MK.Type: types.Number,
MK.AllowNone: True,
},
},
},
"additional_node_candidates": {
MK.Type: types.Integer,
Expand Down Expand Up @@ -1674,6 +1680,18 @@ def parse_config(
"The concave hulls of the layers are used to split "
"the number of additional nodes between the layers."
)
if layers and not len(layers) is len(config.flownet.additional_flow_nodes):
raise ValueError(
"For each layer in the FlowNet model you have to supply an entry in the "
f"additional flow nodes list. Currenly you have {str(len(layers))} layers "
f"and {str(len(config.flownet.additional_flow_nodes))} additional flow node "
"defitions."
)
if not layers and len(config.flownet.additional_flow_nodes) > 1:
raise ValueError(
"You supplied multiple entries for the additional flow nodes but "
"there is only a single layer."
)

req_relp_parameters: List[str] = []
if (
Expand Down
4 changes: 3 additions & 1 deletion src/flownet/network_model/_generate_connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,9 @@ def create_connections(
Desired restructuring of start-end coordinates into separate columns, as per Flow needs.

"""
if df_coordinates["LAYER_ID"].nunique() > 1 and concave_hull_list is not None:
if isinstance(configuration.flownet.additional_flow_nodes, tuple):
additional_flow_nodes_list = list(configuration.flownet.additional_flow_nodes)
elif df_coordinates["LAYER_ID"].nunique() > 1 and concave_hull_list is not None:
additional_flow_nodes_list = _split_additional_flow_nodes(
total_additional_nodes=configuration.flownet.additional_flow_nodes,
concave_hull_list=concave_hull_list,
Expand Down