geosoft.gxpy.group submodule

A Geosoft View (geosoft.gxpy.view.View or geosoft.gxpy.view.View_3d) contains graphical elements as Group instances. Groups are named and are available to a user in a Geosoft viewer, which allows groups to be turned on or off, modify the transparency, or be deleted.

2D views can only accept 2D groups, while a 3D view can accept both 2D and 3D groups. When a 2D group is placed in a 3D view, the group is placed on a the active plane inside the 3D view

Classes:
Group base class for named rendering groups in 2D and 3D views.
Draw 2D drawing group, handles 2D drawing to a view or plane in a 3D view
Draw_3d 3D grawing group for 3D objects placed in a 3d view
Color_symbols_group group for 2D symbols rendered based on data values
Aggregate_group group that contains a geosoft.gxpy.agg.Aggregate_image instance
Color colour definition
Color_map maps values to colors
Pen pen definition, includes line colour, thickness and pattern, and fill.
Text_def defined text characteristics

Note

Regression tests provide usage examples: group drawing tests

APPEND = 0
class Aggregate_group(view, group_name, mode)

Bases: geosoft.gxpy.group.Group

Aggregate groups on a map

Parameters:
  • viewgxpy.view.View instance
  • name – group name, default uses the aggregate name
  • agggxpy.agg.Aggregate_image instance
Constructors:
open() open an existing aggregate group
new() create a new aggregate group
Properties:
name:aggregate group name
agg:gxpy.agg.Aggregate_image instance

New in version 9.2.

classmethod new(view, agg, name=None)
classmethod open(view, group_name)
CMODEL_CMY = 1
CMODEL_HSV = 2
CMODEL_RGB = 0
COLOR_BAR_ANNOTATE_BOTTOM = -1
COLOR_BAR_ANNOTATE_LEFT = -1
COLOR_BAR_ANNOTATE_RIGHT = 1
COLOR_BAR_ANNOTATE_TOP = 1
COLOR_BAR_BOTTOM = 2
COLOR_BAR_LEFT = 1
COLOR_BAR_RIGHT = 0
COLOR_BAR_TOP = 3
CYLINDER_CLOSE_ALL = 3
CYLINDER_CLOSE_END = 2
CYLINDER_CLOSE_START = 1
CYLINDER_OPEN = 0
C_BLACK = 67108863
C_BLUE = 50266112
C_CYAN = 50331903
C_GREEN = 33619712
C_GREY = 41975936
C_GREY10 = 51910680
C_GREY25 = 54542400
C_GREY50 = 41975936
C_LT_BLUE = 50348096
C_LT_CYAN = 50331712
C_LT_GREEN = 54526016
C_LT_GREY = 54542400
C_LT_MAGENTA = 50348032
C_LT_RED = 54542336
C_LT_YELLOW = 54525952
C_MAGENTA = 50396928
C_RED = 33554687
C_TRANSPARENT = 0
C_WHITE = 50331648
C_YELLOW = 67043328
class Color(color, model=0)

Bases: object

Colours, which are stored as a 24-bit color integer.

Parameters:
  • color

    string descriptor (eg. ‘R255G0B125’), color letter R, G, B, C, M, Y, H, S or V.; tuple (r, g, b), (c, m, y) or (h, s, v), each item defined in the range 0 to 255; 24-bit color number, which can be an item selected from the following list:

    C_BLACK
    C_RED
    C_GREEN
    C_BLUE
    C_CYAN
    C_MAGENTA
    C_YELLOW
    C_GREY
    C_LT_RED
    C_LT_GREEN
    C_LT_BLUE
    C_LT_CYAN
    C_LT_MAGENTA
    C_LT_YELLOW
    C_LT_GREY
    C_GREY10
    C_GREY25
    C_GREY50
    C_WHITE
    C_TRANSPARENT
    
  • model

    model of the tuple:

    CMODEL_RGB (default)
    CMODEL_CMY
    CMODEL_HSV
    

New in version 9.2.

adjust_brightness(brightness)

Return a Color instance adjusted for brightness.

New in version 9.2.

cmy

color as an (cyan, magenta, yellow) tuple, can be set

int_value

color as a 24-bit color integer, can be set

rgb

color as an (red, green, brue) tuple, can be set

class Color_map(cmap=None, title=None, unit_of_measure=None)

Bases: object

Color map for establishing data color mapping for things like aggregates and color symbols.

