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

Replace hardcoded parameters with parameter files in .csv or .json #1

Open
juliancabezas opened this issue Jan 6, 2022 · 2 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@juliancabezas
Copy link
Collaborator

Currently the Standalone_GCBM/input_database/add_species_vol_to_bio.py and Standalone_GCBM/input_database/modify_root_parameters.py codes insert or modify the data into the Standalone_GCBM/input_database/gcbm_input.db database using SQL, these SQL statements contain hardcoded parameters, that are used for customizing the model (e.g. using a custom root to shoot ratio paramater)

This hardcoding into the python codes is not ideal and can be difficult to understand for the user if they are not into python or sql. the parameters can be stored in json dictionaries or csv tables (other suggestions are welcome) and then inserted to the database using the abovementioned python codes, to make it easier for the user to introduce custom parameters

@juliancabezas juliancabezas added enhancement New feature or request good first issue Good for newcomers labels Jan 6, 2022
@aornugent
Copy link

Great idea, thanks @juliancabezas. Can you show us an example of the input files? CSVs are usually very simple to work with.

@juliancabezas
Copy link
Collaborator Author

juliancabezas commented Jan 11, 2022

Of course!

As an example, the query (in Standalone_GCBM/input_database/add_species_vol_to_bio.py):
conn.execute(
"""
INSERT INTO vol_to_bio_factor
SELECT 801 AS id, 0.329 AS a, 1 AS b,
0 AS a_nonmerch, 1 AS b_nonmerch, 1 AS k_nonmerch, 1 AS cap_nonmerch,
0 AS a_sap, 1 AS b_sap, 1 AS k_sap, 1 AS cap_sap,
-1.945910149 AS a1, 0 AS a2, 0 AS a3,
-1.540445041 AS b1, 0 AS b2, 0 AS b3,
-2.63905733 AS c1, 0 AS c2, 0 AS c3,
0.1 AS min_volume, 1000000 AS max_volume,
0.50249 AS low_stemwood_pop, 0.70391 AS high_stemwood_pop,
0.09492 AS low_stembark_prop, 0.11402 AS high_stembark_prop,
0.26098 AS low_branches_prop, 0.14622 AS high_branches_pop,
0.1416 AS low_foliage_prop, 0.03585 AS high_foliage_prop
""")

should instead grab that data from a csv such as the one attached, with the possibility of adding more lines
Uploading example_vol_to_bio_factor.csv…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants