本文整理汇总了Python中sentinelsat.sentinel.SentinelAPI.format_url方法的典型用法代码示例。如果您正苦于以下问题:Python SentinelAPI.format_url方法的具体用法?Python SentinelAPI.format_url怎么用?Python SentinelAPI.format_url使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sentinelsat.sentinel.SentinelAPI
的用法示例。
在下文中一共展示了SentinelAPI.format_url方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_format_url_custom_api_url
# 需要导入模块: from sentinelsat.sentinel import SentinelAPI [as 别名]
# 或者: from sentinelsat.sentinel.SentinelAPI import format_url [as 别名]
def test_format_url_custom_api_url():
api = SentinelAPI("user", "pw", api_url='https://scihub.copernicus.eu/dhus/')
url = api.format_url()
assert url.startswith('https://scihub.copernicus.eu/dhus/search')
api = SentinelAPI("user", "pw", api_url='https://scihub.copernicus.eu/dhus')
url = api.format_url()
assert url.startswith('https://scihub.copernicus.eu/dhus/search')
示例2: test_format_url
# 需要导入模块: from sentinelsat.sentinel import SentinelAPI [as 别名]
# 或者: from sentinelsat.sentinel.SentinelAPI import format_url [as 别名]
def test_format_url():
api = SentinelAPI(**_api_kwargs)
start_row = 0
url = api.format_url(start_row=start_row)
assert url is api.url
assert api.url == 'https://scihub.copernicus.eu/apihub/search?format=json&rows={rows}&start={start}'.format(
rows=api.page_size, start=start_row)
示例3: test_api_url_format
# 需要导入模块: from sentinelsat.sentinel import SentinelAPI [as 别名]
# 或者: from sentinelsat.sentinel.SentinelAPI import format_url [as 别名]
def test_api_url_format():
api = SentinelAPI(
environ.get('SENTINEL_USER'),
environ.get('SENTINEL_PASSWORD')
)
now = datetime.now()
api.format_url('0 0,1 1,0 1,0 0', end_date=now)
last_24h = format_date(now - timedelta(hours=24))
assert api.url == 'https://scihub.copernicus.eu/apihub/search?format=json&rows=15000' + \
'&q=(beginPosition:[%s TO %s]) ' % (last_24h, format_date(now)) + \
'AND (footprint:"Intersects(POLYGON((0 0,1 1,0 1,0 0)))")'
api.format_url('0 0,1 1,0 1,0 0', end_date=now, producttype='SLC')
assert api.url == 'https://scihub.copernicus.eu/apihub/search?format=json&rows=15000' + \
'&q=(beginPosition:[%s TO %s]) ' % (last_24h, format_date(now)) + \
'AND (footprint:"Intersects(POLYGON((0 0,1 1,0 1,0 0)))") ' + \
'AND (producttype:SLC)'
示例4: test_SentinelAPI
# 需要导入模块: from sentinelsat.sentinel import SentinelAPI [as 别名]
# 或者: from sentinelsat.sentinel.SentinelAPI import format_url [as 别名]
def test_SentinelAPI():
api = SentinelAPI(
environ.get('SENTINEL_USER'),
environ.get('SENTINEL_PASSWORD')
)
api.query('0 0,1 1,0 1,0 0', datetime(2015, 1, 1), datetime(2015, 1, 2))
assert api.url == 'https://scihub.esa.int/dhus/search?format=json&rows=15000' + \
'&q=(ingestionDate:[2015-01-01T00:00:00Z TO 2015-01-02T00:00:00Z]) ' + \
'AND (footprint:"Intersects(POLYGON((0 0,1 1,0 1,0 0)))")'
assert api.content.status_code == 200
now = datetime.now()
api.format_url('0 0,1 1,0 1,0 0', end_date=now)
last_24h = format_date(now - timedelta(hours=24))
assert api.url == 'https://scihub.esa.int/dhus/search?format=json&rows=15000' + \
'&q=(ingestionDate:[%s TO %s]) ' % (last_24h, format_date(now)) + \
'AND (footprint:"Intersects(POLYGON((0 0,1 1,0 1,0 0)))")'
api.format_url('0 0,1 1,0 1,0 0', end_date=now, producttype='SLC')
assert api.url == 'https://scihub.esa.int/dhus/search?format=json&rows=15000' + \
'&q=(ingestionDate:[%s TO %s]) ' % (last_24h, format_date(now)) + \
'AND (footprint:"Intersects(POLYGON((0 0,1 1,0 1,0 0)))") ' + \
'AND (producttype:SLC)'