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 – formula/expression to evaluate. Consists of dataset group names, operators and numbers
  • outputFile – file to store the resulting dataset group data
  • outputExtent – spatial filter defined by rectangle
  • startTime – time filter defining the starting dataset
  • endTime – time filter defining the ending dataset
  • layer – 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

New in version 3.6: 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

Signals

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 – formula/expression to evaluate. Consists of dataset group names, operators and numbers
  • layer – mesh layer with dataset groups references in formulaString
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 – The optional feedback argument for progress reporting and cancelation support
Returns:QgsMeshCalculator.Success in case of success