Skip to content

Commit 6db608d

Browse files
committed
Reburn network
1 parent fd72a3c commit 6db608d

3 files changed

Lines changed: 18 additions & 14 deletions

File tree

fct/drainage/BorderFlats.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,12 @@ def LabelBorderFlatsTile(row, col, params, tileset='default', **kwargs):
109109
elevations[0, :],
110110
elevations[:, -1],
111111
np.flip(elevations[-1, :], axis=0),
112-
np.flip(elevations[:, 0], axis=0)]),
112+
np.flip(elevations[:, 0], axis=0)], dtype=object),
113113
labels=np.array([
114114
labels[0, :],
115115
labels[:, -1],
116116
np.flip(labels[-1, :], axis=0),
117-
np.flip(labels[:, 0], axis=0)]),
117+
np.flip(labels[:, 0], axis=0)], dtype=object),
118118
flatindex=flatindex,
119119
graph=np.array(list(graph.items()), dtype=object)
120120
)

fct/drainage/Burn.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
box
2727
)
2828

29-
from .. import terrain_analysis as ta
30-
from ..config import config
31-
from ..rasterize import rasterize_linestringz
29+
from fct import terrain_analysis as ta
30+
from fct.config import config
31+
from fct.rasterize import rasterize_linestringz
3232

3333
# def DispatchHydrographyToTiles():
3434

@@ -50,7 +50,7 @@
5050
# for feature in features:
5151
# fst.write(feature)
5252

53-
def BurnTile(params, row, col, tileset='default'):
53+
def BurnTile(params, row, col, elevations=None, tileset='default'):
5454
"""
5555
DOCME
5656
"""
@@ -62,7 +62,9 @@ def BurnTile(params, row, col, tileset='default'):
6262

6363
with rio.open(elevation_raster) as ds:
6464

65-
elevations = ds.read(1)
65+
if elevations is None:
66+
elevations = ds.read(1)
67+
6668
height, width = elevations.shape
6769

6870
if os.path.exists(hydrography):

fct/drainage/DepressionFill.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@
2323
import fiona
2424
import fiona.crs
2525

26-
from ..config import (
26+
from fct.config import (
2727
config,
2828
DatasetParameter,
2929
LiteralParameter
3030
)
31-
from .. import terrain_analysis as ta
32-
from .. import speedup
33-
from .Burn import BurnTile
31+
from fct import terrain_analysis as ta
32+
from fct import speedup
33+
from fct.drainage.Burn import BurnTile
3434

3535
from multiprocessing import Pool
36-
from ..cli import starcall_nokwargs
36+
from fct.cli import starcall_nokwargs
3737

3838
def tileindex(tileset='default'):
3939
"""
@@ -133,7 +133,7 @@ def step(msg):
133133
if offset < 0:
134134
elevations = ds.read(1)
135135
else:
136-
elevations = BurnTile(params, row, col, tileset=tileset)
136+
elevations = BurnTile(params, row, col, elevations=None, tileset=tileset)
137137

138138
step('Label flats')
139139

@@ -142,6 +142,8 @@ def step(msg):
142142

143143
step('Write filled DEM')
144144

145+
elevations = BurnTile(params, row, col, elevations, tileset=tileset) # Burn again filled elevations to avoid burned zone filling
146+
145147
profile.update(
146148
compress='deflate',
147149
tiled='yes'
@@ -167,7 +169,7 @@ def step(msg):
167169
elevations[0, :],
168170
elevations[:, -1],
169171
np.flip(elevations[-1, :], axis=0),
170-
np.flip(elevations[:, 0], axis=0)]),
172+
np.flip(elevations[:, 0], axis=0)], dtype=object),
171173
labels=np.array([
172174
labels[0, :],
173175
labels[:, -1],

0 commit comments

Comments
 (0)