demeter.weight package
Submodules
demeter.weight.kernel_density module
Kernel density algorithm.
Copyright (c) 2017, Battelle Memorial Institute
Open source under license BSD 2-Clause - see LICENSE and DISCLAIMER
@author: Chris R. Vernon (chris.vernon@pnnl.gov); Yannick le Page (niquya@gmail.com)
- class demeter.weight.kernel_density.KernelDensity(resolution, spat_coords, final_landclasses, kernel_distance, ngrids, order_rules)
Bases:
object
- apply_convolution(cellindexresin, pft_maps, kernel_maps, lat, lon, yr, kernel_vector, weights, spat_ludataharm)
Apply convolution filter to compute kernel density.
- Returns:
- compute_cell_index(lat, lon)
Compute grid-cell indices to convert from native resolution to user-defined resolution. Do this only for start year.
- Returns:
- convolution_filter(weights)
Convolution filter (distance weighted, function of square of the distance).
- Returns:
- dist_iter()
Create distance iterator for weight assignment.
- Parameters:
weights –
- Returns:
- global_system()
Create geographic latitude and longitude coordinates for map grid system from user-defined resolution.
- Parameters:
resolution – User-defined resolution setting
- Returns:
latitude and longitude arrays
- prep_arrays(lat, lon)
Prepare empty arrays used in kernel density calculation.
- Returns:
- preprocess_kernel_density()
Calculate and map PFT kernel density.
- Returns:
- demeter.weight.kernel_density.handle_single_pft(pft_order, order_rules, final_landclasses, pft_maps, cellindexresin, spat_ludataharm, kernel_maps, kernel_vector, weights)
Helper function to handle pft convultion filters. This is used to parallelize the convultion filter operation to speed up processing.