# Internal configuration parameters - relevant only to sits developers
# default raster package
raster_api_package: "terra"
request_api_package: "httr2"

# sample size
summary_sample_size: 10000

# estimated relative growth size of R memory relative to block size
processing_bloat        : 4
processing_bloat_cpu    : 4
processing_bloat_seg    : 2
processing_bloat_seg_class : 10

# number of items returned by stac service
rstac_pagination_limit  : 100

# configuration for generate tokens for mpc cubes
cube_token_generator_n_tries: 3
cube_token_generator_sleep_time: 10
cube_token_generator_min_remaining_time: 5

# mandatory columns in data cube description
sits_cube_cols :    ["source", "collection", "satellite", "sensor",
"tile", "xmin", "xmax", "ymin", "ymax", "crs", "file_info"]

# mandatory columns in tibble description
sits_tibble_cols :  ["longitude", "latitude", "start_date",
"end_date", "label", "cube", "time_series"]

# mandatory columns in predicted time series classification
ts_predicted_cols:  ["from", "to", "class"]

# mandatory columns in CSV input files
df_sample_columns : ["longitude", "latitude", "start_date", "end_date", "label"]

# supported shp types
sf_geom_types_supported : ["POINT", "POLYGON", "MULTIPOLYGON"]

# local cube config options
local_file_extensions   : ["tiff", "tif", "jp2", "hdf", "vrt", "gpkg"]
local_parse_info_col    : ["tile", "band", "date"]
local_parse_info_def    : ["X1", "X2", "tile", "band", "date"]

# parsing info contents for results cube
results_parse_info_def : ["X1", "X2", "tile", "start_date", "end_date",
"band", "version"]
results_parse_info_col : ["tile", "start_date", "end_date", "band"]


# bands resulting from classification and post-classification
sits_results_bands : ["probs", "bayes", "uncert", "entropy",
                      "class", "least", "margin", "variance",
                      "segments"]

sits_results_vector_bands : ["probs-vector", "entropy",
                      "class-vector", "least", "margin", "variance"]

# bands resulting from classification and smoothing
sits_probs_bands : ["probs", "bayes"]
# bands resulting from uncertainty
sits_uncert_bands : ["uncert", "entropy", "least", "margin"]

# bands resulting from classification and post-classification
sits_results_s3_class:
                    probs: "probs_cube"
                    probs-vector: "probs_vector_cube"
                    bayes: "probs_cube"
                    uncert: "uncertainty_cube"
                    margin: "uncertainty_cube"
                    least: "uncertainty_cube"
                    entropy: "uncertainty_cube"
                    variance: "variance_cube"
                    class:  "class_cube"
                    class-vector:  "class_vector_cube"

grid_systems:
    MGRS:
        path: "extdata/grids/s2_tiles.rds"
        xres: 10
        yres: 10
        nrows: 10980
        ncols: 10980
    BDC_LG_V2:
        path: "extdata/grids/bdc_tiles_lg_v2.rds"
        xres: 64
        yres: 64
        nrows: 6600
        ncols: 6600
    BDC_MD_V2:
        path: "extdata/grids/bdc_tiles_md_v2.rds"
        xres: 30
        yres: 30
        nrows: 7040
        ncols: 7040
    BDC_SM_V2:
        path: "extdata/grids/bdc_tiles_sm_v2.rds"
        xres: 10
        yres: 10
        nrows: 10560
        ncols: 10560

# configuration for probability cubes
probs_cube_scale_factor : 0.0001

# configuration for texture cubes
texture_options:
    block_size: 512
    minimum_value: 0
    maximum_value: 1000

# Default values for non-registered bands
default_values       :
    INT2S            : &conf_default_int2s
        data_type    : "INT2S"
        missing_value: -32768
        minimum_value: -10000
        maximum_value: 10000
        offset_value : 0
        scale_factor : 0.0001

    INT4S            : &conf_default_int4s
        data_type    : "INT4S"
        missing_value: -2147483647
        minimum_value: -2147483647
        maximum_value:  2147483647
        offset_value : 0
        scale_factor : 0.0001

    FLT4S            :
        data_type    : "FLT4S"
        missing_value: -3.402823466385288e+37
        minimum_value: -3.402823466385288e+37
        maximum_value: 1.7014118346015974e+37
        offset_value : 0
        scale_factor : 1
    FLT8S            :
        data_type    : "FLT8S"
        missing_value: -3.402823466385288e+37
        minimum_value: -3.402823466385288e+37
        maximum_value: 1.7014118346015974e+37
        offset_value : 0
        scale_factor : 1

