How to use the wradlib.util.import_optional 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 / io / rainbow.py View on Github external
def get_rb_blob_data(datastring, blobid):
    """ Read BLOB data from datastring and return it

    Parameters
    ----------
    datastring : string
        Blob Description String
    blobid : int
        Number of requested blob

    Returns
    -------
    data : string
        Content of blob
    """
    xmltodict = util.import_optional('xmltodict')

    start = 0
    search_string = '', start)
    xmlstring = datastring[start:end + 1]

    # cheat the xml parser by making xml well-known
    xmldict = xmltodict.parse(xmlstring.decode() + '')
    cmpr = get_rb_blob_attribute(xmldict, 'compression')
    size = int(get_rb_blob_attribute(xmldict, 'size'))
    data = datastring[end + 2:end + 2 + size]  # read blob data to string

    # decompress if necessary
github wradlib / wradlib / wradlib / io.py View on Github external
Parameters
    ----------
    datastring : string
        Blob Description String

    blobid : int
        Number of requested blob

    Returns
    -------
    data : string
        Content of blob

    """
    xmltodict = util.import_optional('xmltodict')

    start = 0
    searchString = '', start)
    xmlstring = datastring[start:end + 1]

    # cheat the xml parser by making xml well-known
    xmldict = xmltodict.parse(xmlstring.decode() + '')
    cmpr = get_RB_blob_attribute(xmldict, 'compression')
    size = int(get_RB_blob_attribute(xmldict, 'size'))
    data = datastring[end + 2:end + 2 + size]  # read blob data to string

    # decompress if necessary
github wradlib / wradlib / wradlib / io / rainbow.py View on Github external
def decompress(data):
    """Decompression of data

    Parameters
    ----------
    data : string
        (from xml) data string containing compressed data.
    """
    zlib = util.import_optional('zlib')
    return zlib.decompress(data)
github wradlib / wradlib / wradlib / io.py View on Github external
def decompress(data):
    """Decompression of data

    Parameters
    ----------
    data : string
        (from xml) data string containing compressed data.
    """
    zlib = util.import_optional('zlib')
    return zlib.decompress(data)