示例#1
0
    def test_define_from(self):
        bands = ['B01', 'XYZ']
        for _ in range(3):
            data_collection = DataCollection.define_from(
                DataCollection.SENTINEL5P, 'NEW_5P', api_id='X', bands=bands)

        self.assertEqual(data_collection, DataCollection.NEW_5P)
        self.assertEqual(data_collection.api_id, 'X')
        self.assertEqual(data_collection.wfs_id,
                         DataCollection.SENTINEL5P.wfs_id)
        self.assertEqual(data_collection.bands, tuple(bands))
byoc_request = SentinelHubRequest(
    evalscript=evalscript_byoc,
    input_data=[SentinelHubRequest.input_data(data_collection=byoc)],
    responses=[SentinelHubRequest.output_response('default', MimeType.TIFF)],
    bbox=slovenia_bbox,
    size=slovenia_size,
    config=config)

byoc_data = byoc_request.get_data()
plt.figure()
plt.imshow(byoc_data[0])

# create a data collection with a different service_url argument. this will collect data from MUNDI deployment (rather
# than SH deployment, which is the default)
s2_12a_mundi = DataCollection.define_from(
    DataCollection.SENTINEL2_L2A,
    'SENTINEL2_L2A_MUNDI',
    service_url='https://shservices.mundiwebservices.com')
print(s2_12a_mundi.__dir__)

time_interval = '2020-06-01', '2020-07-01'

evalscript = """
    //VERSION=3
    
    function setup() {
        return {
            input: [{
                bands: ["B02", "B03", "B04"]
            }],
            output: {
                bands : 3