Parameters:
  • cmap

    the name of a Geosoft color map file (tbl, .zon, .itr, .agg) from which to establish the initial colors. If the file does not have zone values, which is the case for a tbl file, the Color_map will be uninitialized and you can use one of the set methods to establish zone values.

    You can also provide an int, which will create an uninitialized map of the the specified length, or a geosoft.gxapi.GXITR instance.

    If not specified the Geosoft default color table is used.

  • title – Color map title which is displayed in the color map legend.
  • unit_of_measure – Unit of measure to be displayed in a color map legend.

New in version 9.2.

Changed in version 9.3: changed units to unit_of_measure for consistency across gxpy

brightness

Brightness is a value between -1 (black) and +1 (white), The default is 0. :returns: brightness, -1 to +1

New in version 9.2.

color_map

list of zone limts, colours in the color map

color_map_rgb

list of zone limits and (red, green, blue) colours

color_of_value(value)

Return the gxg.Color of a value. The mapping is determined with exclusive minima, inclusive maxima for each color level. Values <= level [0] are assigned the [0] color, and values greater than the the [n-2] level are assigned the [n-1] color.

Parameters:value – data value
Returns:Color instance

New in version 9.2.

initialized

Returns True if the color_map has been initialized to have zone boundaries.

New in version 9.2.

length

Number of color zones in the map.

model_type

Geosoft colour model used in the Geosoft geosoft.gxapi.GXITR

save_file(file_name=None)

Save to a Geosoft file, tbl, itr or zon. If the file_name does not have an extension and the color_map has not been initialized a tbl file is created (colors only), otherwise a itr is created, which contains both zone boundaries and colors.

Parameters:file_name – file name, if None a temporary file is created

This is useful for gxapi methods that require a colour map to be loaded from a file. Say you cave a Color_map instance named cmap and you want to create a GXCSYMB instance, which requires a colur map file:

cs = gxapi.GXCSYMB.create(cmap.save_file())

New in version 9.2.

set_linear(minimum, maximum, inner_limits=True, contour_interval=None)

Set the map boundaries based on a linear distribution between minimum and maximum.

Parameters:
  • minimum – minimum
  • maximum – maximum
  • inner_limits – True if the range specifies the inner limits of the color mappings, in which case values less than or equal to the minimum are mapped to the first color and colors greater than the maximum are mapped to the last color. If False, the minimum and maximum are at the outer-edges of the color map.
  • contour_interval – align color edges on this interval, which is useful for matching colors contour map, for example. The color map will be reduced in size by thinning of unneeded colors if necessary.

New in version 9.2.

set_logarithmic(minimum, maximum, contour_interval=None)

Set the color boundaries based on a logarithmic distribution between minimum and maximum.

Parameters:
  • minimum – minimum, must be > 0
  • maximum – maximum
  • contour_interval – align color edges on this interval, 10 for powers of 10. unneeded colors if necessary.

New in version 9.2.

set_normal(standard_deviation, mean, expansion=1.0, contour_interval=None)

Set the color boundaries using a normal distribution around a mean.

Parameters:
  • standard_deviation – the standard deviation of the normal distribution.
  • mean – maximum
  • contour_interval – align color edges on this interval, 10 for powers of 10. unneeded colors if necessary.

New in version 9.2.

set_sequential(start=0, increment=1)

Set color map zones based on a start and increment between each color zone.

Parameters:
  • start – minimum zone boundary, values <= this value will have the first color
  • increment – increment between each color.

New in version 9.2.

title

Title, usually the name of the data from which the color bar was made or is intended. None if no title

New in version 9.2.

unit_of_measure

Data unit of measure for the data from which the color bar was made or is intended. None if the unit of measure is unknown.

New in version 9.2.

class Color_symbols_group(view, group_name, **kwargs)

Bases: geosoft.gxpy.group.Group

Data represented as colored symbols based on a Color_map.

Constructors:
new() create a new symbol group in a view
open() open an existing symbol group in a view
color_map()

Return the geosoft.gxpy.group.Color_map of a color symbol group.

New in version 9.3.

classmethod new(view, name, data, color_map, symbol_def=None, symbol=20, **kwargs)

Create a new color symbols group with color mapping.

