Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PLUM
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Land Use Lab
PLUM
Commits
c3eaa31e
Commit
c3eaa31e
authored
3 years ago
by
rhenry2
Browse files
Options
Downloads
Patches
Plain Diff
Honour spatial arrangement of protected areas throughout simulation, not only when forced.
parent
44240e8d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/ac/ed/lurg/country/gams/GamsRasterOptimiser.java
+42
-45
42 additions, 45 deletions
src/ac/ed/lurg/country/gams/GamsRasterOptimiser.java
with
42 additions
and
45 deletions
src/ac/ed/lurg/country/gams/GamsRasterOptimiser.java
+
42
−
45
View file @
c3eaa31e
...
@@ -110,7 +110,7 @@ public class GamsRasterOptimiser {
...
@@ -110,7 +110,7 @@ public class GamsRasterOptimiser {
double
gamsPastureChange
=
newLandUseAggItem
.
getLandCoverArea
(
LandCoverType
.
PASTURE
)
-
prevLandUseAggItem
.
getLandCoverArea
(
LandCoverType
.
PASTURE
);
double
gamsPastureChange
=
newLandUseAggItem
.
getLandCoverArea
(
LandCoverType
.
PASTURE
)
-
prevLandUseAggItem
.
getLandCoverArea
(
LandCoverType
.
PASTURE
);
double
gamsCroplandChange
=
newLandUseAggItem
.
getLandCoverArea
(
LandCoverType
.
CROPLAND
)
-
prevLandUseAggItem
.
getLandCoverArea
(
LandCoverType
.
CROPLAND
);
double
gamsCroplandChange
=
newLandUseAggItem
.
getLandCoverArea
(
LandCoverType
.
CROPLAND
)
-
prevLandUseAggItem
.
getLandCoverArea
(
LandCoverType
.
CROPLAND
);
RasterSet
<
LandUseItem
>
landUseItemsForLocation
=
newLandUseRaster
.
createSubsetForKeys
(
keys
);
RasterSet
<
LandUseItem
>
landUseItemsForLocation
=
newLandUseRaster
.
createSubsetForKeys
(
keys
);
if
(
DEBUG
)
{
if
(
DEBUG
)
{
checkedTotalAreas
(
landUseItemsForLocation
,
locId
+
" before"
);
checkedTotalAreas
(
landUseItemsForLocation
,
locId
+
" before"
);
LogWriter
.
println
(
"pastureChange "
+
gamsPastureChange
);
LogWriter
.
println
(
"pastureChange "
+
gamsPastureChange
);
...
@@ -128,58 +128,55 @@ public class GamsRasterOptimiser {
...
@@ -128,58 +128,55 @@ public class GamsRasterOptimiser {
double
prevForestTotal
=
prevManagedForest
+
prevUnmanagedForest
;
double
prevForestTotal
=
prevManagedForest
+
prevUnmanagedForest
;
double
prevForestToNaturalFraction
=
(
prevNatural
>
0
)
?
prevForestTotal
/
prevNatural
:
0
;
double
prevForestToNaturalFraction
=
(
prevNatural
>
0
)
?
prevForestTotal
/
prevNatural
:
0
;
double
prevForestManagedFraction
=
(
prevForestTotal
>
0
)
?
prevManagedForest
/
prevForestTotal
:
0
;
double
prevForestManagedFraction
=
(
prevForestTotal
>
0
)
?
prevManagedForest
/
prevForestTotal
:
0
;
if
(
prevForestToNaturalFraction
>
1.0
)
prevForestToNaturalFraction
=
1.0
;
if
(
prevForestToNaturalFraction
>
1.0
)
prevForestToNaturalFraction
=
1.0
;
if
(
prevForestManagedFraction
>
1.0
)
prevForestManagedFraction
=
1.0
;
if
(
prevForestManagedFraction
>
1.0
)
prevForestManagedFraction
=
1.0
;
//this tries to honour spatial distribution of protected areas, force removal of pasture and cropland from protected areas
if
(
ModelConfig
.
FORCE_PROTECTED_AREAS
&&
year
>=
ModelConfig
.
FORCE_PROTECTED_AREAS_START_YEAR
)
{
double
protectedLandShortfall
=
0
;
for
(
LandUseItem
luItem:
landUseItemsForLocation
.
values
())
{
double
suitableLand
=
luItem
.
getSuitableArea
();
double
prevCropland
=
luItem
.
getLandCoverArea
(
LandCoverType
.
CROPLAND
);
double
prevPasture
=
luItem
.
getLandCoverArea
(
LandCoverType
.
PASTURE
);
//if we have more agricultural land in this cell than we should, remove it and add it to land needing reallocated
if
(
suitableLand
<
(
prevCropland
+
prevPasture
))
{
double
excessAgriculture
=
prevCropland
+
prevPasture
-
suitableLand
;
double
prevPastureFract
=
prevPasture
/
(
prevCropland
+
prevPasture
);
double
pastureShortfall
=
excessAgriculture
*
prevPastureFract
;
double
croplandShortfall
=
excessAgriculture
*
(
1
-
prevPastureFract
);
protectedLandShortfall
+=
luItem
.
moveAreas
(
LandCoverType
.
MANAGED_FOREST
,
LandCoverType
.
PASTURE
,
pastureShortfall
*
prevForestToNaturalFraction
*
prevForestManagedFraction
);
protectedLandShortfall
+=
luItem
.
moveAreas
(
LandCoverType
.
UNMANAGED_FOREST
,
LandCoverType
.
PASTURE
,
pastureShortfall
*
prevForestToNaturalFraction
*
(
1
-
prevForestManagedFraction
));
protectedLandShortfall
+=
luItem
.
moveAreas
(
LandCoverType
.
OTHER_NATURAL
,
LandCoverType
.
PASTURE
,
pastureShortfall
*
(
1
-
prevForestToNaturalFraction
));
protectedLandShortfall
+=
luItem
.
moveAreas
(
LandCoverType
.
MANAGED_FOREST
,
LandCoverType
.
CROPLAND
,
croplandShortfall
*
prevForestToNaturalFraction
*
prevForestManagedFraction
);
protectedLandShortfall
+=
luItem
.
moveAreas
(
LandCoverType
.
UNMANAGED_FOREST
,
LandCoverType
.
CROPLAND
,
croplandShortfall
*
prevForestToNaturalFraction
*
(
1
-
prevForestManagedFraction
));
protectedLandShortfall
+=
luItem
.
moveAreas
(
LandCoverType
.
OTHER_NATURAL
,
LandCoverType
.
CROPLAND
,
croplandShortfall
*
(
1
-
prevForestToNaturalFraction
));
protectedAreasPastureChange
+=
pastureShortfall
;
protectedAreasCroplandChange
+=
croplandShortfall
;
}
}
//this tries to honour spatial distribution of protected areas, force removal of pasture and cropland from protected areas and reallocate within cluster location
double
protectedLandShortfall
=
0
;
if
(
protectedLandShortfall
>
0.00001
)
{
for
(
LandUseItem
luItem:
landUseItemsForLocation
.
values
())
{
LogWriter
.
printlnWarning
(
"locID "
+
locId
+
" Not able to incorporate all protected area changes "
+
protectedLandShortfall
+
" remains unprotected."
);
}
if
(
DEBUG
)
{
double
suitableLand
=
luItem
.
getSuitableArea
();
LogWriter
.
println
(
"protectedAreasPastureChange "
+
protectedAreasPastureChange
+
" protectedAreasCroplandChange "
+
protectedAreasCroplandChange
);
double
prevCropland
=
luItem
.
getLandCoverArea
(
LandCoverType
.
CROPLAND
);
double
prevPasture
=
luItem
.
getLandCoverArea
(
LandCoverType
.
PASTURE
);
//if we have more agricultural land in this cell than we should, remove it and add it to land needing reallocated
if
(
suitableLand
<
(
prevCropland
+
prevPasture
))
{
double
excessAgriculture
=
prevCropland
+
prevPasture
-
suitableLand
;
double
prevPastureFract
=
prevPasture
/
(
prevCropland
+
prevPasture
);
double
pastureShortfall
=
excessAgriculture
*
prevPastureFract
;
double
croplandShortfall
=
excessAgriculture
*
(
1
-
prevPastureFract
);
protectedLandShortfall
+=
luItem
.
moveAreas
(
LandCoverType
.
MANAGED_FOREST
,
LandCoverType
.
PASTURE
,
pastureShortfall
*
prevForestToNaturalFraction
*
prevForestManagedFraction
);
protectedLandShortfall
+=
luItem
.
moveAreas
(
LandCoverType
.
UNMANAGED_FOREST
,
LandCoverType
.
PASTURE
,
pastureShortfall
*
prevForestToNaturalFraction
*
(
1
-
prevForestManagedFraction
));
protectedLandShortfall
+=
luItem
.
moveAreas
(
LandCoverType
.
OTHER_NATURAL
,
LandCoverType
.
PASTURE
,
pastureShortfall
*
(
1
-
prevForestToNaturalFraction
));
protectedLandShortfall
+=
luItem
.
moveAreas
(
LandCoverType
.
MANAGED_FOREST
,
LandCoverType
.
CROPLAND
,
croplandShortfall
*
prevForestToNaturalFraction
*
prevForestManagedFraction
);
protectedLandShortfall
+=
luItem
.
moveAreas
(
LandCoverType
.
UNMANAGED_FOREST
,
LandCoverType
.
CROPLAND
,
croplandShortfall
*
prevForestToNaturalFraction
*
(
1
-
prevForestManagedFraction
));
protectedLandShortfall
+=
luItem
.
moveAreas
(
LandCoverType
.
OTHER_NATURAL
,
LandCoverType
.
CROPLAND
,
croplandShortfall
*
(
1
-
prevForestToNaturalFraction
));
protectedAreasPastureChange
+=
pastureShortfall
;
protectedAreasCroplandChange
+=
croplandShortfall
;
}
}
}
if
(
protectedLandShortfall
>
0.00001
)
{
LogWriter
.
printlnWarning
(
"locID "
+
locId
+
" Not able to incorporate all protected area changes "
+
protectedLandShortfall
+
" remains unprotected."
);
}
}
if
(
DEBUG
)
{
LogWriter
.
println
(
"protectedAreasPastureChange "
+
protectedAreasPastureChange
+
" protectedAreasCroplandChange "
+
protectedAreasCroplandChange
);
}
double
totalPastureChange
=
protectedAreasPastureChange
+
gamsPastureChange
;
double
totalPastureChange
=
protectedAreasPastureChange
+
gamsPastureChange
;
double
totalCroplandChange
=
protectedAreasCroplandChange
+
gamsCroplandChange
;
double
totalCroplandChange
=
protectedAreasCroplandChange
+
gamsCroplandChange
;
...
@@ -235,7 +232,7 @@ public class GamsRasterOptimiser {
...
@@ -235,7 +232,7 @@ public class GamsRasterOptimiser {
}
}
}
}
}
}
return
newLandUseRaster
;
return
newLandUseRaster
;
}
}
...
@@ -265,7 +262,7 @@ public class GamsRasterOptimiser {
...
@@ -265,7 +262,7 @@ public class GamsRasterOptimiser {
double
totalShortfall
=
0
;
double
totalShortfall
=
0
;
Set
<
RasterKey
>
keysWithSpace
=
new
HashSet
<
RasterKey
>();
Set
<
RasterKey
>
keysWithSpace
=
new
HashSet
<
RasterKey
>();
double
totalUnprotectedLC
=
0
;
double
totalUnprotectedLC
=
0
;
for
(
RasterKey
key
:
keys
)
{
for
(
RasterKey
key
:
keys
)
{
LandUseItem
newLandUseItem
=
newLandUseRaster
.
get
(
key
);
LandUseItem
newLandUseItem
=
newLandUseRaster
.
get
(
key
);
totalUnprotectedLC
+=
newLandUseItem
.
getUnprotectedLandCoverArea
(
fromType
);
totalUnprotectedLC
+=
newLandUseItem
.
getUnprotectedLandCoverArea
(
fromType
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment