src/pys5p/l1b_patch.py
def check(self) -> None:
        """
        Check patched dataset in L1B product
        """
        if not self.l1b_patched.is_file():
            raise ValueError('patched product not found')

        with h5py.File(self.l1b_patched, 'r+') as fid:
            if 'SRON_METADATA' not in fid['/METADATA']:
                raise ValueError('no SRON metadata defined in L1B product')
            sgrp = fid['/METADATA/SRON_METADATA']
            if 'patched_datasets' not in sgrp:
                raise ValueError('no patched datasets in L1B prduct')
            patched_datasets = sgrp['patched_datasets'][:]

        for ds_name in patched_datasets:
            with L1BioRAD(self.l1b_product) as l1b:
                l1b.select('STANDARD_MODE')
                orig = l1b.get_msm_data(ds_name.split('/')[-1])

            with L1BioRAD(self.l1b_patched) as l1b:
                l1b.select('STANDARD_MODE')
                patch = l1b.get_msm_data(ds_name.split('/')[-1])

            if np.issubdtype(orig.dtype, np.integer):
                if np.array_equiv(orig, patch):
                    print(ds_name.split('/')[-1], ' equal True')
                else:
                    print('{} equal {} differ {}'.format(
                        ds_name.split('/')[-1],
                        (orig == patch).sum(), (orig != patch).sum()))
            else:
                print('test not yet defined')

        Check patched dataset in L1B product
        
Check patched dataset in L1B product
Check patched dataset in L1B product
def check(self) -> None:
        if not self.l1b_patched.is_file():
            raise ValueError('patched product not found')
        with h5py.File(self.l1b_patched, 'r+') as fid:
            if 'SRON_METADATA' not in fid['/METADATA']:
                raise ValueError('no SRON metadata defined in L1B product')
            sgrp = fid['/METADATA/SRON_METADATA']
            if 'patched_datasets' not in sgrp:
                raise ValueError('no patched datasets in L1B prduct')
            patched_datasets = sgrp['patched_datasets'][:]
        for ds_name in patched_datasets:
            with L1BioRAD(self.l1b_product) as l1b:
                l1b.select('STANDARD_MODE')
                orig = l1b.get_msm_data(ds_name.split('/')[-1])
            with L1BioRAD(self.l1b_patched) as l1b:
                l1b.select('STANDARD_MODE')
                patch = l1b.get_msm_data(ds_name.split('/')[-1])
            if np.issubdtype(orig.dtype, np.integer):
                if np.array_equiv(orig, patch):
                    print(ds_name.split('/')[-1], ' equal True')
                else:
                    print('{} equal {} differ {}'.format(
                        ds_name.split('/')[-1],
                        (orig == patch).sum(), (orig != patch).sum()))
            else:
                print('test not yet defined')
def check ( self ) -> None : if not self . l1b_patched . is_file ( ) : raise ValueError ( 'patched product not found' ) with h5py . File ( self . l1b_patched , 'r+' ) as fid : if 'SRON_METADATA' not in fid [ '/METADATA' ] : raise ValueError ( 'no SRON metadata defined in L1B product' ) sgrp = fid [ '/METADATA/SRON_METADATA' ] if 'patched_datasets' not in sgrp : raise ValueError ( 'no patched datasets in L1B prduct' ) patched_datasets = sgrp [ 'patched_datasets' ] [ : ] for ds_name in patched_datasets : with L1BioRAD ( self . l1b_product ) as l1b : l1b . select ( 'STANDARD_MODE' ) orig = l1b . get_msm_data ( ds_name . split ( '/' ) [ - 1 ] ) with L1BioRAD ( self . l1b_patched ) as l1b : l1b . select ( 'STANDARD_MODE' ) patch = l1b . get_msm_data ( ds_name . split ( '/' ) [ - 1 ] ) if np . issubdtype ( orig . dtype , np . integer ) : if np . array_equiv ( orig , patch ) : print ( ds_name . split ( '/' ) [ - 1 ] , ' equal True' ) else : print ( '{} equal {} differ {}' . format ( ds_name . split ( '/' ) [ - 1 ] , ( orig == patch ) . sum ( ) , ( orig != patch ) . sum ( ) ) ) else : print ( 'test not yet defined' )
Check patched dataset in L1B product
Check patched dataset in L1B product
"""
        Check patched dataset in L1B product
        """
self