Module nemo.regions

Market regions consisting of one or more polygons.

Classes

class Region (ordinal, regionid, descr)
Expand source code
class Region:
    """Each region is described by a Region object."""

    def __init__(self, ordinal, regionid, descr):
        """Construct a Region given an ordinal, region ID and description.

        >>> r = Region(0, 'cbr', 'Capital region')
        """
        self.id = regionid
        self.descr = descr
        self.num = ordinal
        self.polygons = None

    def __repr__(self):
        """Return region code."""
        return self.id

    def __index__(self):
        """Return region number."""
        return self.num

    def __copy__(self):
        """Prevent copying."""
        return self

    def __deepcopy__(self, _):
        """Prevent deepcopying."""
        return self

Each region is described by a Region object.

Construct a Region given an ordinal, region ID and description.

>>> r = Region(0, 'cbr', 'Capital region')