Skip to content

Project🍋

Project 🍋

Unique Project object defining common data (units, CRS, etc.).

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.

attributes_mapping: Dict[str, str] property readonly 🍋

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 dictionnary.

crs: CRS property readonly 🍋

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

Returns:

Type Description
CRS

pyproj CRS object.

unit_registry: UnitRegistry property readonly 🍋

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

Returns:

Type Description
UnitRegistry

Pint unit registry.

get_unit(self, 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.

Exceptions:

Type Description
ValueError

if unit kind is not defined in the project.

quantity(self) 🍋

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(self, 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

Exceptions:

Type Description
ValueError

if attribute is not part of the mapping.

set_crs(self, 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

set_unit(self, 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

Exceptions:

Type Description
ValueError

if unit kind is not defined in the project.

Back to top