As you may know, the new Copernicus Data Space Ecosystem is now needs a registration. I mostly change my dates and coordinates on an Excel .csv file and run the script. So far it has always worked perfectly but now with this update its time to change the code. I was using the sentinelsat library.
If someone could please help me to just change this as simple as possible and keep using my system, I would really appreciate it!
def s5papi(latitude, longitude, startdate, enddate, xy):
username = 's5pguest'
password = 's5pguest'
url = 'https://s5phub.copernicus.eu/dhus/'
lat = str(latitude[xy])
lon = longitude[xy]
startdate1 = str(startdate[xy])
enddate1 = str(enddate[xy])
point = "intersects("+str(lat)+", "+str(lon)+")"
#path_geojson = Path('footprint/Turkmenistan.geojson')
api = SentinelAPI(username, password, url)
# footprint = geojson_to_wkt(read_geojson(path_geojson))
tqdm.write('Fetching products...\n')
products = api.query(date=(startdate1, enddate1),
footprint=point,
platformname='Sentinel-5 Precursor',
producttype='L2__CH4___')
if len(products) == 0:
tqdm.write('No products found\n')
return
else:
tqdm.write(str(len(products))+'Products found\n'+'Fetching Done\n')
tqdm.write('Total product size :'+str(api.get_products_size(products))+' GB\n')
tqdm.write('Downloading products...\n')
api.download_all(products, directory_path=Path('data'))
tqdm.write('Download finished.\n')
products_df = api.to_dataframe(products)
while xy > 0: #when xy turn to 1, stops adding the header to the data.csv
header = False
break
else:
header = True
products_df.to_csv(Path('data.csv'), mode="a", header = header) for each downloaded product
return products_df
I tried to change the link and of course the username and password but it does not work. Hope someone has a better solution.
I found this notebook to do the migration but I am struggling: https://github.com/eu-cdse/notebook-samples/blob/c0e0ade601973c5d4e4bf66a13c0b76ebb099805/sentinelhub/migration_from_scihub_guide.ipynb
To search for available EO products you don't need an account but to download the product you will need a free registration account.
To search:
To download all returned products: