Source code for dataio.export.rms.structure_depth_surfaces
from__future__importannotationsfrompathlibimportPathfromtypingimportTYPE_CHECKING,Any,Finalimportfmu.dataioasdiofromfmu.dataio._loggingimportnull_loggerfromfmu.dataio._models.fmu_resultsimportstandard_resultfromfmu.dataio._models.fmu_results.enumsimportClassification,StandardResultNamefromfmu.dataio.export._decoratorsimportexperimentalfromfmu.dataio.export._export_resultimportExportResult,ExportResultItemfromfmu.dataio.export.rms._utilsimport(get_horizons_in_folder,get_rms_project_units,load_global_config,)ifTYPE_CHECKING:importxtgeo_logger:Final=null_logger(__name__)class_ExportStructureDepthSurfaces:def__init__(self,project:Any,horizon_folder:str,)->None:_logger.debug("Process data, establish state prior to export.")self._config=load_global_config()self._surfaces=get_horizons_in_folder(project,horizon_folder)self._unit="m"ifget_rms_project_units(project)=="metric"else"ft"_logger.debug("Process data... DONE")@propertydef_standard_result(self)->standard_result.StructureDepthSurfaceStandardResult:"""Product type for the exported data."""returnstandard_result.StructureDepthSurfaceStandardResult(name=StandardResultName.structure_depth_surface)@propertydef_classification(self)->Classification:"""Get default classification."""returnClassification.internaldef_export_surface(self,surf:xtgeo.RegularSurface)->ExportResultItem:edata=dio.ExportData(config=self._config,content="depth",unit=self._unit,vertical_domain="depth",domain_reference="msl",subfolder="structure_depth_surfaces",is_prediction=True,name=surf.name,classification=self._classification,rep_include=True,)absolute_export_path=edata._export_with_standard_result(surf,standard_result=self._standard_result)_logger.debug("Surface exported to: %s",absolute_export_path)returnExportResultItem(absolute_path=Path(absolute_export_path),)def_export_surfaces(self)->ExportResult:"""Do the actual surface export using dataio setup."""returnExportResult(items=[self._export_surface(surf)forsurfinself._surfaces])def_validate_surfaces(self)->None:"""Surface validations."""# TODO: Add check that the surfaces are consistent, i.e. a stratigraphic# deeper surface should never have shallower values than the one above# also check that the surfaces have a stratigraphy entry.defexport(self)->ExportResult:"""Export the depth as a standard_result."""returnself._export_surfaces()
[docs]@experimentaldefexport_structure_depth_surfaces(project:Any,horizon_folder:str,)->ExportResult:"""Simplified interface when exporting modelled depth surfaces from RMS. Args: project: The 'magic' project variable in RMS. horizon_folder: Name of horizon folder in RMS. Note: This function is experimental and may change in future versions. Examples: Example usage in an RMS script:: from fmu.dataio.export.rms import export_structure_depth_surfaces export_results = export_structure_depth_surfaces(project, "DS_extracted") for result in export_results.items: print(f"Output surfaces to {result.absolute_path}") """return_ExportStructureDepthSurfaces(project,horizon_folder).export()