maps4fs 1.8.216__py3-none-any.whl → 1.8.217__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/component/base/component.py +4 -1
- maps4fs/generator/dem.py +33 -7
- maps4fs/generator/dtm/dtm.py +0 -30
- maps4fs/generator/dtm/srtm.py +0 -1
- {maps4fs-1.8.216.dist-info → maps4fs-1.8.217.dist-info}/METADATA +1 -1
- {maps4fs-1.8.216.dist-info → maps4fs-1.8.217.dist-info}/RECORD +9 -9
- {maps4fs-1.8.216.dist-info → maps4fs-1.8.217.dist-info}/LICENSE.md +0 -0
- {maps4fs-1.8.216.dist-info → maps4fs-1.8.217.dist-info}/WHEEL +0 -0
- {maps4fs-1.8.216.dist-info → maps4fs-1.8.217.dist-info}/top_level.txt +0 -0
@@ -176,7 +176,10 @@ class Component:
|
|
176
176
|
self.logger.debug("Updated generation info, now contains %s fields", len(data))
|
177
177
|
|
178
178
|
with open(self.generation_info_path, "w", encoding="utf-8") as file:
|
179
|
-
|
179
|
+
try:
|
180
|
+
json.dump(updated_generation_info, file, indent=4)
|
181
|
+
except Exception as e:
|
182
|
+
self.logger.warning("Could not save updated generation info: %s", e)
|
180
183
|
|
181
184
|
self.logger.debug("Saved updated generation info to %s", self.generation_info_path)
|
182
185
|
|
maps4fs/generator/dem.py
CHANGED
@@ -63,6 +63,8 @@ class DEM(Component):
|
|
63
63
|
map=self.map,
|
64
64
|
)
|
65
65
|
|
66
|
+
self.info: dict[str, Any] = {}
|
67
|
+
|
66
68
|
@property
|
67
69
|
def dem_path(self) -> str:
|
68
70
|
"""Returns path to the DEM file.
|
@@ -112,6 +114,27 @@ class DEM(Component):
|
|
112
114
|
)
|
113
115
|
return dem_size, dem_size
|
114
116
|
|
117
|
+
def update_info(self, state: str, data: np.ndarray) -> None:
|
118
|
+
"""Update info dictionary with additional information about DEM data.
|
119
|
+
|
120
|
+
Arguments:
|
121
|
+
data (np.ndarray): DEM data.
|
122
|
+
"""
|
123
|
+
|
124
|
+
try:
|
125
|
+
entry = {
|
126
|
+
"min": float(data.min()),
|
127
|
+
"max": float(data.max()),
|
128
|
+
"std": data.std(),
|
129
|
+
"deviation": float(data.max() - data.min()),
|
130
|
+
"mean": data.mean(),
|
131
|
+
"dtype": str(data.dtype),
|
132
|
+
"shape": str(data.shape),
|
133
|
+
}
|
134
|
+
self.info[state] = entry
|
135
|
+
except Exception as e:
|
136
|
+
self.logger.warning("Failed to update DEM info: %s.", e)
|
137
|
+
|
115
138
|
def process(self) -> None:
|
116
139
|
"""Reads DTM file, crops it to map size, normalizes and blurs it,
|
117
140
|
saves to map directory."""
|
@@ -141,6 +164,8 @@ class DEM(Component):
|
|
141
164
|
data.max(),
|
142
165
|
)
|
143
166
|
|
167
|
+
self.update_info("original", data)
|
168
|
+
|
144
169
|
# Check if the data contains any non zero values, otherwise raise an error.
|
145
170
|
if not np.any(data):
|
146
171
|
self.logger.error("DTM provider returned empty data.")
|
@@ -151,10 +176,12 @@ class DEM(Component):
|
|
151
176
|
|
152
177
|
# 2. Apply multiplier (-10 to 120.4 becomes -20 to 240.8)
|
153
178
|
resampled_data = self.apply_multiplier(resampled_data)
|
179
|
+
self.update_info("multiplied", resampled_data)
|
154
180
|
|
155
181
|
# 3. Raise terrain, and optionally lower to plateau level+water depth
|
156
182
|
# e.g. -20 to 240.8m becomes 20 to 280.8m
|
157
183
|
resampled_data = self.raise_or_lower(resampled_data)
|
184
|
+
self.update_info("raised_lowered", resampled_data)
|
158
185
|
|
159
186
|
# 4. Determine actual height scale value using ceiling
|
160
187
|
# e.g. 255 becomes 280.8+10 = 291
|
@@ -163,6 +190,7 @@ class DEM(Component):
|
|
163
190
|
# 5. Normalize DEM data to 16-bit unsigned integer range (0 to 65535)
|
164
191
|
# e.g. multiply by 65535/291, clip and return as uint16
|
165
192
|
resampled_data = self.normalize_data(resampled_data, height_scale_value)
|
193
|
+
self.update_info("normalized", resampled_data)
|
166
194
|
|
167
195
|
# 6. Blur DEM data.
|
168
196
|
resampled_data = self.apply_blur(resampled_data)
|
@@ -205,10 +233,13 @@ class DEM(Component):
|
|
205
233
|
adjusted_height_scale = math.ceil(
|
206
234
|
max(height_scale, data.max() + self.map.dem_settings.ceiling)
|
207
235
|
)
|
236
|
+
self.info["adjusted_height_scale"] = adjusted_height_scale
|
208
237
|
|
209
238
|
self.map.shared_settings.height_scale_value = adjusted_height_scale # type: ignore
|
210
239
|
self.map.shared_settings.mesh_z_scaling_factor = 65535 / adjusted_height_scale
|
240
|
+
self.info["mesh_z_scaling_factor"] = 65535 / adjusted_height_scale
|
211
241
|
self.map.shared_settings.height_scale_multiplier = adjusted_height_scale / 255
|
242
|
+
self.info["height_scale_multiplier"] = adjusted_height_scale / 255
|
212
243
|
self.map.shared_settings.change_height_scale = True # type: ignore
|
213
244
|
|
214
245
|
self.logger.debug("Height scale value is %s.", adjusted_height_scale)
|
@@ -316,14 +347,9 @@ class DEM(Component):
|
|
316
347
|
)
|
317
348
|
|
318
349
|
def info_sequence(self) -> dict[Any, Any] | None: # type: ignore
|
319
|
-
"""Returns the information sequence for the component.
|
320
|
-
class. If the component does not have an information sequence, an empty dictionary must be
|
321
|
-
returned.
|
350
|
+
"""Returns the information sequence for the component.
|
322
351
|
|
323
352
|
Returns:
|
324
353
|
dict[Any, Any]: The information sequence for the component.
|
325
354
|
"""
|
326
|
-
|
327
|
-
if provider_info_sequence is None:
|
328
|
-
return {}
|
329
|
-
return provider_info_sequence
|
355
|
+
return self.info
|
maps4fs/generator/dtm/dtm.py
CHANGED
@@ -74,8 +74,6 @@ class DTMProvider(ABC):
|
|
74
74
|
self.logger = logger
|
75
75
|
self.map = map
|
76
76
|
|
77
|
-
self._data_info: dict[str, int | str | float] | None = None
|
78
|
-
|
79
77
|
@classmethod
|
80
78
|
def name(cls) -> str | None:
|
81
79
|
"""Name of the provider.
|
@@ -94,24 +92,6 @@ class DTMProvider(ABC):
|
|
94
92
|
"""
|
95
93
|
return cls._code
|
96
94
|
|
97
|
-
@property
|
98
|
-
def data_info(self) -> dict[str, int | str | float] | None:
|
99
|
-
"""Information about the DTM data.
|
100
|
-
|
101
|
-
Returns:
|
102
|
-
dict[str, int | str | float] | None: Information about the DTM data.
|
103
|
-
"""
|
104
|
-
return self._data_info
|
105
|
-
|
106
|
-
@data_info.setter
|
107
|
-
def data_info(self, value: dict[str, int | str | float] | None) -> None:
|
108
|
-
"""Set information about the DTM data.
|
109
|
-
|
110
|
-
Arguments:
|
111
|
-
value (dict[str, int | str | float] | None): Information about the DTM data.
|
112
|
-
"""
|
113
|
-
self._data_info = value
|
114
|
-
|
115
95
|
@property
|
116
96
|
def coordinates(self) -> tuple[float, float]:
|
117
97
|
"""Coordinates of the center point of the DTM data.
|
@@ -330,16 +310,6 @@ class DTMProvider(ABC):
|
|
330
310
|
|
331
311
|
return data
|
332
312
|
|
333
|
-
def info_sequence(self) -> dict[str, int | str | float] | None:
|
334
|
-
"""Returns the information sequence for the component. Must be implemented in the child
|
335
|
-
class. If the component does not have an information sequence, an empty dictionary must be
|
336
|
-
returned.
|
337
|
-
|
338
|
-
Returns:
|
339
|
-
dict[str, int | str | float] | None: Information sequence for the component.
|
340
|
-
"""
|
341
|
-
return self.data_info
|
342
|
-
|
343
313
|
# region helpers
|
344
314
|
def get_bbox(self) -> tuple[float, float, float, float]:
|
345
315
|
"""Get bounding box of the tile based on the center point and size.
|
maps4fs/generator/dtm/srtm.py
CHANGED
@@ -33,7 +33,6 @@ class SRTM30Provider(DTMProvider):
|
|
33
33
|
self.gz_directory = os.path.join(self._tile_directory, "gz")
|
34
34
|
os.makedirs(self.hgt_directory, exist_ok=True)
|
35
35
|
os.makedirs(self.gz_directory, exist_ok=True)
|
36
|
-
self.data_info: dict[str, int | str | float] | None = None # type: ignore
|
37
36
|
|
38
37
|
def download_tiles(self):
|
39
38
|
"""Download SRTM tiles."""
|
@@ -1,7 +1,7 @@
|
|
1
1
|
maps4fs/__init__.py,sha256=EGvLVoRpSt4jITswsGbe1ISVmGAZAMQJcBmTwtyuVxI,335
|
2
2
|
maps4fs/logger.py,sha256=HQrDyj72mUjVYo25aR_-_SxVn2rfFjDCNbj-JKJdSnE,1488
|
3
3
|
maps4fs/generator/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,43
|
4
|
-
maps4fs/generator/dem.py,sha256=
|
4
|
+
maps4fs/generator/dem.py,sha256=bPtMLkY0sa3Euue2oGh-Z4npr4dS8q7N_J9BfaomOoM,12651
|
5
5
|
maps4fs/generator/game.py,sha256=NZaxj5z7WzMiHzAvQyr-TvVjGoHgqGldM6ZsItuYyzA,11292
|
6
6
|
maps4fs/generator/map.py,sha256=1mbnOWXVEDeFHWDBBDX9ugzRtrGBQYrJ5ruKmPUsMe8,11136
|
7
7
|
maps4fs/generator/qgis.py,sha256=Es8hLuqN_KH8lDfnJE6He2rWYbAKJ3RGPn-o87S6CPI,6116
|
@@ -15,7 +15,7 @@ maps4fs/generator/component/layer.py,sha256=QPcEzTv_8N9wYvHAZy8OezfATaVLG-YetSfC
|
|
15
15
|
maps4fs/generator/component/satellite.py,sha256=oZBHjP_QY0ik1-Vk7JqMS__zIG8ffw2voeozB7-HUQc,4946
|
16
16
|
maps4fs/generator/component/texture.py,sha256=GWOE7w2maydB2LDku-YEC1w1oc8kcnnZ1SPTL6b82H8,30966
|
17
17
|
maps4fs/generator/component/base/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,43
|
18
|
-
maps4fs/generator/component/base/component.py,sha256=
|
18
|
+
maps4fs/generator/component/base/component.py,sha256=sUinM8Q6cb26ctJTNF35Gb4rU9gbPCMkV6PKju3sfRo,21414
|
19
19
|
maps4fs/generator/component/base/component_image.py,sha256=2QnJ9xm0D54v4whg7bc1s-kwRVjZHhOo1OR5jHr1Qp0,4786
|
20
20
|
maps4fs/generator/component/base/component_mesh.py,sha256=pc7UVakZCnJPV-0Ukdsm6aUD3NFZbOUazuEbb44k170,8747
|
21
21
|
maps4fs/generator/component/base/component_xml.py,sha256=6OO1dKoceO1ACk7-k1oGtnkfNud8ZN3u3ZNjdNMpTqw,3967
|
@@ -26,7 +26,7 @@ maps4fs/generator/dtm/bavaria.py,sha256=nH2wTxiIdQgKotauTqD-zztwFgfZzIdym2sjmSqf
|
|
26
26
|
maps4fs/generator/dtm/canada.py,sha256=XJ_za2LDV9PEV7hmjPnzdwPbpr6ezAR73-HDVaTuKPk,1290
|
27
27
|
maps4fs/generator/dtm/czech.py,sha256=sT0gwbtEnizVNcZeL7kyDdwmKvB3w8m6UgJR7ZTk1to,1058
|
28
28
|
maps4fs/generator/dtm/denmark.py,sha256=JFuBRrCJTMXe_vdO3gRCwsnZ3nZOp_Y6671Kq8aXRGM,1591
|
29
|
-
maps4fs/generator/dtm/dtm.py,sha256=
|
29
|
+
maps4fs/generator/dtm/dtm.py,sha256=iuZ5lV5OFefpmJh8NKu37APZydcjFzcrhLe1ChxVRjc,16748
|
30
30
|
maps4fs/generator/dtm/england.py,sha256=3URUm7uLH_RYXcQdDW3Vt09GWKAE8RAy1ZFJB94kXOA,1124
|
31
31
|
maps4fs/generator/dtm/finland.py,sha256=VpXpvCgzbyKA6VGSa7ikSzE4B-cLfR1_2zOHvS8delc,1870
|
32
32
|
maps4fs/generator/dtm/flanders.py,sha256=LltmowbS84_DaBHAS9XYoJPMunX6sWGy6zaVACHj5Ro,1039
|
@@ -42,7 +42,7 @@ maps4fs/generator/dtm/rema.py,sha256=arLE12yE92EWmWysNUTtdEzwcNiCBtEBmnfnryOriRY
|
|
42
42
|
maps4fs/generator/dtm/sachsenanhalt.py,sha256=UvLrQVxJX30BqtNbKZyR6EJc-vS5fLyanh6fntjYj2k,1144
|
43
43
|
maps4fs/generator/dtm/scotland.py,sha256=kUGPNjn3mQPOU9sgK3k-uwumPG2wrRFLaDMyPMh06Jw,4819
|
44
44
|
maps4fs/generator/dtm/spain.py,sha256=A5QScsrd_bkVlf2n9ZfXBL9z_YoXpLsm_5FWs-5nd_o,1021
|
45
|
-
maps4fs/generator/dtm/srtm.py,sha256=
|
45
|
+
maps4fs/generator/dtm/srtm.py,sha256=RcAB0PRaTLAJNvasLLdGVvjww05Lby2O2Aw5TG0M0sY,4263
|
46
46
|
maps4fs/generator/dtm/switzerland.py,sha256=Jn3qYVEps_K6cH-9rMfB_zoXMxhzWQKPnlKkSE-TehE,3549
|
47
47
|
maps4fs/generator/dtm/usgs_wcs.py,sha256=X8VxdhyH0-EciGE_X-KgrAM6sVLTGssYIhtebOj8MPI,1021
|
48
48
|
maps4fs/generator/dtm/utils.py,sha256=I-wUSA_J85Xbt8sZCZAVKHSIcrMj5Ng-0adtPVhVmk0,2315
|
@@ -52,8 +52,8 @@ maps4fs/toolbox/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,4
|
|
52
52
|
maps4fs/toolbox/background.py,sha256=RclEqxEWLbMxuEkkegQP8jybzugwQ1_R3rdfDe0s21U,2104
|
53
53
|
maps4fs/toolbox/custom_osm.py,sha256=X6ZlPqiOhNjkmdD_qVroIfdOl9Rb90cDwVSLDVYgx80,1892
|
54
54
|
maps4fs/toolbox/dem.py,sha256=z9IPFNmYbjiigb3t02ZenI3Mo8odd19c5MZbjDEovTo,3525
|
55
|
-
maps4fs-1.8.
|
56
|
-
maps4fs-1.8.
|
57
|
-
maps4fs-1.8.
|
58
|
-
maps4fs-1.8.
|
59
|
-
maps4fs-1.8.
|
55
|
+
maps4fs-1.8.217.dist-info/LICENSE.md,sha256=pTKD_oUexcn-yccFCTrMeLkZy0ifLRa-VNcDLqLZaIw,10749
|
56
|
+
maps4fs-1.8.217.dist-info/METADATA,sha256=dYYPzjVFgA-mTbkFQWK8tUNJ5YOnRqEAbnd4BeDi6oo,45770
|
57
|
+
maps4fs-1.8.217.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
58
|
+
maps4fs-1.8.217.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
|
59
|
+
maps4fs-1.8.217.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|