Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
manuscript_code
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
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
Maria Voigt
manuscript_code
Commits
159c0ef8
Commit
159c0ef8
authored
7 years ago
by
Maria Voigt
Browse files
Options
Downloads
Patches
Plain Diff
deleting cover change and changing the absence layer
parent
553bfa2b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/resource_use/preparing_grid_resource_use.py
+11
-18
11 additions, 18 deletions
src/resource_use/preparing_grid_resource_use.py
with
11 additions
and
18 deletions
src/resource_use/preparing_grid_resource_use.py
+
11
−
18
View file @
159c0ef8
...
@@ -24,20 +24,20 @@ import os
...
@@ -24,20 +24,20 @@ import os
"""
"""
# absence
# absence
os.system(
"
gdal_rasterize
\
os.system(
"
gdal_rasterize
\
-l absence_
shape_re
p
\
-l absence_
diss_ex
p
\
-burn 1
\
-burn 1
\
-ot Float32
\
-ot Float32
\
-te -1751798.359 1267454.241 -629798.359 2560454.241 -ts 1122 1293
\
-te -1751798.359 1267454.241 -629798.359 2560454.241 -ts 1122 1293
\
/homes/mv39zilo/work/Borneo/data/response/cleaned_data/absence_shape/absence_shape_rep.shp
\
/homes/mv39zilo/work/Borneo/data/response/cleaned_data/absence_shape/absence_shape_rep
_expanded_22_08_17
.shp
\
/homes/mv39zilo/work/Borneo/data/response/cleaned_data/absence_shape/absence_shape_rep.tif
"
)
/homes/mv39zilo/work/Borneo/data/response/cleaned_data/absence_shape/absence_shape_rep
_expanded_22_08_17
.tif
"
)
os.system(
"
gdal_rasterize
\
os.system(
"
gdal_rasterize
\
-l absence_shape_rep
\
-l absence_shape_rep
_expanded_22_08_17
\
-burn 1
\
-burn 1
\
-ot Float32
\
-ot Float32
\
-ts 1122 1293
\
-ts 1122 1293
\
/homes/mv39zilo/work/Borneo/data/response/cleaned_data/absence_shape/absence_shape_rep.shp
\
/homes/mv39zilo/work/Borneo/data/response/cleaned_data/absence_shape/absence_shape_rep
_expanded_22_08_17
.shp
\
/homes/mv39zilo/work/Borneo/data/response/cleaned_data/absence_shape/absence_shape_rep.tif
"
)
/homes/mv39zilo/work/Borneo/data/response/cleaned_data/absence_shape/absence_shape_rep
_expanded_22_08_17
.tif
"
)
os.system(
"
gdalwarp
\
os.system(
"
gdalwarp
\
-t_srs
'
+proj=aea +lat_1=7 +lat_2=-32 +lat_0=-15 +lon_0=125 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs
'
\
-t_srs
'
+proj=aea +lat_1=7 +lat_2=-32 +lat_0=-15 +lon_0=125 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs
'
\
...
@@ -45,8 +45,8 @@ os.system("gdalwarp \
...
@@ -45,8 +45,8 @@ os.system("gdalwarp \
-te -1751798.359 1267454.241 -629798.359 2560454.241
\
-te -1751798.359 1267454.241 -629798.359 2560454.241
\
-ts 1122 1293
\
-ts 1122 1293
\
-overwrite
\
-overwrite
\
/homes/mv39zilo/work/Borneo/data/response/cleaned_data/absence_shape/absence_shape_rep.tif
\
/homes/mv39zilo/work/Borneo/data/response/cleaned_data/absence_shape/absence_shape_rep
_expanded_22_08_17
.tif
\
/homes/mv39zilo/work/Borneo/data/response/cleaned_data/absence_shape/absence_shape_repro_res.tif
"
/homes/mv39zilo/work/Borneo/data/response/cleaned_data/absence_shape/absence_shape_
expanded_22_08_17_
repro_res.tif
"
)
)
os.system(
"
gdalwarp
\
os.system(
"
gdalwarp
\
...
@@ -76,7 +76,7 @@ os.system("gdalwarp \
...
@@ -76,7 +76,7 @@ os.system("gdalwarp \
absence_path
=
"
/homes/mv39zilo/work/Borneo/data/response/cleaned_data/absence_shape/absence_shape_repro_res.tif
"
absence_path
=
"
/homes/mv39zilo/work/Borneo/data/response/cleaned_data/absence_shape/absence_shape_
expanded_22_08_17_
repro_res.tif
"
absence
=
mp
.
tiff
.
read_tif
(
absence_path
,
1
)
absence
=
mp
.
tiff
.
read_tif
(
absence_path
,
1
)
grid_layer_path
=
"
/homes/mv39zilo/work/Borneo/data/future/grid_repro_res.tif
"
grid_layer_path
=
"
/homes/mv39zilo/work/Borneo/data/future/grid_repro_res.tif
"
...
@@ -115,10 +115,7 @@ plantations = mp.tiff.read_tif(plantation_path, 1)
...
@@ -115,10 +115,7 @@ plantations = mp.tiff.read_tif(plantation_path, 1)
old_plantations_path
=
"
/homes/mv39zilo/work/Borneo/data/predictors/raw_data/Land_cover_trajectory_before_oil-palm_and_pulpwood_establishment/raster_plantation_old_repro_res.tif
"
old_plantations_path
=
"
/homes/mv39zilo/work/Borneo/data/predictors/raw_data/Land_cover_trajectory_before_oil-palm_and_pulpwood_establishment/raster_plantation_old_repro_res.tif
"
old_plantations
=
mp
.
tiff
.
read_tif
(
old_plantations_path
,
1
)
old_plantations
=
mp
.
tiff
.
read_tif
(
old_plantations_path
,
1
)
# burnt areas
burnt_areas_path
=
"
/homes/mv39zilo/work/Borneo/data/predictors/raw_data/Scrub_ie_forest_destroyed_by_fire/REGIONBorneo_DegradedForestByDroughtAndFire_2015_CIFOR_repro_res.tif
"
burnt
=
mp
.
tiff
.
read_tif
(
burnt_areas_path
,
1
)
np
.
unique
(
burnt
)
dem_path
=
"
/homes/mv39zilo/work/Borneo/data/predictors/cleaned_data/cleaned_predictors/dem_repro_res.tif
"
dem_path
=
"
/homes/mv39zilo/work/Borneo/data/predictors/cleaned_data/cleaned_predictors/dem_repro_res.tif
"
dem
=
mp
.
tiff
.
read_tif
(
dem_path
,
1
)
dem
=
mp
.
tiff
.
read_tif
(
dem_path
,
1
)
...
@@ -140,13 +137,11 @@ grid = np.where((plantations == 0) &
...
@@ -140,13 +137,11 @@ grid = np.where((plantations == 0) &
# 3 logged
# 3 logged
grid
=
np
.
where
((
plantations
==
0
)
&
grid
=
np
.
where
((
plantations
==
0
)
&
(
gaveau_deforested
==
0
)
&
(
gaveau_deforested
==
0
)
&
(
cover_change
==
0
)
&
(
gaveau_logged
==
1
)
&
(
gaveau_logged
==
1
)
&
(
grid
==
1
),
3
,
grid
)
(
grid
==
1
),
3
,
grid
)
# 4 primary forest
# 4 primary forest
grid
=
np
.
where
((
plantations
==
0
)
&
grid
=
np
.
where
((
plantations
==
0
)
&
(
gaveau_deforested
==
0
)
&
(
gaveau_deforested
==
0
)
&
(
cover_change
==
0
)
&
(
gaveau_logged
==
0
)
&
(
gaveau_logged
==
0
)
&
(
gaveau_primary_forest
==
1
)
&
(
gaveau_primary_forest
==
1
)
&
(
grid
==
1
),
4
,
grid
)
(
grid
==
1
),
4
,
grid
)
...
@@ -162,7 +157,6 @@ grid = np.where((grid == 4) &
...
@@ -162,7 +157,6 @@ grid = np.where((grid == 4) &
# 6 regrowth
# 6 regrowth
grid
=
np
.
where
((
plantations
==
0
)
&
grid
=
np
.
where
((
plantations
==
0
)
&
(
gaveau_deforested
==
0
)
&
(
gaveau_deforested
==
0
)
&
(
cover_change
==
0
)
&
(
gaveau_logged
==
0
)
&
(
gaveau_logged
==
0
)
&
(
gaveau_primary_forest
==
0
)
&
(
gaveau_primary_forest
==
0
)
&
(
gaveau_regrowth
==
1
)
&
(
gaveau_regrowth
==
1
)
&
...
@@ -172,7 +166,6 @@ grid = np.where((plantations == 0) &
...
@@ -172,7 +166,6 @@ grid = np.where((plantations == 0) &
grid
=
np
.
where
((
plantations
==
0
)
&
grid
=
np
.
where
((
plantations
==
0
)
&
(
gaveau_deforested
==
0
)
&
(
gaveau_deforested
==
0
)
&
(
cover_change
==
0
)
&
(
gaveau_logged
==
0
)
&
(
gaveau_logged
==
0
)
&
(
gaveau_primary_forest
==
0
)
&
(
gaveau_primary_forest
==
0
)
&
(
gaveau_regrowth
==
0
)
&
(
gaveau_regrowth
==
0
)
&
...
@@ -184,7 +177,6 @@ grid = np.where((plantations == 0) &
...
@@ -184,7 +177,6 @@ grid = np.where((plantations == 0) &
# 8 is other
# 8 is other
grid
=
np
.
where
((
plantations
==
0
)
&
grid
=
np
.
where
((
plantations
==
0
)
&
(
gaveau_deforested
==
0
)
&
(
gaveau_deforested
==
0
)
&
(
cover_change
==
0
)
&
(
gaveau_logged
==
0
)
&
(
gaveau_logged
==
0
)
&
(
gaveau_primary_forest
==
0
)
&
(
gaveau_primary_forest
==
0
)
&
(
gaveau_regrowth
==
0
)
&
(
gaveau_regrowth
==
0
)
&
...
@@ -218,6 +210,7 @@ grid_map = np.where((grid > 6), 3, grid_map)
...
@@ -218,6 +210,7 @@ grid_map = np.where((grid > 6), 3, grid_map)
# need to clip this with the area in which we have orangutans in 1999
# need to clip this with the area in which we have orangutans in 1999
year
=
1999
abundance_path
=
"
/homes/mv39zilo/work/Borneo/analysis/model_prep_and_running/results/abundMod/testing_ae_and_absence/pipeline_results/ppln_ae75m_50-2017-02-28T18-00-52/prediction_map_
"
+
str
(
year
)
+
"
_2017-02-28_repro_res.tif
"
abundance_path
=
"
/homes/mv39zilo/work/Borneo/analysis/model_prep_and_running/results/abundMod/testing_ae_and_absence/pipeline_results/ppln_ae75m_50-2017-02-28T18-00-52/prediction_map_
"
+
str
(
year
)
+
"
_2017-02-28_repro_res.tif
"
abundance
=
mp
.
tiff
.
read_tif
(
abundance_path
,
1
)
abundance
=
mp
.
tiff
.
read_tif
(
abundance_path
,
1
)
...
...
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