orangery Package

orangery Package

survey Module

class orangery.core.survey.LevelSection(data, p1, p2, backsight=0.0, datum=0.0, reverse=False, z_adjustment=None)

Bases: object

A Section view of a set of d,z coordinates. Z values may be calculated based on backsight, foresight and datum elevation.

plot(view='section', **kwargs)

Plot the d, z values of the data.

Parameters:
  • view (str) – Valid entries are ‘section’ and ‘map’. Default is ‘section’ view.
  • kwargs (dict) – Keyword arguments to be passed to Pandas and matplotlib.
Returns:

a matplotlib Axis.

Return type:

ax (Axis)

class orangery.core.survey.Section(data, p1, p2, reverse=False, z_adjustment=None)

Bases: object

A Section view of a set of x,y,z coordinates.

Parameters:
  • data (pandas.DataFrame) – contains the data to project.
  • p1 (shapely.Point) – the start of a line of section.
  • p2 (shapely.Point) – the end of a line of section.
  • reverse (bool) – reverse the order of points in the section.
  • z_adjustment (float) – adjust the elevation of the data.
plot(view='section', **kwargs)

Plot the d, z values of the projected data.

Parameters:
  • view (str) – Valid entries are ‘section’ and ‘map’. Default is ‘section’ view.
  • kwargs (dict) – Keyword arguments to be passed to Pandas and matplotlib.
Returns:

a matplotlib Axis.

Return type:

ax (Axis)

class orangery.core.survey.Survey(filename, columns, codebook, header=0, **kwargs)

Bases: object

A Survey dataset.

Parameters:
  • filename (str) – the path to the file to read.
  • format (str) – a string of characters that describes the survey data. Accepts: p - point x, e - x coord, easting y, n - y coord, northing z, h - z coord d, s - distance, station o - offset t - timestamp c - code r - remark q - quality f - foresight a - attribute The string may contain the characters in any order, without duplicates, except for ‘a’ which may occur multiple times. The string must contain x/e,y/n,z/h or d/s,z/h. Examples: ‘pyxzctnff’, ‘pnezfrf’
  • codebook (dict) – a dict that describes the codes used in the survey.
  • header (int) – the row number of the header. As in pandas it is 0 by default. If there is no header row specify ‘None’.
  • kwargs (dict) – keyword arguments passed to pandas.read_csv.
plot(**kwargs)

Plot the x, y values of the data.

Parameters:kwargs (dict) – Keyword arguments to be passed to Pandas and matplotlib.
Returns:a matplotlib Axis.
Return type:ax (Axis)
save(filename=None, original_header=False, write_history=False)

Save the data to a file

translate(deltas)

Translate the data by an xyz offset and add a line to history.

evaluation Module

class orangery.core.evaluation.Change(section1, section2, close_ends=False)

Bases: object

An analysis of the change between two Section objects.

Parameters
section1 (Section) : the initial condition. section2 (Section) : the final condition. close_ends (bool) : True indicates dangles should be closed with a vertical line.
annotate_plot(ax=None)

Add annotation to a plot to identify individual polygons.

Parameters:ax (Axis) – matplotlib Axis to which to add annotation.
Returns:patched matplotlib Axis.
Return type:ax (Axis)
polygon_plot(ax=None, fill_ec='black', fill_fc='none', fill_hatch='...', fill_label=None, cut_ec='black', cut_fc='none', cut_hatch='x', cut_label=None)

Adds two groups of polygon patches to a matplotlib Axis.

Fill and label first polygon of each type separately, otherwise make sequential call to fill.

Parameters:
  • ax (Axis) – matplotlib Axis to which to add polygon patches.
  • fill_ec (str) – fill polygon edge color.
  • fill_fc (str) – fill polygon face color.
  • fill_hatch (str) – fill polygon hatch pattern.
  • fill_label (str) – fill polygon label.
  • cut_ec (str) – cut polygon edge color.
  • cut_fc (str) – cut polygon face color.
  • cut_hatch (str) – cut polygon hatch pattern.
  • cut_label (str) – cut polygon label.
Returns:

patched matplotlib Axis.

Return type:

ax (Axis)

save(filename=None)
segment(materials)

Prompt the user to assign material from the materials dict to each polygon in the Change objects

Parameters
materials (dict) : a dict containing possible materials

filter Module

orangery.core.filter.benchmarks(df, code_table, codebook)

Given a DataFrame return survey records with benchmark codes.

Parameters:
  • df (pandas.DataFrame) – survey data records.
  • code_table (pandas.DataFrame) – survey data record properties extracted by parse function.
  • codebook (dict) – a dict that describes the codes used in the survey.
Returns:

records having benchmark codes.

Return type:

result (DataFrame)

orangery.core.filter.controls(df, code_table, codebook)

Given a DataFrame return survey records that have control codes.

Parameters:
  • df (pandas.DataFrame) – survey data records.
  • code_table (pandas.DataFrame) – survey data record properties extracted by parse function.
  • codebook (dict) – a dict that describes the codes used in the survey.
Returns:

records having control codes.

Return type:

result (DataFrame)

orangery.core.filter.endpoints(df, reverse=False)

Given a DataFrame return the first and last survey records.

Parameters:
  • df (pandas.DataFrame) – survey data records.
  • reverse (bool) – False returns first then last point, True returns last then first.
Returns:

first and last records in a DataFrame as Points.

Return type:

p1, p2 (Point)

orangery.core.filter.group(df, code_table, group)

Given a DataFrame return a copy of the survey records belonging to a given group

Parameters:
  • df (DataFrame) – survey data records.
  • code_table (DataFrame) – survey data record properties extracted by parse function.
  • group (str) – name of the group to select.
Returns:

records matching the given group name.

Return type:

result (DataFrame)

orangery.core.filter.pointname(df, name)

Given a DataFrame return the named point or survey record.

Parameters:
  • df (DataFrame) – survey data records.
  • name (str) – name of the point to select.
Returns:

records where point field (equivalent to the ‘Point name’ on Trimble data collectors) is equivalent to the name argument.

Return type:

result (DataFrame)