How to use the pvl.dump 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
sample_type_to_save = self.DTYPES[self._sample_type[0] + self.dtype.kind]
        self.label['IMAGE']['SAMPLE_TYPE'] = sample_type_to_save

        if len(self.data.shape) == 3:
            self.label['IMAGE']['BANDS'] = self.data.shape[0]
            self.label['IMAGE']['LINES'] = self.data.shape[1]
            self.label['IMAGE']['LINE_SAMPLES'] = self.data.shape[2]
        else:
            self.label['IMAGE']['BANDS'] = 1
            self.label['IMAGE']['LINES'] = self.data.shape[0]
            self.label['IMAGE']['LINE_SAMPLES'] = self.data.shape[1]

        diff = 0
        if len(pvl.dumps(self.label, cls=encoder)) != label_sz:
            diff = abs(label_sz - len(pvl.dumps(self.label, cls=encoder)))
        pvl.dump(self.label, file_to_write, cls=encoder)
        offset = image_pointer * self.label['RECORD_BYTES'] - label_sz
        stream = open(file_to_write, 'a')
        for i in range(0, offset+diff):
            stream.write(" ")

        if (self._bands > 1 and self._format != 'BAND_SEQUENTIAL'):
            raise NotImplementedError
        else:
            self.data.tofile(stream, format='%' + self.dtype.kind)
        stream.close()

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