Skip to content

Project🍋

Project 🍋

Unique Project object defining common data (units, CRS, etc.). Default configuration option: * COLORED_LOGS: True * TIMESTAMPED_LOGS: True See Config for all available configuration options, see set_config() for more information.

Attributes:

Name Type Description
unit_registry UnitRegistry

registry allowing unit management (see UnitRegistry in pint for more info).

crs CRS

reference coordinates system name or WKT string.

attributes_mapping Dict[str, str]

correspondence table mapping names to attributes.

Example

import geolime as geo
geo.Project()
Output
Project
└─attributes_mapping  {
    'X': 'X',
    'Y': 'Y',
    'Z': 'Z',
    'X_B': 'X_B',
    'Y_B': 'Y_B',
    'Z_B': 'Z_B',
    'X_M': 'X_M',
    'Y_M': 'Y_M',
    'Z_M': 'Z_M',
    'X_E': 'X_E',
    'Y_E': 'Y_E',
    'Z_E': 'Z_E',
    'DEPTH': 'DEPTH',
    'FROM': 'FROM',
    'TO': 'TO',
    'HOLEID': 'HOLEID',
    'AZIMUTH': 'AZIMUTH',
    'DIP': 'DIP',
    'GEOMETRY': 'geometry'
    }
└─crs  None
└─get_attribute()
└─get_config()
└─get_unit()
└─name  GeoLime Project
└─quantity()
└─set_attribute_mapping()
└─set_config()
└─set_crs()
└─set_name()
└─set_unit()
└─unit_registry()

attributes_mapping: Dict[str, str] property 🍋

Get the correspondence table mapping names to object attributes. It is typically used when loading CSV files requires to specify the column names for each attribute (e.g. X, Y, Z, HOLE IDs, DIP, AZIMUTH, etc. when loading Drillholes).

Returns:

Type Description
Dict[str, str]

The attributes mapping as a dictionary.

Example

import geolime as geo
geo.Project().attribute_mapping
Output
{'X_COLLAR': 'X_COLLAR',
'Y_COLLAR': 'Y_COLLAR',
'Z_COLLAR': 'Z_COLLAR',
'X_B': 'X_B',
'Y_B': 'Y_B',
'Z_B': 'Z_B',
'X_M': 'X_M',
'Y_M': 'Y_M',
'Z_M': 'Z_M',
'X_E': 'X_E',
'Y_E': 'Y_E',
'Z_E': 'Z_E',
'DEPTH_SURVEY': 'DEPTH_SURVEY',
'FROM': 'FROM',
'TO': 'TO',
'HOLEID': 'HOLEID',
'AZIMUTH': 'AZIMUTH',
'DIP': 'DIP',
'GEOMETRY': 'geometry'}

crs: CRS property 🍋

Return the CRS name or WKT string. To do: add examples.

Returns:

Type Description
CRS

pyproj CRS object.

Example

import geolime as geo
geo.Project().crs
Output
<Geographic 2D CRS: EPSG:4326>
Name: WGS 84
Axis Info [ellipsoidal]:
- Lat[north]: Geodetic latitude (degree)
- Lon[east]: Geodetic longitude (degree)
Area of Use:
- name: World.
- bounds: (-180.0, -90.0, 180.0, 90.0)
Datum: World Geodetic System 1984 ensemble
- Ellipsoid: WGS 84
- Prime Meridian: Greenwich

name: str property 🍋

Get the project name, default is "GeoLime Project".

Returns:

Type Description
str

The project name.

Example

import geolime as geo
geo.Project().name
Output
'GeoLime Project'

unit_registry: UnitRegistry property 🍋

Return the unit registry, see UnitRegistry in pint for more info.

Returns:

Type Description
UnitRegistry

Pint unit registry.

Example

import geolime as geo
geo.Project().unit_registry
Output
<pint.registry.UnitRegistry at 0x7f3b324be400>

get_attribute(attribute) 🍋

Set the mapping to the given attribute name.

Parameters:

Name Type Description Default
attribute Attribute

attribute to update.

required

Raises:

Type Description
ValueError

Attribute is not part of the mapping.

Example

import geolime as geo
geo.Project().get_attribute("HOLEID")
Output
'HOLEID'

get_config(key) 🍋

Get the value corresponding to the given key. If the key is not part of the config, None is returned.

Parameters:

Name Type Description Default
key str

key to update.

required

Returns:

Type Description
Any

The value associated to the given key, None otherwise

Example

import geolime as geo
geo.Project().get_config(Config.COLORED_LOGS)
Output
False

get_unit(kind) 🍋

Get the default Unit associated to the given UnitKind if applicable. See Unit and UnitRegistry in pint for more info.

Parameters:

Name Type Description Default
kind UnitKind

UnitKind for which to get the default Unit for the project.

required

Returns:

Type Description
Unit

Pint Unit.

Raises:

Type Description
ValueError

Unit kind is not defined in the project.

Example

import geolime as geo
geo.Project().get_unit("LENGTH")
Output
<Unit('meter')>

quantity() 🍋

Get the Quantity constructor associated to the UnitRegistry. See Quantity and UnitRegistry in pint for more info.

Returns:

Type Description
Quantity

Quantity constructor.

set_attribute_mapping(attribute, value) 🍋

Set the mapping to the given attribute name.

Parameters:

Name Type Description Default
attribute Attribute

attribute to update.

required
value str

new name value to update the attribute to.

required

Raises:

Type Description
ValueError

Attribute is not part of the mapping.

Example

import geolime as geo
geo.Project().set_attribute_mapping(geo.Attribute.HOLEID, 'Hole_ID')

set_config(key, value) 🍋

Set the config value of the given key.

Note

Set a configuration option (string value) or flag (boolean value) at runtime by prepending respectively GEOLIME_CONFIG_ or GEOLIME_FLAG_ to the config key as an environment variable. For instance, GEOLIME_FLAG_COLORED_LOGS=0 python main.py will set automatically Project().set_config(Config.COLORED_LOGS, False)

Parameters:

Name Type Description Default
key str

key to update.

required
value Any

new value to set the key to.

required

Example

import geolime as geo
geo.Project().set_config(Config.COLORED_LOGS, True)
geo.Project().set_config("My Custom Option", "Yeah!")

set_crs(crs) 🍋

Set the default CRS used by objects without specified CRS.

Parameters:

Name Type Description Default
crs CRS

the new CRS to set the default to.

required

Example

import geolime as geo
from pyproj import CRS
geo.Project().set_crs(CRS('EPSG:4326'))

set_name(name) 🍋

Set the project name.

Parameters:

Name Type Description Default
name str

the project name.

required

Example

geo.Project().set_name("My Project Name")

set_unit(kind, unit) 🍋

Set the default Unit associated to the given UnitKind if applicable. See Unit and UnitRegistry in pint for more info.

Parameters:

Name Type Description Default
kind UnitKind

UnitKind for which to set the default Unit for the project.

required
unit Unit

Unit to set.

required

Raises:

Type Description
ValueError

Unit kind is not defined in the project.

Example

import geolimes as geo
from pint import Unit
proj.set_unit(geo.UnitKind.ANGLE, Unit('rad'))

Last update: 2023-10-09