Parameters:
  • view – the view in which to place the group
  • group_name – group name, which can optionally be decorated with the unit_of_measure (eg “Cu.ppm”)
  • data – iterable that yields ((x, y), data), or ((x, y, z), data, ...). Only the first data value is used.
  • color_map – symbol fill color Color_map. Symbols are filled with the color lookup using data.
  • symbol_defText_def defines the symbol font to use, normally symbols.gfn is expected, and if used the symbols defined by the SYMBOL manifest are valid. For other fonts you will get the symbol requested. The default is Text_def(font='symbols.gfn', color='k', weight=FONT_WEIGHT_ULTRALIGHT)
  • symbol – the symbol to plot, normally one of SYMBOL.
Returns:

Color_symbols_group instance

New in version 9.2.

classmethod open(view, group_name)

Open an existing color symbols group.

Parameters:
  • view – view that contains the group
  • group_name – name of the group, which must be a color symbols group
Returns:

Color_symbols_group instance

New in version 9.2.

class Draw(*args, **kwargs)

Bases: geosoft.gxpy.group.Group

Create (start) a drawing group for 2D drawing elements.

On a 3D view, 2D drawing elements are placed on the default drawing plane. Drawing groups will lock the view such that only one drawing group can be instantiated at a time.

Use with Draw() as group: to ensure correct unlocking when complete.

Inherits from the Group base class.

contour(grid_file_name)

Draw contours for a grid file. A default contour interval is determined from the grid.

Parameters:grid_file_name – Grid file name

New in version 9.2.

drawing_coordinate_system

The coordinate of incoming spatial data, which are converted to the coordinate system of the view. This is normally the same as the view coordinate system, but it can be set to a different coordinate system to have automatic reprojection occur during drawing.

graticule(dx=None, dy=None, ddx=None, ddy=None, style=1)

Draw a graticule reference on a view.

Parameters:

New in version 9.2.

line(p2)

Draw a line on the current plane

Parameters:p2geometry.Point2, or (p1, p2)

New in version 9.2.

new_pen(**kwargs)

Returns a pen that inherits default from the current view pen. Arguments are the same as the Pen constructor. This using this ensures that default sizing of view unit-based dimensions (such as line_thick) are not lost when new pens are created.

Parameters:kwargs – see Pen
Returns:Pen instance

New in version 9.2.

pen

the current drawing pen as a Pen instance

point(p)

Draw a point.

Parameters:p – point location as geosoft.gxpy.geometry.Point

New in version 9.3.

polygon(pp, close=False)

Draw a polygon on the current plane.

Parameters:ppgeosoft.gxpy.geometry.PPoint

Note

Smooth-line polygons must have at least 6 points for the closure to appear continuous.

New in version 9.2.

polyline(pp, close=False)

Draw a polyline the current plane

Parameters:

Note

Smooth-line polygons must have at least 6 points for the closure to appear continuous.

New in version 9.2.

polypoint(pp)

Draw many points.

Parameters:pp – point location as geosoft.gxpy.geometry.PPoint, or a pair of VVs (vvx, vvy), or something that gxpy.geometry.PPoint can construct into a PP.

New in version 9.3.

rectangle(p2)

Draw a 2D rectangle on the current plane :param p2: geometry.Point2, or (p1, p2), or (x0, y0, x2, y2)

New in version 9.2.

text(text, location=(0, 0), reference=0, angle=0.0, text_def=None)

Draw text in the view.

Parameters:
  • text – text string. Use line-feed characters for multi-line text.
  • location – (x, y) or a gxpy.geomerty.Point location
  • reference

    Text justification point relative text outline box. The points are:

    6 7 8   top left, center, right
    3 4 5   middle left, center, right
    0 1 2   bottom left, center, right
    
  • angle – baseline angle in degrees clockwise
  • text_def – text definition, if not set the current definition is used
  • line_spacing – the line spacing for multi-line text as a factor of the text height, default is 1.5

New in version 9.2.

text_def

the current text definition as a Text_def instance, can be set.

class Draw_3d(view, *args, render_backfaces=False, **kwargs)

Bases: geosoft.gxpy.group.Draw

Create a 3D drawing group within a 3D view.

3D drawing groups accept 3D drawing objects that can be created using methods of this class. 2D objects can also be drawn to a 3D group and will be placed on the default drawing plane within the 3D view.

Parameters:render_backfaces – True to turn backface rendering on.

New in version 9.2.

box_3d(p2, wireframe=False)

Draw a 3D box

