CropSuite Main Interface¶
Main controller for the CropSuiteLite crop suitability modeling framework.
This class handles configuration loading, data downscaling, tiling strategy, and the execution of climate and crop suitability models.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config_file
|
str
|
Path to the configuration file (.ini or .yaml). |
required |
Attributes:
| Name | Type | Description |
|---|---|---|
config_file |
Path
|
Path object to the configuration file. |
climate_config |
dict
|
Dictionary containing parsed configuration parameters. |
extent |
list
|
The spatial extent [min_y, min_x, max_y, max_x]. |
area_name |
str
|
Formatted string identifier for the geographic area. |
output_path |
Path
|
Base path for output files. |
day_interval |
int
|
Time step interval for processing. |
compute_climate_suitability(extent, prec_files, temp_files, prec_dailyfiles, temp_dailyfiles)
¶
Calculates climate suitability based on temperature and precipitation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
extent
|
list of float
|
The specific tile extent [y_max, x_min, y_min, x_max]. |
required |
prec_files
|
list of str
|
Paths to precipitation files. |
required |
temp_files
|
list of str
|
Paths to temperature files. |
required |
prec_dailyfiles
|
bool or list
|
Daily file indicators or paths. |
required |
temp_dailyfiles
|
bool or list
|
Daily file indicators or paths. |
required |
compute_crop_suitability(extent)
¶
Combines climate suitability with soil/terrain data to calculate final crop suitability.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
extent
|
list of float
|
The specific tile extent. |
required |
merge_geodata_outputs(extents)
¶
Merges tiled outputs into a single raster for the entire region.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
extents
|
list of list of float
|
List of tile extents used during processing. |
required |
plant_data()
¶
Loads crop parameterization files and interpolation formulas.
resampling_env_data()
¶
Interpolates or retrieves downscaled climate data (precipitation and temperature).
Returns:
| Type | Description |
|---|---|
tuple
|
A tuple containing: - List of precipitation file paths. - List of temperature file paths. - List of daily precipitation files (or boolean). - List of daily temperature files (or boolean). |
run()
¶
Executes the full CropSuiteLite pipeline.
Steps: 1. Downscale climate data. 2. Split area into tiles based on RAM. 3. Iterate through tiles to compute Climate and Crop suitability. 4. Merge tiles. 5. Clean up temporary files.
split_into_tiles()
¶
Calculates grid tiling based on available RAM to prevent memory overflow.
Returns:
| Type | Description |
|---|---|
list of list of float
|
A list of extents, where each extent is [min_y, min_x, max_y, max_x]. |