ogstools.ogs6py.curves module#

class ogstools.ogs6py.curves.Curves[source]#

Bases: BuildTree

Class to create the curve section of the project file.

__init__(tree, input_file=None)[source]#
coords(name)[source]#

Return the coords of a named curve as a numpy array.

Parameters:

name (str) – Curve name as defined in the <name> element.

Return type:

ndarray

Returns:

1-D array of coordinate values.

Raises:
  • KeyError – If no curve with the given name exists.

  • FileNotFoundError – If the binary file for a file-based curve is not resolved.

values(name)[source]#

Return the values of a named curve as a numpy array.

Parameters:

name (str) – Curve name as defined in the <name> element.

Return type:

ndarray

Returns:

1-D array of curve values corresponding to each coord.

Raises:
  • KeyError – If no curve with the given name exists.

  • FileNotFoundError – If the binary file for a file-based curve is not resolved.

add_curve_from_file(name, coords, values)[source]#

Add a curve whose data is read from binary files.

The binary files must be in little-endian double precision format. Only the file basenames are stored in the project file; if full paths are given, Project.save() copies the files to the project directory.

Parameters:
  • name (str) – Curve name.

  • coords (str | Path) – Path to the binary coords file (full or basename only).

  • values (str | Path) – Path to the binary values file (full or basename only).

Return type:

None

add_curve(name, coords, values)[source]#

Adds a new curve.

Parameters:
Return type:

None