pyresample.bilinear._numpy_resampler module
Code for resampling using bilinear algorithm for irregular grids.
The algorithm is taken from
- class pyresample.bilinear._numpy_resampler.NumpyBilinearResampler(source_geo_def, target_geo_def, radius_of_influence, neighbours=32, epsilon=0, reduce_data=True)
Bases:
BilinearBaseBilinear interpolation using Numpy.
Initialize resampler.
- Parameters:
source_geo_def (object) – Geometry definition of source
target_geo_def (object) – Geometry definition of target
radius_of_influence (float) – Cut off distance in meters
neighbours (int, optional) – The number of neigbours to consider for each grid point
epsilon (float, optional) – Allowed uncertainty in meters. Increasing uncertainty reduces execution time
reduce_data (bool, optional) – Perform initial coarse reduction of source dataset in order to reduce execution time
- _finalize_output_data(data, res, fill_value)
- _reshape_to_target_area(res, ndim)
- _slice_data(data, fill_value)
- get_sample_from_bil_info(data, fill_value=None, output_shape=None)
Resample using pre-computed resampling LUTs.
- resample(data, fill_value=0, nprocs=1)
Resample the given data.
- class pyresample.bilinear._numpy_resampler.NumpyResamplerBilinear(source_geo_def, target_geo_def, radius_of_influence, **kwargs)
Bases:
NumpyBilinearResamplerWrapper for the old resampler class.
Initialize resampler.
- __init__(source_geo_def, target_geo_def, radius_of_influence, **kwargs)
Initialize resampler.
- pyresample.bilinear._numpy_resampler._apply_fill_value_or_mask_data(result, fill_value)
- pyresample.bilinear._numpy_resampler._check_data_shape(data, input_idxs)
Check data shape and adjust if necessary.
- pyresample.bilinear._numpy_resampler.get_bil_info(source_geo_def, target_area_def, radius=50000.0, neighbours=32, nprocs=1, masked=False, reduce_data=True, segments=None, epsilon=0)
Calculate information needed for bilinear resampling.
- source_geo_defobject
Geometry definition of source data
- target_area_defobject
Geometry definition of target area
- radiusfloat, optional
Cut-off distance in meters
- neighboursint, optional
Number of neighbours to consider for each grid point when searching the closest corner points
- nprocsint, optional
Number of processor cores to be used for getting neighbour info
- maskedbool, optional
If true, return masked arrays, else return np.nan values for invalid points (default)
- reduce_databool, optional
Perform initial coarse reduction of source dataset in order to reduce execution time
- epsilonfloat, optional
Allowed uncertainty in meters. Increasing uncertainty reduces execution time
- Returns:
t__ (numpy array) – Vertical fractional distances from corner to the new points
s__ (numpy array) – Horizontal fractional distances from corner to the new points
input_idxs (numpy array) – Valid indices in the input data
idx_arr (numpy array) – Mapping array from valid source points to target points
- pyresample.bilinear._numpy_resampler.get_sample_from_bil_info(data, t__, s__, input_idxs, idx_arr, output_shape=None)
Resample data using bilinear interpolation.
- Parameters:
data (numpy array) – 1d array to be resampled
t (numpy array) – Vertical fractional distances from corner to the new points
s (numpy array) – Horizontal fractional distances from corner to the new points
input_idxs (numpy array) – Valid indices in the input data
idx_arr (numpy array) – Mapping array from valid source points to target points
output_shape (tuple, optional) – Tuple of (y, x) dimension for the target projection. If None (default), do not reshape data.
- Returns:
result – Source data resampled to target geometry
- Return type:
numpy array
- pyresample.bilinear._numpy_resampler.resample_bilinear(data, source_geo_def, target_area_def, radius=50000.0, neighbours=32, nprocs=1, fill_value=0, reduce_data=True, segments=None, epsilon=0)
Resample using bilinear interpolation.
- datanumpy array
Array of single channel data points or (source_geo_def.shape, k) array of k channels of datapoints
- source_geo_defobject
Geometry definition of source data
- target_area_defobject
Geometry definition of target area
- radiusfloat, optional
Cut-off distance in meters
- neighboursint, optional
Number of neighbours to consider for each grid point when searching the closest corner points
- nprocsint, optional
Number of processor cores to be used for getting neighbour info
- fill_value{int, None}, optional
Set undetermined pixels to this value. If fill_value is None a masked array is returned with undetermined pixels masked
- reduce_databool, optional
Perform initial coarse reduction of source dataset in order to reduce execution time
- segmentsint or None
Number of segments to use when resampling. If set to None an estimate will be calculated
- epsilonfloat, optional
Allowed uncertainty in meters. Increasing uncertainty reduces execution time
- Returns:
data – Source data resampled to target geometry
- Return type:
numpy array