Parameters:
  • p2 – box corners as geometry.Point2, or (p0, p1), or (x0, y0, z0, x1, y1, z1)
  • wireframe – True to draw edges only

New in version 9.2.

cone_3d(p2, radius)

Draw a cone.

Parameters:
  • p2 – end points as geometry.Point2, or (p0, p1), or (x0, y0, z0, x1, y1, z1).
  • radius – cone base radius, base is as the the first point of p2.

New in version 9.2.

cylinder_3d(p2, radius, r2=None, close=3)

Draw a cylinder.

Parameters:
  • p2 – end points as geometry.Point2, or (p0, p1), or (x0, y0, z0, x1, y1, z1)
  • radius – cylinder radius.
  • r2 – end radius if different from the start
  • close

    one of:

    CYLINDER_OPEN
    CYLINDER_CLOSE_START
    CYLINDER_CLOSE_END
    CYLINDER_CLOSE_ALL
    

New in version 9.2.

polydata_3d(data, render_info_func=None, passback=None)

Create 3D objects rendered using data attributes.

Parameters:
  • view – a 3D view in which to place the group
  • data – iterable that yields items passed to your render_info_func callback
  • render_info_func

    a callback that given (item, passback) returns the rendering (symbol_type, geometry, color_integer, attibute):

    Symbol Geometry Color Attribute
    SYMBOL_3D_SPHERE Point Color.int_value radius
    SYMBOL_3D_CUBE Point2 Color.int_value None
    SYMBOL_3D_CYLINDER Point2 Color.int_value radius
    SYMBOL_3D_CONE Point2 Color.int_value radius
  • passback – something passed back to your render_info_func function, default None.

Example

import geosoft.gxpy.geometry as gxgm
import geosof.gxpy.view as gxv
import geosogt.gxpy.group as gxg

def render_spheres(xyz, cmap_radius):
    color, radius = cmap_radius
    return gxg.SYMBOL_3D_SPHERE, xyz, color.int_value, radius

data = gxgm.PPoint(((5, 5, 5), (7, 5, 5), (7, 7, 7)))
with gxv.View_3d.new('example_polydata') as v:
    with gxg.Draw_3d(v, 'red_spheres') as g:
        g.polydata_3d(data, render_spheres, (gxg.Color('r'), 0.25))

New in version 9.2.

polyline_3d(points, style=0)

Draw a polyline.

Parameters:
  • points – verticies of the polyline, geosoft.gxpy.geometry.PPoint instance, or array-like [x,y,z]
  • style – LINE3D_STYLE_LINE, LINE3D_STYLE_TUBE or LINE3D_STYLE_TUBE_JOINED. Lines are single-pixel-wide. Tubes have width defined by the pen line thickness. Joined tubes have a joints and rounded ends.

New in version 9.2.

polypoint_3d(points, style=0)

Draw multiple points.

Parameters:
  • points – points to draw, geosoft.gxpy.geometry.PPoint instance, or array-like [x,y,z]
  • style – POINT_STYLE_DOT or POINT_STYLE_SPHERE. Dots are fast and intended for point clouds. The current pen thickness is used as the sphere sizes.

New in version 9.2.

render_backfaces

True if backface rendering is on, default is off (False). Backface rendering controls the rendering of parts of solid objects that would normally be hidden from view. If drawing solid objects that have an open face, such as cylinders with an open end, backface rendering will be be turned on. Once on it cannot be turned off for a view.

New in version 9.2.

sphere(p, radius)

Draw a sphere.

Parameters:
  • p – location as geometry.Point, or (x, y, z)
  • radius – sphere radius

New in version 9.2.

FONT_WEIGHT_BOLD = 4
FONT_WEIGHT_LIGHT = 2
FONT_WEIGHT_MEDIUM = 3
FONT_WEIGHT_ULTRALIGHT = 1
FONT_WEIGHT_XBOLD = 5
FONT_WEIGHT_XXBOLD = 6
GRATICULE_CROSS = 2
GRATICULE_DOT = 0
GRATICULE_LINE = 1
GROUP_AGG = 3
GROUP_ALL = 0
GROUP_CSYMB = 4
GROUP_MARKED = 1
GROUP_NAME_SIZE = 2080
GROUP_VISIBLE = 2
GROUP_VOXD = 5
class Group(view, name='_', plane=None, view_lock=False, mode=0, unit_of_measure='', group_3d=False)

Bases: object

Geosoft group class.

