hypercadaster-ES 1.3.0__tar.gz → 1.3.2__tar.gz

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.
Files changed (47) hide show
  1. {hypercadaster_es-1.3.0/hypercadaster_es.egg-info → hypercadaster_es-1.3.2}/PKG-INFO +28 -29
  2. {hypercadaster_es-1.3.0 → hypercadaster_es-1.3.2}/README.md +10 -4
  3. {hypercadaster_es-1.3.0 → hypercadaster_es-1.3.2}/hypercadaster_ES/__init__.py +1 -1
  4. {hypercadaster_es-1.3.0 → hypercadaster_es-1.3.2}/hypercadaster_ES/_db.py +3 -2
  5. {hypercadaster_es-1.3.0 → hypercadaster_es-1.3.2}/hypercadaster_ES/downloaders.py +15 -1
  6. {hypercadaster_es-1.3.0 → hypercadaster_es-1.3.2}/hypercadaster_ES/mergers.py +11 -3
  7. {hypercadaster_es-1.3.0 → hypercadaster_es-1.3.2}/hypercadaster_ES/utils.py +151 -26
  8. {hypercadaster_es-1.3.0 → hypercadaster_es-1.3.2/hypercadaster_es.egg-info}/PKG-INFO +28 -29
  9. {hypercadaster_es-1.3.0 → hypercadaster_es-1.3.2}/hypercadaster_es.egg-info/requires.txt +16 -10
  10. {hypercadaster_es-1.3.0 → hypercadaster_es-1.3.2}/setup.py +19 -11
  11. {hypercadaster_es-1.3.0 → hypercadaster_es-1.3.2}/LICENSE +0 -0
  12. {hypercadaster_es-1.3.0 → hypercadaster_es-1.3.2}/MANIFEST.in +0 -0
  13. {hypercadaster_es-1.3.0 → hypercadaster_es-1.3.2}/hypercadaster_ES/_pretty.py +0 -0
  14. {hypercadaster_es-1.3.0 → hypercadaster_es-1.3.2}/hypercadaster_ES/building_inference.py +0 -0
  15. {hypercadaster_es-1.3.0 → hypercadaster_es-1.3.2}/hypercadaster_ES/cached_files/ine_inspire_codes.xlsx +0 -0
  16. {hypercadaster_es-1.3.0 → hypercadaster_es-1.3.2}/hypercadaster_ES/energy.py +0 -0
  17. {hypercadaster_es-1.3.0 → hypercadaster_es-1.3.2}/hypercadaster_ES/energy_config.yaml +0 -0
  18. {hypercadaster_es-1.3.0 → hypercadaster_es-1.3.2}/hypercadaster_ES/functions.py +0 -0
  19. {hypercadaster_es-1.3.0 → hypercadaster_es-1.3.2}/hypercadaster_ES/interoperability.py +0 -0
  20. {hypercadaster_es-1.3.0 → hypercadaster_es-1.3.2}/hypercadaster_ES/reporting.py +0 -0
  21. {hypercadaster_es-1.3.0 → hypercadaster_es-1.3.2}/hypercadaster_ES/social.py +0 -0
  22. {hypercadaster_es-1.3.0 → hypercadaster_es-1.3.2}/hypercadaster_ES/topology.py +0 -0
  23. {hypercadaster_es-1.3.0 → hypercadaster_es-1.3.2}/hypercadaster_ES/weather.py +0 -0
  24. {hypercadaster_es-1.3.0 → hypercadaster_es-1.3.2}/hypercadaster_es.egg-info/SOURCES.txt +0 -0
  25. {hypercadaster_es-1.3.0 → hypercadaster_es-1.3.2}/hypercadaster_es.egg-info/dependency_links.txt +0 -0
  26. {hypercadaster_es-1.3.0 → hypercadaster_es-1.3.2}/hypercadaster_es.egg-info/top_level.txt +0 -0
  27. {hypercadaster_es-1.3.0 → hypercadaster_es-1.3.2}/setup.cfg +0 -0
  28. {hypercadaster_es-1.3.0 → hypercadaster_es-1.3.2}/tests/test_aggregation.py +0 -0
  29. {hypercadaster_es-1.3.0 → hypercadaster_es-1.3.2}/tests/test_agricultural_archetype.py +0 -0
  30. {hypercadaster_es-1.3.0 → hypercadaster_es-1.3.2}/tests/test_cat_cache.py +0 -0
  31. {hypercadaster_es-1.3.0 → hypercadaster_es-1.3.2}/tests/test_cat_empty_schema.py +0 -0
  32. {hypercadaster_es-1.3.0 → hypercadaster_es-1.3.2}/tests/test_census_tract_aggregations.py +0 -0
  33. {hypercadaster_es-1.3.0 → hypercadaster_es-1.3.2}/tests/test_code_normalisation.py +0 -0
  34. {hypercadaster_es-1.3.0 → hypercadaster_es-1.3.2}/tests/test_codes.py +0 -0
  35. {hypercadaster_es-1.3.0 → hypercadaster_es-1.3.2}/tests/test_dem_tiles.py +0 -0
  36. {hypercadaster_es-1.3.0 → hypercadaster_es-1.3.2}/tests/test_energy_config.py +0 -0
  37. {hypercadaster_es-1.3.0 → hypercadaster_es-1.3.2}/tests/test_energy_scenarios.py +0 -0
  38. {hypercadaster_es-1.3.0 → hypercadaster_es-1.3.2}/tests/test_floorplan_partition.py +0 -0
  39. {hypercadaster_es-1.3.0 → hypercadaster_es-1.3.2}/tests/test_geometry.py +0 -0
  40. {hypercadaster_es-1.3.0 → hypercadaster_es-1.3.2}/tests/test_import_surface.py +0 -0
  41. {hypercadaster_es-1.3.0 → hypercadaster_es-1.3.2}/tests/test_live_smoke.py +0 -0
  42. {hypercadaster_es-1.3.0 → hypercadaster_es-1.3.2}/tests/test_shadow_rules.py +0 -0
  43. {hypercadaster_es-1.3.0 → hypercadaster_es-1.3.2}/tests/test_social.py +0 -0
  44. {hypercadaster_es-1.3.0 → hypercadaster_es-1.3.2}/tests/test_theoretical_cat_spaces.py +0 -0
  45. {hypercadaster_es-1.3.0 → hypercadaster_es-1.3.2}/tests/test_topology.py +0 -0
  46. {hypercadaster_es-1.3.0 → hypercadaster_es-1.3.2}/tests/test_weather.py +0 -0
  47. {hypercadaster_es-1.3.0 → hypercadaster_es-1.3.2}/tests/test_zero_floor_buildings.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.1
