How to use the georinex.io.TextIOWrapper function in georinex

To help you get started, we’ve selected a few georinex 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 scivision / georinex / georinex / io.py View on Github external
if header:
            with fn.open('r') as f:
                yield f
        else:
            with fn.open('r') as g:
                f = io.StringIO(_opencrx(g))
                yield f
    elif fn.suffix == '.gz':
        with gzip.open(fn, 'rt') as f:
            yield f
    elif fn.suffix == '.zip':
        with zipfile.ZipFile(fn, 'r') as z:
            flist = z.namelist()
            for rinexfn in flist:
                with z.open(rinexfn, 'r') as bf:
                    f = io.TextIOWrapper(bf, newline=None)
                    yield f
    elif fn.suffix == '.Z':
        if unlzw is None:
            raise ImportError('pip install unlzw')
        with fn.open('rb') as zu:
            with io.StringIO(unlzw.unlzw(zu.read()).decode('ascii')) as f:
                yield f

    else:
        with fn.open('r') as f:
            yield f