Data access
CbM data can be accessed through RESTful API or directly accessing the database and object storage, direct access is only for administrators.
Preferable way to access the data is through RESTful API. To easily set the RESTful API account you can use the below python command:
cbm.set_api_account('http://0.0.0.0/', 'YOUR_USERNAME', 'YOUR_PASSWORD')
Alternatively see ‘cbm package configuration‘ for other options.
Parcel information
Download parcel information by ID.
import cbm
aoi = 'ms' # area of interest (str)
year = 2020 # the year of the parcels dataset (int)
pid = '12345' # parcel id (str)
ptype = None # (optional) specify the dataset*
with_geometry = True # get the parcel geometry
debug = False # show debugging output
cbm.get.parcel_info.by_pid(aoi, year, pid, ptype, with_geometry, debug)
Download parcel information by location.
import cbm
aoi = 'ms' # area of interest (str)
year = 2020 # the year of the parcels dataset (int)
lat = 50.12345 # latitude in decimal degrees
lon = 5.12345 # longitude in decimal degrees
ptype = None # (optional) specify the dataset*
with_geometry = True # get the parcel geometry
debug = False # show debugging output
cbm.get.parcel_info.by_location(aoi, year, pid, ptype, with_geometry, debug)
Time series
ptype is used only in case there are different datasets dedicated to different type of analysis for the same year. For example datasets dedicated to grazing use g, for mowing m etc.
scl Scene Classification Values
The classification mask is generated along with the process of generating the cloud mask quality indicator and by merging the information obtained from cirrus cloud detection and cloud shadow detection.
The classification map is produced for each SENTINEL-2 Level-1C product at 60 m resolution and byte values of the classification map are organised as shown below:

Show time series
Plot NDVI time series
import cbm
aoi = 'ms' # area of interest (str)
year = 2020 # the year of the parcels dataset (int)
pid = '12345' # parcel id (str)
ptype = None # (optional) specify the dataset*
cloud_free = True # mark cloud free images based on scl values
scl = '3_8_9_10_11' # scene classification values to be excluded
debug = False # show debugging output
cbm.show.time_series.ndvi(aoi, year, pid, ptype, cloud_free, scl, debug)

Plot S2 bands
import cbm
aoi = 'ms' # area of interest (str)
year = 2020 # the year of the parcels dataset (int)
pid = '12345' # parcel id (str)
ptype = None # (optional) specify the dataset*
bands = ['B03', 'B04'] # bands to plot in a list
cloud_free = True # mark cloud free images based on scl values
scl = '3_8_9_10_11' # scene classification values to be excluded
debug = False # show debugging output
cbm.show.time_series.s2(aoi, year, lat, lon, ptype, bands, cloud_free, scl, debug)
Download time series
Download the time series without plotting for a knowing parcel ID.
import cbm
aoi = 'ms' # area of interest (str)
year = 2020 # the year of the parcels dataset (int)
pid = '12345' # parcel id (str)
ptype = None # (optional) specify the dataset*
tstype = 's2' # time series type (str)
import cbm
cbm.get.time_series.by_pid(aoi, year, pid, tstype, ptype)
Download the time series without plotting based on the parcel location.
import cbm
aoi = 'ms' # area of interest (str)
year = 2020 # the year of the parcels dataset (int)
pid = '12345' # parcel id (str)
ptype = None # (optional) specify the dataset*
lat = 50.12345 # latitude in decimal degrees
lon = 5.12345 # longitude in decimal degrees
tstype = 's2' # time series type (str)
cbm.get.time_series.by_location(aoi, year, lat, lon, tstype, ptype)
The files will be saved by default in the temp/ms/year/parcel/...
folder.
Background images
Show background images
import cbm
aoi = 'ms' # area of interest (str)
year = 2020 # the year of the parcels dataset (int)
pid = '12345' # parcel id (str)
chipsize = 512 # size of the chip in pixels
extend = 512 # size of the chip in meters
tms = ['Google'] # tile map server, Google, Bing or MS orthophotos
ptype = None # (optional) specify the dataset*
columns = 4 # the number of grid columns
debug = False # show debugging output
cbm.show.background.by_pid(aoi, year, pid, ptype, chipsize, extend, tms, ptype, columns, debug)

Download background images
To download background images without plotting the images for a knowing parcel ID.
import cbm
aoi = 'ms' # area of interest (str)
year = 2020 # the year of the parcels dataset (int)
pid = '12345' # parcel id (str)
chipsize = 512 # size of the chip in pixels
extend = 512 # size of the chip in meters
tms = ['Google'] # tile map server, Google, Bing or MS orthophotos
ptype = None # (optional) specify the dataset*
axis = True # show axis
debug = False # show debugging output
cbm.get.background.by_pid(aoi, year, pid, ptype, chipsize, extend, tms, ptype, axis, debug)
To download background images without plotting the images based on the parcel location.
import cbm
aoi = 'ms' # area of interest (str)
year = 2020 # the year of the parcels dataset (int)
pid = '12345' # parcel id (str)
lat = 50.12345 # latitude in decimal degrees
lon = 5.12345 # longitude in decimal degrees
chipsize = 512 # size of the chip in pixels
extend = 512 # size of the chip in meters
tms = ['Google'] # tile map server, Google, Bing or MS orthophotos
ptype = None # (optional) specify the dataset*
axis = True # show axis
debug = False # show debugging output
cbm.get.background.by_location(aoi, year, lat, lon, tstype, axis, ptype)
The files will be saved by default in the temp/ms/year/parcel/...
folder.
Sentinel chips
Download chip images by selected parcel id.
Example
import cbm
cbm.get.chip_images.by_pid(
aoi='dk', # Area of interest (str)
year='2020', # Year of the parcels dataset (int)
pid='92794229', # Parcel id (int)
start_date='2020-06-01', # Start date '2019-06-01' (str)
end_date='2020-06-30', # End date '2019-06-01' (str)
band='SCL', # Selected band
chipsize=2560 # size of the chip in pixels (int)
)
Preview chip images by selected parcel id.
Example
import cbm
cbm.show.chip_images.by_pid(
aoi='dk', # Area of interest (str)
year='2020', # Year of the parcels dataset (int)
pid='92794229', # Parcel id (int)
start_date='2020-06-01', # Start date '2019-06-01' (str)
end_date='2020-06-30', # End date '2019-06-01' (str)
band='SCL', # Selected band
chipsize=2560 # size of the chip in pixels (int)
)
- Arguments
- band: 3 Sentinel-2 band names. One of [‘B02’, ‘B03’, ‘B04’, ‘B08’] (10 m bands) or
[‘B05’, ‘B06’, ‘B07’, ‘B8A’, ‘B11’, ‘B12’] (20 m bands). 10m and 20m bands can be combined.