pymdu.geometric
pymdu.geometric
pymdu.geometric
Building
Building
Bases: IgnCollect
Class to collect the Building data.
This class provides a method to read and process building data from a shapefile or GeoJSON file. It also calculates the mean height of the buildings, as well as their area and centroid.
Args: filepath_shp (str): The file path to the shapefile. output_path (str): The output path for the processed data. If not provided, a default temporary path will be used. defaultStoreyHeight (float): The default height of each storey. set_crs (int): The CRS (Coordinate Reference System) to be set.
Example
import matplotlib.pyplot as plt
import pymdu.geometric.Building as Building
buildings = Building(output_path='./')
buildings.bbox = [-1.152704, 46.181627, -1.139893, 46.18699]
buildings = buildings.run()
buildings.to_gdf().plot(
ax=plt.gca(),
edgecolor='black',
column='hauteur',
legend=True,
legend_kwds={'label': 'Hauteur', 'orientation': 'vertical'},
)
Todo
- For module TODOs
Cadastre
Cadastre
Bases: IgnCollect
Class representing the Cadastre data collection.
output_path (str): The output path for the processed data. If not provided, a default temporary path will be used.
Example
Todo
- For module TODOs
Cosia
Cosia
Bases: GeoCore
A class used to collect and process Cosia data.
This class provides methods for importing GeoPackage files into a PostgreSQL database, retrieving geodata from specified departments within a bounding box, creating landcover rasters, and overlapping with pedestrian areas. It also includes functionalities for creating trees and their positions based on the Cosia data.
ATTRIBUTE | DESCRIPTION |
---|---|
cosia_keys |
A dictionary containing Cosia keys.
TYPE:
|
output_path |
The output path for processed data.
TYPE:
|
template_raster_path |
The default height of each storey.
TYPE:
|
gdf |
The GeoDataFrame containing the geodata.
TYPE:
|
PARAMETER | DESCRIPTION |
---|---|
output_path
|
The output path for the processed data. If not provided, a default temporary path will be used.
TYPE:
|
template_raster_path
|
The default height of each storey.
TYPE:
|
Example
```python exec="false" source="tabbed-right" html="1" tabs="Source code|Plot" import matplotlib.pyplot as plt
plt.clf() # markdown-exec: hide cosia = Cosia(output_path='./') cosia.bbox = [-1.15643, 46.16123, -1.15127, 46.16378] cosia_gdf = cosia.run().to_gdf() cosia_gdf.plot(color=cosia_gdf['color']) cosia_gdf.plot(ax=plt.gca()) from io import StringIO # markdown-exec: hide
buffer = StringIO() # markdown-exec: hide plt.gcf().set_size_inches(10, 5) # markdown-exec: hide plt.savefig(buffer, format='svg', dpi=199) # markdown-exec: hide print(buffer.getvalue()) # markdown-exec: hide ```
Todo
- For module TODOs
Dem
Dem
Bases: IgnCollect
Class to collect the Dem data
PARAMETER | DESCRIPTION |
---|---|
output_path
|
The output path for the processed data. If not provided, a default temporary path will be used.
TYPE:
|
Example:
import matplotlib.pyplot as plt
import pymdu.geometric.Dem as Dem
import rasterio
import rasterio.plot
dem = Dem(output_path='./')
dem.bbox = [-1.152704, 46.181627, -1.139893, 46.18699]
ign_dem = dem.run()
fig, ax = plt.subplots(figsize=(15, 15))
raster = rasterio.open('DEM.tif')
rasterio.plot.show(raster, ax=ax, cmap='viridis')
Todo
- For module TODOs
DetectionUrbanTypes
DetectionUrbanTypes
Bases: GeoCore
PARAMETER | DESCRIPTION |
---|---|
output_path
|
The output path for the processed data. If not provided, a default temporary path will be used.
TYPE:
|
Example
import matplotlib.pyplot as plt
import pymdu.geometric.DetectionUrbanTypes as DetectionUrbanTypes
detection = DetectionUrbanTypes(output_path='./')
detection.bbox = [-1.152704, 46.181627, -1.139893, 46.18699]
detection = detection.run()
gdf = detection.to_gdf()
gdf.plot(
ax=plt.gca(),
column='cluster',
categorical=True,
figsize=(16, 16),
legend=True,
)
Todo
- For module TODOs
Dpe
Dpe
Bases: GeoCore
Class to collect the Cadastre data
PARAMETER | DESCRIPTION |
---|---|
output_path
|
The output path for the processed data. If not provided, a default temporary path will be used.
TYPE:
|
Example
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import pymdu.geometric.Dpe as Dpe
import pymdu.geometric.Building as Building
dpe = Dpe()
dpe.bbox = [-1.152704, 46.181627, -1.139893, 46.18699]
dpe_gdf = dpe.run().to_gdf()
table_color = dpe.table_color
buildings = Building(output_path='./')
buildings.bbox = [-1.152704, 46.181627, -1.139893, 46.18699]
buildings_gdf = buildings.run().to_gdf()
# color_mapping = {"category1": "green", "category2": "red"}
ax = dpe_gdf.plot(
ax=plt.gca(),
edgecolor='black',
categorical=True,
column='classe_consommation_energie',
legend=True,
color=dpe_gdf['color'],
)
patches = [
mpatches.Patch(color=info[1], label=info[0])
for info in table_color.values()
]
plt.legend(
handles=patches,
loc='upper right',
title='Etiquette DPE',
bbox_to_anchor=(1.1, 1.0),
)
buildings_gdf.plot(ax=ax, edgecolor='black', alpha=0.5)
Todo
- For module TODOs
Dxf2Shp
create_circle
Créer un polygone approximant un cercle.
:param center: Tuple (x, y) représentant les coordonnées du centre. :param radius: Rayon du cercle. :param num_segments: Nombre de segments pour approximer le cercle. :return: Géométrie OGR de type POLYGON.
calculate_centroid
Calculer le centroïde ou le point moyen d'une géométrie MultiLineString25D.
:param geometry: Géométrie OGR de type wkbMultiLineString25D. :return: Tuple (x, y) représentant le centroïde.
calculate_circumscribed_circle_radius
Calculer le rayon du cercle circonscrit à une géométrie donnée.
:param geometry: Géométrie OGR (par ex., wkbMultiLineString25D). :return: Rayon du cercle circonscrit.
dxf_to_polygon_shp
Convertir des polygones d'un fichier DXF en un fichier SHP.
:param input_dxf: Chemin vers le fichier DXF d'entrée. :param output_shp: Chemin vers le fichier shapefile de sortie. :param encoding: Character encoding le fichier DXF
dxf_to_polygon_shp2
Convertir des polygones d'un fichier DXF en deux fichiers SHP :
- output_shp
pour les polygones généraux.
- tree_shp
pour les arbres identifiés.
:param input_dxf: Chemin vers le fichier DXF d'entrée. :param output_shp: Chemin vers le fichier shapefile de sortie général. :param tree_shp: Chemin vers le fichier shapefile des arbres.
dxf_to_cosia_and_weighted_layers
dxf_to_cosia_and_weighted_layers(
input_shp_dxf,
output_shp_gdf,
bbox_coords=None,
bbox_crs="EPSG:4326",
encoding="UTF-8",
)
Convertir des layers d'un fichier DXF en layers Cosia avec poids : :param input_shp_dxf: Chemin vers le fichier SHP d'entrée. :param output_shp: Chemin vers le fichier shapefile de sortie :param bbox_coords: choisir le taille :param bbox_crs: le crs du bbox_coords :param encoding: encoding de le fichier SHP
Iris
Iris
Bases: IgnCollect
PARAMETER | DESCRIPTION |
---|---|
output_path
|
The output path for the processed data. If not provided, a default temporary path will be used.
TYPE:
|
Example
Todo
- For module TODOs
Isochrone
Isochrone
Bases: GeoCore
PARAMETER | DESCRIPTION |
---|---|
output_path
|
The output path for the processed data. If not provided, a default temporary path will be used.
TYPE:
|
poi
|
The point of interest.
TYPE:
|
write_geojson
|
If True, the processed data will be written to a GeoJSON file.
TYPE:
|
Example
import matplotlib.pyplot as plt
import contextily as cx
import pymdu.geometric.Isochrone as Isochrone
poi = {'lon': -1.1491, 'lat': 46.1849}
iso = Isochrone(poi=poi)
iso.bbox = [-1.152704, 46.181627, -1.139893, 46.18699]
iso.run()
iso_in_gdf, iso_out_gdf = iso.to_gdf()
t = 15 # 15 minutes
ax = iso_in_gdf.loc[[t]].plot(
alpha=0.25, color='black', figsize=(8, 8), label='in'
)
ax = iso_out_gdf.loc[[t]].plot(alpha=0.25, color='b', ax=ax, label='out')
cx.add_basemap(
ax,
source=cx.providers.CartoDB.VoyagerNoLabels,
crs=iso_out_gdf.crs.to_string(),
)
_ = plt.plot(iso.poi_lam93.x, iso.poi_lam93.y, marker='o', color='red', alpha=1)
_ = plt.axis('off')
Todo
- For module TODOs
create_isochrones
create_isochrones(
coords,
tt_col="tt_out",
x_col="x_2154",
y_col="y_2154",
steps_m=[10, 20, 30],
ratio=0.3,
allow_holes=False,
)
Create isochrones from travel time data.
Parameters
coords : pandas.DataFrame DataFrame containing coordinates and travel time data. tt_col : str, optional Name of the column containing travel time data. The default is "tt_out". x_col : str, optional Name of the column containing x-coordinates. The default is "x_2154". y_col : str, optional Name of the column containing y-coordinates. The default is "y_2154". steps_m : list of int, optional List of travel times in minutes for which to create isochrones. The default is [10, 20, 30]. ratio : float, optional Ratio of concavity for the isochrones. The default is 0.3. allow_holes : bool, optional Whether to allow holes in the isochrones. The default is False.
Returns
gdf : geopandas.GeoDataFrame GeoDataFrame containing the isochrones as polygons.
IsochroneIGN
IsochroneIGN
IsochroneIGN(
output_path=None,
resource="bdtopo-valhalla",
point=(2.337306, 48.849319),
costValue=300,
costType="time",
set_crs=None,
)
Bases: IgnCollect
Class to collect the Building data
PARAMETER | DESCRIPTION |
---|---|
output_path
|
The output path for the processed data. If not provided, a default temporary path will be used.
TYPE:
|
resource
|
The resource to use.
TYPE:
|
point
|
Coordonnées d'une position ponctuelle. C'est le point à partir duquel seront fait les calculs. Il devra être exprimé dans le CRS, par défaut, de la ressource (voir le paramètre 'crs' dans le GetCapabilities).
TYPE:
|
costValue
|
The cost value. Valeur du coût utilisé pour le calcul. Les valeurs disponibles et la valeur par défaut utilisées sont présentes dans le GetCapabilities. On pourra, par exemple, préciser une distance ou un temps, selon l'optimisation choisie. L'unité dépendra aussi des paramètres distanceUnit et timeUnit.
TYPE:
|
costType
|
The cost type. Type du coût utilisé pour le calcul. Les valeurs disponibles et la valeur par défaut utilisées sont présentes dans le GetCapabilities. On pourra, par exemple, préciser une distance ou un temps, selon l'optimisation choisie. L'unité dépendra aussi des paramètres distanceUnit et timeUnit
TYPE:
|
set_crs
|
The CRS (Coordinate Reference System) to be set.
TYPE:
|
Example
Traceback (most recent call last):
File "/Users/Boris/miniforge3/envs/pymdu/lib/python3.11/site-packages/markdown_exec/_internal/formatters/python.py", line 71, in _run_python
exec_python(code, code_block_id, exec_globals)
File "/Users/Boris/miniforge3/envs/pymdu/lib/python3.11/site-packages/markdown_exec/_internal/formatters/_exec_python.py", line 8, in exec_python
exec(compiled, exec_globals) # noqa: S102
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<code block: n8>", line 8, in <module>
isochroneIGN = isochroneIGN.run()
^^^^^^^^^^^^^^^^^^
File "/Users/Boris/Documents/TIPEE/pymdu_public/pymdu/geometric/IsochroneIGN.py", line 102, in run
gdf = gpd.read_file(file, driver='GeoJSON')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Boris/miniforge3/envs/pymdu/lib/python3.11/site-packages/geopandas/io/file.py", line 317, in _read_file
return _read_file_pyogrio(
^^^^^^^^^^^^^^^^^^^
File "/Users/Boris/miniforge3/envs/pymdu/lib/python3.11/site-packages/geopandas/io/file.py", line 577, in _read_file_pyogrio
return pyogrio.read_dataframe(path_or_bytes, bbox=bbox, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Boris/miniforge3/envs/pymdu/lib/python3.11/site-packages/pyogrio/geopandas.py", line 275, in read_dataframe
result = read_func(
^^^^^^^^^^
File "/Users/Boris/miniforge3/envs/pymdu/lib/python3.11/site-packages/pyogrio/raw.py", line 198, in read
return ogr_read(
^^^^^^^^^
File "pyogrio/_io.pyx", line 1293, in pyogrio._io.ogr_read
File "pyogrio/_io.pyx", line 227, in pyogrio._io.ogr_open
pyogrio.errors.DataSourceError: '/vsimem/pyogrio_72d8efac3f9f4979802decaf9ce00fe2' not recognized as being in a supported file format.; It might help to specify the correct driver explicitly by prefixing the file path with '<DRIVER>:', e.g. 'CSV:path'.
Todo
- For module TODOs
LandCover
LandCover
LandCover(
building_gdf=None,
vegetation_gdf=None,
water_gdf=None,
pedestrian_gdf=None,
cosia_gdf=None,
dxf_gdf=None,
output_path=None,
write_file=True,
)
Bases: GeoCore
, BasicFunctions
classdocs rappel de la définition initiale des classes dans Umep Name Code Alb Emis Ts_deg Tstart TmaxLST Roofs(buildings) 2 0.18 0.95 0.58 -9.78 15.0 Dark_asphalt 1 0.18 0.95 0.58 -9.78 15.0 Cobble_stone_2014a 0 0.20 0.95 0.37 -3.41 15.0 Water 7 0.05 0.98 0.00 0.00 12.0 Grass_unmanaged 5 0.16 0.94 0.21 -3.38 14.0 bare_soil 6 0.25 0.94 0.33 -3.01 14.0 Walls 99 0.20 0.90 0.37 -3.41 15.0
PARAMETER | DESCRIPTION |
---|---|
building_gdf
|
gpd.GeoDataFrame = None,
TYPE:
|
vegetation_gdf: gpd.GeoDataFrame = None,
water_gdf: gpd.GeoDataFrame = None,
pedestrian_gdf: gpd.GeoDataFrame = None,
cosia_gdf: gpd.GeoDataFrame = None,
dxf_gdf: gpd.GeoDataFrame = None,
output_path: str = None,
write_file: bool = True,
Example
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from pymdu.image import geotiff
from pymdu.geometric import Vegetation, Pedestrian, Water, Building, LandCover
from pymdu.geometric.Dem import Dem
from pymdu.commons.BasicFunctions import plot_sol_occupancy
from pymdu.GeoCore import GeoCore
geocore = GeoCore()
geocore.bbox = [-1.152704, 46.181627, -1.139893, 46.18699]
building = Building(output_path="./")
buildings_gdf = building.run().to_gdf()
# building.to_shp(name='buildings')
water = Water(output_path="./")
water_gdf = water.run().to_gdf()
# water.to_shp(name='water')
pedestrian = Pedestrian(output_path="./")
pedestrian_gdf = pedestrian.run().to_gdf()
# pedestrian.to_shp(name='pedestrian')
vegetation = Vegetation(output_path="./", min_area=100)
vegetation_gdf = vegetation.run().to_gdf()
# vegetation.to_shp(name='vegetation')
# cosia_gdf = gpd.read_file("../../demos/demo_cosia_gdf.shp")
# dxf_gdf = gpd.read_f #
cosia_gdf = None
dxf_gdf = None
landcover = LandCover(
output_path="./",
building_gdf=buildings_gdf,
vegetation_gdf=vegetation_gdf,
water_gdf=water_gdf,
cosia_gdf=cosia_gdf,
dxf_gdf=dxf_gdf,
pedestrian_gdf=pedestrian_gdf,
write_file=False,
)
landcover.run()
# landcover.to_shp(name="landcover")
landcover_gdf = landcover.to_gdf()
fig, ax = plt.subplots(figsize=(10, 10))
if cosia_gdf is not None:
landcover_gdf.plot(color=landcover_gdf["color"])
fig_hist = plot_sol_occupancy(cosia_gdf, landcover_gdf)
fig_hist.show()
else:
landcover_gdf.plot(ax=plt.gca(), edgecolor="black", column="type")
Todo
- For module TODOs
Lcz
Lcz
Bases: GeoCore
Class to collect the Building data
PARAMETER | DESCRIPTION |
---|---|
filepath_shp
|
The file path to the shapefile.
TYPE:
|
output_path
|
The output path for the processed data. If not provided, a default temporary path will be used.
TYPE:
|
set_crs
|
The CRS (Coordinate Reference System) to be set.
TYPE:
|
Example
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import pymdu.geometric.Lcz as Lcz
lcz = Lcz()
lcz_gdf = lcz.run().to_gdf()
lcz.bbox = [-1.152704, 46.181627, -1.139893, 46.18699]
table_color = lcz.table_color
fig, ax = plt.subplots(figsize=(10, 10))
lcz_gdf.plot(ax=ax, edgecolor=None, color=lcz_gdf['color'])
patches = [
mpatches.Patch(color=info[1], label=info[0])
for info in table_color.values()
]
plt.legend(
handles=patches,
loc='upper right',
title='LCZ Legend',
bbox_to_anchor=(1.1, 1.0),
)
Todo
- For module TODOs
Pedestrian
Pedestrian
Bases: GeoCore
Class to collect the Pedestrian data
PARAMETER | DESCRIPTION |
---|---|
filepath_shp
|
The file path to the shapefile.
TYPE:
|
output_path
|
The output path for the processed data. If not provided, a default temporary path will be used.
TYPE:
|
Example
import matplotlib.pyplot as plt
import h3pandas
import pymdu.geometric.Pedestrian as Pedestrian
pedestrian = Pedestrian(output_path='./')
pedestrian.bbox = [-1.152704, 46.181627, -1.139893, 46.18699]
pedestrian.run()
gdf = pedestrian.to_gdf()
point_arbres = pedestrian.tree_position(
pedestrian=pedestrian.gdf,
resolution=11,
height=6.0,
type=2,
trunk_zone=3.0,
)
gdf.plot(ax=plt.gca(), edgecolor='black')
# point_arbres.plot(color='red', markersize=10)
Todo
- For module TODOs
tree_position
staticmethod
PARAMETER | DESCRIPTION |
---|---|
diameter
|
TYPE:
|
height
|
TYPE:
|
type
|
TYPE:
|
trunk_zone
|
TYPE:
|
pedestrian
|
le geodataframe de la zone piétonne
TYPE:
|
resolution
|
la résolution pour le découpage hexagonal
TYPE:
|
Returns: geodataframe de la position des arbres
Rnb
Rnb
Bases: GeoCore
PARAMETER | DESCRIPTION |
---|---|
output_path
|
The output path for the processed data. If not provided, a default temporary path will be used.
TYPE:
|
Example
import matplotlib.pyplot as plt
import pymdu.geometric.Building as Building
import pymdu.geometric.Rnb as Rnb
rnb = Rnb(output_path='./')
rnb.bbox = [-1.152704, 46.181627, -1.139893, 46.18699]
rnb = rnb.run()
rnb_gdf = rnb.to_gdf()
buildings = Building(output_path='./')
buildings.bbox = [-1.152704, 46.181627, -1.139893, 46.18699]
buildings_gdf = buildings.run().to_gdf()
ax = rnb_gdf.plot(ax=plt.gca(), edgecolor='black', color='red')
buildings_gdf.plot(ax=ax, edgecolor='black', alpha=0.5)
Todo
- For module TODOs
Road
Road
Bases: IgnCollect
Class to collect the Road data
PARAMETER | DESCRIPTION |
---|---|
output_path
|
The output path for the processed data. If not provided, a default temporary path will be used.
TYPE:
|
Example
Todo
- For module TODOs
SkyFactor
SkyFactor
Bases: GeoCore
classdocs
PARAMETER | DESCRIPTION |
---|---|
buildings_gdf
|
GeoDataFrame of the buildings.
TYPE:
|
elevationFieldname
|
Name of the elevation field.
TYPE:
|
Example
import matplotlib.pyplot as plt
import pymdu.geometric.SkyFactor as SkyFactor
import pymdu.geometric.Building as Building
building = Building(output_path='./')
buildings_gdf = building.run().to_gdf()
sky_factor = SkyFactor(
buildings_gdf=buildings_gdf, elevationFieldname='hauteur'
)
sky_factor.bbox = [-1.152704, 46.181627, -1.139893, 46.18699]
sky_factor = sky_factor.run()
sky_factor_gdf = sky_factor.to_gdf()
_, basemap = plt.subplots(figsize=(8.26, 8.26))
basemap.set_title('Sky View Factor', fontsize=16)
plt.axis('off')
buildings_gdf.plot(ax=basemap, color='grey')
sky_factor_gdf.plot(
ax=basemap, column='svf', markersize=8, legend=True, cmap='viridis'
)
plt.legend(loc='upper right', framealpha=0.5)
Todo
- For module TODOs
UrockFiles
UrockFiles
Vegetation
Vegetation
Bases: IgnCollect
Class to collect the Vegetation data
PARAMETER | DESCRIPTION |
---|---|
filepath_shp
|
(str) The path to the shapefile to be processed. If not provided, the data will be read from the input file.
TYPE:
|
output_path
|
The output path for the processed data. If not provided, a default temporary path will be used.
TYPE:
|
set_crs
|
(int) The EPSG code to set the CRS of the output file. If not provided, the CRS of the input file will be used.
TYPE:
|
write_file
|
(bool) If True, the output file will be written to disk. If False, the output file will be returned.
TYPE:
|
min_area
|
(float) The minimum area of the polygons to be considered as vegetation. If not provided, the minimum area will be set to 0.
TYPE:
|
Example
import matplotlib.pyplot as plt
import pymdu.geometric.Vegetation as Vegetation
vegetation = Vegetation(output_path='./')
vegetation.bbox = [-1.152704, 46.181627, -1.139893, 46.18699]
vegetation = vegetation.run()
gdf = vegetation.to_gdf()
gdf.plot(ax=plt.gca(), edgecolor='black', color='green', alpha=0.5)
Todo
- For module TODOs
Water
Water
Bases: GeoCore
=== Classe qui permet - de construire une reqûete pour interroger l'API de l'IGN - enregistre les données dans le dossier ./demo/ ===
PARAMETER | DESCRIPTION |
---|---|
filepath_shp
|
(str) The path to the shapefile to be processed. If not provided, the data will be read from the input file.
TYPE:
|
output_path
|
The output path for the processed data. If not provided, a default temporary path will be used.
TYPE:
|
set_crs
|
(int) The EPSG code to set the CRS of the output file. If not provided, the CRS of the input file will be used.
TYPE:
|
Example
Todo
- For module TODOs
pymdu.meteo
pymdu.meteo
pymdu.meteo
Meteo
Meteo
Bases: GeoCore
gen_umep_weather_from_list
gen_umep_weather_from_list(
listofdays,
epw_file="LaRochelle_historical_IPSL_bc_type.epw",
init_weather_file="base_weather.txt",
compute_night=True,
)
TODO : mieux définir les jours/nuits
PARAMETER | DESCRIPTION |
---|---|
listofdays
|
|
epw_file
|
DEFAULT:
|
init_weather_file
|
DEFAULT:
|
compute_night
|
DEFAULT:
|
pymdu.physics.umep
pymdu.physics.umep
pymdu.physics.umep
DsmModelGenerator
DsmModelGenerator
DsmModelGenerator(
working_directory,
output_filepath_dsm="DSM.tif",
input_filepath_dem="DEM.tif",
input_building_shp_path="buildings.shp",
input_mask_shp_path="mask.shp",
)
Bases: UmepCore
PARAMETER | DESCRIPTION |
---|---|
input_solweig_path
|
The path to the input Solweig file.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
None |
HeightAspectModelGenerator
SVFModelGenerator
Solweig
Solweig
Solweig(
meteo_path,
output_dir,
working_directory,
input_filepath_landcover="landcover.tif",
input_filepath_dsm="DSM.tif",
input_filepath_dem="DEM.tif",
input_filepath_cdsm="CDSM.tif",
input_filepath_tdsm="TDSM.tif",
input_filepath_height="HEIGHT.tif",
input_filepath_aspect="ASPECT.tif",
input_filepath_shadowmats_npz="shadowmats.npz",
input_filepath_svf_zip="svfs.zip",
)
Bases: UmepCore
PARAMETER | DESCRIPTION |
---|---|
input_solweig_path
|
The path to the input solweig file.
TYPE:
|
meteo_path
|
The path to the meteo file.
TYPE:
|
output_dir
|
The path to the output directory.
TYPE:
|
SurfaceModelGenerator
SurfaceModelGenerator
SurfaceModelGenerator(
working_directory,
input_filepath_dsm="DSM.tif",
input_filepath_dem="DEM.tif",
input_filepath_tree_shp="trees.shp",
output_filepath_cdsm="CDSM.tif",
output_filepath_tdsm="TDSM.tif",
)
Bases: UmepCore
PARAMETER | DESCRIPTION |
---|---|
input_solweig_path
|
The path to the input Solweig file.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
None |
pymdu.image
pymdu.image
pymdu.image
Lidar
Lidar
Bases: GeoCore
PARAMETER | DESCRIPTION |
---|---|
building_gdf
|
gpd.GeoDataFrame = None,
|
vegetation_gdf
|
gpd.GeoDataFrame = None,
|
water_gdf
|
gpd.GeoDataFrame = None,
|
pedestrian_gdf
|
gpd.GeoDataFrame = None,
|
cosia_gdf
|
gpd.GeoDataFrame = None,
|
dxf_gdf
|
gpd.GeoDataFrame = None,
|
output_path
|
str = None,
TYPE:
|
write_file
|
bool = True,
|
Example
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from shapely.geometry.geo import box
from pyproj import Transformer
import matplotlib.pyplot as plt
import rasterio.plot
from pymdu.image.Lidar import Lidar
lidar = Lidar(
output_path="./",
classification=6,
)
lidar.bbox = [-1.154894, 46.182639, -1.148361, 46.186820]
# lidar_gdf = lidar.run().to_gdf()
# # lidar_gdf.plot(ax=plt.gca(), edgecolor='black')
# # plt.show()
# lidar.to_shp(name='LidarTest')
lidar_tif = lidar.to_tif(write_out_file=True)
# Lire les données et les afficher avec rasterio.plot
with lidar_tif.open() as src:
fig, ax = plt.subplots(figsize=(10, 10))
rasterio.plot.show(src, ax=ax, title="Lidar CDSM")
Todo
- For module TODOs
merge_tifs
Merge multiple GeoTIFF files into a single GeoTIFF file.
PARAMETER | DESCRIPTION |
---|---|
dsm_out
|
Path to the output GeoTIFF file.
TYPE:
|
write_out_file
|
If True, write the merged GeoTIFF file. Otherwise, return a MemoryFile.
TYPE:
|
input_files
|
List of paths to input GeoTIFF files.
TYPE:
|
geotiff
resample_resolution
resample resolution the pixel size of the raster.
PARAMETER | DESCRIPTION |
---|---|
new_xres
|
desired resolution in x-direction
TYPE:
|
new_yres
|
desired resolution in y-direction
TYPE:
|
save_path
|
filepath to where the output file should be stored
TYPE:
|
Returns: Nothing, it writes a raster file with decreased resolution. :param new_yres: :param new_xres:
reproject
resample resolution the pixel size of the raster.
PARAMETER | DESCRIPTION |
---|---|
new_xres
|
desired resolution in x-direction
TYPE:
|
new_yres
|
desired resolution in y-direction
TYPE:
|
save_path
|
filepath to where the output file should be stored
TYPE:
|
Returns: Nothing, it writes a raster file with decreased resolution. :param new_yres: :param new_xres:
resample_size
resample size of the raster.
PARAMETER | DESCRIPTION |
---|---|
new_width
|
desired width
TYPE:
|
new_height
|
desired height
TYPE:
|
Returns: Nothing, it writes a raster file with decreased resolution. :param save_path: :param new_height: :param new_width:
resample_projection
resample projection of the raster.
PARAMETER | DESCRIPTION |
---|---|
new_epsg
|
desired epsg
TYPE:
|
save_path
|
filepath to where the output file should be stored
TYPE:
|
Returns: Nothing, it writes a raster file with decreased resolution. :param save_path: :param new_epsg:
raster_to_gdf
RETURNS | DESCRIPTION |
---|---|
object
|
TYPE:
|
gdf_to_raster
gdf_to_raster(
gdf,
dst_tif,
measurement,
categorical=False,
resolution=(-0.03, 0.03),
raster_file_like=None,
fill_value=None,
dtype="float64",
)
PARAMETER | DESCRIPTION |
---|---|
dst_tif
|
|
measurement
|
TYPE:
|
dtype
|
DEFAULT:
|
fill_value
|
DEFAULT:
|
gdf
|
TYPE:
|
categorical
|
TYPE:
|
resolution
|
TYPE:
|
raster_file_like
|
TYPE:
|
reproject_resample_cropped_raster
PARAMETER | DESCRIPTION |
---|---|
model_file
|
le raster .tif dont les caractéristiques doivent être copiées
|
input_file
|
le fichier raster .tif d'entrée
|
output_file
|
le du raster .tif nom que l'on souhaite donner à la sortie
|
rasterize
rasterize
pc_to_dsm
builtin
pc_to_dsm(points: numpy.ndarray[numpy.float64], values: numpy.ndarray[numpy.float64], valid: numpy.ndarray[numpy.int32], xstart: float, ystart: float, xsize: int, ysize: int, resolution: float, radius: int, sigma: float) -> tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray]
Convert point cloud to digital surface model
Generated by MkDocs