NumpyConverter Class Reference

Converting points including their attributes into numpy arrays. More...

+ Inheritance diagram for NumpyConverter:

Static Public Member Functions

def compare (obj, translator, leaf, classMatrix, mapCol, map, helper, invert, filter=None)
 integral comparison of a specific attribute columns with a given numpy array More...
 
def create (rowCount, layout, withCoordinates=True, noDataObj=None, valueType=ColumnType(-1))
 Creates a python dictionary mapping columns labels (x,y,z or attribute name) to correctly sized column numpy arrays. More...
 
def fill (self, *args, **kwargs)
 possible calls: More...
 
def get (self, *args, **kwargs)
 possible calls: More...
 
def searchPoint (DM, win, layout, withCoordinates=True, noDataObj=None, valueType=ColumnType(-1), filter=None)
 possible calls: More...
 
def set (obj, translators, leaf, layout, filter=None, rowIdx=0)
 set attributes of a point index leaf object from a numpy dictionary More...
 
def setById (obj, DM, layout=0)
 set attributes of datamanager objects identified by their id More...
 

Detailed Description

Converting points including their attributes into numpy arrays.

Member Function Documentation

◆ compare()

def compare (   obj,
  translator,
  leaf,
  classMatrix,
  mapCol,
  map,
  helper,
  invert,
  filter = None 
)
static

integral comparison of a specific attribute columns with a given numpy array

The results are stored in a class comparison matrix

Parameters
[in]objnumpy array
[in]translatorpython dictionary for translating input values (can be empty)
[in]leafpoint index leaf that should be converter
[in]classMatrixclassification matrix storing cross validation
[in]mapColattribute (single column layout) for accessing the relevant map index
[in]mapindex map object describing the object indices for selection
[in]helperindex helper object for keeping track of traversed map index (can be empty. the object is extended automatically)
[in]invertif false all objects listed by the index map are inserted to the numpy dict. Otherwise all objects that are NOT listed are inserted.
[in]filteroptional filter to subselect the points

◆ create()

def create (   rowCount,
  layout,
  withCoordinates = True,
  noDataObj = None,
  valueType = ColumnType(-1) 
)
static

Creates a python dictionary mapping columns labels (x,y,z or attribute name) to correctly sized column numpy arrays.

Parameters
[in]rowCountsize of column numpy arrays
[in]layoutdefines the attributes that should be transferred
[in]withCoordinatesflag if numpy arrays for coordinates are desired
[in]noDataObjsingle or list of no data values. Beside integer and double values also 'max', 'min' and 'mask' supported. if set to 'mask', masked numpy arrays are returned instead of using no data values
[in]valueTypeset specific output column type (pyDM.ColumnType or numpy.dtype) if needed
Returns
python dictionary object

◆ fill()

def fill (   self,
args,
**  kwargs 
)
static

possible calls:

  • fill(obj: object, rowIdx: object, leaf: PointIndexLeaf, filter: Filter)
  • fill(obj: object, rowIdx: object, mapCol: AddInfoLayout, map: IndexMapSet, helper: IndexHelperSet, invert: object, leaf: PointIndexLeaf, filter: Filter)
Parameters
self(type: object) self pointer
*args(type: list) mandatory parameter
**kwargs(type: dict) mandatory parameter
Returns
(type: int)

◆ get()

def get (   self,
args,
**  kwargs 
)
static

possible calls:

  • get(leaf: PointIndexLeaf, layout: AddInfoLayout, withCoordinates: object, noDataObj: object, valueType: ColumnType, filter: Filter)
  • get(leaf: PointIndexLeaf, layout: AddInfoLayout, mapCol: AddInfoLayout, map: IndexMapSet, helper: IndexHelperSet, invert: object, withCoordinates: object, noDataObj: object, valueType: ColumnType, filter: Filter)
  • get(pointSet: PointSet, layout: AddInfoLayout, withCoordinates: object, noDataObj: object, valueType: ColumnType, filter: Filter)
  • get(DM: Datamanager, layout: AddInfoLayout, withCoordinates: object, noDataObj: object, valueType: ColumnType, filter: Filter)
Parameters
self(type: object) self pointer
*args(type: list) mandatory parameter
**kwargs(type: dict) mandatory parameter
Returns
(type: object)

◆ searchPoint()

def searchPoint (   DM,
  win,
  layout,
  withCoordinates = True,
  noDataObj = None,
  valueType = ColumnType(-1),
  filter = None 
)
static

possible calls:

  • searchPoint(DM: Datamanager, win: Window, layout: AddInfoLayout, withCoordinates: object, noDataObj: object, valueType: ColumnType, filter: Filter)
  • searchPoint(DM: Datamanager, box: Box, layout: AddInfoLayout, withCoordinates: object, noDataObj: object, valueType: ColumnType, filter: Filter)
  • searchPoint(DM: Datamanager, polygon: Polygon, layout: AddInfoLayout, withCoordinates: object, noDataObj: object, valueType: ColumnType, filter: Filter)
Parameters
DM(type: Datamanager) mandatory parameter
win(type: Window | Polygon | Box) mandatory parameter
layout(type: AddInfoLayout) mandatory parameter
withCoordinates(type: object) optional parameter
noDataObj(type: object) optional parameter
valueType(type: ColumnType) optional parameter
filter(type: Filter) optional parameter
Returns
(type: object)

◆ set()

def set (   obj,
  translators,
  leaf,
  layout,
  filter = None,
  rowIdx = 0 
)
static

set attributes of a point index leaf object from a numpy dictionary

The optional translator objects can be used to map input values to 'translated' values. If a values is not specified in the corresponding dictionary object, this value will be treated as null. Since the functionality allows setting multiple attributes at once, an empty list (which disables the translator functionality) or a list containing the same number of dictionary objects as provided by the data object and the layout columns. The function uses the layout column order for selection the correct translator object.

Parameters
[in]objpython dictionary of numpy column arrays
[in]translatorslist of python dictionary for translating input values (can be empty)
[in]leafpoint index leaf that should be converter
[in]layoutdefines the attributes that should be transferred
[in]filteroptional filter to subselect the points
[in]rowIdxoptional row index where to start accessing the numpy object(s). default=0
Returns
number of points that have been changed

◆ setById()

def setById (   obj,
  DM,
  layout = 0 
)
static

set attributes of datamanager objects identified by their id

The functionality can be used to update but also to create new attributes. The given numpy dict object must contain the 'Id' entry and at least one more entry/numpy array that is used for setting the attribute of the identified datamanager objects. The provided layout needs to match the entries of the numpy dict object otherwise an exception is thrown. The function returns the number of changed objects allowing the call to check if all Ids exist in the datamanager.

Parameters
[in]objpython dictionary of numpy column arrays
[in]DMdatamanager object which should be modified
[in]layoutdefines the attributes that should be transferred
Returns
number of points that have been changed