Skip to content

V1.2 science updates and bug fixes#27

Open
hhughes92 wants to merge 94 commits intocirevo/initial-improvementsfrom
hh-modeller-improvements
Open

V1.2 science updates and bug fixes#27
hhughes92 wants to merge 94 commits intocirevo/initial-improvementsfrom
hh-modeller-improvements

Conversation

@hhughes92
Copy link
Collaborator

DO NOT ACCEPT PR UNTIL REVIEWED BY PLAN VIVO REVIEWER.

Key changes compared to v1.1, from versions.md. Some of these changes were made on the target branch cirevo\initial-improvements, though may have been further refined on this branch.

DATA & DEFAULT UPDATES:

  1. Climate data: was CRU-TS 3.10, now OpenMeteo API request for daily ERA5 data for 30 years
  2. Soil data: was HWSD, now SoilGrids 2.0 via API
  3. Global Warming Potential values: were IPCC Second Assessment Report (1995), now IPCC Sixth Assessment Report (2021)
  4. Combustion factors, crop parameters, emission factors, volatilisation factors: were IPCC (2006), now IPCC (2019)
  5. Crop C content: was literature (Johnson et al., 2006; Latshaw & Miller, 1924), now IPCC (2019)

BUG FIXES:

  1. In tree_growth.py: tree growth derivative functions were inconsistent in the inputs they expected. This has been standardised to expect aboveground biomass.
  2. In tree_growth.py: Chave Dry allometric parameters included a typo, that has been fixed.
  3. In emit.py: tree inputs reduced from fire used crop combustion factor, now fixed to use the tree combustion factor.
  4. In emit.py: nitrogen_emit did not account for fire impacts on input amounts, this is now applies.
  5. In calculate_emissions.py: whether residues off-field are burned is now set by user in the input template.
  6. Some inconsistencies in how the input data questionnaire was set out have been updated.

…_TREES" could be confused with stand density, but here means number of species or cohorts.
…ed and are not available in IPCC 2019, the values were not changed.
… (y) as input, rather than mix of x (age) and y.

tree_model.py gives the derivative functions agb (line 331: t_NPP[i] = derivative_functions[tree_growth.best](tree_growth.fit_params, agb))
- updated formulae in input sheet to use INDEX(MATCH()) instead of specific cell pull-throughs
- tidied up questionnaire to make sure all answers are used in the input sheet and that formatting indicating where to add data for additional plots is related to the same logic in the input sheet (i.e. whether the value is a plot or intervention level data point)
- updated link in initial_info sheet
- applied formatting more consistently to show where users are expected to complete information
- still to do: confirm which data points are plot vs intervention level, confirm all cells currently highlighted in red.
…late has not yet been updated with instructions on how to add more cohorts.
hhughes92 and others added 30 commits November 7, 2025 14:43
…require users to include the versions they want to use in the source directory. The necessary updates to crop_params.py and tree_params.py may slow the model runs: this would only be noticeable if a large number of runs were queued.
…t of residue calculation is only applied when crop yield >0
…1. Previously it represented whichever year was the first in the data the user provided.
…nd the model documentation were aligned, but the method as written is not valid for the parameters provided. In brief, allocation to root and leaf pools should be based on the total woody AGB pool, not the change in woody biomass. The updated code calculates WOODY_POOLS and DEPENDENT_POOLS separately.
…gistic_function_inverse.

Also add bounds to curve fitting, and change initial hyperbolic parameter values: Hyp was often not returning a successful fit due to initial parameter values.
…exponential_function"/"exp" becomes "exponential_1param_function"/"exp1", new function is "exponential_2param_function"/"exp2". SHAMBA model description update to do, so equation numbers are missing for new function.

Add ValueErrors where no finite and real solution exists for inverse functions.
- ensure initial_WAGB_tree is not < 0
- Reverse part of recently updated approach to biomass pool allocation:  flux from last year's growth is applied to all pools at the same time, as in previous versions of SHAMBA. The recent correction to how DEPENDENT_POOLS are allocated remains.
…bers, np.log works for arrays and is slower than math.log for single numbers.
…Was (AG residues left) * (1- proportion left), fixed to be based on (total AG residues) * (1- proportion left)
…mortality, turnover) so that proportions are applied to remaining biomass after each flux. This allows all proportions 0-1 to be entered into the model (and avoids issues where sum(flux) > biomass available)
…_off_base and burn_off_project is True (conservative), but input data should be used where available.
1. Add base_plant_yr so that baseline tree cohort isn't assumed to be planted in yr 0
2. Update guidance for thinning years: these are applied as 'project years' not 'years since planting'
3. Update guidance for planting year: year 0 should be used when saplings are planted at the start of the project.
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

Successfully merging this pull request may close these issues.

1 participant