:py:mod:`python.odpy.dbman` =========================== .. py:module:: python.odpy.dbman Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: python.odpy.dbman.getDBList python.odpy.dbman.getInfoFromDBListByNameOrKey python.odpy.dbman.getInfoByName python.odpy.dbman.getInfoByKey python.odpy.dbman.getDBDict python.odpy.dbman.getByName python.odpy.dbman.getDBKeyForName python.odpy.dbman.retFileLoc python.odpy.dbman.getFileLocation python.odpy.dbman.getNewEntryFileName Attributes ~~~~~~~~~~ .. autoapisummary:: python.odpy.dbman.dbmanexe .. py:data:: dbmanexe :annotation: = od_DBMan .. py:function:: getDBList(translnm, alltrlsgrps=False, exenm=dbmanexe, args=None) Gets information on survey database wells Parameters: * translnm (string): default value='Well' * alltrlsgrps (bool): if True, returns information on TranslatorGroups for available wells * exenm (string): database executable file * args (dict, optional): Dictionary with the members 'dtectdata' and 'survey' as single element lists, and/or 'dtectexec' (see odpy.common.getODSoftwareDir) Returns: * dict: Dictionary containing database survey well information (size, IDs, Names, Formats, Status) .. py:function:: getInfoFromDBListByNameOrKey(nm_or_key, dblist) Gets info from database list with obj key or name Parameters: * nm_or_key (str): object key or name * dblist (dict): survey database list, check odpy.getDBList for docs Returns: * dict: info on database object (Name,ID, Format, Type, TranslatorGroup iff available) .. py:function:: getInfoByName(objnm, translnm, exenm=dbmanexe, args=None) Gets object info by name Parameters: * objnm (str): database object to get info on * translnm (str): * exenm (str): executable file, defaults to dbmanexe=od_DBMan * args (dict, optional): Dictionary with the members 'dtectdata' and 'survey' as single element lists, and/or 'dtectexec' (see odpy.common.getODSoftwareDir) Returns: * dict: information on object, dict keys include; ID, Name, file name, etc Example: >>> import odpy.dbman as dbman >>> dbman.getInfoByName(objnm='F02-1', translnm='Well') {'ID': '100050.2', 'Name': 'F02-1', 'Format': 'dGB', 'TranslatorGroup': 'Well', 'File_name': 'C:\Users\OLAWALE IBRAHIM\DTECT_DATA\F3_Demo_2020\WellInfo\F02-1.well', 'Status': 'OK'} .. py:function:: getInfoByKey(objkey, exenm=dbmanexe, args=None) Gets datbase info on well Parameters: * objkey (str): well ID key * exenm (str): executable file name * args (dict, optional): Dictionary with the members 'dtectdata' and 'survey' as single element lists, and/or 'dtectexec' (see odpy.common.getODSoftwareDir) Returns: dict: file info (ID, Name, Format, File name, etc) .. py:function:: getDBDict(cmd, args=None) Gets database dict with command Parameters: * cmd (str): command to be executed * args (dict, optional): Dictionary with the members 'dtectdata' and 'survey' as single element lists, and/or 'dtectexec' (see odpy.common.getODSoftwareDir) .. py:function:: getByName(dblist, retname, keystr) Gets value of specified database list key Parameters: * dblist (dict): survey database list, check odpy.getDBList for docs * retname (str): key to return from dblist * keystr (str): value to return from retname Returns: * str: database object value Example: >>> import odpy.dbman as dbman >>> dbman.getByName(dblist, 'F03-4', 'IDs') '100050.4' .. py:function:: getDBKeyForName(dblist, retname) Gets object ID key from database info Parameters: * dblist (dict): survey database list, check odpy.getDBList for docs * retname (str): key to return from dblist Returns: * str: ID of database object (well) .. py:function:: retFileLoc(bstdout) .. py:function:: getFileLocation(dbkey, args=None) Gets full file path Parameters: * dbkey (str): object database key * args (dict, optional): Dictionary with the members 'dtectdata' and 'survey' as single element lists, and/or 'dtectexec' (see odpy.common.getODSoftwareDir) Returns: str: full path to file .. py:function:: getNewEntryFileName(objnm, dirid, trgrp, trl, ext, ftype=None, args=None) Registers a new OpendTect dataset to database Parameters: * objnm (str): file name * dirid (internal: int) * trgrp (str): TranslatorGroup e.g. Well, Seismic, etc * ext (str): file extension Returns: * file path to the object created with write permission