maps4fs 0.9.8__py3-none-any.whl → 0.9.91__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- maps4fs/generator/dem.py +18 -0
- maps4fs/generator/map.py +8 -4
- {maps4fs-0.9.8.dist-info → maps4fs-0.9.91.dist-info}/METADATA +1 -1
- {maps4fs-0.9.8.dist-info → maps4fs-0.9.91.dist-info}/RECORD +7 -7
- {maps4fs-0.9.8.dist-info → maps4fs-0.9.91.dist-info}/LICENSE.md +0 -0
- {maps4fs-0.9.8.dist-info → maps4fs-0.9.91.dist-info}/WHEEL +0 -0
- {maps4fs-0.9.8.dist-info → maps4fs-0.9.91.dist-info}/top_level.txt +0 -0
maps4fs/generator/dem.py
CHANGED
@@ -79,6 +79,22 @@ class DEM(Component):
|
|
79
79
|
)
|
80
80
|
return dem_width, dem_height
|
81
81
|
|
82
|
+
def to_ground(self, data: np.ndarray) -> np.ndarray:
|
83
|
+
"""Receives the signed 16-bit integer array and converts it to the ground level.
|
84
|
+
If the min value is negative, it will become zero value and the rest of the values
|
85
|
+
will be shifted accordingly.
|
86
|
+
"""
|
87
|
+
# For examlem, min value was -50, it will become 0 and for all values we'll +50.
|
88
|
+
|
89
|
+
if data.min() < 0:
|
90
|
+
self.logger.debug("Array contains negative values, will be shifted to the ground.")
|
91
|
+
data = data + abs(data.min())
|
92
|
+
|
93
|
+
self.logger.debug(
|
94
|
+
"Array was shifted to the ground. Min: %s, max: %s.", data.min(), data.max()
|
95
|
+
)
|
96
|
+
return data
|
97
|
+
|
82
98
|
# pylint: disable=no-member
|
83
99
|
def process(self) -> None:
|
84
100
|
"""Reads SRTM file, crops it to map size, normalizes and blurs it,
|
@@ -119,6 +135,8 @@ class DEM(Component):
|
|
119
135
|
data.max(),
|
120
136
|
)
|
121
137
|
|
138
|
+
data = self.to_ground(data)
|
139
|
+
|
122
140
|
resampled_data = cv2.resize(
|
123
141
|
data, dem_output_resolution, interpolation=cv2.INTER_LINEAR
|
124
142
|
).astype("uint16")
|
maps4fs/generator/map.py
CHANGED
@@ -116,15 +116,19 @@ class Map:
|
|
116
116
|
)
|
117
117
|
return previews
|
118
118
|
|
119
|
-
def pack(self,
|
119
|
+
def pack(self, archive_path: str, remove_source: bool = True) -> str:
|
120
120
|
"""Pack map directory to zip archive.
|
121
121
|
|
122
122
|
Args:
|
123
|
-
|
123
|
+
archive_path (str): Path to the archive.
|
124
|
+
remove_source (bool, optional): Remove source directory after packing.
|
124
125
|
|
125
126
|
Returns:
|
126
127
|
str: Path to the archive.
|
127
128
|
"""
|
128
|
-
archive_path = shutil.make_archive(
|
129
|
-
self.logger.info("Map packed to %s.zip",
|
129
|
+
archive_path = shutil.make_archive(archive_path, "zip", self.map_directory)
|
130
|
+
self.logger.info("Map packed to %s.zip", archive_path)
|
131
|
+
if remove_source:
|
132
|
+
shutil.rmtree(self.map_directory)
|
133
|
+
self.logger.info("Map directory removed: %s", self.map_directory)
|
130
134
|
return archive_path
|
@@ -4,18 +4,18 @@ maps4fs/generator/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk
|
|
4
4
|
maps4fs/generator/background.py,sha256=AP-Z3F-4I9achvA9xsaXAAoA6IHtmPLxb1RkUsVYdbg,14036
|
5
5
|
maps4fs/generator/component.py,sha256=ZEDjChPnvqAsgnBu2f2YBOlwGOlfax4VaAYBcJerLIQ,10684
|
6
6
|
maps4fs/generator/config.py,sha256=ZO5BWDU-S3p0-ndKDSFa8Oin3YcYy0iH8B4lqEA_07Q,4275
|
7
|
-
maps4fs/generator/dem.py,sha256=
|
7
|
+
maps4fs/generator/dem.py,sha256=rBqVeWiLEpY89EIpfnSENOYsNYxsJcV_Y2UuBalE104,16438
|
8
8
|
maps4fs/generator/game.py,sha256=94HjPNOyy6XSSOnBp-uxrkBglKyC-X3ULIrrucfdlKw,6825
|
9
9
|
maps4fs/generator/i3d.py,sha256=UuQiQRusPQ2f6PvGKxJ_UZeXsx3uG15efmy8Ysnm3F8,3597
|
10
|
-
maps4fs/generator/map.py,sha256=
|
10
|
+
maps4fs/generator/map.py,sha256=_LQe54KLfS_4M462UiiNSqKyUroqnQ8inwXZIZDP9a0,4487
|
11
11
|
maps4fs/generator/path_steps.py,sha256=yeN6hmOD8O2LMozUf4HcQMIy8WJ5sHF5pGQT_s2FfOw,3147
|
12
12
|
maps4fs/generator/qgis.py,sha256=R5Iv3ovyLXkhAL5Oy41u3ZLNOSEbc1byLetzPootO7o,6091
|
13
13
|
maps4fs/generator/texture.py,sha256=CwaXZfAG4e3D3YR7yVR2MC677EHpbUWTboCS3G6jkhk,17723
|
14
14
|
maps4fs/generator/tile.py,sha256=3vmfjQiPiiUZKPuIo5tg2rOKkgcP1NRVkMGK-Vo10-A,2138
|
15
15
|
maps4fs/toolbox/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,43
|
16
16
|
maps4fs/toolbox/dem.py,sha256=53KVZ6IKIlK642eYFSRDAC8l2HL9IEUpQNYkkTC56uU,3510
|
17
|
-
maps4fs-0.9.
|
18
|
-
maps4fs-0.9.
|
19
|
-
maps4fs-0.9.
|
20
|
-
maps4fs-0.9.
|
21
|
-
maps4fs-0.9.
|
17
|
+
maps4fs-0.9.91.dist-info/LICENSE.md,sha256=-JY0v7p3dwXze61EbYiK7YEJ2aKrjaFZ8y2xYEOrmRY,1068
|
18
|
+
maps4fs-0.9.91.dist-info/METADATA,sha256=f3HjLTLqTPdawct_RVHaq4004NR07XR440jh80KBRA8,25171
|
19
|
+
maps4fs-0.9.91.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
20
|
+
maps4fs-0.9.91.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
|
21
|
+
maps4fs-0.9.91.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|