2
2
  Name: hypercadaster_es
3
- Version: 1.3.0
3
+ Version: 1.3.2
4
4
  Summary: Python library to obtain the Spanish cadaster data joined with external attributes.
5
5
  Home-page: https://github.com/BeeGroup-cimne
6
6
  Author: Jose Manuel Broto Vispe
@@ -33,7 +33,7 @@ Requires-Dist: shapely<3.0,>=2.0
33
33
  Requires-Dist: pyproj<4.0,>=3.5
34
34
  Requires-Dist: rasterio<2.0,>=1.3
35
35
  Requires-Dist: fiona<2.0,>=1.9
36
- Requires-Dist: geopandas<1.1,>=0.13
36
+ Requires-Dist: geopandas<1.2,>=1.1.2
37
37
  Requires-Dist: pyogrio<1.0,>=0.8
38
38
  Requires-Dist: affine>=2.4
39
39
  Requires-Dist: snuggs>=1.4
@@ -43,28 +43,34 @@ Requires-Dist: pyrosm>=0.6
43
43
  Requires-Dist: networkx>=3.2
44
44
  Requires-Dist: eppy>=0.5.63
45
45
  Requires-Dist: geomeppy>=0.12
46
- Requires-Dist: pyarrow>=14.0
46
+ Requires-Dist: pyarrow>=23.0.1
47
47
  Requires-Dist: openpyxl>=3.1
48
48
  Requires-Dist: et-xmlfile>=1.1
49
49
  Requires-Dist: arrow>=1.4.0
50
50
  Requires-Dist: fastkml>=1.4.0
51
- Requires-Dist: lxml>=6.0.2
52
- Requires-Dist: duckdb>=1.5.3
53
- Requires-Dist: requests<3.0,>=2.31
54
- Requires-Dist: urllib3<3,>=2.1
51
+ Requires-Dist: lxml>=6.1.0
52
+ Requires-Dist: duckdb<2,>=1.5.3
53
+ Requires-Dist: cdsapi>=0.7
54
+ Requires-Dist: xarray>=2024.1
55
+ Requires-Dist: cfgrib>=0.9.10
56
+ Requires-Dist: pvlib>=0.11
57
+ Requires-Dist: requests<3.0,>=2.33
58
+ Requires-Dist: urllib3<3,>=2.8
55
59
  Requires-Dist: charset-normalizer>=3.3
56
- Requires-Dist: idna>=3.6
57
- Requires-Dist: certifi>=2024.2
60
+ Requires-Dist: idna>=3.15
61
+ Requires-Dist: certifi>=2026.10.18
58
62
  Requires-Dist: beautifulsoup4>=4.12
59
- Requires-Dist: soupsieve>=2.5
63
+ Requires-Dist: soupsieve>=2.9
60
64
  Requires-Dist: xmltodict>=0.13
61
65
  Requires-Dist: matplotlib<4,>=3.8
62
66
  Requires-Dist: contourpy>=1.2
63
67
  Requires-Dist: cycler>=0.12
64
68
  Requires-Dist: kiwisolver>=1.4
65
69
  Requires-Dist: fonttools>=4.53
66
- Requires-Dist: pillow>=10.2
70
+ Requires-Dist: pillow>=13.0
67
71
  Requires-Dist: folium>=0.20.0
72
+ Requires-Dist: contextily>=1.5
73
+ Requires-Dist: plotly>=5.20
68
74
  Requires-Dist: click>=8.1
