zensus
The central module containing all code dealing with importing Zensus data.
- class ZensusMiscellaneous(dependencies)[source]
Bases:
Dataset- sources: DatasetSources = DatasetSources(tables={}, files={}, urls={'zensus_households': 'https://www.zensus2011.de/SharedDocs/Downloads/DE/Pressemitteilung/DemografischeGrunddaten/csv_Haushalte_100m_Gitter.zip?__blob=publicationFile&v=2', 'zensus_buildings': 'https://www.zensus2011.de/SharedDocs/Downloads/DE/Pressemitteilung/DemografischeGrunddaten/csv_Gebaeude_100m_Gitter.zip?__blob=publicationFile&v=2', 'zensus_apartments': 'https://www.zensus2011.de/SharedDocs/Downloads/DE/Pressemitteilung/DemografischeGrunddaten/csv_Wohnungen_100m_Gitter.zip?__blob=publicationFile&v=5'})
The sources used by the datasets. Could be tables, files and urls
- targets: DatasetTargets = DatasetTargets(tables={'zensus_households': 'society.egon_destatis_zensus_household_per_ha', 'zensus_buildings': 'society.egon_destatis_zensus_building_per_ha', 'zensus_apartments': 'society.egon_destatis_zensus_apartment_per_ha'}, files={'zensus_households': 'data_bundle_egon_data/zensus_population/csv_Haushalte_100m_Gitter.zip', 'zensus_buildings': 'data_bundle_egon_data/zensus_population/csv_Gebaeude_100m_Gitter.zip', 'zensus_apartments': 'data_bundle_egon_data/zensus_population/csv_Wohnungen_100m_Gitter.zip'})
The targets created by the datasets. Could be tables and files
- class ZensusPopulation(dependencies)[source]
Bases:
Dataset- sources: DatasetSources = DatasetSources(tables={'boundaries_vg250_lan': 'boundaries.vg250_lan'}, files={'zensus_population': 'data_bundle_egon_data/zensus_population/csv_Bevoelkerung_100m_Gitter.zip'}, urls={})
The sources used by the datasets. Could be tables, files and urls
- targets: DatasetTargets = DatasetTargets(tables={'zensus_population': 'society.destatis_zensus_population_per_ha'}, files={})
The targets created by the datasets. Could be tables and files
- adjust_zensus_misc()[source]
Delete unpopulated cells in zensus-households, -buildings and -apartments
Some unpopulated zensus cells are listed in: - egon_destatis_zensus_household_per_ha - egon_destatis_zensus_building_per_ha - egon_destatis_zensus_apartment_per_ha
This can be caused by missing population information due to privacy or other special cases (e.g. holiday homes are listed as buildings but are not permanently populated.) In the following tasks of egon-data, only data of populated cells is used.
- Returns:
None.
- create_combined_zensus_table()[source]
Create combined table with buildings, apartments and population per cell
Only apartment and building data with acceptable data quality (quantity_q<2) is used, all other data is dropped. For more details on data quality see Zensus docs: https://www.zensus2011.de/DE/Home/Aktuelles/DemografischeGrunddaten.html
If there’s no data on buildings or apartments for a certain cell, the value for building_count resp. apartment_count contains NULL.
- filter_zensus_misc(filename, dataset)[source]
This block filters lines in the source CSV file and copies the appropriate ones to the destination based on grid_id values.
- Parameters:
filename (str) – Path to input csv-file
dataset (str, optional) – Toggles between production (dataset=’Everything’) and test mode e.g. (dataset=’Schleswig-Holstein’). In production mode, data covering entire Germany is used. In the test mode a subset of this data is used for testing the workflow.
- Returns:
str – Path to output csv-file
- filter_zensus_population(filename, dataset)[source]
This block filters lines in the source CSV file and copies the appropriate ones to the destination based on geometry.
- Parameters:
filename (str) – Path to input csv-file
dataset (str, optional) – Toggles between production (dataset=’Everything’) and test mode e.g. (dataset=’Schleswig-Holstein’). In production mode, data covering entire Germany is used. In the test mode a subset of this data is used for testing the workflow.
- Returns:
str – Path to output csv-file