berlin_gelaendemodelle_downloader package¶
Submodules¶
berlin_gelaendemodelle_downloader.cli module¶
berlin_gelaendemodelle_downloader.constant module¶
berlin_gelaendemodelle_downloader.download module¶
-
berlin_gelaendemodelle_downloader.download.
download_data
(download_path: str, keep_original: bool, compress: int, file_format: tuple)[source]¶ Download and compress the ground level data of Berlin.
Parameters: Raises: click.BadParameter
– for invalid parameter combinations
-
berlin_gelaendemodelle_downloader.download.
download_zip
(zip_url: str) -> (<class 'str'>, <class 'str'>)[source]¶ Parameters: zip_url (str) – URL to a zip subset of the data Returns: file name and content of the file that is included in the zip archiv Return type: (str, list) Raises: HTTPError
– Will be raised if thezip_url
responsed a not 200 code
berlin_gelaendemodelle_downloader.file module¶
-
berlin_gelaendemodelle_downloader.file.
save_files
(download_path: str, file_name: str, original_content: str, data_frame: pandas.core.frame.DataFrame, file_formats: tuple, keep_original: bool) → None[source]¶ Saves all files that are downloaded or created to the proper directories.
Parameters: - download_path (str) – Path to the download directory.
- file_name (str) – file name.
- original_content (str) – Original download content.
- data_frame (DataFrame) – If data were compressed, the corresponding compressed
DataFrame
orGeoDataFrame
. - file_formats (tuple) – Formats to save.
- keep_original (bool) – Flag that indicates whether to save the original files.
berlin_gelaendemodelle_downloader.utils module¶
-
berlin_gelaendemodelle_downloader.utils.
compress_data_frame
(data_frame: pandas.core.frame.DataFrame, tile_size: int) → pandas.core.frame.DataFrame[source]¶ Compress the given
DataFrame
. Uses windows of size ‘\(tile\ size \times tile\ size\)’ and calculates their mean.Use convolution algorithm to compress the neighboring tiles. TODO: see documentation to get an intuition about the convolution implementation.
Parameters: - data_frame (DataFrame) – Original DataFrame
- tile_size (int) – window size
Returns: The compressed pandas.DataFrame
Return type: DataFrame
-
berlin_gelaendemodelle_downloader.utils.
create_directories
(download_path: str, keep_original: bool, compress: int, file_formats: tuple) -> (<class 'str'>, <class 'str'>)[source]¶ Simple helper function that creates all necessary directories.
Parameters: Returns: path for original files, path for compressed files
Return type:
-
berlin_gelaendemodelle_downloader.utils.
data_frame_2_file_content
(data_frame: pandas.core.frame.DataFrame) → list[source]¶ Converts the given
data_frame
into a list of lines as file contentParameters: data_frame – to be serialized Returns: list of lines for serialization as file Return type: list
-
berlin_gelaendemodelle_downloader.utils.
data_frame_2_geo_data_frame
(data_frame: pandas.core.frame.DataFrame) → geopandas.geodataframe.GeoDataFrame[source]¶ Creates a
GeoDataFrame
from the givenDataFrame
Parameters: data_frame (DataFrame) – DataFrame
that is used to create aGeoDataFrame
with geometric information.Returns: Created GeoDataFrame
.Return type: GeoDataFrame