Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Dynamic Exposure
Global Dynamic Exposure
gde-core
Commits
c861cd3d
Commit
c861cd3d
authored
Apr 12, 2022
by
Cecilia Nievas
Browse files
Fixed NaN OBM buildings in GDEProcessor.process_group_data_unit_tiles()
parent
131edb30
Pipeline
#41419
passed with stage
in 2 minutes and 12 seconds
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
gdecore/processor.py
View file @
c861cd3d
...
...
@@ -781,6 +781,7 @@ class GDEProcessor:
# aggregated and OBM buildings per data-unit tiles in the same DataFrame
data_unit_tiles_full
=
data_unit_tiles
.
join
(
obm_buildings_per_quadkey
.
counts
,
"quadkey"
)
data_unit_tiles_full
=
data_unit_tiles_full
.
rename
(
columns
=
{
"counts"
:
"obm_buildings"
})
data_unit_tiles_full
[
"obm_buildings"
]
=
data_unit_tiles_full
[
"obm_buildings"
].
fillna
(
0
)
# Prepare 'data_unit_tiles' for parallel processing:
# each tuple contains (quadkey, aggregated_buildings, obm_buildings) of a data-unit tile
...
...
tests/data/test_database_set_up.sql
View file @
c861cd3d
...
...
@@ -209,4 +209,6 @@ CREATE TABLE obm_built_area_assessments
INSERT
INTO
obm_built_area_assessments
(
quadkey
,
source_id
,
completeness
)
VALUES
(
'122010321033023130'
,
1
,
0
),
(
'122010321033023120'
,
1
,
0
),
(
'122010321033023132'
,
1
,
1
);
(
'122010321033023132'
,
1
,
1
),
(
'122010321033023121'
,
1
,
0
),
(
'122010321033023123'
,
1
,
1
);
tests/test_processor.py
View file @
c861cd3d
...
...
@@ -480,8 +480,14 @@ def test_process_group_data_unit_tiles(test_db):
data_unit_tiles
=
pandas
.
DataFrame
(
{
"quadkey"
:
[
"122010321033023120"
,
"122010321033023132"
,
"122010321033023130"
],
"aggregated_buildings"
:
[
39.1
,
34.4
,
15.7
],
"quadkey"
:
[
"122010321033023120"
,
"122010321033023132"
,
"122010321033023130"
,
"122010321033023121"
,
"122010321033023123"
,
],
"aggregated_buildings"
:
[
39.1
,
34.4
,
15.7
,
26.2
,
16.5
],
}
)
...
...
@@ -497,8 +503,10 @@ def test_process_group_data_unit_tiles(test_db):
expected_output
[
"122010321033023130"
]
=
(
12.7
,
False
)
expected_output
[
"122010321033023120"
]
=
(
0.0
,
False
)
expected_output
[
"122010321033023132"
]
=
(
0.0
,
True
)
expected_output
[
"122010321033023121"
]
=
(
26.2
,
False
)
expected_output
[
"122010321033023123"
]
=
(
0.0
,
True
)
assert
returned_data_unit_tiles_full
.
shape
[
0
]
==
3
assert
returned_data_unit_tiles_full
.
shape
[
0
]
==
5
for
quadkey
in
expected_output
.
keys
():
assert
(
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment