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_boundaries_longitude_less(fixture_path):
with pytest.raises(ValueError):
geojson_to_wkt(read_geojson(fixture_path('map_boundaries_lon.geojson')))
def test_boundaries_latitude_more(fixture_path):
with pytest.raises(ValueError):
geojson_to_wkt(read_geojson(fixture_path("map_boundaries_lat.geojson")))
def test_boundaries_latitude_more(fixture_path):
with pytest.raises(ValueError):
geojson_to_wkt(read_geojson(fixture_path('map_boundaries_lat.geojson')))
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
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
def test_boundaries_longitude_less(fixture_path):
with pytest.raises(ValueError):
geojson_to_wkt(read_geojson(fixture_path("map_boundaries_lon.geojson")))
The maximum cloud clover (as calculated by Copernicus) to download.
Returns
-------
A dictionary of Sentinel-2 granule products that are touched by your AOI polygon, keyed by product ID.
Returns both level 1 and level 2 data.
Notes
-----
If you get a 'request too long' error, it is likely that your polygon is too complex. The following functions
download by granule; there is no need to have a precise polygon at this stage.
"""
# Originally by Ciaran Robb
api = SentinelAPI(user, passwd)
footprint = geojson_to_wkt(read_geojson(geojsonfile))
log.info("Sending Sentinel-2 query:\nfootprint: {}\nstart_date: {}\nend_date: {}\n cloud_cover: {} ".format(
footprint, start_date, end_date, cloud))
products = api.query(footprint,
date=(start_date, end_date), platformname="Sentinel-2",
cloudcoverpercentage="[0 TO {}]".format(cloud))
return products