Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is an example of the TOML file used to run the command line model #1

Open
dodge-ttu opened this issue Sep 17, 2024 · 3 comments
Open

Comments

@dodge-ttu
Copy link

Hello. Do you have an example of the TOML input file and formatting for the mdoel?

@tcztzy
Copy link
Owner

tcztzy commented Sep 17, 2024

Thanks for your question, I am currently not working on Crop Growth Simulation and have limited time to polish this repository. The input file's schema is describe in the following. Document is not ready because the input file schema changes in development.

cotton2k/src/profile.rs

Lines 83 to 132 in 046f1ad

pub struct Profile {
#[serde(skip)]
pub path: PathBuf,
#[serde(default = "original_light_intercept_method")]
pub light_intercept_method: LightInterceptMethod,
pub latitude: f64,
pub longitude: f64,
pub elevation: f64,
#[serde(deserialize_with = "from_isoformat")]
pub start_date: NaiveDate,
#[serde(deserialize_with = "from_isoformat")]
pub stop_date: NaiveDate,
#[serde(default)]
#[serde(deserialize_with = "from_isoformat_option")]
pub emerge_date: Option<NaiveDate>,
#[serde(default)]
#[serde(deserialize_with = "from_isoformat_option")]
pub plant_date: Option<NaiveDate>,
pub co2_enrichment: Option<CO2Enrichment>,
pub mulch: Option<Mulch>,
pub weather_path: PathBuf,
pub soil_impedance: Option<PathBuf>,
pub site: Site,
pub cultivar_parameters: Vec<f64>,
pub row_space: f64,
#[serde(default = "zero")]
pub skip_row_width: f64,
pub plants_per_meter: f64,
pub agronomy_operations: Vec<AgronomyOperation>,
pub light_intercept_parameters: Option<[f64; 20]>,
pub soil_layers: [SoilLayer; 14],
pub soil_hydraulic: SoilHydraulic,
pub plant_maps: Option<Vec<PlantMap>>,
/// maximum leaf area index.
#[serde(skip)]
pub lmax: f64,
/// The effect of moisture stress on the photosynthetic rate
#[serde(skip)]
pub ptsred: f64,
/// correction factor for ambient CO2 in air
#[serde(skip)]
pub ambient_CO2_factor: f64,
#[serde(skip)]
pub num_watertable_data: usize,
#[serde(skip)]
pub states: Vec<State>,
#[serde(skip)]
#[serde(default = "default_last_day_weather_data")]
pub last_day_weather_data: NaiveDate,
}

THOUGHT: Cotton2k simulate in following procedure hourly. I'd like to group paramters in three sections.

  graph TD;
      Atmosphere-->Soil;
      Soil-->Plant;
Loading

@dodge-ttu
Copy link
Author

Thanks for the reply! Any insight is helpful. I have deduced the format of the TOML file and it mostly works except I get the following error regarding the cultivar_parameters:

image

My TOML file is as follows:

light_intercept_method = "Original"  # Can be "Original", "Fry1980", or "Latered"
latitude = 0.0
longitude = 0.0
elevation = 0.0
start_date = "2023-01-01"
stop_date = "2023-10-30"
emerge_date = "2023-01-02"  # Optional
plant_date = "2023-01-01"  # Optional

# Weather and soil data paths
weather_path = "weather_data/test_weather.csv"
#soil_impedance = "path/to/soil_imp.csv"  # Optional, will be set automatically if not provided

# Site parameters
[site]
average_wind_speed = 0.0  # Optional
estimate_dew_point = [0.0, 0.0]
wind_blow_after_sunrise = 0.0
wind_max_after_noon = 0.0
wind_stop_after_sunset = 0.0
night_time_wind_factor = 0.0
cloud_type_correction_factor = 0.0
max_temperature_after_noon = 0.0
deep_soil_temperature = [0.0, 0.0, 0.0]
dew_point_range = [0.0, 0.0, 0.0]
albedo_range = [0.0, 0.0]


# Optional parameters
[co2_enrichment]
factor = 0.0
start_date = "2023-01-02"
stop_date = "2023-01-03"

[mulch]
indicator = "NoMulch"  # Can be "NoMulch", "All", "OneColumnLeftAtSide", or "TwoColumnsLeftAtSide"
sw_trans = 0.0
lw_trans = 0.0
start_date = "2023-01-01"
#stop_date = "YYYY-MM-DD"  # Optional

light_intercept_parameters = [0.0, 0.0, 0.0, 0.0]  # Optional, array of 20 float values
cultivar_parameters = [
    0.95,
    1.05,
    0.85,
    1.2,
    0.9,
    0.95,
    1.05,
    0.85,
    1.2,
    0.9,
    0.95,
    1.05,
    0.85,
    1.2,
    0.9,
]

# Soil layers (14 required)
[[soil_layers]]
ammonium = 0.0
nitrate = 0.0
organic_matter = 0.0
water_content = 0.0
[[soil_layers]]
ammonium = 0.0
nitrate = 0.0
organic_matter = 0.0
water_content = 0.0
[[soil_layers]]
ammonium = 0.0
nitrate = 0.0
organic_matter = 0.0
water_content = 0.0
[[soil_layers]]
ammonium = 0.0
nitrate = 0.0
organic_matter = 0.0
water_content = 0.0
[[soil_layers]]
ammonium = 0.0
nitrate = 0.0
organic_matter = 0.0
water_content = 0.0
[[soil_layers]]
ammonium = 0.0
nitrate = 0.0
organic_matter = 0.0
water_content = 0.0
[[soil_layers]]
ammonium = 0.0
nitrate = 0.0
organic_matter = 0.0
water_content = 0.0

[[soil_layers]]
ammonium = 0.0
nitrate = 0.0
organic_matter = 0.0
water_content = 0.0
[[soil_layers]]
ammonium = 0.0
nitrate = 0.0
organic_matter = 0.0
water_content = 0.0
[[soil_layers]]
ammonium = 0.0
nitrate = 0.0
organic_matter = 0.0
water_content = 0.0
[[soil_layers]]
ammonium = 0.0
nitrate = 0.0
organic_matter = 0.0
water_content = 0.0
[[soil_layers]]
ammonium = 0.0
nitrate = 0.0
organic_matter = 0.0
water_content = 0.0
[[soil_layers]]
ammonium = 0.0
nitrate = 0.0
organic_matter = 0.0
water_content = 0.0
[[soil_layers]]
ammonium = 0.0
nitrate = 0.0
organic_matter = 0.0
water_content = 0.0
# Repeat soil_layers block 13 more times

[soil_hydraulic]
implicit_ratio = 0.0
max_conductivity = 0.0
psi_fc = 0.0
psi_id = 0.0

[[soil_hydraulic.layers]]
depth = 0.0
theta_d = 0.0
theta_s = 0.0
alpha = 0.0
beta = 0.0
hcs = 0.0
hcfc = 0.0
bulk_density = 0.0
clay = 0.0
sand = 0.0
[[soil_hydraulic.layers]]
depth = 0.0
theta_d = 0.0
theta_s = 0.0
alpha = 0.0
beta = 0.0
hcs = 0.0
hcfc = 0.0
bulk_density = 0.0
clay = 0.0
sand = 0.0
[[soil_hydraulic.layers]]
depth = 0.0
theta_d = 0.0
theta_s = 0.0
alpha = 0.0
beta = 0.0
hcs = 0.0
hcfc = 0.0
bulk_density = 0.0
clay = 0.0
sand = 0.0

# Repeat soil_hydraulic.layers as needed


# Agronomy operations (multiple of each type can be specified)
[[agronomy_operations]]
type = "irrigation"
date = "2023-01-02"
amount = 0.0
predict = false
method = "Sprinkler"  # Can be "Sprinkler", "Furrow", or "Drip"
#drip_x = 0.0  # Only for drip irrigation
#drip_y = 0.0  # Only for drip irrigation
#max_amount = 0.0  # Optional
#stop_predict_date = "YYYY-MM-DD"  # Optional


[[agronomy_operations]]
type = "fertilization"
date = "2023-01-02"

@tcztzy
Copy link
Owner

tcztzy commented Sep 17, 2024

cultivar parameter is an array with length 49. Those parameters' meaning are explained in this article

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants