Ejemplo n.º 1
0
    def __init__(self,
                 cwd=None,
                 env=None,
                 stdout_handler=None,
                 stderr_handler=None):
        """
        :param cwd:
            program working directory
        :param env:
            environment dictionary
        :param envmerge:
            if set to True (default) it is the :attr:`env` dictionaty is
            used to update the system environment
        :param stdout_handler:
            *OutputHandler* for the stdout of the tool
        :param stderr_handler:
            *OutputHandler* for the stderr of the tool

        .. seealso:: :class:`exectools.BaseOutputHandler`

        """

        executable = shutil.which('gsdstats')
        if executable:
            cmd = utils.scriptcmd(executable)
        else:
            cmd = _gsdtoolcmd('stats')

        super().__init__(cmd, [], cwd, env, stdout_handler, stderr_handler)

        #: Disable statistics computation (default: False)
        self.nostats = None

        #: Compute statistics for a specific raster band.
        #:
        #: Default: all bands are precessed.
        self.band = None

        #: Allow approximate statistics computation.
        #:
        #: If set then statistics may be computed based on overviews or a
        #: subset of all tiles (default: False)
        self.approxok = None

        #: Only print minimum and maximum on the same line
        self.minmaxonly = None

        #: Specify source window in image coordinates.
        #:
        #: Default: the entire image is processed.
        self.srcwin = None

        #: Write results to FILE.
        self.outfile = None

        #: Suppress progress messages.
        self.quiet = False

        self._histreq = HistogramRequest()
        self._histreq.computehistogram = False
Ejemplo n.º 2
0
    def __init__(self, cwd=None, env=None,
                 stdout_handler=None, stderr_handler=None):
        '''
        :param cwd:
            program working directory
        :param env:
            environment dictionary
        :param envmerge:
            if set to True (default) it is the :attr:`env` dictionaty is
            used to update the system environment
        :param stdout_handler:
            *OutputHandler* for the stdout of the tool
        :param stderr_handler:
            *OutputHandler* for the stderr of the tool

        .. seealso:: :class:`exectools.BaseOutputHandler`

        '''

        executable = utils.which('gsdstats')
        if executable:
            cmd = utils.scriptcmd(executable)
        else:
            cmd = _gsdtoolcmd('stats')

        super(StatsDescriptor, self).__init__(cmd, [],
                                    cwd, env, stdout_handler, stderr_handler)

        #: Disable statistics computation (default: False)
        self.nostats = None

        #: Compute statistics for a specific raster band.
        #:
        #: Default: all bands are precessed.
        self.band = None

        #: Allow approximate statistics computation.
        #:
        #: If set then statistics may be computed based on overviews or a
        #: subset of all tiles (default: False)
        self.approxok = None

        #: Only print minimum and maximum on the same line
        self.minmaxonly = None

        #: Specify source window in image coordinates.
        #:
        #: Default: the entire image is processed.
        self.srcwin = None

        #: Write results to FILE.
        self.outfile = None

        #: Suppress progress messages.
        self.quiet = False

        self._histreq = HistogramRequest()
        self._histreq.computehistogram = False
Ejemplo n.º 3
0
def _gsdtoolcmd(name):
    path = os.path.abspath(gsdtools.__path__)
    script = os.path.join(path, name + '.py')
    for variant in ('o', 'c', ''):
        variant = script + variant
        if os.path.exists(variant):
            script = variant
            break
    else:
        return None

    cmd = utils.scriptcmd(script)
    return cmd
Ejemplo n.º 4
0
def _gsdtoolcmd(name):
    path = os.path.abspath(gsdtools.__path__)
    script = os.path.join(path, name + '.py')
    for variant in ('o', 'c', ''):
        variant = script + variant
        if os.path.exists(variant):
            script = variant
            break
    else:
        return None

    cmd = utils.scriptcmd(script)
    return cmd
Ejemplo n.º 5
0
    def __init__(self,
                 cwd=None,
                 env=None,
                 stdout_handler=None,
                 stderr_handler=None):
        """
        :param cwd:
            program working directory
        :param env:
            environment dictionary
        :param envmerge:
            if set to True (default) it is the :attr:`env` dictionaty is
            used to update the system environment
        :param stdout_handler:
            *OutputHandler* for the stdout of the tool
        :param stderr_handler:
            +OutputHandler* for the stderr of the tool

        .. seealso:: :class:`exectools.BaseOutputHandler`

        """

        executable = shutil.which('ras2vec')
        if executable:
            cmd = utils.scriptcmd(executable)
        else:
            cmd = _gsdtoolcmd('ras2vec')

        super().__init__(cmd, [], cwd, env, stdout_handler, stderr_handler)

        #: Generate an additional layer for GCPs.
        self.gcps = None

        #: Generate markers for bounding box corners.
        self.corners = None

        #: Store absolute path in bounding box feature description.
        self.abspath = None
Ejemplo n.º 6
0
    def __init__(self, cwd=None, env=None,
                 stdout_handler=None, stderr_handler=None):
        '''
        :param cwd:
            program working directory
        :param env:
            environment dictionary
        :param envmerge:
            if set to True (default) it is the :attr:`env` dictionaty is
            used to update the system environment
        :param stdout_handler:
            *OutputHandler* for the stdout of the tool
        :param stderr_handler:
            +OutputHandler* for the stderr of the tool

        .. seealso:: :class:`exectools.BaseOutputHandler`

        '''

        executable = utils.which('ras2vec')
        if executable:
            cmd = utils.scriptcmd(executable)
        else:
            cmd = _gsdtoolcmd('ras2vec')

        super(Ras2vecDescriptor, self).__init__(cmd, [],
                                    cwd, env, stdout_handler, stderr_handler)

        #: Generate an additional layer for GCPs.
        self.gcps = None

        #: Generate markers for bounding box corners.
        self.corners = None

        #: Store absolute path in bounding box feature description.
        self.abspath = None