Configuration¶
The config module provides the AgriboundConfig dataclass for controlling every aspect of the delineation pipeline.
config ¶
Configuration management for Agribound.
Provides the AgriboundConfig dataclass for controlling every aspect of the
delineation pipeline — satellite source, delineation engine, GEE export
settings, post-processing parameters, and optional fine-tuning.
Configurations can be created programmatically, loaded from YAML files, or passed via CLI flags.
AgriboundConfig
dataclass
¶
Configuration for an Agribound delineation run.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
str
|
Satellite source. One of |
'sentinel2'
|
engine
|
str
|
Delineation engine. One of |
'delineate-anything'
|
year
|
int
|
Target year for the annual composite. |
2024
|
study_area
|
str
|
Path to a GeoJSON / Shapefile / GeoParquet or a GEE vector asset
ID (e.g. |
''
|
output_path
|
str
|
Destination file for the output field boundary vectors. |
'fields.gpkg'
|
output_format
|
str
|
Output vector format: |
'gpkg'
|
gee_project
|
str or None
|
Google Earth Engine project ID. Required when source is a GEE-based satellite. |
None
|
export_method
|
str
|
GEE export method: |
'local'
|
gcs_bucket
|
str or None
|
Google Cloud Storage bucket name. Required when export_method is
|
None
|
composite_method
|
str
|
Compositing strategy: |
'median'
|
date_range
|
tuple[str, str] or None
|
Override the default full-year date range with an explicit
|
None
|
cloud_cover_max
|
int
|
Maximum cloud cover percentage for scene filtering (default 20). |
20
|
local_tif_path
|
str or None
|
Path to a local GeoTIFF when source is |
None
|
bands
|
dict or None
|
Band mapping override, e.g. |
None
|
min_field_area_m2
|
float
|
Minimum field polygon area in m** (default 2500). |
2500.0
|
simplify_tolerance
|
float
|
Ramer-Douglas-Peucker simplification tolerance in pixels (default 2.0). |
2.0
|
device
|
str
|
Compute device: |
'auto'
|
tile_size
|
int
|
Max tile dimension (pixels) for auto-chunking large composites (default 10 000). |
10000
|
n_workers
|
int
|
Number of parallel workers for dask tiling / download (default 4). |
4
|
reference_boundaries
|
str or None
|
Path to existing field boundaries ( |
None
|
fine_tune
|
bool
|
When True and reference_boundaries is provided, fine-tune the engine on the reference data before inference. |
False
|
fine_tune_epochs
|
int
|
Number of epochs for fine-tuning (default 20). |
20
|
fine_tune_val_split
|
float
|
Fraction of reference data reserved for validation (default 0.2). |
0.2
|
engine_params
|
dict
|
Arbitrary keyword arguments forwarded to the selected engine. |
dict()
|
Source code in agribound/config.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 | |
to_dict ¶
to_yaml ¶
Write configuration to a YAML file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or Path
|
Destination file path. |
required |
Source code in agribound/config.py
from_yaml
classmethod
¶
Load configuration from a YAML file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or Path
|
Path to the YAML configuration file. |
required |
Returns:
| Type | Description |
|---|---|
AgriboundConfig
|
Loaded configuration instance. |
Source code in agribound/config.py
from_dict
classmethod
¶
Create configuration from a dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict
|
Configuration dictionary. |
required |
Returns:
| Type | Description |
|---|---|
AgriboundConfig
|
Configuration instance. |
Source code in agribound/config.py
resolve_device ¶
Resolve "auto" to an actual device string.
Returns:
| Type | Description |
|---|---|
str
|
One of |
Source code in agribound/config.py
is_gee_source ¶
is_embedding_source ¶
get_output_extension ¶
Return the file extension for the configured output format.
get_working_dir ¶
Return a working directory for intermediate files.
Creates a .agribound_cache directory next to the output path.