Created
April 5, 2017 18:21
-
-
Save davidvhill/2d27b5083cec9cb76c69480ceb59e013 to your computer and use it in GitHub Desktop.
partition code in python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" Functions to drive algorithm execution in Apache Spark. | |
All coordinates are handled according to GeoJSON specifications. | |
http://geojson.org/geojson-spec.html""" | |
import geojson | |
import itertools | |
import math | |
def bbox(multipoint): | |
""" Determines minimum geometry from points. | |
Args: | |
multipoint: A GeoJSON multipoint | |
Returns: | |
A four element list: [minx, miny, maxx, maxy]""" | |
pass | |
def partition_size(item_count, partition_count): | |
""" Given a count and desired number of partitions determine the partition | |
size | |
Args: | |
item_count: number of items to be partitioned | |
partition_count: desired number of partitions | |
Returns: | |
Size of each partition """ | |
return math.ceil(item_count / partition_count) | |
def partition(iterable, size=1, fillvalue=None): | |
""" Bins items in buckets of requested size """ | |
# partition('ABCDEFG', 3, 'x') --> ABC DEF Gxx" | |
# partition([1, 2, 3, 4, 5], 3, None) --> [[1, 2, 3], [4, 5, None]] | |
args = [iter(iterable)] * size | |
return itertools.zip_longest(*args, fillvalue=fillvalue) | |
def tiles(multipoint, partitions=1): | |
""" Given multiple polygons determine a set of """ | |
pass | |
def pyccd(point, spectra): | |
""" For a given x, y and spectra, execute and returns results from pyccd """ | |
pass | |
def train(): | |
pass | |
def classify(): | |
pass | |
def product_a(): | |
pass | |
def product_b(): | |
pass | |
def results(x, y, algorithm_fn, inputs): |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment