geosoft.gxpy.gdb submodule¶
Geosoft databases for line-oriented spatial data.
- Classes
Geosoft_gdb
Geosoft line database
Line
line handling
Channel
channel handling
- Constants
- LINE_TYPE_NORMAL
- LINE_TYPE_BASE
- LINE_TYPE_TIE
- LINE_TYPE_TEST
- LINE_TYPE_TREND
- LINE_TYPE_SPECIAL
- LINE_TYPE_RANDOM
- LINE_CATEGORY_FLIGHT
- LINE_CATEGORY_GROUP
- LINE_CATEGORY_NORMAL
- FORMAT_NORMAL
- FORMAT_EXP
- FORMAT_TIME
- FORMAT_DATE
- FORMAT_GEOGR
- FORMAT_SIGDIG
- FORMAT_HEX
- CHAN_ALL
None
- CHAN_NORMAL
0
- CHAN_ARRAY
1
- CHAN_DISPLAYED
2
- SYMB_LINE_NORMAL
- SYMB_LINE_FLIGHT
- SYMB_LINE_GROUP
- SELECT_INCLUDE
- SELECT_EXCLUDE
- COMP_NONE
- COMP_SPEED
- COMP_SIZE
- READ_REMOVE_DUMMYROWS
1
- READ_REMOVE_DUMMYCOLUMNS
2
- SYMBOL_LOCK_NONE
- SYMBOL_LOCK_READ
- SYMBOL_LOCK_WRITE
- DRAW_AS_POINTS
0
- DRAW_AS_LINES
1
See also
geosoft.gxapi.GXGB
, geosoft.gxapi.GXEDB
,
geosoft.gxapi.GXDBREAD
, geosoft.gxapi.GXDBWRITE
Note
Regression tests provide usage examples: Tests
-
class
Channel
(gdb, name)[source]¶ Bases:
object
Class to work with database channels. Use constructor
Channel.new
to create a new channel. Use instance properties to work with channel properties.- Parameters
gdb – database instance
name – channel name string, must exist - see
new()
to create a new channel
New in version 9.3.
-
property
array
¶ Array channel width, 1 for non-array channels
New in version 9.3.
-
property
class_
¶ Class name to which this channel is associated. Can be set.
New in version 9.3.
-
property
decimal
¶ Number of displayed decimal places, can be set.
New in version 9.3.
-
delete
()[source]¶ Delete the channel and all associated data. After calling this method this channel instance is no longer valid.
New in version 9.3.
-
property
format
¶ Channel display format:
FORMAT_NORMAL
normal decimal or integer format
FORMAT_EXP
exponential
FORMAT_TIME
geosoft time (HH:MM:SS.ssss)
FORMAT_DATE
date (YYYY/MM/DD)
FORMAT_GEOGR
geographic (deg.mm.ss.ssss)
FORMAT_SIGDIG
decimals is number of significant digits
FORMAT_HEX
hexadecimal
New in version 9.3.
-
property
is_array
¶ True
if this is an array channelNew in version 9.3.
-
property
label
¶ Channel label used in display graphics, normally the same as the channel name. Can be set.
New in version 9.3.
-
property
lock
¶ Lock setting:
-1 unlocked (SYMBOL_LOCK_NONE)0 read-locked (SYMBOL_LOCK_READ)1 write-locked (SYMBOL_LOCK_WRITE)Can be set.
-
property
locked
¶ True if symbol is locked. Use property
lock
to determine if read or write lock, or to set the lock.Setting to
False
unlocks the symbol.New in version 9.3.
-
property
name
¶ Channel name.
New in version 9.3.
-
classmethod
new
(gdb, name, dtype=<class 'numpy.float64'>, array=1, dup=None, details=None, replace=False, unit_of_measure=None)[source]¶ Create a new channel.
- Parameters
gdb – Geosoft_gdb instance
name – channel name
dtype – numpy data type, defaule np.float64
array – array size, default 1
dup – duplicate properties of this channal (name, symbol or Channel)
details – dictionary of other channel properties - see
Geosoft_gdb.set_channel_details
replace –
True
to replace existing channel. Existing channel information and data is lost. default isFalse
.unit_of_measure – unit of measurement of the data
- Returns
Channel instance
-
property
protect
¶ True
if this channel is protected from modification. Can be set.New in version 9.3.
-
property
symbol
¶ Channel symbol
New in version 9.3.
-
property
type
¶ Geosoft data type.
New in version 9.3.
-
property
unit_of_measure
¶ Unit of measure, can be set.
New in version 9.3.
-
property
width
¶ Display window width in characters. Can be set.
New in version 9.3.
-
exception
GdbException
(message)[source]¶ Bases:
geosoft.GXRuntimeError
Exceptions from
geosoft.gxpy.gdb
.New in version 9.1.
-
class
Geosoft_gdb
(name=None, db=None)[source]¶ Bases:
geosoft.gxpy.geometry.Geometry
Class to work with Geosoft databases. This class wraps many of the functions found in
geosoft.gxapi.GXDB
.- Constructors
open an existing file, or if not specified open/lock the current database
create a new database
Some typical programming patterns
Python Oasis extension opens and reads through all data in the current database:
import os,sys import numpy as np import gxpy.gx as gxp import gxpy.gdb as gxdb # open the current database in the open project gdb = gxdb.Geosoft_gdb.open() for line in gdb.list_lines(): npd,ch,fid = gdb.read_line(line) # npd is a 2D numpy array to all data in this line. # ch is a list of the channels, one channel for each column in npd. # Array channels are expanded with channel names "name[0]", "name[1]" ... # fid is a tuple (start,increment) fiducial, which will be the minimum start and smallest increment. # ... do something with the data in npd ...
External Python program to open and read through all data in a database:
import os,sys import numpy as np import gxpy.gx as gx import gxpy.gdb as gxdb # initalize the gx environment - required for external programs. gxp = gx.GXpy() # open a database gdb = gxdb.Geosoft_gdb.open('test.gdb') for line in gdb.list_lines(): npd,ch,fid = gdb.read_line(line) # npd is a 2D numpy array to all data in this line. # ch is a list of the channels, one channel for each column in npd. # Array channels are expanded with channel names "name[0]", "name[1]" ... # fid is a tuple (start,increment) fiducial, which will be the minimum start and smallest increment. # ... do something with the data in npd ...
The following creates a new channel that is the distance from the origin to the X,Y,Z location of every point.
... gdb = gxdb.Geosoft_gdb.open('test.gdb') for line in gdb.list_lines(): npd,ch,fid = gdb.read_line(line, channels=['X','Y','Z']) npd = np.square(npd) distance_from_origin = np.sqrt(npd[0] + npd[1] + npd[2]) gdb.write_channel(line, 'distance', distance_from_origin, fid)
New in version 9.1.
Changed in version 9.3: float numpy arrays use np.nan for dummies so dummy filtering no longer necessary.
Changed in version 9.3.1: inherits from
geosoft.gxpy.geometry.Geometry
-
channel_details
(channel)[source]¶ Return dictionary of channel details
- Parameters
channel – channel name or symbol
- Returns
dictionary:
Key
Meaning
name
channel name
symbol
channel symbol
class
class name
format
format, one of gxapi.DB_CHAN_FORMAT constants
width
display width in characters
decimal
decimal places to display
unit
measurement unit
label
channel label, which can be different from the channel name
protect
protection: 0 can be modified; 1 protected from modification
columns
number data columns, 1 for normal channels, n for VA channels
type
data type, one of gxapi.DB_CATEGORY_CHAN constants
New in version 9.1.
-
channel_dtype
(channel)[source]¶ Returns channel numpy dtype
- Parameters
channel – channel name or symbol
- Returns
numpy dtype
New in version 9.1.
-
channel_fid
(line, channel)[source]¶ Return the fiducial of a line, channel
- Parameters
line – line name, symbol or Line
channel – channel name, symbol or channel
- Returns
(start,increment)
-
channel_name_symb
(chan)[source]¶ Return channel name, symbol
- Parameters
chan – channel name, or symbol number or Channel instance
- Returns
line name, symbol, returns (‘’,-1) if invalid
- Raises
GdbException if channel does not exist
New in version 9.1.
-
channel_width
(channel)[source]¶ Channel array width, 1 for normal channels, >1 for VA channels.
- Parameters
channel – channel symbol or name
- Returns
array dimension, 1 for non-array channels
New in version 9.1.
-
close
(discard=False)[source]¶ Close the database and free resources
- Parameters
discard – True to discard the database files(s) after closing.
New in version 9.4.
-
property
compression
¶ database compression setting
-
property
coordinate_system
¶ Coordinate system of the current
xyz_channels
. Can be set from anygeosoft.gxpy.coordinate_system.Coordinate_system
constructor.Changed in version 9.3: added setter
-
property
data_has_changed
¶ True
if data has changed
-
property
db_size_kb
¶ database size in kb
-
delete_channel
(channels)[source]¶ Delete channel(s) by name or symbol.
- Parameters
channels – channel name or symbol, or a list of channel names or symbols
New in version 9.1.
-
delete_line
(lines)[source]¶ Delete line(s) by name or symbol.
- Parameters
lines – line name/symbol, or a list of names/symbols
New in version 9.1.
-
delete_line_data
(lines)[source]¶ Delete all data in line(s) by name or symbol but keep the line.
- Parameters
lines – line name/symbol, or a list of names/symbols
New in version 9.6.
-
exist_symb_
(symb, symb_type)[source]¶ Check if a symbol exists of the required type.
- Parameters
symb – symbol name, number or instance
symb_type – one of DB_SYMB_TYPE
- Returns
True
if the symbol exists and is the expected symbol type,False
otherwise
New in version 9.1.
-
property
extent
¶ Return the spatial extent of all selected data in the database as a
geosoft.gxpy.geometry.Point2
.- Returns
geosoft.gxpy.geometry.Point2
of minimum, maximum, or None if no spatial information.
New in version 9.2.
-
figure_map
(file_name=None, overwrite=False, title=None, draw=0, features=None, **kwargs)[source]¶ Create a figure map file from selected lines in the database.
- Parameters
file_name – the name of the map, if None a temporary default map is created.
overwrite –
True
to overwrite map file should it existtitle – Title added to the image
draw –
DRAW_AS_POINTS
to draw a dot at each point (default). Long lines are decimated.DRAW_AS_LINES
to draw lines with a line label at each end.features –
list of features to place on the map, default is (‘SCALE’, ‘NEATLINE’)
’ALL’
include all features. This is the default.
’SCALE’
show a scale bar
’NEATLINE’
draw a neat-line around the image
’ANNOT_XY’
annotate map coordinates
’ANNOT_LL’
annotate map Latitude, Longitude
kwargs – passed to
geosoft.gxpy.map.Map.new
New in version 9.3.
-
property
file_name
¶ Database file name.
-
property
free_blocks
¶ number of free blocks
-
get_gx_metadata
()[source]¶ Return the database Geosoft metadata as a Geosoft
geosoft.gxpy.metadata.Metadata
instance.The internal database metadata is used to store various database properties that are not intended to be part of the exposed dataset metadata exposed by the :attr:metadata property.
If you wish to add your own metadata to the internal properties you can use the
geosoft.gxpy.metadata
module to add metadata and save it to the database usinggeosoft.gxapi.GXDB.set_meta
.New in version 9.3.
-
property
gxdb
¶ The
geosoft.gxapi.GXDB
instance handle
-
property
index_size_kb
¶ index size in kb
-
is_channel
(chan, raise_err=False)[source]¶ Returns
True
if the channel name exists in the database.- Parameters
chan – channel name
raise_err – True to raise an error if it does not exist
New in version 9.1.
-
is_line
(line, raise_err=False)[source]¶ Returns
True
if the named line exists in the database.- Parameters
line – line name
raise_err – True to raise an error if it does not exist
New in version 9.1.
-
line_details
(line)[source]¶ Return dictionary of line details
- Parameters
line – channel name or symbol
- Returns
dictionary:
Key
Meaning
name
line name
symbol
line symbol
type
line type, one of gxapi.DB_LINE_TYPE
category
one of SYMB_LINE
date
date of the line
number
numeric line number
flight
flight number
version
line version number
groupclass
class name for grouped lines, None if not a grouped line
New in version 9.1.
-
line_name_symb
(line, create=False)[source]¶ Return line name, symbol
- Parameters
line – line name, or symbol number
create –
True
to create a line if one does not exist
- Returns
line name, symbol
- Raises
GdbException if line not found or cannot be created
New in version 9.1.
-
list_channels
(chan=None)[source]¶ Return a dict of channels in the database.
- Parameters
chan –
channel filter, default CHAN_ALL:
CHAN_ALL
all channels, normal and VA
CHAN_NORMAL
normal channels only
CHAN_ARRAY
VA channels only
- Returns
dictionary {channel_names: channel_symbols}
New in version 9.1.
-
list_lines
(select=True)[source]¶ List of lines in the database, returned as a {name: symbol} dictionary
- Parameters
select –
True
to return selected lines,False
to return all lines- Returns
dictionary (line name: symbol)
New in version 9.1.
-
list_values
(chan, umax=1000, selected=True, dupl=50, progress=None, stop=None)[source]¶ Build a list of unique values in a channel. Uniqueness depends on the current display format for the field.
- Parameters
chan – channel to scan
umax – maximum values allowed, once this maximum is reached scanning stops, default 1000
selected –
True
to scan only selected linesdupl – Stop growing list after this many lines fail to grow the list, 0 scans all lines
progress – progress reporting function
stop – stop check function
- Returns
list of values, represented as a string
New in version 9.1.
-
property
lost_blocks
¶ lost blocks that might be freed
-
property
max_blobs
¶ maximum blobs allowed
-
property
max_block_size_bytes
¶ maximum block size in bytes
-
property
max_channels
¶ maximum number of channels allowed
-
property
max_compressed_channel_bytes
¶ maximum compressed data per channel per line in bytes
-
property
max_lines
¶ maximum number of lines allowed
-
property
metadata
¶ Return the database XML metadata as a dictionary. Can be set, in which case the dictionary items passed will be added to, or replace existing XML metadata.
New in version 9.2.
-
classmethod
new
(name=None, max_lines=500, max_channels=200, max_blobs=0, page_size=1024, comp=None, overwrite=False)[source]¶ Create a new database.
- Parameters
name – database name, if None a temporary database is created
max_lines – maximum number of lines, default 500
max_channels – maximum number of channels, default 200
max_blobs – maximum number of blobs, default lines*channels+20
comp –
compression:
COMP_NONECOMP_SPEED (default)COMP_SIZEoverwrite –
True
to overwrite existing database. Default isFalse
, GdbException if file exists.page_size – page size (default is 1024), which limits the amount of compressed data that can be stored in a single channel on a line. The maximum compressed data size for a channel will be this number * 65534 (default 1024 * 65534 = 64 MB of compressed data). This will be forced to a power of 2 between 64 and 4096, which would allow for a maximum of 256 MB compressed data per channel per line.
- Returns
Geosoft_gdb
instance
New in version 9.1.
Changed in version 9.3: added parameter
overwrite=False
Changed in version 9.4:
name=None
creates a temporary database
-
new_channel
(name, dtype=<class 'numpy.float64'>, array=1, dup=None, details=None)[source]¶ Return a channel symbol, create if it does not exist.
- Parameters
name – channel name
dtype – numpy dtype (ie. np.int64)
array – array columns (default is 1)
dup – duplicate properties of this channel (name, symbol, channel)
details – dictionary containing channel details, see channel_details()
- Returns
channel symbol
Examples:
symb = gdb.newChan('X') symb = gdb.newChan('X', dtype=np.float64, details={'decimal':4})
New in version 9.1.
Changed in version 9.3: added support for duplication an existing channel via dup=
-
new_line
(line, linetype=None, group=None, dup=None)[source]¶ Create a new line symbol. If line exists an error is raised.
- Parameters
line – line name
linetype –
line type for creating a new line, ignored if group defines
SYMB_LINE_NORMAL
normal lines, name is a string
SYMB_LINE_FLIGHT
flight lines, first letter is line type
group – group name for a grouped class
dup – duplicate from an existing line (name, symbol of Line)
- Returns
line symbol
See also
function
create_line_name
to create a valid line name.New in version 9.1.
-
property
number_of_blocks
¶ number of blocks
-
classmethod
open
(name=None)[source]¶ Open an existing database.
- Parameters
name – name of the database, default is the current project database
- Returns
Geosoft_gdb
instance
New in version 9.1.
-
property
pages_for_blobs
¶ pages consumed by blobs
-
read_channel
(line, channel, dtype=None)[source]¶ Read data from a single channel.
- Parameters
line – line name or symbol
channel – channel name or symbol
dtype – type wanted, default same as the channel data
- Returns
numpy data, fid (start, increment)
For dtype=np.float, dummy values will be np.nan. For integer types dummy values will be the Geosoft dummy values.
New in version 9.1.
-
read_channel_va
(line, channel, dtype=None)[source]¶ Read VA data from a single channel, return in a va.
- Parameters
line – line name or symbol
channel – channel name or symbol
dtype – type wanted, default same as the channel data
- Returns
va
New in version 9.2.
-
read_channel_vv
(line, channel, dtype=None)[source]¶ Read data from a single channel, return in a vv.
- Parameters
line – line name or symbol
channel – channel name or symbol
dtype – type wanted, default same as the channel data
- Returns
vv
New in version 9.2.
-
read_line
(line, channels=None, dtype=None, fid=None, dummy=None)[source]¶ Read a line of data into a numpy array.
- Parameters
line – line to read, string or symbol number
channels – list of channels, strings or symbol number. If empty, read all channels
dtype – numpy data type for the array, default np.float64 for multi-channel data, data type for single channel data. Use “<Unnn” for string type.
fid – required fiducial as tuple (start,incr), default smallest in data
dummy –
dummy_handling for multi-channel read, default leaves dummies in place.:
READ_REMOVE_DUMMYROWS
remove rows with dummies, fiducials lose meaning
READ_REMOVE_DUMMYCOLUMNS
remove columns with dummies
- Returns
2D numpy array shape(records,channels), list of channel names, (fidStart,fidIncr)
- Raises
GdbException if first channel requested is empty
VA channels are expanded by element with channel names name[0], name[1], etc.
This method is intended for relatively simple databases in relatively simple applications. If your database has a lot of channels, or wide array channels it will be more efficient to read and work with just the channels you need. See
read_channel
,read_channel_vv
andread_channel_va
.Examples:
# npd - returned numpy array shape (n, number of channels) # ch - list of returned channels names, array channels expanded to array[0], array[1], ... # fid - tuple (fidStart,fidIncrement), channels resampled as necessary npd,ch,fid = gdb.read_line('L100') # read all channels in line "L100" npd,ch,fid = gdb.read_line(681) # read all channels in line symbol 681 npd,ch,fid = gdb.read_line('L100','X') # read channel 'X' from line 'L100' npd,ch,fid = gdb.read_line('L100',2135) # read channel symbol 2135 from 'L100" npd,ch,fid = gdb.read_line('L100',channels=['X','Y','Z']) # read a list of channels to (n,3) array npd,ch,fid = gdb.read_line('L100','X',np.int32) # read channel 'X' into integer array
New in version 9.1.
-
read_line_dataframe
(line, channels=None, fid=None)[source]¶ Read a line of data into a Pandas DataFrame
- Parameters
line – line to read, string or symbol number
channels – list of channels, strings or symbol number. If empty, read all channels
fid – required fiducial as tuple (start,incr), default smallest in data
- Returns
Pandas DataFrame, list of channel names, (fidStart,fidIncr)
- Raises
GdbException if first channel requested is empty
VA channels are expanded by element with channel names name[0], name[1], etc.
This method can be used to conveniently get a table structure of all data corresponding to the native types of the channels. It is however not necessarily the most efficient way to get at the data. If your database has a lot of channels, or wide array channels it will be more efficient to read and work with just the channels you need. See
read_channel
,read_channel_vv
andread_channel_va
. This method also does not currently support dummy removal in the same way asread_line
.Examples:
# df - Pandas DataFrame # ch - list of returned channels names # fid - tuple (fidStart,fidIncrement), channels resampled as necessary df,ch,fid = gdb.read_line('L100') # read all channels in line "L100" df,ch,fid = gdb.read_line(681) # read all channels in line symbol 681 df,ch,fid = gdb.read_line('L100','X') # read channel 'X' from line 'L100' df,ch,fid = gdb.read_line('L100',2135) # read channel symbol 2135 from 'L100" df,ch,fid = gdb.read_line('L100',channels=['X','Y','Z']) # read a list of channels to (n,3) array
New in version 9.5.
-
read_line_vv
(line, channels=None, dtype=None, fid=None, common_fid=False, chan_dtypes=False)[source]¶ Read a line of data into VVs stored in a dictionary by channel.
- Parameters
line – line to read, string or symbol number
channels – list of channels, strings or symbol number. If None, read all channels
dtype – numpy data type for the array, default np.float64 for multi-channel data (unless chan_dtypes is
True
), data type for single channel data. Use “<Unnn” for string type.common_fid –
True
to resample all channels to a common fiducialchan_dtypes –
True
to determine dtype for each vv from channel type, defaultFalse
- Returns
list of tuples [(channel_name, vv), …]
If a requested channel is a VA, it is with channel names ‘name[0]’, ‘name[1]’, etc.
Examples:
# npd - returned numpy array shape (n, number of channels) # ch - list of returned channels names, array channels expanded to array[0], array[1], ... # fid - tuple (fidStart,fidIncrement), channels resampled as necessary data = gdb.read_line_vv('L100') # read all channels in line "L100" data = gdb.read_line_vv(681) # read all channels in line symbol 681 data = gdb.read_line_vv('L100','X') # read channel 'X' from line 'L100' data = gdb.read_line_vv('L100',2135) # read channel symbol 2135 from 'L100" data = gdb.read_line_vv('L100',channels=['X','Y','Z']) # read a list of channels to (n,3) array data = gdb.read_line_vv('L100','X',np.int32) # read channel 'X' into integer array
New in version 9.2.
-
scan_line_fid
(line, channels=None)[source]¶ Scan channels in a line and return the smallest common fid, line length, data width, list of channels
- Parameters
line – line to read, string or symbol number
channels – list of channels, strings or symbol number. If empty, read all channels
- Returns
(fid_start, fid_increment, fid_last, data_width, channel_list)
New in version 9.4.
-
select_lines
(selection='', select=True)[source]¶ Change selected state of a line, or group of lines
- Parameters
selection – string representing selection, comma-delimit multiple selections, or provide a list of selections.
select –
True
to select,False
to deselect
“L99:800” will select all lines of type “L” in range 99 through 800.
Use a “T” prefix for Tie lines.Use an “F” prefix to specify lines of a specific flight.For example, “F10” would select all lines of flight 10.Use an empty string (“”) to select/deselect ALL lines.Invalid line names are ignored.
New in version 9.1.
-
set_channel_details
(channel, detail)[source]¶ Set/change channel details from dictionary
- Parameters
channel – channel name or symbol
detail – dictionary, see chan_details
New in version 9.1.
-
sorted_chan_list
(channels=None)[source]¶ Get a list of sorted channels from Gdb, placing x, y and z channels (if defined) at front of list.
- Parameters
channels – list of channels, strings or symbol number. If None, read all channels
- Returns
list containing channel names
New in version 9.6.
-
update_gxmeta
(new_meta)[source]¶ Update the database Geosoft metadata as a Geosoft
geosoft.gxpy.metadata.Metadata
instance.- Parameters
meta – the new metadata as a
geosoft.gxpy.Metadata
instance or a nested dict.
New in version 9.3.1.
-
property
used_blobs
¶ number of blobs used
-
property
used_channels
¶ number of channels used
-
property
used_lines
¶ number of lines used
-
writeDataChan
(*args, **kwargs)[source]¶ Deprecated since version 9.2: use
write_channel
-
write_channel
(line, channel, data, fid=0.0, 1.0, unit_of_measure=None)[source]¶ Write data to a single channel.
- Parameters
line – line name or symbol
channel – channel name or symbol
data – numpy array (2D for VA channel), or a list
fid – tuple (fid start, increment), default (0.0,1.0)
unit_of_measure – data unit of measurement
Changed in version 9.3: support for setting channel from a list
added unit_of_measure
New in version 9.1.
-
write_channel_va
(line, channel, va)[source]¶ Write VA data to a single channel.
- Parameters
line – line name or symbol
channel – channel name or symbol
va – va data to write
New in version 9.2.
-
write_channel_vv
(line, channel, vv)[source]¶ Write data to a single channel.
- Parameters
line – line name or symbol
channel – channel name or symbol
vv – vv data to write
New in version 9.2.
-
write_line
(line, data, channels=None, fid=0.0, 1.0)[source]¶ Write data to a multiple channels in a line. If no channel list is provided it assumes that the data is for all channels from the line, the compliment of read_line().
- Parameters
line – line to write to, name or symbol
data – numpy array shape (records,channels). If single dimension, one channel
channels – channel name or symbol list, or a single name/symbol. If a single name is specified for multi-column data, a VA channel is assumed. If None, a sorted list of all channels is assumed.
fid – option fid tuple (start, increment), default (0.0,1.0)
New in version 9.1.
-
write_line_vv
(line, chan_data)[source]¶ Write data to multiple channels in a line. If no channel list is provided it assumes that the data is for all channels from the line, the compliment of read_line().
- Parameters
line – line to write to, name or symbol
chan_data – numpy array shape (records,channels). If single dimension, one channel. Channels are created if they do not exist. VA channels must exist.
chan_data – list of tuples [(channel_name, vv), ]
Note
chan_data may contain VA data, which is defined by slice (ie. name[0], name[4]…). If VA data is included the VA channels must already exist.
New in version 9.2.
-
property
xyz_channels
¶ The currently identified (x, y, z) channels. Methods that work on spatial locations will use these channels for locating the data at each fiducial of the data. Can be set using a tuple of two or three strings. For example:
gdb.xyz_channels = ('Easting', 'Northing') gdb.xyz_channels = ('Easting', 'Northing', 'Elevation')
New in version 9.2.
-
class
Line
(gdb, name)[source]¶ Bases:
object
Class to work with database lines. Use constructor
Line.new
to create a new line. Use instance properties to work with line properties.- Parameters
gdb –
Geosoft_gdb
instancename – line name string, must exist - see
new()
to create a new line
New in version 9.3.
-
bearing
()[source]¶ Return bearing of a line based on location of the first and last point in the line. Returns None if the line is empty or first and last points are the same.
New in version 9.3.
-
property
category
¶ Line category, which can be set:
LINE_CATAGORY_FLIGHTLINE_CATEGORY_GROUPLINE_CATEGORY_NORMALNew in version 9.3.
-
property
date
¶ Line date. Can be set.
New in version 9.3.
-
delete
()[source]¶ Delete the line and all data associated with the line. After calling this method this line instance is no longer valid.
New in version 9.3.
-
property
flight
¶ Line flight number (flight/cruise/survey event). Can be set.
New in version 9.3.
-
property
group
¶ The lines group class name, ‘’ for a group lines (LINE_CATEGORY_GROUP). Only works for lines that are part of a group. Can be set.
New in version 9.3.
-
property
grouped
¶ True if this is a grouped line.
New in version 9.3.
-
property
lock
¶ Lock setting:
-1 unlocked (SYMBOL_LOCK_NONE)0 read-locked (SYMBOL_LOCK_READ)1 write-locked (SYMBOL_LOCK_WRITE)Can be set.
-
lock_set_
(fn, v)[source]¶ write_lock, set and release a gdb attribute that requires locking to write.
-
property
locked
¶ True if symbol is locked. Use property
lock
to determine if read or write lock, or to set the lock.Setting to
False
unlocks the symbol.New in version 9.3.
-
property
name
¶ Line name, consistent with names constructed by
create_line_name
.To change a line name change the type, number or version.
New in version 9.3.
-
classmethod
new
(gdb, name, linetype=None, group=None, dup=None, replace=False)[source]¶ Create a new line.
- Parameters
gdb –
Geosoft_gdb
instancename – line name
linetype –
line type for creating a new line, ignored if group defines
SYMB_LINE_NORMAL
normal lines, name is a string
SYMB_LINE_FLIGHT
flight lines, first letter is line type
group – group name for a grouped class
dup – duplicate properties of this line (name, symbol or Line).
replace –
True
to replace line if it exists. Default isFalse
.
- Returns
Line instance
New in version 9.3.
-
property
number
¶ Line number. Can be set
New in version 9.3.
-
property
selected
¶ True if this line is selected, can be set.
-
property
symbol
¶ Line symbol
New in version 9.3.
-
property
type
¶ Line type, which can be set:
LINE_TYPE_NORMALLINE_TYPE_BASELINE_TYPE_TIELINE_TYPE_TESTLINE_TYPE_TRENDLINE_TYPE_SPECIALLINE_TYPE_RANDOMNew in version 9.3.
-
property
version
¶ Line version number. Can be set.
New in version 9.3.
-
create_line_name
(number=0, line_type=0, version=0)[source]¶ Returns a valid database line name constructed from the component parts.
- Parameters
number – line number, or a string, default is 0
line_type – one of LINE_TYPE constants, default is LINE_TYPE_NORMAL
version – version number, default is 0
- Returns
string line name
Line name strings are constructed using the line naming convention as in the following:
L10.4
LINE_TYPE_NORMAL, number 10, version 4
B10.4
LINE_TYPE_BASE, number 10, version 4
D10.4
LINE_TYPE_RANDOM, number 10, version 4
P10.4
LINE_TYPE_SPECIAL, number 10, version 4
T10.4
LINE_TYPE_TIE, number 10, version 4
S10.4
LINE_TYPE_TEST, number 10, version 4
R10.4
LINE_TYPE_TREND, number 10, version 4
New in version 9.3.
-
delete_files
(file_name)[source]¶ Delete all files associates with this database name.
- Parameters
file_name – name of the database
New in version 9.3.
-
is_valid_line_name
(name)[source]¶ Return True if this is a valid line name.
See also
create_line_name
New in version 9.3.