odpy.dbman

Functions

getSurvey([args])

Return an odbind.Survey instance using the content of args , falling bask to the current users

getDBList(translnm[, alltrlsgrps, args])

Gets information on survey database items

getInfoFromDBListByNameOrKey(nm_or_key, dblist)

Gets info from database list with obj key or name

getInfoByName(objnm[, translnm, args])

Gets object info by name

getInfoByKey(objkey[, args])

Gets datbase info on well

getByName(dblist, retname, keystr)

Gets value of specified database list key

getDBKeyForName(dblist, retname)

Gets object ID key from database info

getFileLocation(dbkey[, args])

Gets full file path

getNewEntryFileName(objnm, trgrp, trl[, overwrite, args])

Registers a new OpendTect dataset to database

removeEntry(objname[, trgrp, args])

Remove the OpendTect dataset from the database

isPresent(objname[, trgrp, args])

Checks if an OpendTect dataset exists in the database

Module Contents

odpy.dbman.getSurvey(args={})

Return an odbind.Survey instance using the content of args , falling bask to the current users settings for base data folder and current survey.

Parameters:
  • args (dict, optional): Dictionary with the members ‘dtectdata’ and ‘survey’ as single element lists, and/or ‘dtectexec’ (see odpy.common.getODSoftwareDir)

Returns:

odbind.Survey

odpy.dbman.getDBList(translnm, alltrlsgrps=False, args={})

Gets information on survey database items

Parameters:
  • translnm (string):

  • alltrlsgrps (bool): if True, returns information on all translators in the TranslatorGroup

  • args (dict, optional): Dictionary with the members ‘dtectdata’ and ‘survey’ as single element lists, and/or ‘dtectexec’ (see odpy.common.getODSoftwareDir)

Returns:
  • list[dict]: List of Python dictionaries containing database information {ID, Name, Format, TranslatorGroup, File name}

odpy.dbman.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)

odpy.dbman.getInfoByName(objnm, translnm=None, args={})

Gets object info by name

Parameters:
  • objnm (str): database object to get info on

  • translnm (str):

  • 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:DTECT_DATAF3_Demo_2020WellInfoF02-1.well’, ‘Status’: ‘OK’}

odpy.dbman.getInfoByKey(objkey, args={})

Gets datbase info on well

Parameters:
  • objkey (str): well ID key

  • 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)

odpy.dbman.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', 'ID')
    '100050.4'
odpy.dbman.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)

odpy.dbman.getFileLocation(dbkey, args={})

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

odpy.dbman.getNewEntryFileName(objnm, trgrp, trl, overwrite=False, args={})

Registers a new OpendTect dataset to database

Parameters:
  • objnm (str): the object name

  • trgrp (str): TranslatorGroup e.g. Well, Seismic Data, etc

  • trl (str): Translator e.g. CBVS

Returns:
  • file path to the object created with write permission

odpy.dbman.removeEntry(objname, trgrp=None, args={})

Remove the OpendTect dataset from the database

Parameters:
  • objname (str): the object name

  • trgrp (str)=None: TranslatorGroup

odpy.dbman.isPresent(objname, trgrp=None, args={})

Checks if an OpendTect dataset exists in the database

Parameters:
  • objname (str): the object name

  • trgrp (str)=None: TranslatorGroup

Returns:
  • True if the object exists, False otherwise