Learn how you (developer, engineer, end-user, domain expert, project manager, etc.) can contribute to the creation of apps that provide real value to your work.
There are two ways in which you can use the CPT interpretation with Robertson functionality:
I With VIKTOR, out-of-the-box, using our free version.
II Without VIKTOR, by integrating with your own Python code. In this case, you create the following yourself:
In the code block below, you can see the 6 lines of Python code from the built-in functionality that is used to import and read out GEF-files. This code is also used in another open-source sample application that is entirely focused on comparing CPT's with either VIKTOR or by integrating with your own Python code. Read more about the open-source CPT comparison app and get the code from our GitHub repository here.
1from viktor.geo import GEFFile
2
3@ParamsFromFile(file_types=['.gef'])
4def process_file(self, file: File, **kwargs) -> dict:
5 """Process the CPT file when it is first uploaded"""
6 cpt_file = GEFFile(file.getvalue("ISO-8859-1"))
7 return cpt_data_object.serialize()
Below is a code snippet from the CPT interpretation with Robertson sample app. This snippet depicts a function that you can use to automatically classify the soil. The soil classification functionality is included in VIKTOR but in the sample app, users always have the option to overwrite the classification by not allowing for very thin layers or by editing the table directly.
1def classify_cpt_file(cpt_file: GEFFile) -> dict:
2 """Classify an uploaded CPT File based on the selected _ClassificationMethod"""
3 try:
4 # Parse the GEF file content
5 cpt_data_object = cpt_file.parse(additional_columns=ADDITIONAL_COLUMNS, return_gef_data_obj=True)
6 ground_water_level = get_water_level(cpt_data_object)
7
8 # Classify the CPTData object to get a SoilLayout
9 soil_layout_obj = cpt_data_object.classify(method=RobertsonMethod(DEFAULT_ROBERTSON_TABLE),
10 return_soil_layout_obj=True)
11
12 except GEFParsingException as parsing_exception:
13 raise UserException(f"CPT Parsing: {str(parsing_exception)}") from parsing_exception
14 except GEFClassificationError as classification_exception:
15 raise UserException(f"CPT Classification: {str(classification_exception)}") from classification_exception
16
17 # Serialize the parsed CPT File content and update it with the new soil layout
18 cpt_dict = cpt_data_object.serialize()
19 cpt_dict['soil_layout'] = soil_layout_obj
20 cpt_dict["groundwater"] = ground_water_level
21 return cpt_dict
In this video, you can see the functionality being used in a sample application on the VIKTOR platform.
As you can see in the video, the process of interpreting a soil layout using the Robertson method consists of four easy steps:
Get the entire Python code from our GitHub repository to integrate with your own code or use the free version to use the app out-of-the-box with VIKTOR!