Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Removed support to SMRT.py #5707

Merged
merged 9 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ tests = [
# Never directly imported but required when loading ML related file see #4713
"scikit-learn>=1.0.0,<1.7",
"scikit-rf>=0.30.0,<1.6",
"SRTM.py",
"utm",
]
dotnet = [
Expand Down Expand Up @@ -117,7 +116,6 @@ all = [
# Never directly imported but required when loading ML related file see #4713
"scikit-learn>=1.0.0,<1.7",
"scikit-rf>=0.30.0,<1.6",
"SRTM.py",
"utm",
]
installer = [
Expand All @@ -132,7 +130,6 @@ installer = [
# Never directly imported but required when loading ML related file see #4713
"scikit-learn>=1.0.0,<1.7",
"scikit-rf>=0.30.0,<1.6",
"SRTM.py",
"utm",
"jupyterlab>=3.6.0,<4.4",
"ipython>=7.30.0,<8.32",
Expand Down
16 changes: 3 additions & 13 deletions src/ansys/aedt/core/modeler/advanced_cad/oms.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,10 @@

try:
import osmnx as ox
import srtm
import utm

except ImportError: # pragma: no cover
warnings.warn(
"OpenStreetMap Reader requires utm, osmnx and srtm extra packages.\n"
"Install with \n\npip install utm osmnx srtm"
)
warnings.warn("OpenStreetMap Reader requires utm, osmnx extra packages.\n" "Install with \n\npip install utm osmnx")


class BuildingsPrep(object):
Expand Down Expand Up @@ -422,18 +418,14 @@
latlat_utm_centered = all_utm[lat_idx][lon_idx][0] - utm_center[0]
lonlon_utm_centered = all_utm[lat_idx][lon_idx][1] - utm_center[1]

if (
all_data[lat_idx][lon_idx] != -32768
): # this is missing data from srtm, don't add if it doesn't exist
if all_data[lat_idx][lon_idx] != -32768: # this is missing data, don't add if it doesn't exist

Check warning on line 421 in src/ansys/aedt/core/modeler/advanced_cad/oms.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/aedt/core/modeler/advanced_cad/oms.py#L421

Added line #L421 was not covered by tests
xyz.append([latlat_utm_centered, lonlon_utm_centered, all_data[lat_idx][lon_idx]])
xyz = np.array(xyz)

file_out = self.cad_path + "/terrain.stl"
logger.info("saving STL as " + file_out)
terrain_mesh = pv.PolyData(xyz)
terrain_mesh = terrain_mesh.delaunay_2d(
tol=10 / (2 * max_radius) / 2
) # tolerance, srtm is 30meter, so as a fraction of total size this would be 30/2/radius
terrain_mesh = terrain_mesh.delaunay_2d(tol=10 / (2 * max_radius) / 2)

Check warning on line 428 in src/ansys/aedt/core/modeler/advanced_cad/oms.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/aedt/core/modeler/advanced_cad/oms.py#L428

Added line #L428 was not covered by tests
terrain_mesh = terrain_mesh.smooth(n_iter=100, relaxation_factor=0.04)

el = terrain_mesh.points[:, 2]
Expand Down Expand Up @@ -483,7 +475,6 @@
num_samples = int(np.ceil(max_radius * 2 / sample_grid_size))
x_samples = np.linspace(utm_x_min, utm_x_max, int(num_samples))
y_samples = np.linspace(utm_y_min, utm_y_max, int(num_samples))
elevation_data = srtm.get_data()

all_data = np.zeros((num_samples, num_samples))
all_utm = np.zeros((num_samples, num_samples, 2))
Expand All @@ -506,7 +497,6 @@
zone_letter = utm.latitude_to_zone_letter(center_lat_lon[0])
zone_number = utm.latlon_to_zone_number(center_lat_lon[0], center_lat_lon[1])
current_lat_lon = utm.to_latlon(x, y, zone_number, zone_letter)
all_data[n, m] = elevation_data.get_elevation(current_lat_lon[0], current_lat_lon[1])
all_lat_lon[n, m] = current_lat_lon
all_utm[n, m] = [x, y]
logger.info(str(100) + "% - Done")
Expand Down
7 changes: 7 additions & 0 deletions src/ansys/aedt/core/modeler/modeler_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -1239,6 +1239,13 @@ def import_from_openstreet_map(
dict
Dictionary of generated infos.

Notes
-----
Please note that elevation is not computed anymore in this method.
Please check the example
``https://examples.aedt.docs.pyansys.com/version/dev/examples/high_frequency/antenna/large_scenarios/city.html``
to compute also elevation.

"""
from ansys.aedt.core.modeler.advanced_cad.oms import BuildingsPrep
from ansys.aedt.core.modeler.advanced_cad.oms import RoadPrep
Expand Down