vvmtools.analyze.DataRetriever.get_var_parallel#
- DataRetriever.get_var_parallel(var, time_steps, domain_range=(None, None, None, None, None, None), compute_mean=False, axis=None, cores=5)[source]#
Get variable data for multiple time steps in parallel.
Uses multiprocessing to parallelize the retrieval of variable data across time steps.
- Parameters:
var (str) – The variable name.
time_steps (list or array-like) – List or array of time steps for which to retrieve the variable data.
domain_range (tuple, optional) – Tuple specifying the range in each dimension (k1, k2, j1, j2, i1, i2), defaults to (None, None, None, None, None, None).
compute_mean (bool, optional) – Whether to compute the mean of the variable data, defaults to False.
axis (int or tuple of ints, optional) – Axis or axes along which the mean is computed, defaults to None.
cores (int, optional) – Number of CPU cores to use for parallel processing, defaults to 5.
- Returns:
The retrieved variable data across time steps.
- Return type:
numpy.ndarray
- Raises:
TypeError – If time_steps is not a list or tuple of integers.
- Example:
>>> import numpy as np >>> import vvmtools >>> my_vvmtool = vvmtools.analyze.DataRetriever(case_path="path/to/case") >>> domain_range = (None, None, None, None, 64, 128) >>> time_steps = np.arange(0, 721, 1) >>> u_tzyx = my_vvmtool.get_var_parallel("u", time_steps=time_steps, domain_range=domain_range) >>> u_tz_xymean_subdomain = my_vvmtool.get_var_parallel("u", time_steps=time_steps, domain_range=domain_range, compute_mean=True, axis=(1,2))