Parameters:
view:gxpy.View
name:group name, default is “_”.
plane:plane number, or plane name if drawing to a 3D view. Default is plane number 0.
view_lock:True to lock the view for a single-stream drawing group. Default is False.
unit_of_measure:
 unit of measurement for data in this group, default is ‘’
group_3d:True for a 3D drawing group, default assumes a 2D drawing group to a plane.
mode:APPEND (default), NEW or READ_ONLY
Properties:
view:the geosoft.gxpy.view.View instance that contains this group
name:the name of the group
unit_of_measure:
 the unit of measurement (uom) for this data in this group
name_uom:uom decorated group name as it appears in a view
extent:extent of the group in view units
extent_map_cm:extent of the group in map cm
drawing_coordinate_system:
 the coordinate system of drawing coordinates. Setting to None will reset drawing coordinates to the view cs. If drawing_coordinate_system is set to some other cs the drawing coordinates will be transformed into the view cs.

New in version 9.2.

Changed in version 9.3: added support for unit_of_measure

close()

Close the group, unlocks the view

drawing_plane

drawing plane of this group, None for a group in a 2D view.

extent

group extent as (xmin, ymin, xmax, ymax) in view units

extent_map_cm(extent=None)

Return an extent in map cm.

Parameters:extent – an extent in view units as a tuple (xmin, ymin, xmax, ymax), Default is the group extent.

New in version 9.2.

guid

The group GUID.

New in version 9.3.

gx_metadata

The group Geosoft metadata as a Geosoft geosoft.gxpy.metadata.Metadata instance. Can be set.

New in version 9.3.

locate(location, reference=4)

Locate the group relative to a point.

Parameters:
  • location – location (x, y) or a geosoft.gxpy.geometry.Point
  • reference

    reference point relative to the clip limits of the view to which reference location. The points are:

    6 7 8   top left, center, right
    3 4 5   center left, center, right
    0 1 2   bottom left, center, right
    

New in version 9.2.

name

group name

number

group number in the view

unit_of_measure

Unit of measure for scalar data contained in this group. This is only relevant for groups that contain scalar data, such as a Colour_symbols_group. For the spatial unit_of_measure use drawing_coordinate_system.unit_of_measure

Can be set.

..versionadded:: 9.3

view

view that contains this group.

visible

True if group is visible, can be set.

exception GroupException

Bases: Exception

Exceptions from geosoft.gxpy.group.

New in version 9.2.

LINE3D_STYLE_LINE = 0
LINE3D_STYLE_TUBE = 1
LINE3D_STYLE_TUBE_JOINED = 2
LINE_STYLE_DOTTED = 3
LINE_STYLE_LONG = 2
LINE_STYLE_LONG_DOT_LONG = 6
LINE_STYLE_LONG_SHORT_LONG = 5
LINE_STYLE_SHORT = 4
LINE_STYLE_SOLID = 1
LOCATE_CENTER = 2
LOCATE_FIT = 0
LOCATE_FIT_KEEP_ASPECT = 1
NEW = 1
POINT_STYLE_DOT = 0
POINT_STYLE_SPHERE = 1
class Pen(**kwargs)

Bases: object

Geosoft Pen class.

The default dimensioned properties (line_thick, line_pitch, pat_size and pat_thick) assume the view units are cm, and this is usually only the case for the base view. For views in other units either explicitly define the dimention in view units, or pass factor set the the view geosoft.gxpy.view.View.units_per_map_cm.

Parameters:
  • line_color – line Color instance, default is black
  • fill_color – fill Color instance, default is transparent
  • line_thick – line thickness, default is 0.01
  • line_style

    line pattern style

    LINE_STYLE_SOLID (default)
    LINE_STYLE_LONG
    LINE_STYLE_DOTTED
    LINE_STYLE_SHORT
    LINE_STYLE_LONG_SHORT_LONG
    LINE_STYLE_LONG_DOT_LONG
    
  • line_pitch – line style pitch, default is 0.5
  • line_smooth

    smooth line:

    SMOOTH_NONE (default)
    SMOOTH_AKIMA
    SMOOTH_CUBIC
    
  • pat_number – pattern number for filled patterns (refer to etc/default.pat) default 0, flood fill
  • pat_angle – pattern angle, default 0
  • pat_density – pattern density, default 1
  • pat_size – pattern size, default 1.0
  • pat_style

    pattern style:

    TILE_RECTANGULAR (default)
    TILE_DIAGONAL
    TILE_TRIANGULAR
    TILE_RANDOM
    
  • pat_thick – pattern line thickness, default 0.01
  • default – default Pen instance, if specified defaults are established from this
  • factor – default spatial properties are multiplied by this factor. This is useful for creating pens scaled to the units of a view. The default pen properties are scaled to cm. Typically you will pass geosoft.gxpy.view.View.units_per_map_cm.
