Class: QgsMeshCalculator

class qgis.analysis.QgsMeshCalculator(formulaString: str, outputFile: str, outputExtent: QgsRectangle, startTime: float, endTime: float, layer: QgsMeshLayer)

Bases: sip.wrapper

Creates calculator with bounding box (rectangular) mask

Parameters
  • formulaString (str) – formula/expression to evaluate. Consists of dataset group names, operators and numbers

  • outputFile (str) – file to store the resulting dataset group data

  • outputExtent (QgsRectangle) – spatial filter defined by rectangle

  • startTime (float) – time filter defining the starting dataset

  • endTime (float) – time filter defining the ending dataset

  • layer (QgsMeshLayer) – mesh layer with dataset groups references in formulaString

QgsMeshCalculator(formulaString: str, outputFile: str, outputMask: QgsGeometry, startTime: float, endTime: float, layer: QgsMeshLayer) Creates calculator with geometry mask

Parameters
  • formulaString – formula/expression to evaluate. Consists of dataset group names, operators and numbers

  • outputFile – file to store the resulting dataset group data

  • outputMask – spatial filter defined by geometry

  • startTime – time filter defining the starting dataset

  • endTime – time filter defining the ending dataset

  • layer – mesh layer with dataset groups references in formulaString

QgsMeshCalculator(QgsMeshCalculator)

Performs mesh layer calculations.

Mesh calculator can do various mathematical operations between dataset groups from a single mesh layer. Resulting dataset group is added to the mesh layer. Result can be filtered by extent or a vector layer mask spatially and by selection of times.

Note: only dataset groups defined on vertices are implemented and supported

Methods

expression_valid

Returns whether formula is valid for particular mesh layer

processCalculation

Starts the calculation, writes new dataset group to file and adds it to the mesh layer

Attributes

Canceled

CreateOutputError

EvaluateError

InputLayerError

InvalidDatasets

MemoryError

ParserError

Success

Canceled = 1
CreateOutputError = 2
EvaluateError = 6
InputLayerError = 3
InvalidDatasets = 5
MemoryError = 7
ParserError = 4
class Result

Bases: int

Success = 0
expression_valid(formulaString: str, layer: QgsMeshLayer) → QgsMeshCalculator.Result

Returns whether formula is valid for particular mesh layer

Parameters
  • formulaString (str) – formula/expression to evaluate. Consists of dataset group names, operators and numbers

  • layer (QgsMeshLayer) – mesh layer with dataset groups references in formulaString

Return type

QgsMeshCalculator.Result

Returns

QgsMeshCalculator.Success in case of success

processCalculation(self, feedback: QgsFeedback = None) → QgsMeshCalculator.Result

Starts the calculation, writes new dataset group to file and adds it to the mesh layer

Parameters

feedback (QgsFeedback = None) – The optional feedback argument for progress reporting and cancellation support

Return type

QgsMeshCalculator.Result

Returns

QgsMeshCalculator.Success in case of success