本文整理汇总了Python中sentinelsat.SentinelAPI.get_product_odata方法的典型用法代码示例。如果您正苦于以下问题:Python SentinelAPI.get_product_odata方法的具体用法?Python SentinelAPI.get_product_odata怎么用?Python SentinelAPI.get_product_odata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sentinelsat.SentinelAPI
的用法示例。
在下文中一共展示了SentinelAPI.get_product_odata方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_scihub_unresponsive
# 需要导入模块: from sentinelsat import SentinelAPI [as 别名]
# 或者: from sentinelsat.SentinelAPI import get_product_odata [as 别名]
def test_scihub_unresponsive():
timeout_connect = 6
timeout_read = 6.6
timeout = (timeout_connect, timeout_read)
api = SentinelAPI("mock_user", "mock_password", timeout=timeout)
with requests_mock.mock() as rqst:
rqst.request(requests_mock.ANY, requests_mock.ANY, exc=requests.exceptions.ConnectTimeout)
with pytest.raises(requests.exceptions.ConnectTimeout):
api.query(**_small_query)
with pytest.raises(requests.exceptions.ConnectTimeout):
api.get_product_odata('8df46c9e-a20c-43db-a19a-4240c2ed3b8b')
with pytest.raises(requests.exceptions.ConnectTimeout):
api.download('8df46c9e-a20c-43db-a19a-4240c2ed3b8b')
with pytest.raises(requests.exceptions.ConnectTimeout):
api.download_all(['8df46c9e-a20c-43db-a19a-4240c2ed3b8b'])
with requests_mock.mock() as rqst:
rqst.request(requests_mock.ANY, requests_mock.ANY, exc=requests.exceptions.ReadTimeout)
with pytest.raises(requests.exceptions.ReadTimeout):
api.query(**_small_query)
with pytest.raises(requests.exceptions.ReadTimeout):
api.get_product_odata('8df46c9e-a20c-43db-a19a-4240c2ed3b8b')
with pytest.raises(requests.exceptions.ReadTimeout):
api.download('8df46c9e-a20c-43db-a19a-4240c2ed3b8b')
with pytest.raises(requests.exceptions.ReadTimeout):
api.download_all(['8df46c9e-a20c-43db-a19a-4240c2ed3b8b'])
示例2: test_SentinelAPI_wrong_credentials
# 需要导入模块: from sentinelsat import SentinelAPI [as 别名]
# 或者: from sentinelsat.SentinelAPI import get_product_odata [as 别名]
def test_SentinelAPI_wrong_credentials():
api = SentinelAPI(
"wrong_user",
"wrong_password"
)
with pytest.raises(SentinelAPIError) as excinfo:
api.query(**_small_query)
assert excinfo.value.response.status_code == 401
with pytest.raises(SentinelAPIError) as excinfo:
api.get_product_odata('8df46c9e-a20c-43db-a19a-4240c2ed3b8b')
assert excinfo.value.response.status_code == 401
with pytest.raises(SentinelAPIError) as excinfo:
api.download('8df46c9e-a20c-43db-a19a-4240c2ed3b8b')
assert excinfo.value.response.status_code == 401
with pytest.raises(SentinelAPIError) as excinfo:
api.download_all(['8df46c9e-a20c-43db-a19a-4240c2ed3b8b'])
assert excinfo.value.response.status_code == 401
示例3: test_get_product_odata_scihub_down
# 需要导入模块: from sentinelsat import SentinelAPI [as 别名]
# 或者: from sentinelsat.SentinelAPI import get_product_odata [as 别名]
def test_get_product_odata_scihub_down():
api = SentinelAPI("mock_user", "mock_password")
with requests_mock.mock() as rqst:
rqst.get(
"https://scihub.copernicus.eu/apihub/odata/v1/Products('8df46c9e-a20c-43db-a19a-4240c2ed3b8b')?$format=json",
text="Mock SciHub is Down", status_code=503
)
with pytest.raises(SentinelAPIError) as excinfo:
api.get_product_odata('8df46c9e-a20c-43db-a19a-4240c2ed3b8b')
rqst.get(
"https://scihub.copernicus.eu/apihub/odata/v1/Products('8df46c9e-a20c-43db-a19a-4240c2ed3b8b')/?$format=json",
text="Mock SciHub is Down", status_code=200
)
with pytest.raises(SentinelAPIError) as excinfo:
api.get_product_odata('8df46c9e-a20c-43db-a19a-4240c2ed3b8b')
assert excinfo.value.msg == "Mock SciHub is Down"
# Test with a real server response
rqst.get(
"https://scihub.copernicus.eu/apihub/odata/v1/Products('8df46c9e-a20c-43db-a19a-4240c2ed3b8b')?$format=json",
text=textwrap.dedent("""\
<!doctype html>
<title>The Sentinels Scientific Data Hub</title>
<link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
<style>
body { text-align: center; padding: 125px; background: #fff;}
h1 { font-size: 50px; }
body { font: 20px 'Open Sans',Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 820px; margin: 0 auto; }
a { color: #0062a4; text-decoration: none; font-size: 26px }
a:hover { color: #1b99da; text-decoration: none; }
</style>
<article>
<img alt="" src="/datahub.png" style="float: left;margin: 20px;">
<h1>The Sentinels Scientific Data Hub will be back soon!</h1>
<div style="margin-left: 145px;">
<p>
Sorry for the inconvenience,<br/>
we're performing some maintenance at the moment.<br/>
</p>
<!--<p><a href="https://scihub.copernicus.eu/news/News00098">https://scihub.copernicus.eu/news/News00098</a></p>-->
<p>
We'll be back online shortly!
</p>
</div>
</article>
"""),
status_code=502)
with pytest.raises(SentinelAPIError) as excinfo:
api.get_product_odata('8df46c9e-a20c-43db-a19a-4240c2ed3b8b')
assert "The Sentinels Scientific Data Hub will be back soon!" in excinfo.value.msg
示例4: test_get_product_odata_scihub_down
# 需要导入模块: from sentinelsat import SentinelAPI [as 别名]
# 或者: from sentinelsat.SentinelAPI import get_product_odata [as 别名]
def test_get_product_odata_scihub_down(read_fixture_file):
api = SentinelAPI("mock_user", "mock_password")
request_url = "https://scihub.copernicus.eu/apihub/odata/v1/Products('8df46c9e-a20c-43db-a19a-4240c2ed3b8b')?$format=json"
with requests_mock.mock() as rqst:
rqst.get(
request_url,
text="Mock SciHub is Down", status_code=503
)
with pytest.raises(SentinelAPIError) as excinfo:
api.get_product_odata('8df46c9e-a20c-43db-a19a-4240c2ed3b8b')
assert excinfo.value.msg == "Mock SciHub is Down"
rqst.get(
request_url,
text='{"error":{"code":null,"message":{"lang":"en","value":'
'"No Products found with key \'8df46c9e-a20c-43db-a19a-4240c2ed3b8b\' "}}}',
status_code=500
)
with pytest.raises(SentinelAPIError) as excinfo:
api.get_product_odata('8df46c9e-a20c-43db-a19a-4240c2ed3b8b')
assert excinfo.value.msg == "No Products found with key \'8df46c9e-a20c-43db-a19a-4240c2ed3b8b\' "
rqst.get(
request_url,
text="Mock SciHub is Down", status_code=200
)
with pytest.raises(SentinelAPIError) as excinfo:
api.get_product_odata('8df46c9e-a20c-43db-a19a-4240c2ed3b8b')
assert excinfo.value.msg == "Mock SciHub is Down"
# Test with a real "server under maintenance" response
rqst.get(
request_url,
text=read_fixture_file('server_maintenance.html'),
status_code=502)
with pytest.raises(SentinelAPIError) as excinfo:
api.get_product_odata('8df46c9e-a20c-43db-a19a-4240c2ed3b8b')
assert "The Sentinels Scientific Data Hub will be back soon!" in excinfo.value.msg
示例5: test_get_product_odata_short
# 需要导入模块: from sentinelsat import SentinelAPI [as 别名]
# 或者: from sentinelsat.SentinelAPI import get_product_odata [as 别名]
def test_get_product_odata_short():
api = SentinelAPI(**_api_auth)
expected_short = {
'8df46c9e-a20c-43db-a19a-4240c2ed3b8b': {
'id': '8df46c9e-a20c-43db-a19a-4240c2ed3b8b',
'size': 143549851,
'md5': 'D5E4DF5C38C6E97BF7E7BD540AB21C05',
'url': "https://scihub.copernicus.eu/apihub/odata/v1/Products('8df46c9e-a20c-43db-a19a-4240c2ed3b8b')/$value",
'date': datetime(2015, 11, 21, 10, 3, 56, 675000),
'footprint': 'POLYGON((-63.852531 -5.880887,-67.495872 -5.075419,-67.066071 -3.084356,-63.430576 -3.880541,'
'-63.852531 -5.880887))',
'title': 'S1A_EW_GRDM_1SDV_20151121T100356_20151121T100429_008701_00C622_A0EC'
},
'44517f66-9845-4792-a988-b5ae6e81fd3e': {
'id': '44517f66-9845-4792-a988-b5ae6e81fd3e',
'date': datetime(2015, 12, 27, 14, 22, 29),
'footprint': 'POLYGON((-58.80274769505742 -4.565257232533263,-58.80535376268811 -5.513960396525286,'
'-57.90315169909761 -5.515947033626909,-57.903151791669515 -5.516014389089381,-57.85874693129081 -5.516044812342758,'
'-57.814323596961835 -5.516142631941845,-57.81432351345917 -5.516075248310466,-57.00018056571297 -5.516633044843839,'
'-57.000180565731384 -5.516700066819259,-56.95603179187787 -5.51666329264377,-56.91188395837315 -5.516693539799448,'
'-56.91188396736038 -5.51662651925904,-56.097209386295305 -5.515947927683427,-56.09720929423562 -5.516014937246069,'
'-56.053056977999596 -5.5159111504805916,-56.00892491028779 -5.515874390220655,-56.00892501130261 -5.515807411549814,'
'-55.10621586418906 -5.513685455771881,-55.108821882251775 -4.6092845892233,-54.20840287327946 -4.606372862374043,'
'-54.21169990975238 -3.658594390979672,-54.214267703869346 -2.710949551849636,-55.15704255065496 -2.7127451087194463,'
'-56.0563616875051 -2.71378646425769,-56.9561852630143 -2.7141556791285275,-57.8999998009875 -2.713837142510183,'
'-57.90079161941062 -3.6180222056692726,-58.800616247288836 -3.616721351843382,-58.80274769505742 -4.565257232533263))',
'md5': '48C5648C2644CE07207B3C943DEDEB44',
'size': 5854429622,
'title': 'S2A_OPER_PRD_MSIL1C_PDMC_20151228T112523_R110_V20151227T142229_20151227T142229',
'url': "https://scihub.copernicus.eu/apihub/odata/v1/Products('44517f66-9845-4792-a988-b5ae6e81fd3e')/$value"
}
}
for id, expected in expected_short.items():
ret = api.get_product_odata(id)
assert set(ret) == set(expected)
for k in ret:
assert ret[k] == expected[k]
示例6: test_get_product_info_bad_key
# 需要导入模块: from sentinelsat import SentinelAPI [as 别名]
# 或者: from sentinelsat.SentinelAPI import get_product_odata [as 别名]
def test_get_product_info_bad_key():
api = SentinelAPI(**_api_auth)
with pytest.raises(SentinelAPIError) as excinfo:
api.get_product_odata('invalid-xyz')
assert excinfo.value.msg == "InvalidKeyException : Invalid key (invalid-xyz) to access Products"
示例7: test_get_product_odata_full
# 需要导入模块: from sentinelsat import SentinelAPI [as 别名]
# 或者: from sentinelsat.SentinelAPI import get_product_odata [as 别名]
def test_get_product_odata_full():
api = SentinelAPI(**_api_auth)
expected_full = {
'8df46c9e-a20c-43db-a19a-4240c2ed3b8b': {
'id': '8df46c9e-a20c-43db-a19a-4240c2ed3b8b',
'title': 'S1A_EW_GRDM_1SDV_20151121T100356_20151121T100429_008701_00C622_A0EC',
'size': 143549851,
'md5': 'D5E4DF5C38C6E97BF7E7BD540AB21C05',
'date': datetime(2015, 11, 21, 10, 3, 56, 675000),
'footprint': 'POLYGON((-63.852531 -5.880887,-67.495872 -5.075419,-67.066071 -3.084356,-63.430576 -3.880541,-63.852531 -5.880887))',
'url': "https://scihub.copernicus.eu/apihub/odata/v1/Products('8df46c9e-a20c-43db-a19a-4240c2ed3b8b')/$value",
'Acquisition Type': 'NOMINAL',
'Carrier rocket': 'Soyuz',
'Cycle number': 64,
'Date': datetime(2015, 11, 21, 10, 3, 56, 675000),
'Filename': 'S1A_EW_GRDM_1SDV_20151121T100356_20151121T100429_008701_00C622_A0EC.SAFE',
'Footprint': '<gml:Polygon srsName="http://www.opengis.net/gml/srs/epsg.xml#4326" xmlns:gml="http://www.opengis.net/gml">\n <gml:outerBoundaryIs>\n <gml:LinearRing>\n <gml:coordinates>-5.880887,-63.852531 -5.075419,-67.495872 -3.084356,-67.066071 -3.880541,-63.430576 -5.880887,-63.852531</gml:coordinates>\n </gml:LinearRing>\n </gml:outerBoundaryIs>\n</gml:Polygon>',
'Format': 'SAFE',
'Identifier': 'S1A_EW_GRDM_1SDV_20151121T100356_20151121T100429_008701_00C622_A0EC',
'Ingestion Date': datetime(2015, 11, 21, 13, 22, 4, 992000),
'Instrument': 'SAR-C',
'Instrument abbreviation': 'SAR-C SAR',
'Instrument description': '<a target="_blank" href="https://sentinel.esa.int/web/sentinel/missions/sentinel-1">https://sentinel.esa.int/web/sentinel/missions/sentinel-1</a>',
'Instrument description text': 'The SAR Antenna Subsystem (SAS) is developed and build by AstriumGmbH. It is a large foldable planar phased array antenna, which isformed by a centre panel and two antenna side wings. In deployedconfiguration the antenna has an overall aperture of 12.3 x 0.84 m.The antenna provides a fast electronic scanning capability inazimuth and elevation and is based on low loss and highly stablewaveguide radiators build in carbon fibre technology, which arealready successfully used by the TerraSAR-X radar imaging mission.The SAR Electronic Subsystem (SES) is developed and build byAstrium Ltd. It provides all radar control, IF/ RF signalgeneration and receive data handling functions for the SARInstrument. The fully redundant SES is based on a channelisedarchitecture with one transmit and two receive chains, providing amodular approach to the generation and reception of wide-bandsignals and the handling of multi-polarisation modes. One keyfeature is the implementation of the Flexible Dynamic BlockAdaptive Quantisation (FD-BAQ) data compression concept, whichallows an efficient use of on-board storage resources and minimisesdownlink times.',
'Instrument mode': 'EW',
'Instrument name': 'Synthetic Aperture Radar (C-band)',
'Instrument swath': 'EW',
'JTS footprint': 'POLYGON ((-63.852531 -5.880887,-67.495872 -5.075419,-67.066071 -3.084356,-63.430576 -3.880541,-63.852531 -5.880887))',
'Launch date': 'April 3rd, 2014',
'Mission datatake id': 50722,
'Mission type': 'Earth observation',
'Mode': 'EW',
'NSSDC identifier': '0000-000A',
'Operator': 'European Space Agency',
'Orbit number (start)': 8701,
'Orbit number (stop)': 8701,
'Pass direction': 'DESCENDING',
'Phase identifier': 1,
'Polarisation': 'VV VH',
'Product class': 'S',
'Product class description': 'SAR Standard L1 Product',
'Product composition': 'Slice',
'Product level': 'L1',
'Product type': 'GRD',
'Relative orbit (start)': 54, 'Relative orbit (stop)': 54, 'Resolution': 'Medium',
'Satellite': 'Sentinel-1',
'Satellite description': '<a target="_blank" href="https://sentinel.esa.int/web/sentinel/missions/sentinel-1">https://sentinel.esa.int/web/sentinel/missions/sentinel-1</a>',
'Satellite name': 'Sentinel-1',
'Satellite number': 'A',
'Sensing start': datetime(2015, 11, 21, 10, 3, 56, 675000),
'Sensing stop': datetime(2015, 11, 21, 10, 4, 29, 714000),
'Size': '223.88 MB',
'Slice number': 1,
'Start relative orbit number': 54,
'Status': 'ARCHIVED',
'Stop relative orbit number': 54,
'Timeliness Category': 'Fast-24h'
},
'44517f66-9845-4792-a988-b5ae6e81fd3e': {
'id': '44517f66-9845-4792-a988-b5ae6e81fd3e',
'title': 'S2A_OPER_PRD_MSIL1C_PDMC_20151228T112523_R110_V20151227T142229_20151227T142229',
'size': 5854429622,
'md5': '48C5648C2644CE07207B3C943DEDEB44',
'date': datetime(2015, 12, 27, 14, 22, 29),
'footprint': 'POLYGON((-58.80274769505742 -4.565257232533263,-58.80535376268811 -5.513960396525286,-57.90315169909761 -5.515947033626909,-57.903151791669515 -5.516014389089381,-57.85874693129081 -5.516044812342758,-57.814323596961835 -5.516142631941845,-57.81432351345917 -5.516075248310466,-57.00018056571297 -5.516633044843839,-57.000180565731384 -5.516700066819259,-56.95603179187787 -5.51666329264377,-56.91188395837315 -5.516693539799448,-56.91188396736038 -5.51662651925904,-56.097209386295305 -5.515947927683427,-56.09720929423562 -5.516014937246069,-56.053056977999596 -5.5159111504805916,-56.00892491028779 -5.515874390220655,-56.00892501130261 -5.515807411549814,-55.10621586418906 -5.513685455771881,-55.108821882251775 -4.6092845892233,-54.20840287327946 -4.606372862374043,-54.21169990975238 -3.658594390979672,-54.214267703869346 -2.710949551849636,-55.15704255065496 -2.7127451087194463,-56.0563616875051 -2.71378646425769,-56.9561852630143 -2.7141556791285275,-57.8999998009875 -2.713837142510183,-57.90079161941062 -3.6180222056692726,-58.800616247288836 -3.616721351843382,-58.80274769505742 -4.565257232533263))',
'url': "https://scihub.copernicus.eu/apihub/odata/v1/Products('44517f66-9845-4792-a988-b5ae6e81fd3e')/$value",
'Cloud cover percentage': 18.153846153846153,
'Date': datetime(2015, 12, 27, 14, 22, 29),
'Degraded MSI data percentage': 0, 'Degraded ancillary data percentage': 0,
'Filename': 'S2A_OPER_PRD_MSIL1C_PDMC_20151228T112523_R110_V20151227T142229_20151227T142229.SAFE',
'Footprint': '<gml:Polygon srsName="http://www.opengis.net/gml/srs/epsg.xml#4326" xmlns:gml="http://www.opengis.net/gml">\n <gml:outerBoundaryIs>\n <gml:LinearRing>\n <gml:coordinates>-4.565257232533263,-58.80274769505742 -5.513960396525286,-58.80535376268811 -5.515947033626909,-57.90315169909761 -5.516014389089381,-57.903151791669515 -5.516044812342758,-57.85874693129081 -5.516142631941845,-57.814323596961835 -5.516075248310466,-57.81432351345917 -5.516633044843839,-57.00018056571297 -5.516700066819259,-57.000180565731384 -5.51666329264377,-56.95603179187787 -5.516693539799448,-56.91188395837315 -5.51662651925904,-56.91188396736038 -5.515947927683427,-56.097209386295305 -5.516014937246069,-56.09720929423562 -5.5159111504805916,-56.053056977999596 -5.515874390220655,-56.00892491028779 -5.515807411549814,-56.00892501130261 -5.513685455771881,-55.10621586418906 -4.6092845892233,-55.108821882251775 -4.606372862374043,-54.20840287327946 -3.658594390979672,-54.21169990975238 -2.710949551849636,-54.214267703869346 -2.7127451087194463,-55.15704255065496 -2.71378646425769,-56.0563616875051 -2.7141556791285275,-56.9561852630143 -2.713837142510183,-57.8999998009875 -3.6180222056692726,-57.90079161941062 -3.616721351843382,-58.800616247288836 -4.565257232533263,-58.80274769505742</gml:coordinates>\n </gml:LinearRing>\n </gml:outerBoundaryIs>\n</gml:Polygon>',
'Format': 'SAFE',
'Format correctness': 'PASSED',
'General quality': 'PASSED',
'Generation time': datetime(2015, 12, 28, 11, 25, 23, 357),
'Geometric quality': 'PASSED',
'Identifier': 'S2A_OPER_PRD_MSIL1C_PDMC_20151228T112523_R110_V20151227T142229_20151227T142229',
'Ingestion Date': datetime(2015, 12, 28, 10, 57, 13, 725000),
'Instrument': 'MSI',
'Instrument abbreviation': 'MSI',
'Instrument mode': 'INS-NOBS',
'Instrument name': 'Multi-Spectral Instrument',
'JTS footprint': 'POLYGON ((-58.80274769505742 -4.565257232533263,-58.80535376268811 -5.513960396525286,-57.90315169909761 -5.515947033626909,-57.903151791669515 -5.516014389089381,-57.85874693129081 -5.516044812342758,-57.814323596961835 -5.516142631941845,-57.81432351345917 -5.516075248310466,-57.00018056571297 -5.516633044843839,-57.000180565731384 -5.516700066819259,-56.95603179187787 -5.51666329264377,-56.91188395837315 -5.516693539799448,-56.91188396736038 -5.51662651925904,-56.097209386295305 -5.515947927683427,-56.09720929423562 -5.516014937246069,-56.053056977999596 -5.5159111504805916,-56.00892491028779 -5.515874390220655,-56.00892501130261 -5.515807411549814,-55.10621586418906 -5.513685455771881,-55.108821882251775 -4.6092845892233,-54.20840287327946 -4.606372862374043,-54.21169990975238 -3.658594390979672,-54.214267703869346 -2.710949551849636,-55.15704255065496 -2.7127451087194463,-56.0563616875051 -2.71378646425769,-56.9561852630143 -2.7141556791285275,-57.8999998009875 -2.713837142510183,-57.90079161941062 -3.6180222056692726,-58.800616247288836 -3.616721351843382,-58.80274769505742 -4.565257232533263))',
'Mission datatake id': 'GS2A_20151227T140932_002681_N02.01',
'NSSDC identifier': '2015-000A',
'Orbit number (start)': 2681,
'Pass direction': 'DESCENDING',
'Platform serial identifier': 'Sentinel-2A',
'Processing baseline': 2.01,
'Processing level': 'Level-1C',
'Product type': 'S2MSI1C',
'Radiometric quality': 'PASSED',
'Relative orbit (start)': 110,
'Satellite': 'Sentinel-2',
'Satellite name': 'Sentinel-2',
'Satellite number': 'A',
'Sensing start': datetime(2015, 12, 27, 14, 22, 29),
'Sensing stop': datetime(2015, 12, 27, 14, 22, 29),
'Sensor quality': 'PASSED',
#.........这里部分代码省略.........