Update fetchOrbit.py

LT1AB
Bryan Marfito 2021-03-14 21:11:21 +08:00 committed by GitHub
parent a25f80537a
commit c8af76be10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 8 deletions

View File

@ -155,8 +155,14 @@ if __name__ == '__main__':
'/' + str(fileTS1[8:10]) + '/' '/' + str(fileTS1[8:10]) + '/'
elif oType == 'restituted': elif oType == 'restituted':
url = server + spec[1] + str(fileTS.year).zfill(2) + '/' + str(fileTS.month).zfill(2) + \ delta = datetime.timedelta(days=1)
'/' + str(fileTS.day).zfill(2) + '/' timebef = (fileTS - delta).strftime(queryfmt)
timeaft = (fileTS + delta).strftime(queryfmt)
url = (server + spec[1] + str(fileTS.year).zfill(2) + '/' + str(fileTS.month).zfill(2) + \
'/' + str(fileTS.day).zfill(2) + '/' + '?validity_start={0}..{1}&sentinel1__mission={2}'.\
format(timebef, timeaft,satName))
success = False success = False
match = None match = None
@ -164,14 +170,12 @@ if __name__ == '__main__':
try: try:
r = session.get(url, verify=False) r = session.get(url, verify=False)
r.raise_for_status() r.raise_for_status()
parser = MyHTMLParser(satName, url) parser = MyHTMLParser(satName, url)
parser.feed(r.text) parser.feed(r.text)
for resulturl, result in parser.fileList: for resulturl, result in parser.fileList:
match = os.path.join(resulturl, result) match = os.path.join(resulturl, result)
if match is not None: if match is not None:
success = True success = True
except: except:
pass pass