@@ -798,77 +798,7 @@ def parse_fault_orientations(self) -> tuple:
798798
799799 return (False , "" )
800800
801- @beartype .beartype
802- def parse_structure_map (self ) -> tuple :
803- """
804- Parse the structure shapefile data into a consistent format
805-
806- Returns:
807- tuple: A tuple of (bool: success/fail, str: failure message)
808- """
809- # Check type and size of loaded structure map
810- if (
811- self .raw_data [Datatype .STRUCTURE ] is None
812- or type (self .raw_data [Datatype .STRUCTURE ]) is not geopandas .GeoDataFrame
813- ):
814- logger .warning ("Structure map is not loaded or valid" )
815- return (True , "Structure map is not loaded or valid" )
816-
817- if len (self .raw_data [Datatype .STRUCTURE ]) < 2 :
818- logger .warning (
819- "Stucture map does not enough orientations to complete calculations (need at least 2), projection may be inconsistent"
820- )
821-
822- # Create new geodataframe
823- structure = geopandas .GeoDataFrame (self .raw_data [Datatype .STRUCTURE ]["geometry" ])
824- config = self .config .structure_config
825-
826- # Parse dip direction and dip columns
827- if config ["dipdir_column" ] in self .raw_data [Datatype .STRUCTURE ]:
828- if config ["orientation_type" ] == "strike" :
829- structure ["DIPDIR" ] = self .raw_data [Datatype .STRUCTURE ].apply (
830- lambda row : (row [config ["dipdir_column" ]] + 90.0 ) % 360.0 , axis = 1
831- )
832- else :
833- structure ["DIPDIR" ] = self .raw_data [Datatype .STRUCTURE ][config ["dipdir_column" ]]
834- else :
835- print (f"Structure map does not contain dipdir_column '{ config ['dipdir_column' ]} '" )
836-
837- # Ensure all DIPDIR values are within [0, 360]
838- structure ["DIPDIR" ] = structure ["DIPDIR" ] % 360.0
839-
840- if config ["dip_column" ] in self .raw_data [Datatype .STRUCTURE ]:
841- structure ["DIP" ] = self .raw_data [Datatype .STRUCTURE ][config ["dip_column" ]]
842- else :
843- print (f"Structure map does not contain dip_column '{ config ['dip_column' ]} '" )
844-
845- # Add bedding and overturned booleans
846- if config ["overturned_column" ] in self .raw_data [Datatype .STRUCTURE ]:
847- structure ["OVERTURNED" ] = (
848- self .raw_data [Datatype .STRUCTURE ][config ["overturned_column" ]]
849- .astype (str )
850- .str .contains (config ["overturned_text" ])
851- )
852- else :
853- structure ["OVERTURNED" ] = False
854-
855- if config ["description_column" ] in self .raw_data [Datatype .STRUCTURE ]:
856- structure ["BEDDING" ] = (
857- self .raw_data [Datatype .STRUCTURE ][config ["description_column" ]]
858- .astype (str )
859- .str .contains (config ["bedding_text" ])
860- )
861- else :
862- structure ["BEDDING" ] = False
863-
864- # Add object id
865- if config ["objectid_column" ] in self .raw_data [Datatype .STRUCTURE ]:
866- structure ["ID" ] = self .raw_data [Datatype .STRUCTURE ][config ["objectid_column" ]]
867- else :
868- structure ["ID" ] = numpy .arange (len (structure ))
869-
870- self .data [Datatype .STRUCTURE ] = structure
871- return (False , "" )
801+
872802
873803 @beartype .beartype
874804 def parse_geology_map (self ) -> tuple :
@@ -1182,74 +1112,7 @@ def parse_fault_map(self) -> tuple:
11821112
11831113 return (False , "" )
11841114
1185- @beartype .beartype
1186- def parse_fault_orientations (self ) -> tuple :
1187- """
1188- Parse the fault orientations shapefile data into a consistent format
1189-
1190- Returns:
1191- tuple: A tuple of (bool: success/fail, str: failure message)
1192- """
1193- # Check type and size of loaded structure map
1194- if (
1195- self .raw_data [Datatype .FAULT_ORIENTATION ] is None
1196- or type (self .raw_data [Datatype .FAULT_ORIENTATION ]) is not geopandas .GeoDataFrame
1197- ):
1198- logger .warning ("Fault orientation shapefile is not loaded or valid" )
1199- return (True , "Fault orientation shapefile is not loaded or valid" )
1200-
1201- # Create new geodataframe
1202- fault_orientations = geopandas .GeoDataFrame (
1203- self .raw_data [Datatype .FAULT_ORIENTATION ]["geometry" ]
1204- )
1205-
1206- config = self .config .fault_config
1207-
1208- # Parse dip direction and dip columns
1209- if config ["dipdir_column" ] in self .raw_data [Datatype .FAULT_ORIENTATION ]:
1210- if config ["orientation_type" ] == "strike" :
1211- fault_orientations ["DIPDIR" ] = self .raw_data [Datatype .STRUCTURE ].apply (
1212- lambda row : (row [config ["dipdir_column" ]] + 90.0 ) % 360.0 , axis = 1
1213- )
1214- else :
1215- fault_orientations ["DIPDIR" ] = self .raw_data [Datatype .FAULT_ORIENTATION ][
1216- config ["dipdir_column" ]
1217- ]
1218- else :
1219- print (
1220- f"Fault orientation shapefile does not contain dipdir_column '{ config ['dipdir_column' ]} '"
1221- )
1222-
1223- if config ["dip_column" ] in self .raw_data [Datatype .FAULT_ORIENTATION ]:
1224- fault_orientations ["DIP" ] = self .raw_data [Datatype .FAULT_ORIENTATION ][
1225- config ["dip_column" ]
1226- ]
1227- else :
1228- print (
1229- f"Fault orientation shapefile does not contain dip_column '{ config ['dip_column' ]} '"
1230- )
1231-
1232- # TODO LG would it be worthwhile adding a description column for faults?
1233- # it would be possible to parse out the fault displacement, type, slip direction
1234- # if this was stored in the descriptions?
1235-
1236- # Add object id
1237- if config ["objectid_column" ] in self .raw_data [Datatype .FAULT_ORIENTATION ]:
1238- fault_orientations ["ID" ] = self .raw_data [Datatype .FAULT_ORIENTATION ][
1239- config ["objectid_column" ]
1240- ]
1241- else :
1242- fault_orientations ["ID" ] = numpy .arange (len (fault_orientations ))
1243- self .data [Datatype .FAULT_ORIENTATION ] = fault_orientations
1244-
1245- if config ["featureid_column" ] in self .raw_data [Datatype .FAULT_ORIENTATION ]:
1246- fault_orientations ["featureId" ] = self .raw_data [Datatype .FAULT_ORIENTATION ][
1247- config ["featureid_column" ]
1248- ]
1249- else :
1250- fault_orientations ["featureId" ] = numpy .arange (len (fault_orientations ))
1251-
1252- return (False , "" )
1115+
12531116
12541117
12551118 @beartype .beartype
0 commit comments