Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
geopat
geopat
Commits
18d05f66
Commit
18d05f66
authored
Apr 12, 2019
by
Dumoulin Nicolas
Browse files
indicator changed from minimization to maximisation
parent
6e4c1f4d
Changes
1
Hide whitespace changes
Inline
Side-by-side
scenariosAleatoires/social.py
View file @
18d05f66
...
...
@@ -43,13 +43,16 @@ class Social:
# patches that have different farming that others of the same farmer
if
row
[
'cultgeopat_y'
]
not
in
filter1
[
filter1
[
'id_expl'
]
==
row
[
'id_expl'
]][
'cultgeopat_x'
]:
cost
+=
self
.
matrice_transition
[
row
[
'cultgeopat_x'
]][
row
[
'cultgeopat_y'
]]
return
cost
return
1
/
(
1
+
cost
)
if
__name__
==
'__main__'
:
import
geopandas
as
gpd
patches
=
gpd
.
GeoDataFrame
.
from_file
(
"../output/PAT_patches/PAT_patches.shp"
,
encoding
=
'utf-8'
)
social
=
Social
(
patches
,
'../resources/matrice_transition.csv'
,
0.1
)
scenario_patches
=
patches
.
copy
()
print
(
social
.
compute_indicator
(
scenario_patches
))
scenario_patches
.
ix
[
2
,
'cultgeopat'
]
=
'Protéagineux'
social
=
Social
(
patches
,
'../resources/matrice_transition.csv'
,
0.1
)
print
(
social
.
compute_indicator
(
scenario_patches
))
# should give 0.5 the cost for one transition to Protéagineux
scenario_patches
[
'cultgeopat'
]
=
'Fruits et légumes'
print
(
social
.
compute_indicator
(
scenario_patches
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment