pyfvcom2.weights_calculator module

class pyfvcom2.weights_calculator.ExponentialWeightsCalculator[source]

Bases: WeightsCalculator

Exponential weights calculator for different grid bands within a nest

calculate_weights(n: int, n_bands: int, grid_band_index: int) ndarray[source]

Calculate exponential weights based on the grid band index

Args:

n (int): Number of nodes/elements n_bands (int): Total number of grid bands grid_band_index (int): Index of the grid band

Returns:

Array of weights.

class pyfvcom2.weights_calculator.LinearWeightsCalculator[source]

Bases: WeightsCalculator

Linear weights calculator for different grid bands within a nest

calculate_weights(n: int, n_bands: int, grid_band_index: int) ndarray[source]

Calculate linear weights based on the grid band index

Args:

n (int): Number of nodes/elements n_bands (int): Total number of grid bands grid_band_index (int): Index of the grid band

Returns:

Array of weights.

class pyfvcom2.weights_calculator.WeightsCalculator[source]

Bases: object

calculate_weights(n: int, n_bands: int, grid_band_index: int) ndarray[source]

Calculate inverse weights based on the grid band index

Args:

n (int): Number of nodes/elements n_bands (int): Total number of grid bands grid_band_index (int): Index of the grid band

Returns:

Array of weights.

pyfvcom2.weights_calculator.get_weights_calculator(calculation_method: str) WeightsCalculator[source]

Factory function to get the appropriate WeightsCalculator instance.

Args:

calculation_method (str): The method of weight calculation (“linear”, “inverse”, “exponential”).

Returns:

WeightsCalculator: An instance of the corresponding WeightsCalculator subclass.

Raises:

ValueError: If an unknown calculation method is provided.