PredictiveEcology / CBM_core

Other
0 stars 1 forks source link

spadesCBM-Python #16

Open cboisvenue opened 4 weeks ago

cboisvenue commented 4 weeks ago

Problems: a. Users have to install Python: need to decide where to load Python, reticulate, and libcbm (Python package). Users without any Python installation will present a different solution to the ones that have one or multiple installations. b. Users have to setup Python environments to work with R environments correctly - where we decide to load a., will determine what we do here. c. Accessing the functions is slow - need to check this. d. The functions add a layer of opacity to the code - documentation on the Python side for all libcbm calls needed.

cboisvenue commented 5 days ago

There is some documentation that could be useful on the Python side: https://cat-cfs.github.io/libcbm_py/index.html with these two being more relevant to us: cbm_exn.html, Fully dynamic modelling with cbm_exn

these are all of the libcbm requirements so it may require a few more tweaks https://github.com/cat-cfs/libcbm_py/blob/main/requirements.txt requirements.txt cat-cfs/libcbm_py looks like this is still an issue related to that recent numpy2.0 release , it may be a bit of time before things fully stabilize around that version as far as other packages.

we will have to tweak the package versions until we find ones taht work...can we try to tweak package versions like this:

install the latest numpy < 2.0

reticulate::py_install("numpy==1.26.4", envname = "r-reticulate") reticulate::py_install("pandas==2.2.2", envname = "r-reticulate")

the entire script to pull out those CSV files that get used by cbm_exn is here. Is that what you mean?
https://github.com/cat-cfs/libcbm_py/blob/main/libcbm/model/cbm_exn/parameters/parameter_extraction.py this script queries the cbm_defaults db and drops references to softwood and hardwood specific pools and fluxes and expands to hardwood/softwood specific disturbance matrices, decay rates, turnover parameters cat-cfs/libcbm_py