FvParticles

class tfv.particles.FvParticles(file: Path | str | xarray.Dataset, lazy_load: bool = True, is_spherical: bool = True, warmup: str | Timedelta = '0D')

Class that extracts particle data from a TUFLOW FV PTM netCDF4 result file.

Parameters:

file (string) – Model result file path.

nt

Number of time steps

Type:

int

np

Number of particles

Type:

int

get_mask_vector(ii: int)

Query to extract an array that defines invalid model data.

Parameters:

ii (integer) – Time index at which to extract the mask array.

Returns:

mask – Logical index, True if model cells/nodes are invalid (i.e dry cells).

Return type:

np.ndarray

get_raw_data(variable: str, ii: int)

Query to extract raw data at a time step (if time-varying).

Parameters:
  • variable (string) – Name of time varying data set to be extracted.

  • ii (integer) – The time vector index at which to extract the data.

Returns:

data – The raw data as 1D or 2D numpy array

Return type:

np.ndarray

get_vertical_selection(ii: int, datum: str, limits: tuple)

Query to extract logical index of particles within a given vertical selection at given time step.

Parameters:
  • ii (integer) – Time index at which to extract the selection.

  • datum ({'sigma', 'depth', 'height', 'elevation'}) – Vertical depth-averaging datum i.e sigma, depth, height, elevation, top, bottom.

  • limits (tuple) – Vertical depth-averaging limits (z1, z2) relative to vertical datum.

Returns:

lgi – A logical index for particles within specified limits. True if particle is in limits.

Return type:

np.ndarray