How to use the regionmask.core.utils._sanitize_names_abbrevs function in regionmask

To help you get started, we’ve selected a few regionmask examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mathause / regionmask / regionmask / core / regions.py View on Github external
r = Regions(outlines)

        """

        super(Regions, self).__init__()

        if numbers is None:
            numbers = range(len(outlines))

        if not _is_numeric(numbers):
            raise ValueError("'numbers' must be numeric")

        outlines = _maybe_to_dict(numbers, outlines)

        names = _sanitize_names_abbrevs(numbers, names, "Region")
        abbrevs = _sanitize_names_abbrevs(numbers, abbrevs, "r")

        regions = dict()

        for n in numbers:
            regions[n] = _OneRegion(n, names[n], abbrevs[n], outlines[n])

        self.regions = regions
        self.name = name
        self.source = source
github mathause / regionmask / regionmask / core / regions.py View on Github external
# arguments are now optional
            r = Regions(outlines)

        """

        super(Regions, self).__init__()

        if numbers is None:
            numbers = range(len(outlines))

        if not _is_numeric(numbers):
            raise ValueError("'numbers' must be numeric")

        outlines = _maybe_to_dict(numbers, outlines)

        names = _sanitize_names_abbrevs(numbers, names, "Region")
        abbrevs = _sanitize_names_abbrevs(numbers, abbrevs, "r")

        regions = dict()

        for n in numbers:
            regions[n] = _OneRegion(n, names[n], abbrevs[n], outlines[n])

        self.regions = regions
        self.name = name
        self.source = source