Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
2c35c25
First version for openalea configuration
pradal Jun 4, 2026
37d3282
First try
pradal Jun 4, 2026
7b5315c
Fix syntax error
pradal Jun 4, 2026
73d4c67
i add 2 news classes Parameter and MyModelUnit and many functions in …
LeticiaNapolitano-34 Jun 4, 2026
542175d
adding pyyaml
LeticiaNapolitano-34 Jun 5, 2026
2c3e8e1
Update meta.yaml
LeticiaNapolitano-34 Jun 5, 2026
f60d764
i add pyyaml in dependencies
LeticiaNapolitano-34 Jun 5, 2026
2b5091d
i made some test to create a params.json file with one example of Hyd…
LeticiaNapolitano-34 Jun 5, 2026
9d61cae
[no ci] modification of the classes and some test from a params.json …
LeticiaNapolitano-34 Jun 8, 2026
6bbde94
Merge branch 'config' of github.com:openalea/core into config
LeticiaNapolitano-34 Jun 8, 2026
f355e7d
modification of the indexation
LeticiaNapolitano-34 Jun 8, 2026
d14b987
I do some test with yml
LeticiaNapolitano-34 Jun 8, 2026
486ac6b
Update the tests
pradal Jun 10, 2026
eaae10c
Update the tests
pradal Jun 10, 2026
b551247
i add new functions and made some test
LeticiaNapolitano-34 Jun 10, 2026
59273ee
i add 3 new functions and dict
LeticiaNapolitano-34 Jun 10, 2026
8a5899e
ajout de nouveaux parametres
LeticiaNapolitano-34 Jun 16, 2026
bb66dc6
modification of the load function
LeticiaNapolitano-34 Jun 16, 2026
dc55b88
modification of the dump function
LeticiaNapolitano-34 Jun 17, 2026
ba618be
i just add some test
LeticiaNapolitano-34 Jun 19, 2026
c343804
i made config a dict and dataclass of parameter
LeticiaNapolitano-34 Jun 19, 2026
44a3063
after several attempts, I found a function to generate a function but…
LeticiaNapolitano-34 Jun 23, 2026
1b81681
test with comment
LeticiaNapolitano-34 Jun 24, 2026
454023a
new function for adding comment
LeticiaNapolitano-34 Jun 24, 2026
b7a7562
add ruamel.yaml
LeticiaNapolitano-34 Jun 24, 2026
6db511e
Tutorial of the configuration
LeticiaNapolitano-34 Jun 25, 2026
032b4bc
I made some test and add new comments, in some parameters and section…
LeticiaNapolitano-34 Jun 26, 2026
5eefc99
I add 2 functons for adding comments before each section and paramete…
LeticiaNapolitano-34 Jun 26, 2026
8f0460b
New documentation
LeticiaNapolitano-34 Jun 29, 2026
ea24456
Tutorial and documentation about configuration on Jupyternotebook
LeticiaNapolitano-34 Jun 30, 2026
5d4c27f
Modification of comment section and ModelUnit class
LeticiaNapolitano-34 Jul 2, 2026
1522c19
Delete Documentation.ipynb
LeticiaNapolitano-34 Jul 3, 2026
8dd9c4a
Add description to the sections
LeticiaNapolitano-34 Jul 3, 2026
4d53bbd
Merge branch 'config' of github.com:openalea/core into config
LeticiaNapolitano-34 Jul 3, 2026
14d3e88
Json and yml file
LeticiaNapolitano-34 Jul 3, 2026
6e94dba
last version of config, new parameters in modelUnit
LeticiaNapolitano-34 Jul 3, 2026
2d92d10
The tutorial in Jupyter notebook
LeticiaNapolitano-34 Jul 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions Tutorial.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Tutorial of the configuration

This tutorial explains how the configuration work on the model. User, modeler and developer interact with the configuration. The user update the file, the modeler build the file and the developer use config to init the model and run it.

## User

The user interacts only with the configuration file, not with Python code.
The user can modify the YAML and JSON file. He can change the values, the parameters and also comment.
The file can be opened with a text editor or on Visual Studio Code.
The configuration file is written in YAML or JSON and contains sections, parameters inside each section.

For example, in HydroRoot with simulation and planting as sections with their parameters:
simulation:
sdate: '2012-08-01 00:00:00'
edate: '2012-08-04 23:00:00'
latitude: 43.61
longitude: 3.87
elevation: 44.0
tzone: Europe/Paris
output_index: ''
unit_scene_length: cm
hydraulic_structure: true
negligible_shoot_resistance: false
energy_budget: true
planting:
spacing_between_rows: 3.6
spacing_on_row: 1
row_angle_with_south: 140.0

The user can modify only the values, never the parameter names but can never change the name of parameters. He can change latitude 43.61 to 41 for example. The user can also comment, comments begin with #. JSON doesn't support comment, if the user want to comment, he have to use YAML.

## Modeler

The modeler constructs the configuration. A Config is a Python dictionary that stores sections and parameters. A Config is built from a list of ModelUnit objects.

For example:
p_sdate = Parameter("sdate", "2012-08-01 00:00:00")
p_edate = Parameter("edate", "2012-08-04 23:00:00")
p_lat = Parameter("latitude", 43.61)
p_longitude = Parameter("longitude", 3.87)
p_elevation = Parameter("elevation", 44.0)
p_tzone = Parameter("tzone", "Europe/Paris")
p_output_index = Parameter("output_index", "")
p_unit_scene_length = Parameter("unit_scene_length", "cm")
p_hydraulic_structure = Parameter("hydraulic_structure", True)
p_negligible_shoot_resistance = Parameter("negligible_shoot_resistance", False)
p_energy_budget = Parameter("energy_budget", True)
parameters = [p_sdate, p_edate, p_lat, p_longitude, p_elevation, p_tzone, p_output_index, p_unit_scene_length, p_hydraulic_structure, p_negligible_shoot_resistance, p_energy_budget]
simulation = ModelUnit('simulation', parameters)
config = Config([simulation])

The modeler can also load and dump a configuration file as config.dump("params.yml") or config.dump("params.json"). The modeler can also add new sections, for example *config.add_section(planting)*.

## Developer

The developer receives a config object. Config unherite from a dict, the developer can access to the parameters value. He can initialize the model and call run().
4 changes: 4 additions & 0 deletions conda/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,16 @@ build:
requirements:
host:
- python
- ruamel.yaml
- pyyaml
{% for dep in build_deps %}
- {{ dep }}
{% endfor %}

run:
- python
- ruamel.yaml
- pyyaml
{% for dep in deps + conda_deps %}
- {{ dep }}
{% endfor %}
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ dependencies = [
"configobj",
"six",
"setuptools",
"pyyaml",
]

[tool.setuptools.dynamic]
Expand Down
Loading
Loading