# Derived cube definitions
derived_cube         :
    probs_cube       :
        s3_class     : [ "probs_cube", "derived_cube", "raster_cube" ]
        bands        :
            probs    : &int2u_0_10000
                data_type    : "INT2U"
                missing_value: 65535
                minimum_value: 1
                maximum_value: 10000
                offset_value : 0
                scale_factor : 0.0001
            bayes    :
                <<: *int2u_0_10000
    variance_cube       :
        s3_class     : [ "variance_cube", "derived_cube", "raster_cube" ]
        bands        :
            variance :
                data_type    : "INT2U"
                missing_value: 65535
                minimum_value: 1
                maximum_value: 10000
                offset_value : 0
                scale_factor : 0.01
    uncertainty_cube :
        s3_class     : [ "uncertainty_cube", "derived_cube", "raster_cube" ]
        bands        :
            least    :
                <<: *int2u_0_10000
            entropy  :
                <<: *int2u_0_10000
            margin   :
                <<: *int2u_0_10000
    class_cube       :
        s3_class     : [ "class_cube", "derived_cube", "raster_cube" ]
        bands        :
            class    :
                data_type    : "INT1U"
                missing_value: 255
                minimum_value: 0
                maximum_value: 254
                offset_value : 0
                scale_factor : 1
    radd_cube        :
        s3_class     : [ "radd_cube", "derived_cube", "raster_cube" ]
        bands        :
            radd     :
                data_type    : "INT4U"
                missing_value: 0
                minimum_value: 1
                maximum_value: 4999365
                offset_value : 0
                scale_factor : 1

    detections_cube    :
        s3_class       : [ "detections_cube", "derived_cube", "raster_cube" ]
        bands          :
            detection  :
                data_type    : "INT1U"
                missing_value: 255
                minimum_value: 0
                maximum_value: 254
                offset_value : 0
                scale_factor : 1

# Vector cube definitions
vector_cube          :
    segs_cube        :
        s3_class     : ["segs_cube", "vector_cube"]
        bands        :
            segments :
    probs_vector_cube:
        s3_class     : ["probs_vector_cube", "derived_vector_cube",
                        "segs_cube", "vector_cube"]
        bands        :
            probs-vector:
    class_vector_cube:
        s3_class     : ["class_vector_cube", "derived_vector_cube",
                        "segs_cube", "vector_cube"]
        bands        :
            class-vector:
    uncertainty_vector_cube:
        s3_class     : ["uncertainty_vector_cube", "derived_vector_cube",
                        "segs_cube", "vector_cube"]
        bands        :
            entropy  :
            least    :
            margin   :

# GDAL GTiff presets
gdal_presets         :
    options          :
        GDAL_CACHEMAX: "4096"
    cog              :
        overviews    : [2, 4, 8, 16]
        method       : "NEAREST"
        of           : "COG"
        co           : ["COMPRESS=ZSTD", "PREDICTOR=2", "ZSTD_LEVEL=1",
                        "OVERVIEW_COUNT=9", "BLOCKSIZE=512", "BIGTIFF=YES"]
    gtiff            :
        of           : "GTiff"
        co           : ["COMPRESS=ZSTD", "PREDICTOR=2", "ZSTD_LEVEL=1",
                        "BIGTIFF=YES", "TILED=YES", "BLOCKXSIZE=512",
                        "BLOCKYSIZE=512"]
    image            :
        of           : "GTiff"
        co           : ["COMPRESS=LZW", "PREDICTOR=2", "BIGTIFF=YES",
                        "TILED=YES", "BLOCKXSIZE=512", "BLOCKYSIZE=512"]

# GDAL GTiff default creation options
gdal_creation_options: [ "COMPRESS=LZW", "PREDICTOR=2",
                         "BIGTIFF=YES", "TILED=YES",
                         "BLOCKXSIZE=512", "BLOCKYSIZE=512" ]

# GDAL performance tuning options for reading and downloading images
gdal_read_options:
    GDAL_HTTP_MERGE_CONSECUTIVE_RANGES: "YES"
    GDAL_DISABLE_READDIR_ON_OPEN: "EMPTY_DIR"
    GDAL_INGESTED_BYTES_AT_OPEN: 32000
    GDAL_CACHEMAX: 200
    CPL_VSIL_CURL_CACHE_SIZE: 200000000
    VSI_CACHE: TRUE
    VSI_CACHE_SIZE: 5000000
    GDAL_HTTP_MULTIPLEX: "YES"
    #GDAL_NUM_THREADS: "ALL_CPUS"

gdalcubes_options: ["COMPRESS=LZW", "PREDICTOR=2",
                     "BIGTIFF=YES", "BLOCKXSIZE=512",
                     "BLOCKYSIZE=512"]

# GDAL netrc file
gdal_netrc_file_path: "~/.netrc"
gdal_netrc_file_path_win: "%HOME%\\_netrc"

# gdalcubes parameters
gdalcubes_chunk_size: [1, 2048, 2048]
gdalcubes_type_format: "int16"
gdalcubes_cog_generate: true
gdalcubes_cog_resample_overview: "bilinear"

# dendrogram parameters
dendro_dist_method: ["dtw", "dtw2", "dtw_basic", "lbk", "lbi"]
dendro_linkage: ["ward.D", "ward.D2", "single", "complete",
                 "average", "mcquitty", "median", "centroid"]

# possible som evaluations
som_outcomes: ["clean", "analyze", "remove"]

# metadata search strategy
metadata_search_strategies: ["tile", "feature"]

# SNIC grid parameters
snic_grids: ["rectangular", "diamond", "hexagonal", "random", "count"]


# Colours and plots
#
# color table mandatory collumns
color_table_cols: ["name", "color"]

# tmap configurations
tmap_continuous_style: ["cont", "order", "log10"]

# Download options
#
download_sleep_time: 10