fill_color
classmethod from_mapplot_string(cstr)

Create a Pen instance from a mapplot-style string descriptor using either a krgbKRGB or kcmyKCMY color model. Lower case letters indicate line color, uppercase indicates fill color, ‘k’, ‘K’ for black. Each letter may be followed by an intensity between 0 and 255. If an intensity is not specified 255 is assumed.

Line thickness can be defined by ‘t’ followed by a thickness in 1000’th of the view unit, which for the default ‘base’ view would be microns.

Parameters:cstr – mapplot-style color definition

Examples:

‘r’ red line
‘R’ red fill
‘rG64’ red line, light-green fill
‘c64’ light cyan line, equivalent to ‘R191G255B255’
‘c64K96’ light cyan line, light-grey fill
‘bt500’ blue line, 0.5 units thick

New in version 9.2.

line_color

pen line color as a color instance, can be set.

mapplot_string

line/fill colour and thickness string suing mapplor format, eg. ‘kR125B64t1000’

READ_ONLY = 2
REF_BOTTOM_CENTER = 1
REF_BOTTOM_LEFT = 0
REF_BOTTOM_RIGHT = 2
REF_CENTER = 4
REF_CENTER_LEFT = 3
REF_CENTER_RIGHT = 5
REF_TOP_CENTER = 7
REF_TOP_LEFT = 6
REF_TOP_RIGHT = 8
SMOOTH_AKIMA = 2
SMOOTH_CUBIC = 1
SMOOTH_NONE = 0
SYMBOL_3D_CONE = 3
SYMBOL_3D_CUBE = 1
SYMBOL_3D_CYLINDER = 2
SYMBOL_3D_SPHERE = 0
SYMBOL_BOX = 4
SYMBOL_CIRCLE = 20
SYMBOL_DOT = 1
SYMBOL_HEXAGON = 7
SYMBOL_INVERTED_TRIANGLE = 6
SYMBOL_NONE = 0
SYMBOL_PLUS = 2
SYMBOL_SMALL_BOX = 8
SYMBOL_SMALL_DIAMOND = 9
SYMBOL_TRIANGLE = 5
SYMBOL_X = 3
TILE_DIAGONAL = 1
TILE_RANDOM = 3
TILE_RECTANGULAR = 0
TILE_TRIANGULAR = 2
class Text_def(**kwargs)

Bases: object

Text definition:

Parameters:
  • font – font name. TrueType fonts are assumed unless the name ends with ‘.gfn’, which is a Geosoft gfn font.
  • weight

    one of:

    FONT_WEIGHT_ULTRALIGHT
    FONT_WEIGHT_LIGHT
    FONT_WEIGHT_MEDIUM
    FONT_WEIGHT_BOLD
    FONT_WEIGHT_XBOLD
    FONT_WEIGHT_XXBOLD
    
  • line_thick – line thickness from which to determine a weight, which is calculated from the ratio of line thickness to height.
  • italics – True for italics fonts
  • height – text height, default 0.25
  • factor – default spatial properties are multiplied by this factor. This is useful for creating text scaled to the units of a view. The default text properties are scaled to cm.
Properties:
height:font height in view units
font:font name
weight:font weight, one of FONT_WEIGHT
line_thick:font line thickness for gfn stroke fonts
italics:True for italics
slant:Slant angle for stroke fonts, 0 if normal, 15 for italics
mapplot_string:mapplot compatible text definition string

New in version 9.2.

color

text color as a Color instance, can be set

font

text font name, can be set.

line_thick

text line thickness determined from the font weight, can be set.

mapplot_string

Mapplot text definition string, assumes scaling in cm.

slant

text slant, 15 for italics, 0 for not italics, can be set. If set, any slant greater than 5 will result in a 15 degree slant to create italics.

UNIT_MAP = 2
UNIT_VIEW = 0
UNIT_VIEW_UNWARPED = 3
color_from_string(cstr)

Return a Geosoft color number from a color string.

