aldivi / caland

ca carbon accounting model
Other
7 stars 7 forks source link

Soil climate scalar bug fix #82

Closed msimmond closed 3 years ago

msimmond commented 3 years ago

This update to CALAND v3.0.0. addresses the issue that occurs when a scenario has 1) projected climate change, and 2) soil conservation is prescribed in cultivated lands that results in a flip in the sign of the unmanaged cultivated soil carbon flux. With the current input parameters in v3.0.0, this can occur if Delta cultivated soil conservation is run in CALAND() using the +SD of the soil conservation flux, i.e value_col_soilcon = 9 and ADD_soilcon=TRUE. In this case the average unmanaged soil carbon flux, which is negative (net emissions), flips to a positive managed soil carbon flux. The bug was related to the input soil climate scalars, which may need to be adjusted in CALAND() to maintain its intended effect. For example, if the climate scalar was intended to increase (i.e., scalar >1) the loss of the net soil carbon flux (i.e., flux <0) in the unmanaged system, then the scalar must be adjusted if management causes that system to have a net gain in soil carbon (i.e., flux >0), to decrease the net soil carbon flux.

I incorporated this sign check and adjustment into CALAND() for Cultivated lands.

msimmond commented 3 years ago

The 2 attached images are the key results from the bug fix testing I did (see Bug_fix_tests_soil_con_soil_climate_scalar_adjustment.R for specifics and description below), showing what was expected with the comparison between outputs from Test 1 and Test 2.

All_region_All_land_All_own_Total_AnnCO2eq_all_diff_output__compare_orig_AltA_no_Delta_soilcon.pdf Delta_Cultivated_Easement_Total_AnnCO2eq_all_output_compare_edited_AltA_Delta_soilcon_added.pdf

Description of tests: Two tests below look at the effect of updating CALAND 3.0.0. (master) with a bug fix to calculations for applying the input soil climate scalars to soil carbon fluxes under cultivated soil conservation when the sign of the historic managed soil carbon flux is flipped from the unmanaged historic flux. Based on the original lc_params inputs, it appears this is only the case for Delta soil conservation when CALAND() is run with mean+SD for soil conservation (i.e, soil flux flips from negative without management to positive with management). Test 1 compares the outputs of the original NWL Alt A RCP8.5 scenario with and without the CALAND() updates - both run with soilcon +SD and the original climate scalars. The outputs should be identical since there were no cases where the sign flipped because there was no prescribed Delta soil conservation. The comparison of CO2e outputs in plot_caland show they are identical. Test 2 compares the outputs with and without the CALAND() updates using an edited version of the NWL Alt A RCP8.5 scenario with Delta soil conservation added, run at mean+SD for soil conservation, and using the original climate scalars. There should be differences between these two outputs. Since the original climate scalars were <1 for the Delta cultivated, which decreases the soil c flux (less emissions) (note climate scalars were later corrected for this region for a separate reason related to pre-processing), the bug fix is expected to detect the the flipped sign of managed soil conservation soil carbon flux (net sequestration) and consequently adjust the climate scalars so they have the opposite effect - in this case, increase the magnitude of that flux (i.e., greater net sequestration). The comparison of outputs in plot_caland show, as expected, that the CO2e sequestration is greater with the bug fix.