<jupyter_start><jupyter_text>Fonte http://sentinelhub-py.readthedocs.io/en/latest/examples/ogc_request.htmlImportsconfiguazione e importla configurazione dell'applicazione deve essere fatta qui https://apps.sentinel-hub.com/configurator//<jupyter_code>INSTANCE_ID = '1dea38a8-f0eb-4d2c-bc72-81a315227c9a'
%reload_ext autoreload
%autoreload 2
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import datetime
from sentinelhub.data_request import WmsRequest, WcsRequest
from sentinelhub.constants import MimeType
from sentinelhub.common import BBox, CRS<jupyter_output><empty_output><jupyter_text>Per disegnare l'immagine in colore RGB e mostrarla<jupyter_code>def plot_image(data, factor=1):
    """
    Utility function for plotting RGB images. The numpy arrays returned by the WMS and WCS requests have channels
    ordered as Blue (`B02`), Green (`B03`), and Red (`B04`) therefore the order has to be reversed before ploting
    the image. http://sentinelhub-py.readthedocs.io/en/latest/examples/ogc_request.html#Imports comfiguration https://apps.sentinel-hub.com/configurator/#/configurations/1
    """
    fig = plt.subplots(nrows=1, ncols=1, figsize=(15, 7))
    rgb = np.zeros(data.shape, dtype=np.float32)
    rgb[..., 0] = data[..., 2]
    rgb[..., 1] = data[..., 1]
    rgb[..., 2] = data[..., 0]
    plt.imshow(rgb*factor)<jupyter_output><empty_output><jupyter_text>Definizione dell area geografica da monitorare<jupyter_code>prato_coords_wgs84 = [43.9351, 11.0004, 43.8327, 11.1681]
prato_bbox = BBox(bbox=prato_coords_wgs84,crs=CRS.WGS84)<jupyter_output><empty_output><jupyter_text>Configurazione della richiesta dei dati satellitari<jupyter_code>wms_true_color_request = WmsRequest(data_folder='immagini',
                                    layer='TRUE-COLOR',
                                    bbox=prato_bbox,
                                    time=('2018-01-01', '2018-01-31'),
                                    width=1000, height=1000,
                                    maxcc=0.2,
                                    instance_id=INSTANCE_ID)<jupyter_output><empty_output><jupyter_text>Richiedo i dati al servizio e li salvo in locale<jupyter_code>wms_true_color_img = wms_true_color_request.get_data()
wms_bands_img = wms_true_color_request.save_data()
print('Ci sono %d immagini di Sentinel-2 disponibili con una copertura nuvole inferiore al %1.0f%%.' % (len(wms_true_color_img), wms_true_color_request.maxcc * 100.0))
plot_image(wms_true_color_img[-1], 1./255)
print('Le %d immagini prelevate hanno queste date:' % len(wms_true_color_img))
for index, date in enumerate(wms_true_color_request.get_dates()):
    print(' - image %d was taken on %s' % (index, date))<jupyter_output>Le 1 immagini prelevate hanno queste date:
 - image 0 was taken on 2018-01-24 10:13:52
{'fraction_non_alphanumeric': 0.11087420042643924, 'fraction_numerical': 0.04406538734896944, 'mean_word_length': 3.8202054794520546, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 20, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '117134', 'license': 'MIT', 'n_tokens_mistral': 1091, 'n_tokens_neox': 986, 'n_words': 204, 'path': 'Sentinel Hub Prato.ipynb', 'repo_name': 'iltempe/notebooks', 'size': '2814'}