@@ -147,6 +147,9 @@ def search(self, platform, min_overlap=0, download_dir=None, start_date=None, en
147147 'ingestionDate') (Default: beginPosition)
148148 **keywords: Further OpenSearch arguments can be passed to the query according to the ESA Data Hub Handbook
149149 (please see https://scihub.copernicus.eu/twiki/do/view/SciHubUserGuide/3FullTextSearch#Search_Keywords)
150+ missing under this link:
151+ - slicenumber: the graticule along an orbit; particularly important for interferometric applications
152+ to identify overlapping scene pairs
150153
151154 Mandatory args:
152155 platform
@@ -200,15 +203,15 @@ def search(self, platform, min_overlap=0, download_dir=None, start_date=None, en
200203 if len (subscenes ) < 100 :
201204 break
202205
203- print '%s scenes after initial search' % len (scenes )
206+ print ( '%s scenes after initial search' % len (scenes ) )
204207 if len (scenes ) > 0 :
205208 scenes = self ._filter_existing (scenes )
206209 scenes = self ._filter_overlap (scenes , geom , min_overlap )
207- print '%s scenes after filtering before merging' % len (scenes )
210+ print ( '%s scenes after filtering before merging' % len (scenes ) )
208211 self .__scenes = self ._merge_scenes (self .__scenes , scenes )
209212
210213 print ('===========================================================' )
211- print '%s total scenes after merging' % len (self .__scenes )
214+ print ( '%s total scenes after merging' % len (self .__scenes ) )
212215 print ('===========================================================' )
213216
214217 def get_scenes (self ):
@@ -221,7 +224,7 @@ def print_scenes(self):
221224 def sorter (x ): return re .findall ('[0-9T]{15}' , x )[0 ]
222225
223226 titles = sorted ([x ['title' ] for x in self .__scenes ], key = sorter )
224- print '\n ' .join (titles )
227+ print ( '\n ' .join (titles ) )
225228
226229 def write_results (self , file_type , filename , output = False ):
227230 """Write results to disk in different kind of formats
@@ -271,16 +274,16 @@ def download_all(self, download_dir=None):
271274 try :
272275 response = requests .get (url , auth = (self .__esa_username , self .__esa_password ), stream = True )
273276 except requests .exceptions .ConnectionError :
274- print 'Connection Error'
277+ print ( 'Connection Error' )
275278 continue
276279 if 'Content-Length' not in response .headers :
277- print 'Content-Length not found'
278- print url
280+ print ( 'Content-Length not found' )
281+ print ( url )
279282 continue
280283 size = int (response .headers ['Content-Length' ].strip ())
281284 if size < 1000000 :
282- print 'The found scene is to small: %s (%s)' % (scene ['title' ], size )
283- print url
285+ print ( 'The found scene is to small: %s (%s)' % (scene ['title' ], size ) )
286+ print ( url )
284287 continue
285288
286289 print ('Size of the scene: %s MB' % (size / 1024 / 1024 )) # show in MegaBytes
@@ -305,7 +308,7 @@ def download_all(self, download_dir=None):
305308 sys .exit (0 )
306309
307310 # Check if file is valid
308- print "Check if file is valid: "
311+ print ( "Check if file is valid: " )
309312 valid = self ._is_valid (path )
310313
311314 if not valid :
@@ -330,18 +333,20 @@ def _is_valid(self, zipfile, minsize=1000000):
330333 if not os .path .getsize (zipfile ) > minsize :
331334 print ('The downloaded scene is too small: {}' .format (os .path .basename (zipfile )))
332335 return False
333- archive = zf .ZipFile (zipfile , 'r' )
334336 try :
335- corrupt = archive .testzip ()
336- except zlib .error :
337- corrupt = zipfile
338- archive .close ()
337+ archive = zf .ZipFile (zipfile , 'r' )
338+ try :
339+ corrupt = True if archive .testzip () else False
340+ except zlib .error :
341+ corrupt = True
342+ archive .close ()
343+ except zf .BadZipfile :
344+ corrupt = True
339345 if corrupt :
340346 print ('The downloaded scene is corrupt: {}' .format (os .path .basename (zipfile )))
341- return False
342347 else :
343348 print ('file seems to be valid.' )
344- return True
349+ return not corrupt
345350
346351 def _format_url (self , startindex , wkt_geometry , platform , date_filtering , ** keywords ):
347352 """Format the search URL based on the arguments
0 commit comments