69
75
  Requires-Dist: click-plugins>=1.1
70
76
  Requires-Dist: cligj>=0.7
@@ -83,27 +89,14 @@ Requires-Dist: ruff>=0.4; extra == "dev"
83
89
  Requires-Dist: pytest>=7.0; extra == "dev"
84
90
  Requires-Dist: pytest-cov>=4.0; extra == "dev"
85
91
  Requires-Dist: pdoc>=14.0; extra == "dev"
86
- Dynamic: author
87
- Dynamic: author-email
88
- Dynamic: classifier
89
- Dynamic: description
90
- Dynamic: description-content-type
91
- Dynamic: home-page
92
- Dynamic: keywords
93
- Dynamic: license
94
- Dynamic: license-file
95
- Dynamic: provides-extra
96
- Dynamic: requires-dist
97
- Dynamic: requires-python
98
- Dynamic: summary
99
92
 
100
93
  # hypercadaster_ES
101
94
 
102
95
  A comprehensive Python library for downloading, processing, and analyzing Spanish cadastral data with integration of external geographic datasets and EnergyPlus model generation.
103
96
 
104
- [![Python Version](https://img.shields.io/badge/python-3.10+-blue.svg)](https://python.org)
97
+ [![Python Version](https://img.shields.io/badge/python-3.12+-blue.svg)](https://python.org)
105
98
  [![License](https://img.shields.io/badge/license-EUPL%20v1.2-blue.svg)](https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12)
106
- [![Version](https://img.shields.io/badge/version-1.1.0-green.svg)](https://github.com/BeeGroup-cimne/hypercadaster_ES)
99
+ [![Version](https://img.shields.io/badge/version-1.3.2-green.svg)](https://github.com/BeeGroup-cimne/hypercadaster_ES)
107
100
 
108
101
  ## 🎯 Overview
109
102
 
@@ -206,9 +199,15 @@ For detailed installation instructions and advanced examples, see [Installation
206
199
 
207
200
  ## 👥 Authors & Contributors
208
201
 
209
- **Primary Authors:**
202
+ **Main Authors:**
210
203
  - **Jose Manuel Broto Vispe** - jmbrotovispe@gmail.com
211
204
  - **Gerard Mor** - gmor@cimne.upc.edu
205
+ - **Maite Sellart** - tsellart@cimne.upc.edu
206
+
207
+ **Co-authors:**
208
+ - **David Blanco** - dblanco@cimne.upc.edu
209
+ - **Gerard Laguna** - glaguna@cimne.upc.edu
210
+ - **Nadiya Mehraj** - nmehraj@cimne.upc.edu
212
211
 
213
212
  **Institutional Affiliations:**
214
213
  - **CIMNE** - Centre Internacional de Mètodes Numèrics en Enginyeria, Building Energy and Environment (BEE) group
@@ -222,4 +221,4 @@ This project is licensed under the **EUPL v1.2**. See the [license](https://join
222
221
 
223
222
  *hypercadaster_ES - Built with ❤️ for the Spanish urban analysis and building research community*
224
223
 
225
- *Last updated: July 2026 | Version 1.1.0*
224
+ *Last updated: November 2026 | Version 1.3.2*
@@ -2,9 +2,9 @@
2
2
 
3
3
  A comprehensive Python library for downloading, processing, and analyzing Spanish cadastral data with integration of external geographic datasets and EnergyPlus model generation.
4
4
 
5
- [![Python Version](https://img.shields.io/badge/python-3.10+-blue.svg)](https://python.org)
5
+ [![Python Version](https://img.shields.io/badge/python-3.12+-blue.svg)](https://python.org)
6
6
  [![License](https://img.shields.io/badge/license-EUPL%20v1.2-blue.svg)](https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12)
7
- [![Version](https://img.shields.io/badge/version-1.1.0-green.svg)](https://github.com/BeeGroup-cimne/hypercadaster_ES)
7
+ [![Version](https://img.shields.io/badge/version-1.3.2-green.svg)](https://github.com/BeeGroup-cimne/hypercadaster_ES)
8
8
 
9
9
  ## 🎯 Overview
10
10
 
@@ -107,9 +107,15 @@ For detailed installation instructions and advanced examples, see [Installation
107
107
 
108
108
  ## 👥 Authors & Contributors
109
109
 
110
- **Primary Authors:**
110
+ **Main Authors:**
111
111
  - **Jose Manuel Broto Vispe** - jmbrotovispe@gmail.com
112
112
  - **Gerard Mor** - gmor@cimne.upc.edu
113
+ - **Maite Sellart** - tsellart@cimne.upc.edu
114
+
115
+ **Co-authors:**
116
+ - **David Blanco** - dblanco@cimne.upc.edu
117
+ - **Gerard Laguna** - glaguna@cimne.upc.edu
118
+ - **Nadiya Mehraj** - nmehraj@cimne.upc.edu
113
119
 
114
120
  **Institutional Affiliations:**
115
121
  - **CIMNE** - Centre Internacional de Mètodes Numèrics en Enginyeria, Building Energy and Environment (BEE) group
@@ -123,4 +129,4 @@ This project is licensed under the **EUPL v1.2**. See the [license](https://join
123
129
 
124
130
  *hypercadaster_ES - Built with ❤️ for the Spanish urban analysis and building research community*
125
131
 
126
- *Last updated: July 2026 | Version 1.1.0*
132
+ *Last updated: November 2026 | Version 1.3.2*
@@ -26,7 +26,7 @@ from ._db import ResultsHandle
26
26
  from . import (mergers, utils, building_inference, downloaders, interoperability,
27
27
  energy, weather, social, topology, reporting)
28
28
 
29
- __version__ = "1.3.0"
29
+ __version__ = "1.3.2"
30
30
  __author__ = "Jose Manuel Broto Vispe"
31
31
  __email__ = "jmbrotovispe@gmail.com"
32
32
 
@@ -131,9 +131,10 @@ def cat_cache_read(results_dir: str, cadaster_code: str):
131
131
  con = duckdb.connect(path, read_only=True)
132
132
  if not _table_exists(con, CAT_SPACES_TABLE):
133
133
  return None
134
- df = con.execute(
134
+ # Relation .pl(): duckdb 2.0 dropped .pl() on the DB-API connection.
135
+ df = con.sql(
135
136
  f'SELECT * FROM "{CAT_SPACES_TABLE}" WHERE cadaster_code = ?',
136
- [str(cadaster_code)],
137
+ params=[str(cadaster_code)],
137
138
  ).pl()
138
139
  if df.height == 0:
139
140
  return None
@@ -2299,6 +2299,13 @@ def parse_CAT_file(cadaster_code, CAT_files_dir, allowed_dataset_types = [14, 15
2299
2299
  """
2300
2300
  # Function to parse a single line into a dictionary for each record type
2301
2301
  def process_line(line, allowed_dataset_types):
2302
+ # Skip empty lines or lines with only whitespace
2303
+ if not line or not line.strip():
2304
+ return None
2305
+
2306
+ if len(line) < 2 or not line[:2].strip().isdigit():
2307
+ return None
2308
+
2302
2309
  parsed_row = {}
2303
2310
 
2304
2311
  line = line.encode('utf-8').decode('utf-8')
@@ -2326,6 +2333,9 @@ def parse_CAT_file(cadaster_code, CAT_files_dir, allowed_dataset_types = [14, 15
2326
2333
 
2327
2334
  # Aggregate rows for each type from parsed rows
2328
2335
  for row_dict in parsed_rows:
2336
+ if row_dict is None:
2337
+ continue
2338
+
2329
2339
  for dataset_type, row in row_dict.items():
2330
2340
  row_data[dataset_type].append(row)
2331
2341
 
@@ -2333,7 +2343,11 @@ def parse_CAT_file(cadaster_code, CAT_files_dir, allowed_dataset_types = [14, 15
2333
2343
  combined_dfs = {}
2334
2344
  for dataset_type, rows in row_data.items():
2335
2345
  schema = {i[3]: i[4] for i in catstruct[dataset_type]}
2336
- combined_dfs[dataset_type] = pl.DataFrame(rows, schema=schema, orient="row")
2346
+ cleaned_rows = []
2347
+ for row in rows:
2348
+ cleaned_row = [None if v == "" else v for v in row]
2349
+ cleaned_rows.append(cleaned_row)
2350
+ combined_dfs[dataset_type] = pl.DataFrame(cleaned_rows, schema=schema, orient="row")
2337
2351
 
2338
2352
  return combined_dfs
2339
2353
 
@@ -18,6 +18,7 @@ import os
18
18
  import glob
19
19
  import numpy as np
20
20
  import pandas as pd
21
+ import time
21
22
  from ._pretty import PrettyDict
22
23
  import polars as pl
23
24
  import geopandas as gpd
@@ -1095,9 +1096,16 @@ def join_cadaster_building(gdf, cadaster_dir, census_tracts_dir, DEM_raster_dir,
1095
1096
  'reference': 'building_reference',
1096
1097
  'beginning': 'year_of_construction'
1097
1098
  })
1098
- building_gdf_['year_of_construction'] = building_gdf_['year_of_construction'].str[0:4]
1099
- building_gdf_['year_of_construction'] = pd.to_numeric(
1100
- building_gdf_['year_of_construction'], errors='coerce').astype('Int64')
1099
+ if 'year_of_construction' in building_gdf_.columns:
1100
+ building_gdf_['year_of_construction'] = (
1101
+ building_gdf_['year_of_construction']
1102
+ .astype('string')
1103
+ .str[:4]
1104
+ )
1105
+
1106
+ building_gdf_['year_of_construction'] = pd.to_numeric(
1107
+ building_gdf_['year_of_construction'], errors='coerce').astype('Int64')
1108
+
1101
1109
  building_gdf_.drop(
1102
1110
  ["localId", "namespace", "officialAreaReference", "value_uom", "horizontalGeometryEstimatedAccuracy",
1103
1111
  "horizontalGeometryEstimatedAccuracy_uom", "horizontalGeometryReference", "referenceGeometry",
@@ -3854,7 +3854,7 @@ def _create_full_street_names(gdf):
3854
3854
 
3855
3855
  return gdf_result
3856
3856
 
3857
- def flat_gdf_to_building_spaces_resolution(gdf, building_reference_col="building_reference"):
3857
+ def flat_gdf_to_building_spaces_resolution(gdf, building_reference_col="building_reference", chunk_size=50_000):
3858
3858
  """Explode a building-level (Geo)DataFrame to one row per building space.
3859
3859
 
3860
3860
  Each ``br__building_spaces_<name>`` column holds a ``{use_type: [values]}``
@@ -3891,6 +3891,9 @@ def flat_gdf_to_building_spaces_resolution(gdf, building_reference_col="building
3891
3891
  pandas.DataFrame
3892
3892
  One row per building space.
3893
3893
  """
3894
+
3895
+ import gc
3896
+
3894
3897
  prefix = "br__building_spaces_"
3895
3898
  out_prefix = "building_space_"
3896
3899
  excluded_per_space = {"br__building_spaces_by_floor"}
@@ -3901,36 +3904,158 @@ def flat_gdf_to_building_spaces_resolution(gdf, building_reference_col="building
3901
3904
  return (isinstance(v, dict) and len(v) > 0
3902
3905
  and all(isinstance(x, list) for x in v.values()))
3903
3906
 
3907
+ # Find per-space columns
3904
3908
  candidate_cols = [
3905
3909
  c for c in gdf.columns
3906
3910
  if c.startswith(prefix) and c not in excluded_per_space
3907
3911
  ]
3908
3912
 
3909
- records = []
3910
- for _, row in gdf.iterrows():
3911
- consumed = [c for c in candidate_cols if _is_per_space(row[c])]
3912
- if not consumed:
3913
- continue
3914
- exploded = {out_prefix + c[len(prefix):]: row[c] for c in consumed}
3915
- # building-level context = everything not exploded as a per-space column
3916
- context = {c: row[c] for c in gdf.columns if c not in consumed}
3917
- # All per-space columns share the same {use_type: [...]} shape; use the
3918
- # first as the reference for the use-type keys and per-use list lengths.
3919
- ref = exploded[next(iter(exploded))]
3920
- for use_type, values in ref.items():
3921
- for i in range(len(values)):
3922
- rec = dict(context)
3923
- rec["use_type"] = use_type
3924
- for name, by_use in exploded.items():
3925
- seq = by_use.get(use_type)
3926
- rec[name] = seq[i] if isinstance(seq, list) and i < len(seq) else None
3927
- records.append(rec)
3928
-
3929
- result = pd.DataFrame(records)
3930
- if not result.empty:
3931
- lead = [c for c in (building_reference_col, "use_type") if c in result.columns]
3932
- rest = [c for c in result.columns if c not in lead]
3933
- result = result[lead + rest]
3913
+ per_space_cols = []
3914
+
3915
+ for col in candidate_cols:
3916
+ for value in gdf[col]:
3917
+ if _is_per_space(value):
3918
+ per_space_cols.append(col)
3919
+ break
3920
+
3921
+ if not per_space_cols:
3922
+ sys.stderr.write("[FLAT] No per-space columns found")
3923
+ return pd.DataFrame()
3924
+
3925
+ renamed_space_cols = {
3926
+ c: out_prefix + c[len(prefix):]
3927
+ for c in per_space_cols
3928
+ }
3929
+
3930
+ context_cols = [
3931
+ c for c in gdf.columns
3932
+ if c not in per_space_cols
3933
+ ]
3934
+
3935
+ sys.stderr.write(f"[FLAT] per-space columns: {len(per_space_cols)}")
3936
+
3937
+ sys.stderr.write(f"[FLAT] context columns: {len(context_cols)}")
3938
+
3939
+ sys.stderr.write("[FLAT] Counting building spaces...")
3940
+
3941
+ # Determine how many output rows we need.
3942
+ total_records = 0
3943
+
3944
+ n_buildings = len(gdf)
3945
+
3946
+ for start in range(0, n_buildings, chunk_size):
3947
+ stop = min(start + chunk_size, n_buildings)
3948
+ sys.stderr.write(f"[FLAT] counting buildings {start:,} -> {stop:,}")
3949
+ part = gdf.iloc[start:stop]
3950
+
3951
+ for _, row in part.iterrows():
3952
+ ref = None
3953
+ for col in per_space_cols:
3954
+ value = row[col]
3955
+ if _is_per_space(value):
3956
+ ref = value
3957
+ break
3958
+
3959
+ if ref is None:
3960
+ continue
3961
+
3962
+ for values in ref.values():
3963
+ if isinstance(values, list):
3964
+ total_records += len(values)
3965
+
3966
+ del part
3967
+
3968
+ gc.collect()
3969
+
3970
+ sys.stderr.write(f"[FLAT] Total records: {total_records:,}")
3971
+
3972
+ if total_records == 0:
3973
+ return pd.DataFrame()
3974
+
3975
+ sys.stderr.write("[FLAT] Allocating output columns...")
3976
+
3977
+ output = {}
3978
+
3979
+ for col in context_cols:
3980
+ output[col] = [None] * total_records
3981
+
3982
+ output["use_type"] = [None] * total_records
3983
+
3984
+ for col in per_space_cols:
3985
+ output[renamed_space_cols[col]] = [None] * total_records
3986
+
3987
+ pos = 0
3988
+ # Fill the preallocated columns.
3989
+ for start in range(0, n_buildings, chunk_size):
3990
+ stop = min(start + chunk_size, n_buildings)
3991
+
3992
+ sys.stderr.write(f"\n[FLAT] filling buildings {start:,} -> {stop:,}")
3993
+
3994
+ part = gdf.iloc[start:stop]
3995
+
3996
+ for _, row in part.iterrows():
3997
+ values_by_col = {}
3998
+ for col in per_space_cols:
3999
+ value = row[col]
4000
+ if _is_per_space(value):
4001
+ values_by_col[col] = value
4002
+
4003
+ if not values_by_col:
4004
+ continue
4005
+
4006
+ # First valid per-space column is reference.
4007
+ ref = next(iter(values_by_col.values()))
4008
+
4009
+ for use_type, values in ref.items():
4010
+ if not isinstance(values, list):
4011
+ continue
4012
+
4013
+ n_spaces = len(values)
4014
+
4015
+ for i in range(n_spaces):
4016
+ for col in context_cols:
4017
+ output[col][pos] = row[col]
4018
+
4019
+ output["use_type"][pos] = use_type
4020
+
4021
+ for col in per_space_cols:
4022
+ by_use = values_by_col.get(col)
4023
+ if by_use is None:
4024
+ continue
4025
+
4026
+ seq = by_use.get(use_type)
4027
+
4028
+ if isinstance(seq, list) and i < len(seq):
4029
+ output[renamed_space_cols[col]][pos] = seq[i]
4030
+
4031
+ pos += 1
4032
+
4033
+ del part
4034
+
4035
+ gc.collect()
4036
+
4037
+ sys.stderr.write(f"[FLAT] filled {pos:,} / {total_records:,}")
4038
+
4039
+ if pos != total_records:
4040
+ raise RuntimeError(
4041
+ f"Expected {total_records:,} records but generated {pos:,}"
4042
+ )
4043
+
4044
+ sys.stderr.write("\n[FLAT] Creating final DataFrame...")
4045
+
4046
+ result = pd.DataFrame(output)
4047
+
4048
+ del output
4049
+ gc.collect()
4050
+
4051
+ lead = [c for c in (building_reference_col,"use_type") if c in result.columns]
4052
+ rest = [c for c in result.columns if c not in lead]
4053
+ result = result[lead + rest]
4054
+
4055
+ gc.collect()
4056
+
4057
+ sys.stderr.write(f"[FLAT] Final DataFrame: {len(result):,} rows")
4058
+
3934
4059
  return result
3935
4060
 
3936
4061
 
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.1
2
2
  Name: hypercadaster_es
3
- Version: 1.3.0
3
+ Version: 1.3.2
4
4
  Summary: Python library to obtain the Spanish cadaster data joined with external attributes.
5
5
  Home-page: https://github.com/BeeGroup-cimne
6
6
  Author: Jose Manuel Broto Vispe
@@ -33,7 +33,7 @@ Requires-Dist: shapely<3.0,>=2.0
33
33
  Requires-Dist: pyproj<4.0,>=3.5
34
34
  Requires-Dist: rasterio<2.0,>=1.3
35
35
  Requires-Dist: fiona<2.0,>=1.9
36
- Requires-Dist: geopandas<1.1,>=0.13
36
+ Requires-Dist: geopandas<1.2,>=1.1.2
37
37
  Requires-Dist: pyogrio<1.0,>=0.8
38
38
  Requires-Dist: affine>=2.4
39
39
  Requires-Dist: snuggs>=1.4
@@ -43,28 +43,34 @@ Requires-Dist: pyrosm>=0.6
43
43
  Requires-Dist: networkx>=3.2
44
44
  Requires-Dist: eppy>=0.5.63
45
45
  Requires-Dist: geomeppy>=0.12
46
- Requires-Dist: pyarrow>=14.0
46
+ Requires-Dist: pyarrow>=23.0.1
47
47
  Requires-Dist: openpyxl>=3.1
48
48
  Requires-Dist: et-xmlfile>=1.1
49
49
  Requires-Dist: arrow>=1.4.0
50
50
  Requires-Dist: fastkml>=1.4.0
51
- Requires-Dist: lxml>=6.0.2
52
- Requires-Dist: duckdb>=1.5.3
53
- Requires-Dist: requests<3.0,>=2.31
54
- Requires-Dist: urllib3<3,>=2.1
51
+ Requires-Dist: lxml>=6.1.0
52
+ Requires-Dist: duckdb<2,>=1.5.3
53
+ Requires-Dist: cdsapi>=0.7
54
+ Requires-Dist: xarray>=2024.1
55
+ Requires-Dist: cfgrib>=0.9.10
56
+ Requires-Dist: pvlib>=0.11
57
+ Requires-Dist: requests<3.0,>=2.33
58
+ Requires-Dist: urllib3<3,>=2.8
55
59
  Requires-Dist: charset-normalizer>=3.3
56
- Requires-Dist: idna>=3.6
57
- Requires-Dist: certifi>=2024.2
60
+ Requires-Dist: idna>=3.15
61
+ Requires-Dist: certifi>=2026.10.18
58
62
  Requires-Dist: beautifulsoup4>=4.12
59
- Requires-Dist: soupsieve>=2.5
63
+ Requires-Dist: soupsieve>=2.9
60
64
  Requires-Dist: xmltodict>=0.13
61
65
  Requires-Dist: matplotlib<4,>=3.8
62
66
  Requires-Dist: contourpy>=1.2
63
67
  Requires-Dist: cycler>=0.12
64
68
  Requires-Dist: kiwisolver>=1.4
65
69
  Requires-Dist: fonttools>=4.53
66
- Requires-Dist: pillow>=10.2
70
+ Requires-Dist: pillow>=13.0
67
71
  Requires-Dist: folium>=0.20.0
72
+ Requires-Dist: contextily>=1.5
73
+ Requires-Dist: plotly>=5.20
68
74
  Requires-Dist: click>=8.1
69
75
  Requires-Dist: click-plugins>=1.1
70
76
  Requires-Dist: cligj>=0.7
@@ -83,27 +89,14 @@ Requires-Dist: ruff>=0.4; extra == "dev"
83
89
  Requires-Dist: pytest>=7.0; extra == "dev"
84
90
  Requires-Dist: pytest-cov>=4.0; extra == "dev"
85
91
  Requires-Dist: pdoc>=14.0; extra == "dev"
86
- Dynamic: author
87
- Dynamic: author-email
88
- Dynamic: classifier
89
- Dynamic: description
90
- Dynamic: description-content-type
91
- Dynamic: home-page
92
- Dynamic: keywords
93
- Dynamic: license
94
- Dynamic: license-file
95
- Dynamic: provides-extra
96
- Dynamic: requires-dist
97
- Dynamic: requires-python
98
- Dynamic: summary
99
92
 
100
93
  # hypercadaster_ES
101
94
 
102
95
  A comprehensive Python library for downloading, processing, and analyzing Spanish cadastral data with integration of external geographic datasets and EnergyPlus model generation.
103
96
 
104
- [![Python Version](https://img.shields.io/badge/python-3.10+-blue.svg)](https://python.org)
97
+ [![Python Version](https://img.shields.io/badge/python-3.12+-blue.svg)](https://python.org)
105
98
  [![License](https://img.shields.io/badge/license-EUPL%20v1.2-blue.svg)](https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12)
106
- [![Version](https://img.shields.io/badge/version-1.1.0-green.svg)](https://github.com/BeeGroup-cimne/hypercadaster_ES)
99
+ [![Version](https://img.shields.io/badge/version-1.3.2-green.svg)](https://github.com/BeeGroup-cimne/hypercadaster_ES)
107
100
 
108
101
  ## 🎯 Overview
109
102
 
@@ -206,9 +199,15 @@ For detailed installation instructions and advanced examples, see [Installation
206
199
 
207
200
  ## 👥 Authors & Contributors
208
201
 
209
- **Primary Authors:**
202
+ **Main Authors:**
210
203
  - **Jose Manuel Broto Vispe** - jmbrotovispe@gmail.com
211
204
  - **Gerard Mor** - gmor@cimne.upc.edu
205
+ - **Maite Sellart** - tsellart@cimne.upc.edu
206
+
207
+ **Co-authors:**
208
+ - **David Blanco** - dblanco@cimne.upc.edu
209
+ - **Gerard Laguna** - glaguna@cimne.upc.edu
210
+ - **Nadiya Mehraj** - nmehraj@cimne.upc.edu
212
211
 
213
212
  **Institutional Affiliations:**
214
213
  - **CIMNE** - Centre Internacional de Mètodes Numèrics en Enginyeria, Building Energy and Environment (BEE) group
@@ -222,4 +221,4 @@ This project is licensed under the **EUPL v1.2**. See the [license](https://join
222
221
 
223
222
  *hypercadaster_ES - Built with ❤️ for the Spanish urban analysis and building research community*
224
223
 
225
- *Last updated: July 2026 | Version 1.1.0*
224
+ *Last updated: November 2026 | Version 1.3.2*
@@ -13,7 +13,7 @@ shapely<3.0,>=2.0
13
13
  pyproj<4.0,>=3.5
14
14
  rasterio<2.0,>=1.3
15
15
  fiona<2.0,>=1.9
16
- geopandas<1.1,>=0.13
16
+ geopandas<1.2,>=1.1.2
17
17
  pyogrio<1.0,>=0.8
18
18
  affine>=2.4
19
19
  snuggs>=1.4
@@ -23,28 +23,34 @@ pyrosm>=0.6
23
23
  networkx>=3.2
24
24
  eppy>=0.5.63
25
25
  geomeppy>=0.12
26
- pyarrow>=14.0
26
+ pyarrow>=23.0.1
27
27
  openpyxl>=3.1
28
28
  et-xmlfile>=1.1
29
29
  arrow>=1.4.0
30
30
  fastkml>=1.4.0
31
- lxml>=6.0.2
32
- duckdb>=1.5.3
33
- requests<3.0,>=2.31
34
- urllib3<3,>=2.1
31
+ lxml>=6.1.0
32
+ duckdb<2,>=1.5.3
33
+ cdsapi>=0.7
34
+ xarray>=2024.1
35
+ cfgrib>=0.9.10
36
+ pvlib>=0.11
37
+ requests<3.0,>=2.33
38
+ urllib3<3,>=2.8
35
39
  charset-normalizer>=3.3
36
- idna>=3.6
37
- certifi>=2024.2
40
+ idna>=3.15
41
+ certifi>=2026.10.18
38
42
  beautifulsoup4>=4.12
39
- soupsieve>=2.5
43
+ soupsieve>=2.9
40
44
  xmltodict>=0.13
41
45
  matplotlib<4,>=3.8
42
46
  contourpy>=1.2
43
47
  cycler>=0.12
44
48
  kiwisolver>=1.4
45
49
  fonttools>=4.53
46
- pillow>=10.2
50
+ pillow>=13.0
47
51
  folium>=0.20.0
52
+ contextily>=1.5
53
+ plotly>=5.20
48
54
  click>=8.1
49
55
  click-plugins>=1.1
50
56
  cligj>=0.7
@@ -3,7 +3,7 @@ from setuptools import find_packages, setup
3
3
 
4
4
  HERE = pathlib.Path(__file__).parent
5
5
 
6
- VERSION = "1.3.0"
6
+ VERSION = "1.3.2"
7
7
  PACKAGE_NAME = "hypercadaster_es"
8
8
  AUTHOR = "Jose Manuel Broto Vispe"
9
9
  AUTHOR_EMAIL = "jmbrotovispe@gmail.com"
@@ -35,7 +35,7 @@ INSTALL_REQUIRES = [
35
35
  "pyproj>=3.5,<4.0",
36
36
  "rasterio>=1.3,<2.0",
37
37
  "fiona>=1.9,<2.0",
38
- "geopandas>=0.13,<1.1",
38
+ "geopandas>=1.1.2,<1.2",
39
39
  "pyogrio>=0.8,<1.0",
40
40
  "affine>=2.4",
41
41
  "snuggs>=1.4",
@@ -51,22 +51,28 @@ INSTALL_REQUIRES = [
51
51
  "geomeppy>=0.12",
52
52
 
53
53
  # --- File formats & tabular IO ---
54
- "pyarrow>=14.0",
54
+ "pyarrow>=23.0.1",
55
55
  "openpyxl>=3.1",
56
56
  "et-xmlfile>=1.1",
57
57
  "arrow>=1.4.0",
58
58
  "fastkml>=1.4.0",
59
- "lxml>=6.0.2",
60
- "duckdb>=1.5.3",
59
+ "lxml>=6.1.0",
60
+ "duckdb>=1.5.3,<2", # 2.0 rejects new work while a prior result is unfinished; port pending
61
+
62
+ # --- Weather (ERA5-Land -> EPW) ---
63
+ "cdsapi>=0.7", # Copernicus CDS client (Apache-2.0)
64
+ "xarray>=2024.1", # (Apache-2.0)
65
+ "cfgrib>=0.9.10", # GRIB engine for xarray; pulls eccodes (Apache-2.0)
66
+ "pvlib>=0.11", # solar position / irradiance (BSD-3)
61
67
 
62
68
  # --- Web / HTTP ---
63
- "requests>=2.31,<3.0",
64
- "urllib3>=2.1,<3",
69
+ "requests>=2.33,<3.0",
70
+ "urllib3>=2.8,<3",
65
71
  "charset-normalizer>=3.3",
66
- "idna>=3.6",
67
- "certifi>=2024.2",
72
+ "idna>=3.15",
73
+ "certifi>=2026.10.18",
68
74
  "beautifulsoup4>=4.12",
69
- "soupsieve>=2.5",
75
+ "soupsieve>=2.9",
70
76
  "xmltodict>=0.13",
71
77
 
72
78
  # --- Plotting & visuals ---
@@ -75,8 +81,10 @@ INSTALL_REQUIRES = [
75
81
  "cycler>=0.12",
76
82
  "kiwisolver>=1.4",
77
83
  "fonttools>=4.53",
78
- "pillow>=10.2",
84
+ "pillow>=13.0",
79
85
  "folium>=0.20.0",
86
+ "contextily>=1.5", # basemap tiles (BSD-3); imported at module level in utils
87
+ "plotly>=5.20", # interactive energy-scenario reports (MIT)
80
88
 
81
89
  # --- CLI & packaging helpers ---
82
90
  "click>=8.1",