How to use the wradlib.zonalstats.DataSource function in wradlib

To help you get started, we’ve selected a few wradlib 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 wradlib / wradlib / wradlib / zonalstats.py View on Github external
def load_vector(self, filename):
        """Load source/target grid points/polygons into in-memory Shapefile

        Parameters
        ----------
        filename : string
            path to vector file
        """
        self.src = DataSource(filename, name='src', source='src')
        self.trg = DataSource(filename, name='trg', source='trg')
        self.dst = DataSource(filename, name='dst', source='dst')

        # get spatial reference object
        self._srs = self.src.ds.GetLayer().GetSpatialRef()
github wradlib / wradlib / wradlib / zonalstats.py View on Github external
def __init__(self, src, trg=None, buf=0., srs=None, **kwargs):
        self._buffer = buf
        self._srs = srs
        silent = kwargs.pop('silent', False)

        if trg is None:
            # try to read complete dump (src, trg, dst)
            self.load_vector(src)
        else:
            if isinstance(src, DataSource):
                self.src = src
            else:
                self.src = DataSource(src, name='src', srs=srs, **kwargs)

            if isinstance(trg, DataSource):
                self.trg = trg
            else:
                self.trg = DataSource(trg, name='trg', srs=srs, **kwargs)

            self.dst = DataSource(name='dst')
            self.dst.ds = self._create_dst_datasource(silent)
            self.dst._create_spatial_index()

        self.dst._create_table_index('trg_index')
        self._count_intersections = self.dst.ds.GetLayer().GetFeatureCount()
github wradlib / wradlib / wradlib / zonalstats.py View on Github external
if trg is None:
            # try to read complete dump (src, trg, dst)
            self.load_vector(src)
        else:
            if isinstance(src, DataSource):
                self.src = src
            else:
                self.src = DataSource(src, name='src', srs=srs, **kwargs)

            if isinstance(trg, DataSource):
                self.trg = trg
            else:
                self.trg = DataSource(trg, name='trg', srs=srs, **kwargs)

            self.dst = DataSource(name='dst')
            self.dst.ds = self._create_dst_datasource(silent)
            self.dst._create_spatial_index()

        self.dst._create_table_index('trg_index')
        self._count_intersections = self.dst.ds.GetLayer().GetFeatureCount()
github wradlib / wradlib / wradlib / zonalstats.py View on Github external
def load_vector(self, filename):
        """Load source/target grid points/polygons into in-memory Shapefile

        Parameters
        ----------
        filename : string
            path to vector file
        """
        self.src = DataSource(filename, name='src', source='src')
        self.trg = DataSource(filename, name='trg', source='trg')
        self.dst = DataSource(filename, name='dst', source='dst')

        # get spatial reference object
        self._srs = self.src.ds.GetLayer().GetSpatialRef()
github wradlib / wradlib / wradlib / zonalstats.py View on Github external
self._srs = srs
        silent = kwargs.pop('silent', False)

        if trg is None:
            # try to read complete dump (src, trg, dst)
            self.load_vector(src)
        else:
            if isinstance(src, DataSource):
                self.src = src
            else:
                self.src = DataSource(src, name='src', srs=srs, **kwargs)

            if isinstance(trg, DataSource):
                self.trg = trg
            else:
                self.trg = DataSource(trg, name='trg', srs=srs, **kwargs)

            self.dst = DataSource(name='dst')
            self.dst.ds = self._create_dst_datasource(silent)
            self.dst._create_spatial_index()

        self.dst._create_table_index('trg_index')
        self._count_intersections = self.dst.ds.GetLayer().GetFeatureCount()
github wradlib / wradlib / wradlib / zonalstats.py View on Github external
def load_vector(self, filename):
        """Load source/target grid points/polygons into in-memory Shapefile

        Parameters
        ----------
        filename : string
            path to vector file
        """
        self.src = DataSource(filename, name='src', source='src')
        self.trg = DataSource(filename, name='trg', source='trg')
        self.dst = DataSource(filename, name='dst', source='dst')

        # get spatial reference object
        self._srs = self.src.ds.GetLayer().GetSpatialRef()
github wradlib / wradlib / wradlib / zonalstats.py View on Github external
def __init__(self, src, trg=None, buf=0., srs=None, **kwargs):
        self._buffer = buf
        self._srs = srs
        silent = kwargs.pop('silent', False)

        if trg is None:
            # try to read complete dump (src, trg, dst)
            self.load_vector(src)
        else:
            if isinstance(src, DataSource):
                self.src = src
            else:
                self.src = DataSource(src, name='src', srs=srs, **kwargs)

            if isinstance(trg, DataSource):
                self.trg = trg
            else:
                self.trg = DataSource(trg, name='trg', srs=srs, **kwargs)

            self.dst = DataSource(name='dst')
            self.dst.ds = self._create_dst_datasource(silent)
            self.dst._create_spatial_index()

        self.dst._create_table_index('trg_index')
        self._count_intersections = self.dst.ds.GetLayer().GetFeatureCount()