# Generated by detroit
# See https://github.com/bourbonut/detroit/tree/main/api_maker

from functools import partial
from operator import is_not

class contours:
    def __init__(self, content="contours"):
        self.content = content

    def __repr__(self):
        return self.content

    def __str__(self):
        return self.content

    def __call__(self, *args):
        arguments = ", ".join(map(repr, args))
        return f"{self}({arguments})"

    def contour(self, values=None, threshold=None):
        """
        Source · Computes a single contour, returning a GeoJSON MultiPolygon geometry object
        representing the area where the input values are greater than or equal to the given
        threshold value; the threshold value for each geometry object is exposed as
        geometry.value.
        The input values must be an array of length n×m where [n, m] is the contour generator’s
        size; furthermore, each values[i + jn] must represent the value at the position ⟨i, j⟩.
        See contours for an example.

        See more informations `here <https://d3js.org/d3-contour/contour#contours_contour>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (values, threshold))))
        return contours(content=f"{self.content}.contour({arguments})")


    def size(self, size=None):
        """
        Source · If size is specified, sets the expected size of the input values grid to the
        contour generator and returns the contour generator. The size is specified as an array
        [n, m] where n is the number of columns in the grid and m is the number of rows; n and
        m must be positive integers. If size is not specified, returns the current size which
        defaults to [1, 1].

        See more informations `here <https://d3js.org/d3-contour/contour#contours_size>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (size,))))
        return contours(content=f"{self.content}.size({arguments})")


    def smooth(self, smooth=None):
        """
        Examples · Source · If smooth is specified, sets whether or not the generated contour
        polygons are smoothed using linear interpolation. If smooth is not specified, returns
        the current smoothing flag, which defaults to true.

        See more informations `here <https://d3js.org/d3-contour/contour#contours_smooth>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (smooth,))))
        return contours(content=f"{self.content}.smooth({arguments})")


    def thresholds(self, thresholds=None):
        """
        Source · If thresholds is specified, sets the threshold generator to the specified
        function or array and returns this contour generator. If thresholds is not specified,
        returns the current threshold generator, which by default implements Sturges’ formula.
        Thresholds are defined as an array of values [x0, x1, …]. The first generated contour
        corresponds to the area where the input values are greater than or equal to x0; the
        second contour corresponds to the area where the input values are greater than or equal
        to x1, and so on. Thus, there is exactly one generated MultiPolygon geometry object for
        each specified threshold value; the threshold value is exposed as geometry.value.
        If a count is specified instead of an array of thresholds, then the input values’
        extent will be uniformly divided into approximately count bins; see ticks.

        See more informations `here <https://d3js.org/d3-contour/contour#contours_thresholds>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (thresholds,))))
        return contours(content=f"{self.content}.thresholds({arguments})")

