@@ -683,7 +683,7 @@ def SetDefaultConfiguration(root, verbose=False):
683683 return response
684684
685685
686- # Extract data collection (map2loop) sources settings
686+ # Extract data collection (map2loop) source urls
687687def GetSources (root , verbose = False ):
688688 response = {"errorFlag" : False }
689689 resp = GetDataCollectionGroup (root )
@@ -710,7 +710,7 @@ def GetSources(root, verbose=False):
710710 return response
711711
712712
713- # Set data collection (map2loop) configuration settings
713+ # Set data collection (map2loop) source urls
714714def SetSources (root , data , verbose = False ):
715715 """
716716 **SetConfiguration** - Saves the settings for the data collection step
@@ -756,7 +756,7 @@ def SetSources(root, data, verbose=False):
756756 return response
757757
758758
759- # Create Default data collection (map2loop) source settings
759+ # Create Default data collection (map2loop) source urls
760760def SetDefaultSources (root , verbose = False ):
761761 response = {"errorFlag" : False }
762762 resp = GetDataCollectionGroup (root )
@@ -774,3 +774,81 @@ def SetDefaultSources(root, verbose=False):
774774 dcGroup .metadataUrl = ""
775775 dcGroup .sourceTags = ""
776776 return response
777+
778+
779+ # Extract data collection (map2loop) raw data
780+ def GetRawSourceData (root , verbose = False ):
781+ response = {"errorFlag" : False }
782+ resp = GetDataCollectionGroup (root )
783+ if resp ["errorFlag" ]:
784+ response = resp
785+ else :
786+ dcGroup = resp ["value" ]
787+ data = {}
788+ if "structureRawData" in dcGroup .ncattrs ():
789+ data ["structureRawData" ] = dcGroup .structureRawData
790+ if "geologyRawData" in dcGroup .ncattrs ():
791+ data ["geologyRawData" ] = dcGroup .geologyRawData
792+ if "faultRawData" in dcGroup .ncattrs ():
793+ data ["faultRawData" ] = dcGroup .faultRawData
794+ if "foldRawData" in dcGroup .ncattrs ():
795+ data ["foldRawData" ] = dcGroup .foldRawData
796+ response ["value" ] = data
797+ return response
798+
799+
800+ # Set data collection raw data
801+ def SetRawSourceData (root , data , verbose = False ):
802+ """
803+ **SetConfiguration** - Saves the settings for the data collection step
804+
805+ Parameters
806+ ----------
807+ rootGroup: netCDF4.Group
808+ The root group node of a Loop Project File
809+ data: dictionary {str: str,...}
810+ A dictionary with the data colletion settings
811+ verbose: bool
812+ A flag to indicate a higher level of console logging (more if True)
813+
814+ Returns
815+ -------
816+ dict {"errorFlag", "errorString"}
817+ errorString exist and contains error message only when errorFlag is
818+ True
819+
820+ """
821+ response = {"errorFlag" : False }
822+ resp = GetDataCollectionGroup (root )
823+ if resp ["errorFlag" ]:
824+ # Create Structural Models Group and add data shape based on project extents
825+ dcGroup = root .createGroup ("DataCollection" )
826+ else :
827+ dcGroup = resp ["value" ]
828+
829+ if (data .contains ("structureRawData" )):
830+ dcGroup .structureRawData = data .structureRawData
831+ if (data .contains ("geologyRawData" )):
832+ dcGroup .geologyRawData = data .geologyRawData
833+ if (data .contains ("faultRawData" )):
834+ dcGroup .faultRawData = data .faultRawData
835+ if (data .contains ("foldRawData" )):
836+ dcGroup .foldRawData = data .foldRawData
837+ return response
838+
839+
840+ # Create blank data collection data
841+ def SetDefaultRawSourceData (root , verbose = False ):
842+ response = {"errorFlag" : False }
843+ resp = GetDataCollectionGroup (root )
844+ if resp ["errorFlag" ]:
845+ dcGroup = root .createGroup ("DataCollection" )
846+ else :
847+ dcGroup = resp ["value" ]
848+
849+ dcGroup .structureRawData = ""
850+ dcGroup .geologyRawData = ""
851+ dcGroup .faultRawData = ""
852+ dcGroup .foldRawData = ""
853+
854+ return response
0 commit comments