eodie package
Submodules
This document describes the different modules available in EODIE.
eodie.extractor module
Class to extract pixel values or statistics per polygon from rasterfile.
Authors: Samantha Wittke, Juuso Varho
- class eodie.extractor.Extractor(maskedarray, geodataframe, idname, affine, statistics, orbit=0, band=1, exclude_border=False)
Bases:
object
Extracting object based information from an array with affine information and a geodataframe.
- __init__(maskedarray, geodataframe, idname, affine, statistics, orbit=0, band=1, exclude_border=False)
Initialize the Extractor object.
- Parameters
maskedarray (array) – the array to extract information from
geodataframe (GeoDataframe) – geodataframe containing the (polygon) features to extract zonal statistics from
idname (str) – Fieldname of unique ID field of the geodataframe (will be used as polygon identifier for storing statistics)
affine (Affine object) – containing affine/transform information of the array
statistics (list of str, optional, default: empty list) – list of statistics to be extracted for each polygon
orbit (None) – orbit information of input raster data (Sentinel-2)
band (integer, default = 1) – which band from a multiband geotif should be handled
exclude_border (boolean, optional, default: False) – indicator if border pixels should be in- (False) or excluded (True)
- extract_array()
Extract per polygon arrays from rasterfile with affine information.
- extract_format(format)
Run own class method based on format given.
- Parameters
format (str) – format to be calculated
- Returns
- Return type
nothing itself, but runs given format function which returns a dictionary for the given format
- extract_geotiff()
Extract per polygon geotiffs.
- extract_statistics()
Extract per polygon statistics from rasterfile with affine information.
eodie.index module
Class to calculate indices. Returns an indexarray based on index input.
Authors: Petteri Lehti, Samantha Wittke
- class eodie.index.Index(inpath='.', resampling_method=None, cfg='test_config.yml', test=False)
Bases:
RasterData
Calculate vegetation indices from remote sensing raster products.
- __init__(inpath='.', resampling_method=None, cfg='test_config.yml', test=False)
Initialize the index object.
- Parameters
inpath (str) – Location and name of the raster bands of the product
cfg (dict) – dictionary with configuration elements
test (boolean) – If testing is performed
- calculate_cvi()
Calculate Chlorophyll Vegetation Index (Vincini, Frazzi & D’Elassio (2008) - https://doi.org/10.1007/s11119-008-9075-z)).
- calculate_dvi()
Calculate Difference Vegetation Index (Tucker (1979)).
- calculate_evi()
Calculate Enhanced Vegetation Index (Liu & Huete (1995) - https://doi.org/10.1109/TGRS.1995.8746027) with L =1, C1 = 6, C2 = 7.5 and G= 2.5.
- calculate_evi2()
Calculate Enhanced Vegetation Index 2 (Jiang et al. (2008) - https://doi.org/10.1016%2Fj.rse.2008.06.006) with L=1, C = 2.4, G=2.5.
- calculate_index(index)
Run own class method based on index given.
- Parameters
index (str) – vegetation index to be calculated
- Returns
- Return type
nothing itself, but runs given index function which returns a numpy array of the calculated index
- calculate_kndvi()
Calculate Kernel NDVI (Camps-Valls et al. (2021) - https://doi.org/10.1126/sciadv.abc7447) from red and nir bands with sigma pixelwise calculation.
- calculate_mcari()
Calculate Modified Chrolophyll Absorption in Reflectance Index (Daughtry et al. (2000) - https://doi.org/10.1016/S0034-4257(00)00113-9) only usable with platforms with bands in the red edge area (eg. Sentinel-2).
- calculate_mndwi()
Calculate Modified Normalized Difference Water Index (Xu (2006) - https://doi.org/10.1080/01431160600589179).
- calculate_nbr()
Calculate Normalized Burnt Ratio (Key & Benson (1999)) from nir and swir2 bands.
- calculate_ndi45()
Calculate Normalized Difference Index 45 (Delegido et al. (2011) - https://doi.org/10.1007/s11119-008-9075-z) only usable with platforms with bands in the red edge area (eg. Sentinel-2).
- calculate_ndmi()
Calculate Normalized Moisture Index (NDMI) as it is used by Wilson (2002) https://doi.org/10.1016/S0034-4257(01)00318-2 similar to the Gao (1996 - https://doi.org/10.1016/S0034-4257(96)00067-3) NDWI, but NOT McFeeters NDWI (1996) https://en.wikipedia.org/wiki/Normalized_difference_water_index.
- calculate_ndvi()
Calculate Normalized Difference Vegetation Index (NDVI) from red and nir bands (Kriegler FJ, Malila WA, Nalepka RF, Richardson W (1969) Preprocessing transformations and their effect on multispectral recognition. Remote Sens Environ VI:97–132.
- calculate_ndwi()
Calculate Normalized Difference Water Index (McFeeters (1996) - https://doi.org/10.1080/01431169608948714.
- calculate_rvi()
Calculate Ratio Vegetation Index (Jordan 1969 - https://doi.org/10.2307/1936256) from red and nir bands.
- calculate_savi()
Calculate Soil Adjusted Vegetation Index (Huete (1988) - https://doi.org/10.1016/0034-4257(88)90106-X) from red and nir bands with factors 1.5 and 0.5.
- calculate_tct(coeffs)
Calculate general Tasseled Cap Index with Sentinel-2 coefficients (Shi & Xu (2019) - https://doi.org/10.1109/JSTARS.2019.2938388).
- Parameters
coeffs (list of float) – coefficients to calculate spcific tasseled cap
- Returns
tctarray – calculated tasseled cap array from coefficients
- Return type
numpy array of float
- calculate_tctb()
Calculate Tasseled Cap Brightness coefficients only valid for Sentinel-2.
- calculate_tctg()
Calculate Tasseled Cap Greenness coefficients only valid for Sentinel-2.
- calculate_tctw()
Calculate Tasseled Cap Wetness coefficients only valid for Sentinel-2.
- mask_array(array, maskarray)
Create a masked array from an array and a mask with fill value -99999 for masked out values ; e.g. masking out cloudpixels from indexarray.
- Parameters
array (float numpy array) – array to be masked
maskarray (boolean/int numpy array) – array to be used as mask
- Returns
masked – masked numpy array with nan where mask was ‘True’/1
- Return type
float masked numpy array
- norm_diff(a: ndarray, b: ndarray) ndarray
Calculate normalized difference.
- Parameters
a (float numpy array) – array to be used as a in formula (a-b)/(a+b)
b (float numpy array) – array to be used as b in formula (a-b)/(a+b)
- Returns
normdiff – normalized difference between a and b
- Return type
float numpy array
- supportedindices = ['ndvi', 'rvi', 'savi', 'nbr', 'kndvi', 'ndmi', 'mndwi', 'evi', 'evi2', 'dvi', 'cvi', 'mcari', 'ndi45', 'tctb', 'tctg', 'tctw', 'ndwi']
eodie.mask module
Class to create and adapt cloudmask array.
Authors: Samantha Wittke, Petteri Lehti
- class eodie.mask.Mask(inpath: str, resampling_method: str, cfg: dict = 'test_config.yml', test=False, external=None)
Bases:
RasterData
Retrieve and transform a cloudmask from Remote Sensing product or external source.
- cloudmask
external cloudmask array
- Type
boolean/int numpy array
- cfg
dictionary with configuration elements
- Type
dict
- __init__(inpath: str, resampling_method: str, cfg: dict = 'test_config.yml', test=False, external=None)
Initialize the mask object.
- Parameters
inpath (str) – Location and name of the raster bands of the product
cfg (dict) – dictionary with configuration elements
test (boolean) – If testing is performed
external (str , optional) – location and name of the external cloudmask to be used
- binarize_cloudmask(sclarray)
Take in an array with different cloud classes and binarizes it according to config file to True being the to be masked pixels (eg clouds) and False for pixels that are ok to use.
- Parameters
sclarray (numpy array) – array of cloudmask from remote sensing product
- Returns
mask – binarized cloudmask using to be masked values or bits from config
- Return type
boolean numpy array
- checkbits(data, tobemaskedlist)
Check bits if they should be masked.
- Parameters
data (numpy array or int) – data point
tobemaskedlist (list) – bits that should be masked
- Returns
- Return type
boolean (1 for masked, 0 for not masked)
- create_cloudmask()
Create a mask from a file with mask information (eg about cloudy pixels), binarizes it, and resamples it to 10m pixel size.
- Returns
cloudmask – array with invalid pixels marked as True/1 and correct ‘pixelsize’
- Return type
boolean numpy array
- createbitmask(maskarr, tobemasked)
Create a bitmask.
- Parameters
maskarr (numpy array) – array of cloudmask from remote sensing product
tobemasked (list) – list of bits to be masked
- Returns
- Return type
binary mask with clouds/invalid pixels true/1, others 0
- load_binary_mask(external)
Load an external mask that needs to be a rasterfile with one/True is cloud, 0/False no cloud, with pixelsize as given in cfg and overlap exactly with the file to be masked.
- Parameters
external (str) – location and name of external cloudmask to be read
- Returns
array of the cloudmask
- Return type
int numpy array
eodie.pathfinder module
Class to find paths dependent on config/platform.
Authors: Samantha Wittke
- class eodie.pathfinder.Pathfinder(rasterdir: str, cfg: dict)
Bases:
object
Class dealing with paths.
- cfg
dictionary with configuration elements
- Type
dict
- rasterdir
location and name of a raster product
- Type
str
- imgpath
location and name of the bands within the raster product
- Type
str
- tile
tile information (if available) of the raster product
- Type
str
- date
date information of the raster product
- Type
str
- __init__(rasterdir: str, cfg: dict)
Initialize Pathfinder object.
- Parameters
rasterdir (str) – location and name of a raster product
cfg (dict) – dictionary with configuration elements
- get_dateinfo()
Extract date from filename according to pattern from config.
- get_imgpath()
Create the path to the raster data band files based on path given in bandlocation.
- get_orbit()
- get_safedir()
Extract Sentinel-2 .SAFE structure from full path
- get_tileinfo()
Extract tilename from filename according to pattern from config.
eodie.rasterdata module
Class for everyhing around the rasterdata.
authors: Samantha Wittke
- class eodie.rasterdata.RasterData(inpath, resampling_method, cfg='test_config.yml', test=False)
Bases:
object
Raster data related information and transformations.
- cfg
dictionary with configuration elements
- Type
dict
- imgpath
location and name of the bands within the raster product
- Type
str
- resamplingdict
mapping resampling methods from configuration file to functions of rasterio
- Type
dict of str and object
- test
If testing is performed
- Type
boolean
- crs
coordinate reference system of the raster product
- Type
str
- epsg
EPSG code of the CRS of the raster product
- Type
str
- affine
affine transformation of the raster product
- Type
object
- __init__(inpath, resampling_method, cfg='test_config.yml', test=False)
Initialize the raster object.
- Parameters
inpath (str) – Location and name of the raster bands of the product
cfg (dict) – dictionary with configuration elements
test (boolean) – If testing is performed
- clip_to_valid_range(array)
Clips the values to valid range ([0,1] in case of Sentinel-2), other values are NoData.
- Parameters
array (array) – array to be clipped
- Returns
array – result of clipping
- Return type
array
- dn_to_reflectance(array)
Transform the digital number used when storing raster data to reflectance.
- Parameters
array (numpy array) – array as read from bandfile of the rasterproduct
- Returns
reflectance – array with values representing the reflectance
- Return type
numpy array
- get_array(band, resampling_method=None)
Retrieve an array based on band request.
- Parameters
band (str) – band name in human readable format (eg ‘red’, ‘nir’ etc)
resampling_method (str, optional) – which resampling method should be used if resampling is necessary
- Returns
array that has been resampled and transformed as needed based on inputs
- Return type
array
- get_bandfile(bandname)
Get bandfile given a band name.
- Parameters
bandname (str) – banddesignation of the band
- Returns
path (str) – location and name of the band with bandname within the rasterproduct
resolution (str) – pixelsize of the band file found
- get_metadata()
Get affine from red band file as representation for all.
- read_array(bandfile, dtype='f4')
Get array in given datatype according to bandname.
- Parameters
bandfile (str) – location and name of the band with bandname within the rasterproduct
dtype (numpy datatype, default f4) – datatype of the output array to be read from bandfile
- Returns
array – bandfile as numpy array with dtype
- Return type
numpy array
- resample(bandfile, scaling_factor, resampling_method, dtype='f4')
Read the information of a band from raster product and resampling it to fit requirements (inputs).
- Parameters
bandfile (str) – location and name of the band with bandname within the rasterproduct
scaling_factor (float) – scaling factor for the resampling operation
resampling_method (str) – which resampling method should be used
dtype (numpy datatype, default: f4) – datatype of the output array to be read from bandfile
- Returns
data – array with the data trnsformed according to inputs
- Return type
numpy array
eodie.rastervalidator_s2 module
Class to check that cloudcover is below the maximum given by user and to check that area of interest is not within nodata zone - only Sentinel-2.
Authors: Samantha Wittke
- class eodie.rastervalidator_s2.RasterValidatorS2(SAFEpath, maxcloudcover)
Bases:
object
Check validity for processing of Sentinel-2 raster product.
- SAFEpath
location and name of a raster product
- Type
str
- maxcloudcover
maximum cloudcover allowed for processing
- Type
int
- geometryobject
object containing the vector data to be processed
- Type
object
- not_cloudcovered
if rasterproduct is below maximum cloudcover
- Type
boolean
- datacovered
if area of interest (given with geometryobject) is datacovered (not all nan)
- Type
boolean
- __init__(SAFEpath, maxcloudcover)
Initialize raster validator object.
- Parameters
SAFEpath (str) – location and name of a raster product
maxcloudcover (int) – maximum cloudcover allowed for processing
- check_cloudcover()
Check that according to metadata the cloudcover is below user given threshold.
- check_datacover(convex_hull)
Check hat there is data within the convexhull of the given shapefile.
- Parameters
geometryobject (VectorData) – Polygons of areas of interest
- Returns
whether there is raster data on the area(s) of interest
- Return type
boolean
- check_integrity()
Check the integrity of the SAFE directory. Images for all bands and metadata XML file should be found.
- Returns
Integrity – integrity of the file, true if all necessary files can be found
- Return type
boolean
- get_bandpath()
Get a representative band location and name (red band).
- get_cloudcover_percentage(doc)
Retrieve the cloudcover information from opened XML file.
- Parameters
doc – accessible version of the xml file
- Returns
cc_perc – Cloudcover percentage for whole raster product tile
- Return type
float
- get_xml()
Build the location and name of the xml file containing metadata for Sentinel-2.
- read_xml(xmlpath)
Parse the XML file into doc to be read.
- Parameters
xmlpath (str) – location and name of the metadata xmlfile
- Returns
accessible version of the xml file
- Return type
doc
eodie.test_all module
class for testing functionality of many methods used in EODIE
automatically run by gitlab on push
can also be run with `pytest test_all.py`
authors: Samantha Wittke
eodie.userinput module
Class with all userinput for running eodie as command line tool.
Authors: Samantha Wittke, Juuso Varho, Petteri Lehti
- class eodie.userinput.UserInput
Bases:
object
Userinput object for EODIE.
- see help text for description of each attribute
- __init__()
Initialize UserInput object.
- create_logfile(output_directory, verbose)
- get_userinput()
Get all userinput from commandline call to run the tool and stores them as userinput attributes.
eodie.validator module
Class to validate user inputs.
Authors: Samantha Wittke
- class eodie.validator.Validator(args)
Bases:
object
Validate userinputs for EODIE call.
- __init__(args)
Initialize validator object.
- Parameters
args (object) – arguments of the userinput
- check_indexlist(platform, indexlist)
Check that list of indices was given if platform is not tif.
- Parameters
platform (str) – platform given by user
indexlist (list) – List of indices to calculate
- check_tiling_grid(platform)
Check if tiling grid for given platform exists.
- Parameters
platform (str) – platform given by user
- csv_check(vectorpath, epsg)
Check that the EPSG has been determined for input CSV, exits if not true :param extension: the file extension of the object :param epsg: EPSG code provided by user
- Returns
csv_ok – if extension is .csv and epsg is not None
- Return type
boolean
- date_check(date)
Check that given date is a valid date (typocheck) and a date before today.
- Parameters
date (str) – date used to define daterange given by user
- Returns
date_ok – if date given is ok to use, exits if not
- Return type
boolean
- gpkg_check(vectorpath, layername)
Check if there are more than one layer in .gpkg input and the layer to be used has been named :param extension: the file extension of the object :param basename: filename of the input without extension :param layername: name of layer in geopackage to be used
- Returns
gpkg_ok – if extension is gpkg with only one layer or if the layer to be used has been determined
- Return type
boolean
- index_check(cfg, indexlist)
Check that all given indices and bands are valid strings, exits if any are not.
- Parameters
cfg – the configuration dictionary used here to get the bad designation for the current platform
indexlist – list of indices given by the user
- Returns
indices_ok – if all indices and bands given by the user are available
- Return type
boolean
- input_amount_check(dir, file)
Check that either directory of filename is given as input.
- Parameters
dir (str or None) – directory with files to be processed or None (not given)
file (str or None) – file to be processed or None (not given)
- input_exists_check(dir, file)
Check that file or directory that are given exist (typo check).
- Parameters
dir (str or None) – directory with files to be processed or None (not given)
file (str or None) – file to be processed or None (not given)
- list_inputs(userinput)
List all inputs into log file.
- Parameters
userinput (class UserInput()) – Userinputs
- vector_exists(vectorfile)
Check that given vectorfile exists.
- Parameters
vectorfile – path to user-given vectorfile
eodie.vectordata module
Class to handle everything regarding the vectordata, atm only ESRI shapefile.
Authors: Samantha Wittke
- class eodie.vectordata.VectorData(geometries, drop=False, epsg_for_csv=None)
Bases:
object
Vector data related information and transformations.
- geometries
location and name of a vectorfile
- Type
str
- __init__(geometries, drop=False, epsg_for_csv=None)
Initialize vectordata object.
- Parameters
geometries (str) – location and name of a vectorfile
drop (boolean) – whether missing or invalid geometries should be excluded from further processing
- check_empty(vectorfile)
Check for empty geometries in vectorfile.
- Parameters
vectorfile (geodataframe the user-defined vectorfile) –
- Returns
- Return type
None; prints the rows with non-existent geometries.
- check_validity(gdf, drop)
Check the validity of each polygon in the vectorfile. Invalid geometries will be excluded from the calculations; saves a new shapefile without the invalid polygons, if any exist.
- Parameters
drop (boolean) – flag to indicate if invalid geometries should be dropped.
- Returns
valid_geom – geodataframe with only valid geometries - if all geometries are valid, returns original geodataframe
- Return type
GeoDataframe
- clip_vector(rasters, tileframe, idname, platform)
Clip vector based on data in input directory.
- Parameters
rasters (list) – list of input files
tileframe (GeoDataframe) – a geodataframe containing tile grid (for either Landsat8 or Sentinel-2)
- Returns
tiles (list) – Sentinel-2 or Landsat8 tiles that were found in input raster directory
Updates
——–
self.geometries (GeoDataframe) – replaces original geodataframe with the clipped one
- compare_geometries(manipulated_geodataframe, original_geodataframe, idname, align=False)
Compare geometries between geodataframes and exclude ones not matching (ie. that have been changed during clipping or intersection).
- Parameters
manipulated_geodataframe (GeoDataframe) – geodataframe that has been clipped/overlaid from the original geodataframe
original_geodataframe (GeoDataframe) – the geodataframe from which the manipulated_geodataframe was processed
idname (string) – Name of idenfifier field in geodataframes
- Returns
manipulated_geodataframe – manipulated_geodataframe from which the altered geometries have been removed
- Return type
GeoDataframe
- filter_geodataframe(vectorframe, tileframe, tile, idname, platform)
Filter features of geodataframe that can be found in the area of one Sentinel-2 tile.
- Parameters
vectorframe (GeoDataframe) – geodataframe containing the polygon features
tileframe (GeoDataframe) – geodataframe containing the Sentinel-2 tiles
tile (str) – Sentinel-2 tilecode
idname (str) – identifier of features in vectorframe
- Returns
overlay_result – geodataframe containing the features that are completely in area of given tile - features crossing the tile edges are excluded
- Return type
GeoDataframe
- gdf_from_bbox(bbox, crs, idname)
Build a Polygon from Raster boundingbox. Used with TIFs.
- Parameters
bbox (BoundingBox) – the bounding box of raster
crs (crs) – the crs of raster
idname (string) – the identifier field name in self.geometries
- get_convex_hull(geodataframe)
Extract convex hull of all features of geodataframe that are located in the area of input data.
- Parameters
geodataframe (GeoDataframe) – geodataframe for the features to extract convex hull from
- Returns
convexhull – GeoDataframe consisting of one feature, the convex hull
- Return type
GeoDataframe
- get_epsg()
Extract epsg code from geodataframe.
- Returns
vectorepsg – EPSG code of the vectorfile
- Return type
str
- read_geodataframe(geometries)
Read input vectorfile into a geopandas GeoDataframe.
- Parameters
geometries (str) – path to input vectorfile
- Returns
geodataframe – input vector read into a geodataframe
- Return type
GeoDataframe
- read_tiles(platform)
Read Sentinel-2 tiles into a Geodataframe.
- Returns
tileframe – geodataframe containing the Sentinel-2 tiles
- Return type
GeoDataframe
- reproject_geodataframe(geodataframe, crs)
Reproject GeoDataframe to another crs.
- Parameters
geodataframe (GeoDataframe) – geodataframe to reproject
crs (crs) – crs to reproject the geodataframe into
- Returns
reprojected – the original geodataframe reprojected to crs
- Return type
GeoDataframe
eodie.workflow module
Class to run the actual processing based on given data platform. Based on old eodie_process.py by Samantha Wittke et al.
Author: Arttu Kivimäki (FGI) - July 2022.
- class eodie.workflow.Workflow(userinput)
Bases:
object
Class responsible for EODIE processing workflow.
Attributes: inputs: Userinput object
all inputs given by user
- platform: str
platform given by user {s2, ls8, tif}
- __init__(userinput)
Initialize Workflow object.
- Parameters
userinput (Userinput object) – All processing inputs given by user.
- cloudmask_creation(pathfinderobject, config)
Create cloudmask from S2 SCL.
- Parameters
pathfinderobject (Pathfinder()) – class Pathfinder
config (dict) – configuration parameters
- Returns
pathfinderobject (class Pathfinder()) – class Pathfinder initialized with safedir
cloudmask (array) – Cloudmask array for safedir
- execute_delayed(input_list)
Execute given processes with dask.delayed.
- Parameters
input_list (list) – list of delayed functions to be executed
- Returns
results – outputs of executed functions
- Return type
tuple
- extract_from_tif(path, gdf, raster, band, pathfinderobject)
Extract zonal statistics from a GeoTIFF and write results accordingly.
- Parameters
path (str) – path to GeoTIFF
gdf (GeoDataFrame) – vector features to calculate zonal statistics from
raster (RasterData) – class based on the tif file
userinput (UserInput) – all userinputs given
band (str) – band number from multiband tifs
pathfinderobject (Pathfinder) – object containing tif paths
- Returns
- Return type
None but writes the results in given output formats.
- extract_index(vegindex, cloudmask, index, geodataframe, pathfinderobject)
Calculate given index, extract zonal statistics and write results.
- Parameters
vegindex (class Index()) – Class for calculating the indices or extracting arrays
cloudmask (array) – cloudmask created from S2 SCL
index (str) – index or band name to calculate zonal statistics from
geodataframe (GeoDataframe) – Polygon features to calculate zonal statistics from
pathfinderobject (class Pathfinder) – object containing information of S2 directory
- Returns
- Return type
None, but writes the results to given output directory in given output formats.
- launch_workflow(platform)
Launch workflow depending on given platform.
- validate_safedir(safedir, cloudcover, convex_hull)
Validate .SAFE directories with RasterValidatorS2.
- Parameters
safedir (str) – path to SAFE directory to validate
cloudcover (int) – maximum cloudcover percentage, imagery above this will be excluded
convex_hull (GeoDataframe) – combined convex hull of all vectorfile features
- Returns
safedir – if safedir is valid for further processing; else None
- Return type
str
- workflow_ls8()
- workflow_s2()
Run workflow for Sentinel-2 imagery.
- workflow_tif()
Run workflow for regular GeoTIFFs.
eodie.writer module
Class for writing results into file.
Authors: Samantha Wittke, Juuso Varho
- class eodie.writer.Writer(outdir, date, tile, index, platform, orbit, statistics=['count'], crs=None)
Bases:
object
Write lists/arrays/georeferenced arrays to file.
- outpath
location and basename of the file where results should be stored
- Type
str
- extractedarrays
extracted array and its information
- Type
dict with numpy arrays
- statistics
extracted statistics
- Type
list of str
- tile
tilename of the raster product where data was extracted from
- Type
str
- __init__(outdir, date, tile, index, platform, orbit, statistics=['count'], crs=None)
Initialize writer object.
- Parameters
outdir (str) – location where results should be stored
date (str) – date of the data to be stored
tile (str) – tilename of the data to be stored
extractedarrays (dict with numpy arrays) – extracted array and its information
index (str) – indexname of the data to be stored
platform (str) – platform of input raster data
orbit (None) – orbit information of input raster data (Sentinel-2)
statistics (list of str, default=['count']) – extracted statistics
crs (str) – coordinate reference system
- write_array(extractedarray)
Write extracted arrays to pickle.
- write_database(extractedarray)
Write statistics results from json into sqlite3 database.
- write_format(format, extractedarray)
Run own class method based on format given.
- Parameters
format (str) – what to write
- Returns
- Return type
nothing itself, but runs given format function which writes data to file
- write_geotiff(extractedarray)
Write extracted arrays to geotiff file.
- write_lookup(lookup, shapefile, idname)
Write a lookup table when extracting arrays.
- Parameters
lookup (string) – location and name of lookup table
shapefile (string) – location and name of shapefile
idname (string) – name of id in shapefile
- write_statistics(extractedarray)
Write statistics results from json into csv.