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
553bfa2b
Commit
553bfa2b
authored
7 years ago
by
Maria Voigt
Browse files
Options
Downloads
Patches
Plain Diff
deleting burnt and fixing bug in output
parent
46852746
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/validation/grid_mapping_for_resource_use.py
+34
-15
34 additions, 15 deletions
src/validation/grid_mapping_for_resource_use.py
with
34 additions
and
15 deletions
src/validation/grid_mapping_for_resource_use.py
+
34
−
15
View file @
553bfa2b
...
...
@@ -12,12 +12,17 @@ Spyder Editor
# the grid_id from the 4rth to the 10th position (6 positions)
#
# now assigning number for each resource use
# now assigning number for each resource use
# 0 - absence
# 1 - plantation
# 2 - deforestation
# 3 - landcover change
# 4 - logging
# 5 - other
# 5 - primary forest < 750m
# 6 - primary forest > 750
# 7 - regrowth
# 8 - plantations before 2000
# 9 - other
"""
...
...
@@ -79,28 +84,42 @@ np.unique(grid)
resource_use
=
mp
.
tiff
.
read_tif
(
"
/homes/mv39zilo/work/Borneo/data/resource_use/resource_use_grid.tif
"
,
1
)
np
.
unique
(
resource_use
)
country_layer_path
=
"
/homes/mv39zilo/work/Borneo/data/auxiliary_additional_data/Borneo_shape/cleaned_data/Borneo_country_repro_res.tif
"
borneo
=
mp
.
tiff
.
read_tif
(
country_layer_path
,
1
)
"""
# format
1 0 0 0 0 0 000 000
(1 / 2) 0 (3 / 6) 0 (1-9) 0 700 000
out/in, MYS/IDN, category,grid_id
"""
# pixel is out / out
resource_grid_1
=
np
.
where
(
absence
==
1
,
1000000000
,
2000000000
)
resource_grid_2
=
np
.
where
(
resource_use
>
0
,
(
resource_grid_1
+
resource_use
*
10000000
),
resource_grid_1
=
np
.
where
(
absence
==
1
,
100000000000
,
200000000000
)
# country
resource_grid_2
=
np
.
where
(
borneo
==
136
,
(
resource_grid_1
+
3
*
1000000000
),
resource_grid_1
)
np
.
unique
(
resource_grid_2
)
resource_grid_3
=
np
.
where
(
borneo
==
106
,
(
resource_grid_2
+
6
*
1000000000
),
resource_grid_2
)
resource_grid_4
=
np
.
where
(
resource_use
>
0
,
(
resource_grid_3
+
resource_use
*
10000000
),
resource_grid_3
)
np
.
unique
(
resource_grid_4
)
# now assigning number for each resource use
# 0 - absence
# 1 - plantation
# 2 - deforestation
# 3 - landcover change
# 4 - logging
# 5 - other
resource_grid_
3
=
np
.
where
(
grid
>
0
,
(
resource_grid_
2
+
grid
),
resource_grid_
2
)
np
.
unique
(
resource_grid_
3
)
resource_grid_
5
=
np
.
where
(
grid
>
0
,
(
resource_grid_
4
+
grid
),
resource_grid_
4
)
np
.
unique
(
resource_grid_
5
)
mp
.
tiff
.
write_tif
(
file_with_srid
=
"
/homes/mv39zilo/work/Borneo/analysis/model_prep_and_running/results/future/grid_with_id_repro_res.tif
"
,
full_output_name
=
"
/homes/mv39zilo/work/Borneo/analysis/model_prep_and_running/results/resource_use/resource_grid_
3
.tif
"
,
data
=
resource_grid_
3
,
full_output_name
=
"
/homes/mv39zilo/work/Borneo/analysis/model_prep_and_running/results/resource_use/resource_grid_
absence_country_category_id
.tif
"
,
data
=
resource_grid_
5
,
dtype
=
5
)
# use this in R script "prepare_boot_grid.R"
...
...
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