This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Requests | |
from oauthlib.oauth2 import BackendApplicationClient | |
from requests_oauthlib import OAuth2Session | |
import requests | |
# Plotting | |
from PIL import Image | |
from io import BytesIO | |
import matplotlib.pyplot as plt | |
# Fetch Oauth token |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//VERSION=3 | |
function setup() { | |
return { | |
input: ["B04", "B08"], | |
output: { bands: 1, sampleType: "UINT16" } | |
}; | |
} | |
function evaluatePixel(sample) { | |
let ndvi = index(sample.B08, sample.B04); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//VERSION=3 | |
function setup() { | |
return { | |
input: [ | |
{ | |
bands: ["B02"], | |
units: "DN", | |
} | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//VERSION=3 | |
function setup() { | |
return { | |
input: ["B02"], | |
output: { bands: 1, sampleType: "UINT16" } | |
}; | |
} | |
const f = 10000; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//VERSION=3 | |
function setup() { | |
return { | |
input: ["B02"], | |
output: { bands: 1, sampleType: "AUTO" } | |
}; | |
} | |
function evaluatePixel(sample) { | |
return [sample.B02]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//VERSION=3 | |
function setup() { | |
return { | |
input: ["B02"], | |
output: { bands: 1, sampleType: "INSERT-HERE" } | |
}; | |
} | |
function evaluatePixel(sample) { | |
return [sample.B02]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Name | Description | Range | |
---|---|---|---|
UINT8 | unsigned 8-bit integer | 0-255 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For requests | |
import requests | |
from oauthlib.oauth2 import BackendApplicationClient | |
from requests_oauthlib import OAuth2Session | |
from sentinelhub import SHConfig | |
config = SHConfig() | |
# Set up credentials for use with batch | |
client = BackendApplicationClient(client_id=config.sh_client_id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//VERSION=3 | |
// Calculate number of bands needed for all intervals | |
// Initialise dates and interval | |
// Beware: in JS months are 0 indexed | |
var start_date = new Date(2019, 3, 1, 0, 0, 0); | |
var end_date = new Date(2019, 9, 31, 0, 0, 0); | |
var sampled_dates = sample_timestamps(start_date, end_date, 15, 'day').map(d => withoutTime(d)); | |
var nb_bands = sampled_dates.length; | |
var n_valid = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
order = { | |
"processRequest": { | |
"input": { | |
"bounds": { | |
"geometry": { | |
"type": "Polygon", | |
"coordinates": AOI_bounds | |
}, | |
"properties": { | |
"crs": "http://www.opengis.net/def/crs/EPSG/0/32632" |
NewerOlder