diff --git a/CHANGELOG.md b/CHANGELOG.md index 052997abf..fd072f8c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,13 +10,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - **scripts** peatland rewetting now automatically considered in `extra/runSEALSallocation.R` ### added -- +- **start_scripts** added `lock_timeout` as option to `start_run` function ### removed - ### fixed -- +- **44_biodiversity** bugfix i44_biome_share, code cleanup, added scaling of `q44_bii` ## [4.9.0] - 2024-12-05 diff --git a/DESCRIPTION b/DESCRIPTION index c96ed5b72..77156ed8a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -21,14 +21,14 @@ Imports: m4fsdp, madrat, magclass (>= 6.14.0), - magpie4 (>= 2.15.8), + magpie4 (>= 2.16.1), MagpieNCGains, magpiesets (>= 0.46.1), mip, mrcommons, patchwork, piamenv (>= 0.5.5), - piamInterfaces (>= 0.37.1), + piamInterfaces (>= 0.40.3), piamutils, quitte, raster, diff --git a/modules/44_biodiversity/bii_target/declarations.gms b/modules/44_biodiversity/bii_target/declarations.gms index 7f4552e05..4134fc41a 100644 --- a/modules/44_biodiversity/bii_target/declarations.gms +++ b/modules/44_biodiversity/bii_target/declarations.gms @@ -16,7 +16,6 @@ positive variables parameters p44_bii_lower_bound(t,i,biome44) Interpolated lower bound for BII over time (1) p44_start_value(i,biome44) Start value for BII lower bound (1) - p44_target_value(i,biome44) Target value for BII lower bound (1) i44_biome_share(j,biome44) Share of biome type in each spatial unit (1) i44_biome_area_reg(i,biome44) Area of range-rarity weighted biome type in each region (mio. ha) ; diff --git a/modules/44_biodiversity/bii_target/equations.gms b/modules/44_biodiversity/bii_target/equations.gms index d372e2a7c..f0ce37c2b 100644 --- a/modules/44_biodiversity/bii_target/equations.gms +++ b/modules/44_biodiversity/bii_target/equations.gms @@ -13,13 +13,13 @@ q44_bii(i2,biome44)$(i44_biome_area_reg(i2,biome44) > 0) .. v44_bii(i2,biome44) =e= - sum((cell(i2,j2),potnatveg,landcover44), vm_bv(j2,landcover44,potnatveg) * i44_biome_share(j2,biome44)) + sum((cell(i2,j2),landcover44,potnatveg), vm_bv(j2,landcover44,potnatveg) * i44_biome_share(j2,biome44)) / i44_biome_area_reg(i2,biome44); *' For each of the 71 biomes, the BII has to meet a minium level based on `s44_bii_lower_bound`. *' `v44_bii_missing` is a technical variable to maintain feasibility in case `v44_bii` cannot be increased. - q44_bii_target(i2,biome44)$(i44_biome_area_reg(i2,biome44) > 0) .. + q44_bii_target(i2,biome44) .. v44_bii(i2,biome44) + v44_bii_missing(i2,biome44) =g= sum(ct, p44_bii_lower_bound(ct,i2,biome44)); *' Costs accrue only for `v44_bii_missing`. In the best case costs should be zero or close to zero. diff --git a/modules/44_biodiversity/bii_target/preloop.gms b/modules/44_biodiversity/bii_target/preloop.gms index 962ffcaea..8d54341f4 100644 --- a/modules/44_biodiversity/bii_target/preloop.gms +++ b/modules/44_biodiversity/bii_target/preloop.gms @@ -6,8 +6,9 @@ *** | Contact: magpie@pik-potsdam.de * Calculate biome share -i44_biome_share(j,biome44) = - (f44_biome_area(j,biome44) + 1e-10) / sum(biome44_2, f44_biome_area(j,biome44_2) + 1e-10); +i44_biome_share(j,biome44) = 0; +i44_biome_share(j,biome44)$(sum(biome44_2, f44_biome_area(j,biome44_2)) > 0) = + f44_biome_area(j,biome44) / sum(biome44_2, f44_biome_area(j,biome44_2)); * Set i44_biome_area_reg i44_biome_area_reg(i,biome44) = diff --git a/modules/44_biodiversity/bii_target/presolve.gms b/modules/44_biodiversity/bii_target/presolve.gms index edca9fc62..288cd7de6 100644 --- a/modules/44_biodiversity/bii_target/presolve.gms +++ b/modules/44_biodiversity/bii_target/presolve.gms @@ -13,32 +13,31 @@ loop(i, v44_bii_missing.fx(i,biome44) = 0; else v44_bii.l(i,biome44) = - sum((cell(i,j),potnatveg,landcover44), vm_bv.l(j,landcover44,potnatveg) * i44_biome_share(j,biome44)) + sum((cell(i,j),landcover44,potnatveg), vm_bv.l(j,landcover44,potnatveg) * i44_biome_share(j,biome44)) / i44_biome_area_reg(i,biome44); ); ); ); +if (m_year(t) = s44_start_year AND s44_bii_lower_bound > 0, * The start value for the linear interpolation is the BII at biome level in the start year. -p44_start_value(i,biome44)$(m_year(t) = s44_start_year) = v44_bii.l(i,biome44); + p44_start_value(i,biome44) = v44_bii.l(i,biome44); * The target value for the linear interpolation is the lower bound defined in `s44_bii_lower_bound`. -p44_target_value(i,biome44) = s44_bii_lower_bound; +* Linear increase of BII target values at biome level from start year to target year, and constant values thereafter. + p44_bii_lower_bound(t2,i,biome44) = p44_start_value(i,biome44) + ((m_year(t2) - s44_start_year) / (s44_target_year - s44_start_year)) * (s44_bii_lower_bound - p44_start_value(i,biome44)); + p44_bii_lower_bound(t2,i,biome44)$(m_year(t2) > s44_target_year) = s44_bii_lower_bound; +* Avoid implausible values + p44_bii_lower_bound(t2,i,biome44)$(p44_bii_lower_bound(t2,i,biome44) >= 1) = 1; + p44_bii_lower_bound(t2,i,biome44)$(m_year(t2) < s44_start_year) = 0; + p44_bii_lower_bound(t2,i,biome44)$(i44_biome_area_reg(i,biome44) <= 0) = 0; +); if (m_year(t) <= sm_fix_SSP2, v44_bii.lo(i,biome44) = 0; else -* Linear increase of BII target values at biome level from start year to target year, and constant values thereafter. - p44_bii_lower_bound(t2,i,biome44) = p44_start_value(i,biome44) + ((m_year(t2) - s44_start_year) / (s44_target_year - s44_start_year)) * (p44_target_value(i,biome44) - p44_start_value(i,biome44)); - p44_bii_lower_bound(t2,i,biome44)$(m_year(t2) > s44_target_year) = p44_target_value(i,biome44); + v44_bii.lo(i,biome44) = p44_bii_lower_bound(t,i,biome44); if(c44_bii_decrease = 0, - p44_bii_lower_bound(t,i,biome44)$(v44_bii.l(i,biome44) >= p44_target_value(i,biome44)) = v44_bii.l(i,biome44); - elseif c44_bii_decrease = 1, - p44_bii_lower_bound(t,i,biome44)$(v44_bii.l(i,biome44) >= p44_target_value(i,biome44)) = p44_target_value(i,biome44); + v44_bii.lo(i,biome44)$(v44_bii.l(i,biome44) >= s44_bii_lower_bound) = v44_bii.l(i,biome44); ); - p44_bii_lower_bound(t,i,biome44)$(p44_bii_lower_bound(t,i,biome44) >= 1) = 1; - p44_bii_lower_bound(t,i,biome44)$(m_year(t) < s44_start_year) = 0; - p44_bii_lower_bound(t,i,biome44)$(i44_biome_area_reg(i,biome44) <= 0) = 0; -* The lower bound of `v44_bii` is set to `p44_bii_lower_bound` to avoid a reduction of BII in combination with `v44_bii_missing`. - v44_bii.lo(i,biome44) = p44_bii_lower_bound(t,i,biome44); - display p44_bii_lower_bound; ); + diff --git a/modules/44_biodiversity/bii_target/realization.gms b/modules/44_biodiversity/bii_target/realization.gms index ff48d813d..7e1ef74dd 100644 --- a/modules/44_biodiversity/bii_target/realization.gms +++ b/modules/44_biodiversity/bii_target/realization.gms @@ -19,6 +19,7 @@ $Ifi "%phase%" == "sets" $include "./modules/44_biodiversity/bii_target/sets.gms $Ifi "%phase%" == "declarations" $include "./modules/44_biodiversity/bii_target/declarations.gms" $Ifi "%phase%" == "input" $include "./modules/44_biodiversity/bii_target/input.gms" $Ifi "%phase%" == "equations" $include "./modules/44_biodiversity/bii_target/equations.gms" +$Ifi "%phase%" == "scaling" $include "./modules/44_biodiversity/bii_target/scaling.gms" $Ifi "%phase%" == "preloop" $include "./modules/44_biodiversity/bii_target/preloop.gms" $Ifi "%phase%" == "presolve" $include "./modules/44_biodiversity/bii_target/presolve.gms" $Ifi "%phase%" == "postsolve" $include "./modules/44_biodiversity/bii_target/postsolve.gms" diff --git a/modules/44_biodiversity/bii_target/scaling.gms b/modules/44_biodiversity/bii_target/scaling.gms new file mode 100644 index 000000000..b954d3923 --- /dev/null +++ b/modules/44_biodiversity/bii_target/scaling.gms @@ -0,0 +1,8 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +q44_bii.scale(i,biome44) = 1e10; diff --git a/modules/44_biodiversity/bii_target_apr24/declarations.gms b/modules/44_biodiversity/bii_target_apr24/declarations.gms index 12eb55056..01351790d 100644 --- a/modules/44_biodiversity/bii_target_apr24/declarations.gms +++ b/modules/44_biodiversity/bii_target_apr24/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) *** | authors, and contributors see CITATION.cff file. This file is part *** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of *** | AGPL-3.0, you are granted additional permissions described in the @@ -16,7 +16,6 @@ positive variables parameters p44_bii_lower_bound(t,i,biome44) Interpolated lower bound for BII over time (1) p44_start_value(i,biome44) Start value for BII lower bound (1) - p44_target_value(i,biome44) Target value for BII lower bound (1) i44_biome_share(j,biome44) Share of biome type in each spatial unit (1) i44_biome_area_reg(i,biome44) Area of range-rarity weighted biome type in each region (mio. ha) ; diff --git a/modules/44_biodiversity/bii_target_apr24/equations.gms b/modules/44_biodiversity/bii_target_apr24/equations.gms index 19c78350c..4c3455690 100644 --- a/modules/44_biodiversity/bii_target_apr24/equations.gms +++ b/modules/44_biodiversity/bii_target_apr24/equations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) *** | authors, and contributors see CITATION.cff file. This file is part *** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of *** | AGPL-3.0, you are granted additional permissions described in the @@ -14,13 +14,13 @@ q44_bii(i2,biome44)$(i44_biome_area_reg(i2,biome44) > 0) .. v44_bii(i2,biome44) =e= - sum((cell(i2,j2),potnatveg,landcover44), vm_bv(j2,landcover44,potnatveg) * f44_rr_layer(j2) * i44_biome_share(j2,biome44)) + sum((cell(i2,j2),landcover44,potnatveg), vm_bv(j2,landcover44,potnatveg) * f44_rr_layer(j2) * i44_biome_share(j2,biome44)) / i44_biome_area_reg(i2,biome44); *' For each of the 71 biomes, the BII has to meet a minium level based on `s44_bii_lower_bound`. *' `v44_bii_missing` is a technical variable to maintain feasibility in case `v44_bii` cannot be increased. - q44_bii_target(i2,biome44)$(i44_biome_area_reg(i2,biome44) > 0) .. + q44_bii_target(i2,biome44) .. v44_bii(i2,biome44) + v44_bii_missing(i2,biome44) =g= sum(ct, p44_bii_lower_bound(ct,i2,biome44)); *' Costs accrue only for `v44_bii_missing`. In the best case costs should be zero or close to zero. diff --git a/modules/44_biodiversity/bii_target_apr24/input.gms b/modules/44_biodiversity/bii_target_apr24/input.gms index 042c3e03f..099ce53b9 100644 --- a/modules/44_biodiversity/bii_target_apr24/input.gms +++ b/modules/44_biodiversity/bii_target_apr24/input.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) *** | authors, and contributors see CITATION.cff file. This file is part *** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of *** | AGPL-3.0, you are granted additional permissions described in the diff --git a/modules/44_biodiversity/bii_target_apr24/postsolve.gms b/modules/44_biodiversity/bii_target_apr24/postsolve.gms index 1974fa3da..3d8723d8f 100644 --- a/modules/44_biodiversity/bii_target_apr24/postsolve.gms +++ b/modules/44_biodiversity/bii_target_apr24/postsolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) *** | authors, and contributors see CITATION.cff file. This file is part *** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of *** | AGPL-3.0, you are granted additional permissions described in the diff --git a/modules/44_biodiversity/bii_target_apr24/preloop.gms b/modules/44_biodiversity/bii_target_apr24/preloop.gms index f296466db..7cab290a5 100644 --- a/modules/44_biodiversity/bii_target_apr24/preloop.gms +++ b/modules/44_biodiversity/bii_target_apr24/preloop.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) *** | authors, and contributors see CITATION.cff file. This file is part *** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of *** | AGPL-3.0, you are granted additional permissions described in the @@ -6,8 +6,9 @@ *** | Contact: magpie@pik-potsdam.de * Calculate biome share -i44_biome_share(j,biome44) = - (f44_biome_area(j,biome44) + 1e-10) / sum(biome44_2, f44_biome_area(j,biome44_2) + 1e-10); +i44_biome_share(j,biome44) = 0; +i44_biome_share(j,biome44)$(sum(biome44_2, f44_biome_area(j,biome44_2)) > 0) = + f44_biome_area(j,biome44) / sum(biome44_2, f44_biome_area(j,biome44_2)); * Set i44_biome_area_reg i44_biome_area_reg(i,biome44) = diff --git a/modules/44_biodiversity/bii_target_apr24/presolve.gms b/modules/44_biodiversity/bii_target_apr24/presolve.gms index f9cd49db4..c5d6f8dd0 100644 --- a/modules/44_biodiversity/bii_target_apr24/presolve.gms +++ b/modules/44_biodiversity/bii_target_apr24/presolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) *** | authors, and contributors see CITATION.cff file. This file is part *** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of *** | AGPL-3.0, you are granted additional permissions described in the @@ -13,33 +13,31 @@ loop(i, v44_bii_missing.fx(i,biome44) = 0; else v44_bii.l(i,biome44) = - sum((cell(i,j),potnatveg,landcover44), vm_bv.l(j,landcover44,potnatveg) * f44_rr_layer(j) * i44_biome_share(j,biome44)) + sum((cell(i,j),landcover44,potnatveg), vm_bv.l(j,landcover44,potnatveg) * f44_rr_layer(j) * i44_biome_share(j,biome44)) / i44_biome_area_reg(i,biome44); ); ); ); +if (m_year(t) = s44_start_year AND s44_bii_lower_bound > 0, * The start value for the linear interpolation is the BII at biome level in the start year. -p44_start_value(i,biome44)$(m_year(t) = s44_start_year) = v44_bii.l(i,biome44); + p44_start_value(i,biome44) = v44_bii.l(i,biome44); * The target value for the linear interpolation is the lower bound defined in `s44_bii_lower_bound`. -p44_target_value(i,biome44) = s44_bii_lower_bound; +* Linear increase of BII target values at biome level from start year to target year, and constant values thereafter. + p44_bii_lower_bound(t2,i,biome44) = p44_start_value(i,biome44) + ((m_year(t2) - s44_start_year) / (s44_target_year - s44_start_year)) * (s44_bii_lower_bound - p44_start_value(i,biome44)); + p44_bii_lower_bound(t2,i,biome44)$(m_year(t2) > s44_target_year) = s44_bii_lower_bound; +* Avoid implausible values + p44_bii_lower_bound(t2,i,biome44)$(p44_bii_lower_bound(t2,i,biome44) >= 1) = 1; + p44_bii_lower_bound(t2,i,biome44)$(m_year(t2) < s44_start_year) = 0; + p44_bii_lower_bound(t2,i,biome44)$(i44_biome_area_reg(i,biome44) <= 0) = 0; +); if (m_year(t) <= sm_fix_SSP2, v44_bii.lo(i,biome44) = 0; else -* Linear increase of BII target values at biome level from start year to target year, and constant values thereafter. - p44_bii_lower_bound(t2,i,biome44) = p44_start_value(i,biome44) + ((m_year(t2) - s44_start_year) / (s44_target_year - s44_start_year)) * (p44_target_value(i,biome44) - p44_start_value(i,biome44)); - p44_bii_lower_bound(t2,i,biome44)$(m_year(t2) > s44_target_year) = p44_target_value(i,biome44); + v44_bii.lo(i,biome44) = p44_bii_lower_bound(t,i,biome44); if(c44_bii_decrease = 0, - p44_bii_lower_bound(t,i,biome44)$(v44_bii.l(i,biome44) >= p44_target_value(i,biome44)) = v44_bii.l(i,biome44); - elseif c44_bii_decrease = 1, - p44_bii_lower_bound(t,i,biome44)$(v44_bii.l(i,biome44) >= p44_target_value(i,biome44)) = p44_target_value(i,biome44); + v44_bii.lo(i,biome44)$(v44_bii.l(i,biome44) >= s44_bii_lower_bound) = v44_bii.l(i,biome44); ); - p44_bii_lower_bound(t,i,biome44)$(p44_bii_lower_bound(t,i,biome44) >= 1) = 1; - p44_bii_lower_bound(t,i,biome44)$(m_year(t) < s44_start_year) = 0; - p44_bii_lower_bound(t,i,biome44)$(i44_biome_area_reg(i,biome44) <= 0) = 0; -* The lower bound of `v44_bii` is set to `p44_bii_lower_bound` to avoid a reduction of BII in combination with `v44_bii_missing`. - v44_bii.lo(i,biome44) = p44_bii_lower_bound(t,i,biome44); - display p44_bii_lower_bound; ); diff --git a/modules/44_biodiversity/bii_target_apr24/realization.gms b/modules/44_biodiversity/bii_target_apr24/realization.gms index 1b1298ab5..696303155 100644 --- a/modules/44_biodiversity/bii_target_apr24/realization.gms +++ b/modules/44_biodiversity/bii_target_apr24/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) *** | authors, and contributors see CITATION.cff file. This file is part *** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of *** | AGPL-3.0, you are granted additional permissions described in the @@ -19,6 +19,7 @@ $Ifi "%phase%" == "sets" $include "./modules/44_biodiversity/bii_target_apr24/se $Ifi "%phase%" == "declarations" $include "./modules/44_biodiversity/bii_target_apr24/declarations.gms" $Ifi "%phase%" == "input" $include "./modules/44_biodiversity/bii_target_apr24/input.gms" $Ifi "%phase%" == "equations" $include "./modules/44_biodiversity/bii_target_apr24/equations.gms" +$Ifi "%phase%" == "scaling" $include "./modules/44_biodiversity/bii_target_apr24/scaling.gms" $Ifi "%phase%" == "preloop" $include "./modules/44_biodiversity/bii_target_apr24/preloop.gms" $Ifi "%phase%" == "presolve" $include "./modules/44_biodiversity/bii_target_apr24/presolve.gms" $Ifi "%phase%" == "postsolve" $include "./modules/44_biodiversity/bii_target_apr24/postsolve.gms" diff --git a/modules/44_biodiversity/bii_target_apr24/scaling.gms b/modules/44_biodiversity/bii_target_apr24/scaling.gms new file mode 100644 index 000000000..b954d3923 --- /dev/null +++ b/modules/44_biodiversity/bii_target_apr24/scaling.gms @@ -0,0 +1,8 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +q44_bii.scale(i,biome44) = 1e10; diff --git a/modules/44_biodiversity/bii_target_apr24/sets.gms b/modules/44_biodiversity/bii_target_apr24/sets.gms index 4e19d2313..69751ecef 100644 --- a/modules/44_biodiversity/bii_target_apr24/sets.gms +++ b/modules/44_biodiversity/bii_target_apr24/sets.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) *** | authors, and contributors see CITATION.cff file. This file is part *** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of *** | AGPL-3.0, you are granted additional permissions described in the diff --git a/scripts/start/projects/project_FSEC_Scenarios.R b/scripts/start/projects/project_FSEC_Scenarios.R index 6ef4c15a8..2d54116ae 100644 --- a/scripts/start/projects/project_FSEC_Scenarios.R +++ b/scripts/start/projects/project_FSEC_Scenarios.R @@ -39,5 +39,5 @@ for (scenarioName in c( # Start runs cfg <- fsecScenario(scenario = scenarioName) - start_run(cfg = cfg, codeCheck = codeCheck) + start_run(cfg = cfg, codeCheck = codeCheck, lock_timeout = 6) } diff --git a/scripts/start/test_runs.R b/scripts/start/test_runs.R index d61b2133c..e1c67aa54 100644 --- a/scripts/start/test_runs.R +++ b/scripts/start/test_runs.R @@ -75,24 +75,28 @@ codeCheck <- FALSE ### Business-as-usual cfg <- fsecScenario(scenario = "c_BAU") +cfg$force_replace <- TRUE cfg$results_folder <- "output/:title:" cfg$results_folder_highres <- "output" start_run(cfg = cfg, codeCheck = codeCheck) ### NatureSparing cfg <- fsecScenario(scenario = "b_NatureSparing") +cfg$force_replace <- TRUE cfg$results_folder <- "output/:title:" cfg$results_folder_highres <- "output" start_run(cfg = cfg, codeCheck = codeCheck) ### LandscapeElements cfg <- fsecScenario(scenario = "a_LandscapeElements") +cfg$force_replace <- TRUE cfg$results_folder <- "output/:title:" cfg$results_folder_highres <- "output" start_run(cfg = cfg, codeCheck = codeCheck) ### FSDP Scenario cfg <- fsecScenario(scenario = "e_FSDP") +cfg$force_replace <- TRUE cfg$results_folder <- "output/:title:" cfg$results_folder_highres <- "output" start_run(cfg = cfg, codeCheck = codeCheck) diff --git a/scripts/start_functions.R b/scripts/start_functions.R index af8da9ddb..dc616e690 100644 --- a/scripts/start_functions.R +++ b/scripts/start_functions.R @@ -202,7 +202,7 @@ download_and_update <- function(cfg) { } -start_run <- function(cfg, scenario = NULL, codeCheck = TRUE, lock_model = TRUE) { +start_run <- function(cfg, scenario = NULL, codeCheck = TRUE, lock_model = TRUE, lock_timeout = 1) { timePrepareStart <- Sys.time() @@ -222,7 +222,7 @@ start_run <- function(cfg, scenario = NULL, codeCheck = TRUE, lock_model = TRUE) withr::defer(setwd(maindir)) if(lock_model) { - lock_id <- gms::model_lock(timeout1 = 1) + lock_id <- gms::model_lock(timeout1 = lock_timeout) withr::defer(gms::model_unlock(lock_id)) }