maps4fs 0.9.8__py3-none-any.whl → 0.9.9__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 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")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: maps4fs
3
- Version: 0.9.8
3
+ Version: 0.9.9
4
4
  Summary: Generate map templates for Farming Simulator from real places.
5
5
  Author-email: iwatkot <iwatkot@gmail.com>
6
6
  License: MIT License
@@ -4,7 +4,7 @@ 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=XLpzjJMPZCxjrF-AhwTeEb-OQoCHEtYdK0b8z3Gb-is,15712
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
10
  maps4fs/generator/map.py,sha256=v8OOLmhAkgqq64tQgEDbV6DmbgOVm3NXJBDDy0nJf60,4226
@@ -14,8 +14,8 @@ maps4fs/generator/texture.py,sha256=CwaXZfAG4e3D3YR7yVR2MC677EHpbUWTboCS3G6jkhk,
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.8.dist-info/LICENSE.md,sha256=-JY0v7p3dwXze61EbYiK7YEJ2aKrjaFZ8y2xYEOrmRY,1068
18
- maps4fs-0.9.8.dist-info/METADATA,sha256=IU-GDGBqpwXJPdf4aWGWqXVog7lC_zGDPFN9ehCwne0,25170
19
- maps4fs-0.9.8.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
20
- maps4fs-0.9.8.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
21
- maps4fs-0.9.8.dist-info/RECORD,,
17
+ maps4fs-0.9.9.dist-info/LICENSE.md,sha256=-JY0v7p3dwXze61EbYiK7YEJ2aKrjaFZ8y2xYEOrmRY,1068
18
+ maps4fs-0.9.9.dist-info/METADATA,sha256=rWT-sSS7QfXGArOqjWMLdCxSRm0bkGd0uMZwJegayZc,25170
19
+ maps4fs-0.9.9.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
20
+ maps4fs-0.9.9.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
21
+ maps4fs-0.9.9.dist-info/RECORD,,