pvdeg.geospatial.elevation_stochastic_downselect#
- pvdeg.geospatial.elevation_stochastic_downselect(meta_df: DataFrame, kdtree, downselect_prop: float, k_neighbors: int = 3, method: str = 'mean', normalization: str = 'linear')[source]#
Downsample function.
Downsample, assigning each point a weight associated with its neighbors changes in height. Randomly choose points based on weights to preferentially select points next to or in mountains while drastically lowering the density of points in flat areas to find a non-uniformly dense sub-sample of original data points.
Parameters:#
- meta_dfpd.DataFrame
Dataframe of metadata as generated by pvdeg.weather.get for geospatial
- kdtreesklearn.neighbors.KDTree or str
kdtree containing latitude-longitude pairs for quick lookups Generate using
pvdeg.geospatial.meta_KDTree. Can take a pickled kdtree as a path to the .pkl file.- downselect_propfloat
proportion of original datapoints to keep in output gids list
- k_neighborsint, (default = 3)
number of neighbors to check for elevation data in nearest neighbors
- methodstr, (default = ‘mean’)
method to calculate elevation weights for each point. Options : ‘mean’, ‘sum’, ‘median’
- normalizationstr, (default = ‘linear’)
function to apply when normalizing weights. Logarithmic uses log_e/ln options : ‘linear’, ‘log’, ‘exp’, ‘invert-linear’
Returns:#
- gidsnp.array
numpy array of downselected gids.