Parameters:cstr – color string (see below)
Returns:color

Colour strings may be “R”, “G”, “B”, “C”, “M”, “Y”, “H”, “S”, “V”, or “K” or a combination of these characters, each followed by up to three digits specifying a number between 0 and 255. An empty string will produce C_ANY_NONE.

You must stay in the same color model, RGB, CMY, HSV or K.

For example “R”, “R127G22”, “H255S127V32”

Characters are not case sensitive.

New in version 9.3.

contour(view, group_name, grid_file_name, **kwargs)

Create a contour group from a grid file. A default contour interval is determined from the grid.

Parameters:
  • group_name – name for the contour group
  • grid_file_name – Grid file name

New in version 9.3.

edge_reference(area, reference)

Location of a reference point of an area.

Parameters:
  • areaPoint2 instance, or (x0, y0, x1, y1)
  • reference

    reference point relative to the clip limits of the view to which reference location. The points are:

    6 7 8   top left, center, right
    3 4 5   middle left, center, right
    0 1 2   bottom left, center, right
    
Returns:

Point desired reference location as a Point

New in version 9.2.

font_weight_from_line_thickness(line_thick, height)

Returns font weight for a text height and line thickness.

Parameters:
  • line_thick – line thickness in same units as the text height
  • height – text height
Returns:

one of:

FONT_WEIGHT_ULTRALIGHT
FONT_WEIGHT_LIGHT
FONT_WEIGHT_MEDIUM
FONT_WEIGHT_BOLD
FONT_WEIGHT_XBOLD
FONT_WEIGHT_XXBOLD

New in version 9.2.

legend_color_bar(view, group_name, cmap, cmap2=None, bar_location=0, location=None, decimals=1, annotation_height=0.2, annotation_offset=None, annotation_side=1, box_size=None, bar_width=None, max_bar_size=None, minimum_gap=0, post_end_values=False, annotate_vertical=False, division_line=1, interval_1=None, interval_2=None, title=None)

Draw a color bar legend from :class:Color_map coloring definitions.

Parameters:
  • viewgxpy.view.View instance in which to place the bar
  • group_name – name for the color_bar group, overwrites group if it exists.
  • cmapColor_map instance
  • cmap2 – optional orthogonal blended Color_map instance. If making a shaded-color legend, provide the shaded color map here.
  • bar_location

    one of:

    COLOR_BAR_RIGHT = 0
    COLOR_BAR_LEFT = 1
    COLOR_BAR_BOTTOM = 2
    COLOR_BAR_TOP = 3
    
  • location – offset or (x, y) offset from bar_location reference point, in cm. The default is determined to center the bar off the location side specified.
  • decimals – annotation decimal places
  • annotation_height – annotation number height (cm)
  • annotation_offset – offset of annotations from the bar (cm)
  • annotation_side

    side of the bar for annotations

    COLOR_BAR_ANNOTATE_RIGHT = 1
    COLOR_BAR_ANNOTATE_LEFT = -1
    COLOR_BAR_ANNOTATE_TOP = 1
    COLOR_BAR_ANNOTATE_BOTTOM = -1
    
  • box_size – box size, height for vertical bars, width for horizontal bars
  • bar_width – width of the color boxes, horizontal for vertical bars, vertical for horizontal bars
  • max_bar_size – maximum bar size, default is the size of the view edge
  • minimum_gap – minimum gap to between annotations. Annotations are dropped in necessary.
  • post_end_values – post the maximum and minimum values
  • annotate_vertical – True to orient labels vertically
  • division_line – 0, no division lines, 1 - line, 2 - tick
  • interval_1 – Major annotation increment, default annotates everything
  • interval_2 – secondary smaller annotations, reduced to 1/10, 1/5, 1/4 or 1/2 of interval_1. Default chooses something reasonable.
  • title – bar title, use new-lines for sub-titles. Default uses the title and unit_of_measure from cmap.

New in version 9.2.

thickness_from_font_weight(weight, height)

Returns the line thickness appropriate for a text weight.

Parameters:
  • weight

    one of:

    FONT_WEIGHT_ULTRALIGHT
    FONT_WEIGHT_LIGHT
    FONT_WEIGHT_MEDIUM
    FONT_WEIGHT_BOLD
    FONT_WEIGHT_XBOLD
    FONT_WEIGHT_XXBOLD
    
  • height – font height

New in version 9.2.