quickpaver.duplicative_upsample#
- quickpaver.duplicative_upsample(array: ndarray[tuple[Any, ...], dtype[float64]], factor: int) ndarray[tuple[Any, ...], dtype[float64]][source]#
Upsample a 2D array by duplicating each cell value.
Each input cell is expanded into a
factor x factorblock containing the same value as the original cell. This operation preserves the original cell values locally, but it does not preserve the total sum of the array.- Parameters:
array (NDArrayFloat) – Two-dimensional array to upsample.
factor (int) – Integer upsampling factor applied along both array axes. Each input cell becomes a square block of shape
(factor, factor)in the output. Must be greater than or equal to 1.
- Returns:
Upsampled array with shape
(array.shape[0] * factor, array.shape[1] * factor).- Return type:
NDArrayFloat
- Raises:
ValueError – If
factoris smaller than 1.
Notes
This function is suitable for intensive quantities, such as temperature or concentration, where duplicating the value over refined cells is meaningful.
For extensive quantities, such as volume, mass, area, or energy, use
conservative_upsample()instead to preserve the total sum.