Skip to content

Instantly share code, notes, and snippets.

[
{
"description": "Area of interest",
"id": "aoi",
"name": "Area of interest",
"optional": false,
"type": "bbox"
},
{
"description": "Spatial Resolution. The following values are allowed: 10m, 20m and 60m",
# here you can place default parameters which will be overwritten by the
# actual parameters in a new cell below
spatial_res = 0.00001
aoi = "POLYGON((11.580840855935284 42.450395132068884,13.009063512185284 42.450395132068884,13.009063512185284 41.65093511375355,11.580840855935284 41.65093511375355,11.580840855935284 42.450395132068884))"
time_range= "2022-02-15/2022-03-14"
x = time_range.split("/")
# calculate the area based on input parameters
import shapely.wkt
# Define NDVI in visualisation
ndvi = ((ndvi_cube.B08-ndvi_cube.B04)/(ndvi_cube.B08+ndvi_cube.B04))
ndvi.attrs['long_name']='NDVI'
ndvi.attrs['units']='unitless'
ndvi_cube['NDVI']= ndvi
ndvi_sum = ndvi_cube.NDVI.sum(dim="time")
ndvi_count = ndvi_cube.NDVI.count(dim="time")
from datetime import date, timedelta
from xcube_sh.config import CubeConfig
from xcube_sh.cube import open_cube
import xcube.core.maskset as maskset
import xarray as xr
# time range conversion
x = time_range.split("/")
output_dir = Path("/home/jovyan/BYOA_example/byoa-sample-algorithm/output")
# here you can place default parameters which will be overwritten by the
# actual parameters in a new cell below
spatial_res = 0.00072
aoi = "POLYGON ((11.519165 41.786673, 11.519165 42.259016, 12.420044 42.259016, 12.420044 41.786673, 11.519165 41.786673))"
time_range= "2022-02-15/2022-03-14"
# here you can place default parameters which will be overwritten by the
# actual parameters in a new cell below
spatial_res = 0.00018
aoi = "POLYGON ((11.519165 41.786673, 11.519165 42.259016, 12.420044 42.259016, 12.420044 41.786673, 11.519165 41.786673))"
//VERSION=3
// Script to extract a time series of NDVI values using
// Sentinel 2 Level 2A data and metadata file.
function setup() {
return {
input: [{
bands: ["B04", "B08"],
units: "DN"
}],
output: {
//VERSION=3
function setup() {
return{
input: [{
bands: ["B04", "B08"],
units: "DN"
}],
output: {
id: "default",
bands: 1,
//VERSION=3
function setup() {
return {
input: [{
bands: ["B01", "B02", "B03", "B04", "B05", "B06", "B07", "B08", "B8A", "B09", "B11", "B12"],
units: "DN"
}],
output: {
id: "default",
bands: 12,