Skip to content

Commit b70bc2b

Browse files
author
Fraser Greenroyd
authored
Ground_Engine: Add associated engine methods for boreholes, stratum and chemical data (#3189)
2 parents 83b91c9 + e5d078f commit b70bc2b

File tree

6 files changed

+458
-2
lines changed

6 files changed

+458
-2
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010
/Analytical_Engine @al-fisher @rwemay @IsakNaslundBh @FraserGreenroyd
1111
#NEED OWNER: /Architecture_Engine
1212
/BHoM_Engine @adecler @al-fisher @FraserGreenroyd
13-
/Data_Engine @adecler @IsakNaslundBH
13+
/Data_Engine @adecler @IsakNaslundBh
1414
/Diffing_Engine @alelom @al-fisher @adecler
1515
/Environment_Engine @FraserGreenroyd @tg359 @jamesramsden-bh
16-
/Geometry_Engine @pawelbaran @al-fisher @IsakNaslundBH
16+
/Geometry_Engine @pawelbaran @al-fisher @IsakNaslundBh
17+
/Ground_Engine @peterjamesnugent @IsakNaslundBh @FraserGreenroyd
1718
/Humans_Engine @al-fisher @rwemay
1819
/Library_Engine @adecler @IsakNaslundBh
1920
/Matter_Engine @al-fisher @IsakNaslundBh @pawelbaran

Ground_Engine/Create/Borehole.cs

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/*
2+
* This file is part of the Buildings and Habitats object Model (BHoM)
3+
* Copyright (c) 2015 - 2023, the respective contributors. All rights reserved.
4+
*
5+
* Each contributor holds copyright over their respective contributions.
6+
* The project versioning (Git) records all such contribution source information.
7+
*
8+
*
9+
* The BHoM is free software: you can redistribute it and/or modify
10+
* it under the terms of the GNU Lesser General Public License as published by
11+
* the Free Software Foundation, either version 3.0 of the License, or
12+
* (at your option) any later version.
13+
*
14+
* The BHoM is distributed in the hope that it will be useful,
15+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
* GNU Lesser General Public License for more details.
18+
*
19+
* You should have received a copy of the GNU Lesser General Public License
20+
* along with this code. If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
21+
*/
22+
23+
using System;
24+
using System.Collections.Generic;
25+
using System.ComponentModel;
26+
using System.Linq;
27+
using BH.oM.Base.Attributes;
28+
using BH.oM.Geometry;
29+
using BH.oM.Geometry.CoordinateSystem;
30+
using BH.oM.Ground;
31+
using BH.Engine.Base;
32+
33+
namespace BH.Engine.Ground
34+
{
35+
public static partial class Create
36+
{
37+
/***************************************************/
38+
/**** Public Methods ****/
39+
/***************************************************/
40+
41+
[Description("Creates a Borehole object containing the start, end, geology and a number of optional parameters. The coordinate system the points are provided in is included.")]
42+
[Input("id", "Location identifier for the borehole unique to the project (LOCA_ID).")]
43+
[Input("top", "The top of the borehole within the coordinate system provided (LOCA_NATE, LOCA_NATEN, LOCA_GL).")]
44+
[Input("bottom", "The bottom of the borehole within the coordinate system provided (LOCA_ETRV, LOCA_NTRV, LOCA_FDEP).")]
45+
[Input("coordinateSystem", "The coordinate system referenced by the top and bottom point. (LOCA_GREF, LOCA_NATD).")]
46+
[Input("properties", "A list of properties related to the borehole.")]
47+
[Input("strata", "A list of strata objects containing geology units and descriptions of the ground.")]
48+
[Input("contaminants", "A list of contaminant sample objects.")]
49+
[Output("borehole", "The created Borehole defined by a coordinate system, start point and end point based on the AGS schema.")]
50+
public static Borehole Borehole(string id, Point top = null, Point bottom = null, Cartesian coordinateSystem = null, List<IBoreholeProperty> properties = null, List<Stratum> strata = null, List<ContaminantSample> contaminants = null)
51+
{
52+
if (string.IsNullOrWhiteSpace(id))
53+
{
54+
Compute.RecordError("The id is null or whitespace.");
55+
return null;
56+
}
57+
58+
return new Borehole() { Id = id, Top = top, Bottom = bottom, Strata = strata, BoreholeProperties = properties,ContaminantSamples = contaminants, CoordinateSystem = coordinateSystem };
59+
60+
}
61+
62+
/***************************************************/
63+
}
64+
}
65+
66+
67+
68+
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/*
2+
* This file is part of the Buildings and Habitats object Model (BHoM)
3+
* Copyright (c) 2015 - 2023, the respective contributors. All rights reserved.
4+
*
5+
* Each contributor holds copyright over their respective contributions.
6+
* The project versioning (Git) records all such contribution source information.
7+
*
8+
*
9+
* The BHoM is free software: you can redistribute it and/or modify
10+
* it under the terms of the GNU Lesser General Public License as published by
11+
* the Free Software Foundation, either version 3.0 of the License, or
12+
* (at your option) any later version.
13+
*
14+
* The BHoM is distributed in the hope that it will be useful,
15+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
* GNU Lesser General Public License for more details.
18+
*
19+
* You should have received a copy of the GNU Lesser General Public License
20+
* along with this code. If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
21+
*/
22+
23+
using System;
24+
using System.Collections.Generic;
25+
using System.ComponentModel;
26+
using System.Linq;
27+
using BH.oM.Base.Attributes;
28+
using BH.oM.Geometry;
29+
using BH.oM.Geometry.CoordinateSystem;
30+
using BH.oM.Ground;
31+
using BH.Engine.Base;
32+
33+
namespace BH.Engine.Ground
34+
{
35+
public static partial class Create
36+
{
37+
/***************************************************/
38+
/**** Public Methods ****/
39+
/***************************************************/
40+
41+
[Description("Creates a ContaminantSample object containing the chemical code, the depth, quantity and properties related to the sample.")]
42+
[Input("id", "Location identifier for the borehole unique to the project (LOCA_ID).")]
43+
[Input("top", "Depth to the top of the sample, measured from the top of the borehole (SAMP_TOP).")]
44+
[Input("chemical", "Chemical code for the contaminant (ERES_CODE).")]
45+
[Input("name", "The name of the chemical (ERES_NAME).")]
46+
[Input("result", "The amount of the chemical present (ERES_RVAL).")]
47+
[Input("type", "The type of sample (SAMP_TYPE).")]
48+
[Input("properties", "A list of different properties including references, tests, analysis, results and detection..")]
49+
[Output("contaminantSample", "The created ContaminantSample defined by its chemical code, depth and quantity based on the AGS schema.")]
50+
public static ContaminantSample ContaminantSample(string id, double top, string chemical, string name, double result, string type, List<IContaminantProperty> properties = null)
51+
{
52+
if (string.IsNullOrWhiteSpace(chemical))
53+
{
54+
Compute.RecordError("The chemical name is null or whitespace.");
55+
return null;
56+
}
57+
58+
return new ContaminantSample() {Id = id, Top = top, Chemical = chemical, Name = name, Result = result, Type = type, ContaminantProperties = properties};
59+
60+
}
61+
62+
/***************************************************/
63+
}
64+
}
65+
66+
67+
68+

Ground_Engine/Create/Stratum.cs

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
/*
2+
* This file is part of the Buildings and Habitats object Model (BHoM)
3+
* Copyright (c) 2015 - 2023, the respective contributors. All rights reserved.
4+
*
5+
* Each contributor holds copyright over their respective contributions.
6+
* The project versioning (Git) records all such contribution source information.
7+
*
8+
*
9+
* The BHoM is free software: you can redistribute it and/or modify
10+
* it under the terms of the GNU Lesser General Public License as published by
11+
* the Free Software Foundation, either version 3.0 of the License, or
12+
* (at your option) any later version.
13+
*
14+
* The BHoM is distributed in the hope that it will be useful,
15+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
* GNU Lesser General Public License for more details.
18+
*
19+
* You should have received a copy of the GNU Lesser General Public License
20+
* along with this code. If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
21+
*/
22+
23+
using System;
24+
using System.Collections.Generic;
25+
using System.ComponentModel;
26+
using System.Linq;
27+
using BH.oM.Base.Attributes;
28+
using BH.oM.Geometry;
29+
using BH.oM.Geometry.CoordinateSystem;
30+
using BH.oM.Ground;
31+
using BH.Engine.Base;
32+
using BH.Engine.Geometry;
33+
34+
namespace BH.Engine.Ground
35+
{
36+
public static partial class Create
37+
{
38+
/***************************************************/
39+
/**** Public Methods ****/
40+
/***************************************************/
41+
42+
[Description("Creates a Stratum element based on its strata, descriptions and optional geological properties. The lists must be of equal length.")]
43+
[Input("id", "Location identifier for the borehole unique to the project (LOCA_ID).")]
44+
[Input("top", "Depth to the top of the strata based on the datum provided on the Borehole (GEOL_TOP).")]
45+
[Input("bottom", "Depth to the bottom of the strata based on the datum provided on the Borehole (GEOL_BOT).")]
46+
[Input("logDescription", "General descriptions for each strata (GEOL_DESC).")]
47+
[Input("legend", "Legend codes summarising the LogDescription (GEOL_LEG).")]
48+
[Input("observedGeology", "Observed geologies expressed as a GeologicalUnit (GEOL_GEOL).")]
49+
[Input("interpretedGeology", "Interpreted geologies expressed as an EngineeringMaterial (GEOL_GEO2).")]
50+
[Input("optionalInterpretedGeology", "The optional interpreted geology expressed as an EngineeringMaterial(GEOL_GEO3).")]
51+
[Input("blankGeology", "The geology to use where blank spaces occur in the observedGeology parameter.")]
52+
[Input("properties", "A list of properties related to the borehole.")]
53+
[Output("stratum", "Stratum object containing information for each strata including descriptions, legend codes and optional geological properties.")]
54+
public static Stratum Stratum(string id, double top, double bottom, string logDescription, string legend,
55+
string observedGeology, string interpretedGeology = "", string optionalInterpretedGeology = "", string blankGeology = "", List<IStratumProperty> properties = null)
56+
{
57+
if(id == "")
58+
{
59+
Base.Compute.RecordError("The id identifying the borehole is empty. The strata will not be referenced to a borehole.");
60+
return null;
61+
}
62+
63+
if (logDescription.Trim() == "")
64+
{
65+
Base.Compute.RecordError("The LogDescription is empty.");
66+
return null;
67+
}
68+
69+
if (!blankGeology.Trim().IsNullOrEmpty())
70+
{
71+
if (observedGeology.Trim().IsNullOrEmpty())
72+
observedGeology = blankGeology;
73+
}
74+
75+
return new Stratum()
76+
{
77+
Id = id,
78+
Top = top,
79+
Bottom = bottom,
80+
LogDescription = logDescription,
81+
Legend = legend,
82+
ObservedGeology = observedGeology,
83+
InterpretedGeology = interpretedGeology,
84+
OptionalInterpretedGeology = optionalInterpretedGeology,
85+
Properties = properties
86+
};
87+
}
88+
89+
/***************************************************/
90+
}
91+
}
92+
93+
94+
95+

0 commit comments

Comments
 (0)