geopyspark.geotrellis.histogram module

This module contains the Histogram class which is a wrapper of the GeoTrellis Histogram class.

class geopyspark.geotrellis.histogram.Histogram(scala_histogram)

A wrapper class for a GeoTrellis Histogram.

The underlying histogram is produced from the values within a TiledRasterLayer. These values represented by the histogram can either be Int or Float depending on the data type of the cells in the layer.

Parameters:scala_histogram (py4j.JavaObject) – An instance of the GeoTrellis histogram.
scala_histogram

py4j.JavaObject – An instance of the GeoTrellis histogram.

bin_counts()

Returns a list of tuples where the key is the bin label value and the value is the label’s respective count.

Returns:[(int, int)] or [(float, int)]
bucket_count()

Returns the number of buckets within the histogram.

Returns:int
cdf()

Returns the cdf of the distribution of the histogram.

Returns:[(float, float)]
classmethod from_dict(value)

Encodes histogram as a dictionary

item_count(item)

Returns the total number of times a given item appears in the histogram.

Parameters:item (int or float) – The value whose occurences should be counted.
Returns:The total count of the occurences of item in the histogram.
Return type:int
max()

The largest value of the histogram.

This will return either an int or float depedning on the type of values within the histogram.

Returns:int or float
mean()

Determines the mean of the histogram.

Returns:float
median()

Determines the median of the histogram.

Returns:float
merge(other_histogram)

Merges this instance of Histogram with another. The resulting Histogram will contain values from both ``Histogram``s

Parameters:other_histogram (Histogram) – The Histogram that should be merged with this instance.
Returns:Histogram
min()

The smallest value of the histogram.

This will return either an int or float depedning on the type of values within the histogram.

Returns:int or float
min_max()

The largest and smallest values of the histogram.

This will return either an int or float depedning on the type of values within the histogram.

Returns:(int, int) or (float, float)
mode()

Determines the mode of the histogram.

This will return either an int or float depedning on the type of values within the histogram.

Returns:int or float
quantile_breaks(num_breaks)

Returns quantile breaks for this Layer.

Parameters:num_breaks (int) – The number of breaks to return.
Returns:[int]
to_dict()

Encodes histogram as a dictionary

Returns:dict
values()

Lists each indiviual value within the histogram.

This will return a list of either ``int``s or ``float``s depedning on the type of values within the histogram.

Returns:[int] or [float]