scripts/download_sen12.py
def _check_date_range_list(self):
        '''
        Helper function that checks to make sure the date range list is in the proper format and raises an error if it isn't
        '''

        t = type(self.date_range_list)
        if t is not list:
            raise ValueError(f'date_range_list is a {t}, but it must be a list')

        polygon_type = type(self.polygons)
        # if self.polygons is None:
        #     raise ValueError('If you input a date_range_list, you must also input polygons')
        if type(polygon_type) is ee.featurecollection.FeatureCollection:
            feature_list = self.polygons.toList(self.polygons.size())
            n_polygons = feature_list.size().getInfo()
        else:
            raise ValueError(f'Polygons are a {polygon_type}, but they must be an ee.FeatureCollection')

        if len(self.date_range_list) != n_polygons:
            raise ValueError('date_range_list and polygons must have the same length')

        offset_value = None
        for d in self.date_range_list:
            if type(d) is not dict:
                raise ValueError(f'date_range_list contains a {type(d)}, but it must solely contain dictionaries')

            if self.dynamic_date_range:
                required_keys = ['start_date', 'end_date', 'original_date', 'day_offset']
            else:
                required_keys = ['start_date', 'end_date']
            if len(d.keys()) != len(required_keys):
                if self.dynamic_date_range:
                    raise ValueError(f'With dynamic date range, all dicts must have {len(required_keys)} keys, but at least one has {len(d.keys())} keys')
                else:
                    raise ValueError(f'Without dynamic date range, all dicts must have {len(required_keys)} keys, but at least one has {len(d.keys())} keys')

            for key in d.keys():
                if key not in required_keys:
                    raise KeyError(f'At least one dict has an inappropriate key: {key}')
                elif (self.dynamic_date_range is True) and (key == 'day_offset'):
                    if offset_value is None:
                        offset_value = d[key]
                    else:
                        if d[key] != offset_value:
                            raise ValueError('Every date range in the date_range_list must have the same day_offset')

        Helper function that checks to make sure the date range list is in the proper format and raises an error if it isn't
        
Helper function that checks to make sure the date range list is in the proper format and raises an error if it isn't
Helper function that checks to make sure the date range list is in the proper format and raises an error if it isn ' t
def _check_date_range_list(self):
        t = type(self.date_range_list)
        if t is not list:
            raise ValueError(f'date_range_list is a {t}, but it must be a list')
        polygon_type = type(self.polygons)
        if type(polygon_type) is ee.featurecollection.FeatureCollection:
            feature_list = self.polygons.toList(self.polygons.size())
            n_polygons = feature_list.size().getInfo()
        else:
            raise ValueError(f'Polygons are a {polygon_type}, but they must be an ee.FeatureCollection')
        if len(self.date_range_list) != n_polygons:
            raise ValueError('date_range_list and polygons must have the same length')
        offset_value = None
        for d in self.date_range_list:
            if type(d) is not dict:
                raise ValueError(f'date_range_list contains a {type(d)}, but it must solely contain dictionaries')
            if self.dynamic_date_range:
                required_keys = ['start_date', 'end_date', 'original_date', 'day_offset']
            else:
                required_keys = ['start_date', 'end_date']
            if len(d.keys()) != len(required_keys):
                if self.dynamic_date_range:
                    raise ValueError(f'With dynamic date range, all dicts must have {len(required_keys)} keys, but at least one has {len(d.keys())} keys')
                else:
                    raise ValueError(f'Without dynamic date range, all dicts must have {len(required_keys)} keys, but at least one has {len(d.keys())} keys')
            for key in d.keys():
                if key not in required_keys:
                    raise KeyError(f'At least one dict has an inappropriate key: {key}')
                elif (self.dynamic_date_range is True) and (key == 'day_offset'):
                    if offset_value is None:
                        offset_value = d[key]
                    else:
                        if d[key] != offset_value:
                            raise ValueError('Every date range in the date_range_list must have the same day_offset')
def _check_date_range_list ( self ) : t = type ( self . date_range_list ) if t is not list : raise ValueError ( f'date_range_list is a {t}, but it must be a list' ) polygon_type = type ( self . polygons ) if type ( polygon_type ) is ee . featurecollection . FeatureCollection : feature_list = self . polygons . toList ( self . polygons . size ( ) ) n_polygons = feature_list . size ( ) . getInfo ( ) else : raise ValueError ( f'Polygons are a {polygon_type}, but they must be an ee.FeatureCollection' ) if len ( self . date_range_list ) != n_polygons : raise ValueError ( 'date_range_list and polygons must have the same length' ) offset_value = None for d in self . date_range_list : if type ( d ) is not dict : raise ValueError ( f'date_range_list contains a {type(d)}, but it must solely contain dictionaries' ) if self . dynamic_date_range : required_keys = [ 'start_date' , 'end_date' , 'original_date' , 'day_offset' ] else : required_keys = [ 'start_date' , 'end_date' ] if len ( d . keys ( ) ) != len ( required_keys ) : if self . dynamic_date_range : raise ValueError ( f'With dynamic date range, all dicts must have {len(required_keys)} keys, but at least one has {len(d.keys())} keys' ) else : raise ValueError ( f'Without dynamic date range, all dicts must have {len(required_keys)} keys, but at least one has {len(d.keys())} keys' ) for key in d . keys ( ) : if key not in required_keys : raise KeyError ( f'At least one dict has an inappropriate key: {key}' ) elif ( self . dynamic_date_range is True ) and ( key == 'day_offset' ) : if offset_value is None : offset_value = d [ key ] else : if d [ key ] != offset_value : raise ValueError ( 'Every date range in the date_range_list must have the same day_offset' )
Helper function that checks to make sure the date range list is in the proper format and raises an error if it isn't
Helper function that checks to make sure the date range list is in the proper format and raises an error if it isn ' t
'''
        Helper function that checks to make sure the date range list is in the proper format and raises an error if it isn't
        ''' # if self.polygons is None: #     raise ValueError('If you input a date_range_list, you must also input polygons')
self