Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
Land-Water Discretizer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Global Dynamic Exposure
Completeness
Land-Water Discretizer
Commits
15c78502
Commit
15c78502
authored
2 years ago
by
Karsten Prehn
Browse files
Options
Downloads
Patches
Plain Diff
Added fix for false classification with duplicate tiles
parent
5a92e224
No related branches found
Branches containing commit
No related tags found
1 merge request
!33
Added fix for false classification with duplicate tiles
Pipeline
#46864
passed
2 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
discretizer/discretize.py
+12
-1
12 additions, 1 deletion
discretizer/discretize.py
with
12 additions
and
1 deletion
discretizer/discretize.py
+
12
−
1
View file @
15c78502
...
...
@@ -521,6 +521,11 @@ class Discretizer(Quadtile, Config):
columns
=
[
"
id
"
,
"
completeness
"
,
"
geometry
"
]
)
# Drop duplicate tiles from sea- and inland-water, so dissolving the combined tiles
# later by ID doesn't falsely sum up classification values
seawater_per_tile_gdf
=
seawater_per_tile_gdf
.
drop_duplicates
([
"
id
"
])
inlandwater_per_tile_gdf
=
inlandwater_per_tile_gdf
.
drop_duplicates
([
"
id
"
])
# Concatenate inland-water and sea-water tiles
water_per_tile_gdf
=
seawater_per_tile_gdf
.
append
(
inlandwater_per_tile_gdf
)
...
...
@@ -531,7 +536,6 @@ class Discretizer(Quadtile, Config):
water_per_tile_gdf
=
gpd
.
GeoDataFrame
(
columns
=
[
"
id
"
,
"
geometry
"
,
"
completeness
"
])
# Sum up sea-water and inland-water classification and aggregate geometries
# _combined_water = water_per_tile_gdf.groupby(["id"]).agg(sum)
_combined_water
=
water_per_tile_gdf
.
dissolve
(
by
=
"
id
"
,
aggfunc
=
{
"
completeness
"
:
"
sum
"
})
_len
=
len
(
set
(
_combined_water
.
index
.
tolist
()))
self
.
log
.
debug
(
f
"
<[
{
pid
}
]> Dissolved into
{
_len
}
water polygon geometries.
"
)
...
...
@@ -646,6 +650,13 @@ class Discretizer(Quadtile, Config):
water_per_tile_gdf
.
set_index
(
"
id
"
)[
"
completeness
"
]
+
self
.
classification
.
VALUE_LAND
)
# Check that classification is within the constraints of the bitmask
if
not
all
(
0
<=
t
<=
7
for
t
in
tile_polygons_gdf
[
"
completeness
"
].
tolist
()):
_gdf
=
tile_polygons_gdf
[
tile_polygons_gdf
[
"
completeness
"
].
between
(
0
,
7
)]
raise
ValueError
(
f
"
<[
{
pid
}
]> Coast-tile classification has to be between `000` and `111` (7).
{
_gdf
}
"
)
# Add water-polygon column to the tiles data set
# We call the water-polygon field `water_geom`; bear in mind the land-polygon field
# is called `geometry`
...
...
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