Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_get_coordinates(fixture_path):
wkt = (
"POLYGON((-66.2695 -8.0592,-66.2695 0.7031,"
"-57.3047 0.7031,-57.3047 -8.0592,-66.2695 -8.0592))"
)
assert geojson_to_wkt(read_geojson(fixture_path("map.geojson"))) == wkt
assert geojson_to_wkt(read_geojson(fixture_path("map_z.geojson"))) == wkt
assert geojson_to_wkt(read_geojson(fixture_path("map_nested.geojson"))) == wkt
username = request.inputs['username'][0].data
password = request.inputs['password'][0].data
cloud_cover = request.inputs['cloud_cover'][0].data
api = SentinelAPI(username, password)
geom = {
"type": "Polygon",
"coordinates": [[[ bbox[0], bbox[1]],
[ bbox[2], bbox[1]],
[ bbox[2], bbox[3]],
[ bbox[0], bbox[3]],
[ bbox[0], bbox[1]]]]}
footprint = geojson_to_wkt(geom)
response.update_status("start searching tiles acording query", 15)
products = api.query(footprint,
date=(start, end),
platformname='Sentinel-2',
cloudcoverpercentage=(0, cloud_cover),
# producttype='SLC',
# orbitdirection='ASCENDING',
)
LOGGER.debug('%s products found' % len(products.keys()))
DIR_cache = cache_path()
DIR_EO = join(DIR_cache, 'scihub.copernicus')
if not exists(DIR_EO):
makedirs(DIR_EO)
username = request.inputs['username'][0].data
password = request.inputs['password'][0].data
cloud_cover = request.inputs['cloud_cover'][0].data
api = SentinelAPI(username, password)
geom = {
"type": "Polygon",
"coordinates": [[[ bbox[0], bbox[1]],
[ bbox[2], bbox[1]],
[ bbox[2], bbox[3]],
[ bbox[0], bbox[3]],
[ bbox[0], bbox[1]]]]}
footprint = geojson_to_wkt(geom)
response.update_status("start searching tiles acording query", 15)
products = api.query(footprint,
date=(start, end),
platformname='Sentinel-2',
cloudcoverpercentage=(0, cloud_cover),
# producttype='SLC',
# orbitdirection='ASCENDING',
)
LOGGER.debug('%s products found' % len(products.keys()))
DIR_cache = cache_path()
DIR_EO = join(DIR_cache, 'scihub.copernicus')
if not exists(DIR_EO):
makedirs(DIR_EO)
username = request.inputs['username'][0].data
password = request.inputs['password'][0].data
cloud_cover = request.inputs['cloud_cover'][0].data
api = SentinelAPI(username, password)
geom = {
"type": "Polygon",
"coordinates": [[[ bbox[0], bbox[1]],
[ bbox[2], bbox[1]],
[ bbox[2], bbox[3]],
[ bbox[0], bbox[3]],
[ bbox[0], bbox[1]]]]}
footprint = geojson_to_wkt(geom)
response.update_status("start searching tiles acording query", 15)
products = api.query(footprint,
date=(start, end),
platformname='Sentinel-2',
cloudcoverpercentage=(0, cloud_cover),
# producttype='SLC',
# orbitdirection='ASCENDING',
)
response.update_status("write out information about files", 20)
# api.download_all(products)
_, filepathes = mkstemp(dir='.', suffix='.txt')
try:
with open(filepathes, 'w') as fp:
16.00,
10.00
],
[
14.00,
10.00
],
[
14.00,
8.00
]
]
]
}
footprint = geojson_to_wkt(geom)
response.update_status("start searching tiles according to query", 15)
products = api.query(footprint,
date=(start, end),
platformname='Sentinel-2',
cloudcoverpercentage=(0, cloud_cover),
# producttype='SLC',
# orbitdirection='ASCENDING',
)
response.update_status("write out information about files", 20)
# api.download_all(products)
_, filepaths = mkstemp(dir='.', suffix='.txt')
try:
with open(filepaths, 'w') as fp: