How to use the pvl.encoder function in pvl

To help you get started, we’ve selected a few pvl 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 planetarypy / planetaryimage / planetaryimage / pds3image.py View on Github external
- MEDIAN, MEAN

        Returns
        -------
        Update label module for the NumPy array.

        Usage: self.label = self._update_label(label, array)

        """
        maximum = float(numpy.max(array))
        mean = float(numpy.mean(array))
        median = float(numpy.median(array))
        minimum = float(numpy.min(array))
        stdev = float(numpy.std(array, ddof=1))

        encoder = pvl.encoder.PDSLabelEncoder
        serial_label = pvl.dumps(label, cls=encoder)
        label_sz = len(serial_label)
        image_pointer = int(label_sz / label['RECORD_BYTES']) + 1

        label['^IMAGE'] = image_pointer + 1
        label['LABEL_RECORDS'] = image_pointer
        label['IMAGE']['MEAN'] = mean
        label['IMAGE']['MAXIMUM'] = maximum
        label['IMAGE']['MEDIAN'] = median
        label['IMAGE']['MINIMUM'] = minimum
        label['IMAGE']['STANDARD_DEVIATION'] = stdev

        return label

pvl

Python implementation for PVL (Parameter Value Language) parsing and encoding.

BSD-3-Clause
Latest version published 2 years ago

Package Health Score

45 / 100
Full package analysis

Similar packages