geo4bolivia 0.1.0__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.
@@ -0,0 +1,30 @@
1
+ # R
2
+ .Rproj.user
3
+ .Rhistory
4
+ .RData
5
+ .Ruserdata
6
+
7
+ # Python
8
+ __pycache__/
9
+ *.py[cod]
10
+ *.egg-info/
11
+ /dist/
12
+ .pytest_cache/
13
+ /build/
14
+
15
+ # Virtual environment (UV)
16
+ .venv/
17
+
18
+ # Jupyter
19
+ .ipynb_checkpoints/
20
+
21
+ # OS
22
+ .DS_Store
23
+
24
+ # Reference clones used to start this project (never committed)
25
+ /geo4cambodia/
26
+ /ds4bolivia/
27
+
28
+ # Files written by running the notebooks
29
+ /notebooks/my_data/
30
+ /notebooks/*.tif
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Carlos Mendez
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,164 @@
1
+ Metadata-Version: 2.5
2
+ Name: geo4bolivia
3
+ Version: 0.1.0
4
+ Summary: Subnational development data for Bolivia across spatial scales (GeoDevelopment Observatory of Bolivia)
5
+ Project-URL: Homepage, https://quarcs-lab.github.io/geo4bolivia/
6
+ Project-URL: Documentation, https://github.com/quarcs-lab/geo4bolivia/blob/main/docs/data-infrastructure.md
7
+ Project-URL: Repository, https://github.com/quarcs-lab/geo4bolivia
8
+ Project-URL: Issues, https://github.com/quarcs-lab/geo4bolivia/issues
9
+ Author: Carlos Mendez
10
+ License: MIT
11
+ License-File: LICENSE
12
+ Keywords: bolivia,gadm,geospatial,municipalities,panel data,regional development,remote sensing,sdgs,subnational data
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Topic :: Scientific/Engineering :: GIS
18
+ Requires-Python: >=3.11
19
+ Requires-Dist: geopandas>=0.14
20
+ Requires-Dist: numpy>=1.24
21
+ Requires-Dist: pandas>=2.0
22
+ Requires-Dist: pyarrow>=15
23
+ Requires-Dist: pyyaml>=6.0
24
+ Requires-Dist: requests>=2.31
25
+ Provides-Extra: raster
26
+ Requires-Dist: rasterio>=1.3; extra == 'raster'
27
+ Description-Content-Type: text/markdown
28
+
29
+ # geo4bolivia
30
+
31
+ **Subnational development data for Bolivia, ready to analyse, at every spatial scale.**
32
+
33
+ `geo4bolivia` is the Python package of the [GeoDevelopment Observatory of Bolivia](https://quarcs-lab.github.io/geo4bolivia/). It loads the observatory's indicators for Bolivia's 339 municipalities (population, night-time lights, 64 indicators of the Municipal Atlas of the SDGs, satellite embeddings...) as tidy panels, with boundaries for every scale. It also lets you **build your own indicators**: link your tables to the same unit IDs, summarise rasters over units, move data across scales and combine datasets. It works out of the box in Google Colab: every example below runs in a new Colab notebook (replace the placeholder files, such as your own table or raster, with yours).
34
+
35
+ ```python
36
+ !pip install -q geo4bolivia mapclassify # mapclassify: for scheme="quantiles"
37
+ import geo4bolivia as geo
38
+
39
+ geo.datasets() # what is available, at which scale and years
40
+ gdf = geo.load("sdg", variables="sdg1_2_mpi", years=2012, geometry=True) # 339 municipalities
41
+ gdf.plot(column="sdg1_2_mpi", scheme="quantiles", k=5, legend=True)
42
+ ```
43
+
44
+ [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/notebooks/empty.ipynb)
45
+
46
+ ## What it does
47
+
48
+ | Task | Functions |
49
+ | --- | --- |
50
+ | **Load** panels (one row per unit and year), names and boundaries | `datasets`, `dictionary`, `load`, `units`, `boundaries`, `crosswalk` |
51
+ | **Link** your own tables by unit names or codes (INE, DS4Bolivia), whatever the spelling | `link`, `check` |
52
+ | **Extract** indicators from rasters (Earth Engine exports, WorldPop, ...) | `zonal` |
53
+ | **Move** data up the hierarchy or onto grids and custom zones | `aggregate`, `overlay`, `overlay_weights` |
54
+ | **Combine** datasets at one scale and **save** new ones in the same format | `combine`, `save` |
55
+ | **Analyse** with [expdpy](https://cmg777.github.io/expdpy/) (panel exploration, fixed and random effects) and [geometrics](https://quarcs-lab.github.io/geometrics/) (convergence, spatial dependence, inequality) | `for_expdpy`, `for_geometrics` |
56
+
57
+ ## One ID for every unit, at every scale
58
+
59
+ Every unit has a **geo ID** that nests by prefix (GADM 4.1 hierarchy): municipality `BO-04-17-04` (La Paz) lies in province `BO-04-17` (Murillo), which lies in department `BO-04` (La Paz), which lies in Bolivia `BO`. INE codes and DS4Bolivia's `asdf_id` are kept as columns of `geo.units()`. Each dataset is a long panel keyed by `geo_id` and `year`.
60
+
61
+ | Scale | Units | Example |
62
+ | --- | --- | --- |
63
+ | `country` | 1 | `BO` |
64
+ | `department` | 9 | `BO-04` |
65
+ | `province` | 112 | `BO-04-17` |
66
+ | `municipality` | 339 | `BO-04-17-04` |
67
+
68
+ ## Build your own indicator in five lines
69
+
70
+ ```python
71
+ !pip install -q geo4bolivia
72
+ import pandas as pd
73
+ import geo4bolivia as geo
74
+
75
+ mine = pd.read_csv("schools_by_municipality.csv") # e.g. columns mun_id (INE code), year, schools
76
+ mine = geo.link(mine, scale="municipality", on="mun_id", key="mun_id") # 20101 -> BO-04-17-04
77
+ panel = geo.combine(["pop"], scale="municipality", extra=[mine])
78
+ panel["schools_per_10k"] = panel["schools"] / panel["pop"] * 1e4
79
+ geo.save(panel, "schools", scale="municipality", directory="my_data")
80
+ ```
81
+
82
+ [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/notebooks/empty.ipynb)
83
+
84
+ From a raster:
85
+
86
+ ```python
87
+ !pip install -q "geo4bolivia[raster]" # [raster] adds rasterio
88
+ import geo4bolivia as geo
89
+
90
+ lights = geo.zonal("viirs_2020.tif", scale="municipality", stats=["sum", "mean"], name="ntl", year=2020)
91
+ ```
92
+
93
+ [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/notebooks/empty.ipynb)
94
+
95
+ Then explore and model the panel with expdpy:
96
+
97
+ ```python
98
+ !pip install -q geo4bolivia expdpy
99
+ import numpy as np
100
+ import geo4bolivia as geo
101
+ import expdpy as ex
102
+
103
+ panel = geo.combine(["ntl", "pop"], scale="municipality", years=(2012, 2020))
104
+ panel["ln_pop"] = np.log(panel["pop"])
105
+ df, df_def = geo.for_expdpy(panel, labels={"ln_pop": "Log of population"})
106
+ df = ex.set_labels(df, df_def, set_panel=True)
107
+ ex.analyze_panel_table(df, "ln_NTLpc", ["ln_pop"]) # pooled, between, fixed and random effects
108
+ ```
109
+
110
+ [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/notebooks/empty.ipynb)
111
+
112
+ Or analyse it spatially with geometrics:
113
+
114
+ ```python
115
+ !pip install -q geo4bolivia geometrics
116
+ import numpy as np
117
+ import geo4bolivia as geo
118
+ import geometrics as gm
119
+
120
+ ntl = geo.load("ntl")
121
+ ntl["NTLpc"] = np.exp(ntl["ln_NTLpc"])
122
+ gdf, df, df_dict = geo.for_geometrics(ntl, labels={"NTLpc": "Night-time lights per capita"})
123
+ df = gm.set_labels(df, df_dict, set_panel=True)
124
+ gm.analyze_beta_convergence(df, "NTLpc", gdf=gdf, w=gm.make_weights(gdf)).interpret() # levels: logged internally
125
+ ```
126
+
127
+ [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/notebooks/empty.ipynb)
128
+
129
+ ## Without the package
130
+
131
+ Every file is also a plain URL, readable with pandas alone (preinstalled in Colab, so nothing to install):
132
+
133
+ ```python
134
+ import pandas as pd
135
+ df = pd.read_csv("https://raw.githubusercontent.com/quarcs-lab/geo4bolivia/main/data/municipality/ntl.csv")
136
+ ```
137
+
138
+ [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/notebooks/empty.ipynb)
139
+
140
+ ## Installation
141
+
142
+ In a Google Colab cell:
143
+
144
+ ```python
145
+ !pip install -q geo4bolivia # core: pandas, numpy, geopandas, pyarrow, requests, pyyaml (Colab has them)
146
+ !pip install -q "geo4bolivia[raster]" # + rasterio, for zonal()
147
+ !pip install -q git+https://github.com/quarcs-lab/geo4bolivia # development version
148
+ ```
149
+
150
+ [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/notebooks/empty.ipynb)
151
+
152
+ Python 3.11 or later. The data are not inside the package. It reads them from the [GitHub repository](https://github.com/quarcs-lab/geo4bolivia), so installation is quick and you always get the files the website links to. For reproducible research, pin a release of the data with `geo.load(..., ref="v0.1.0")` or the environment variable `GEO4BOLIVIA_REF=v0.1.0`.
153
+
154
+ ## Documentation
155
+
156
+ - [How the data infrastructure works](https://github.com/quarcs-lab/geo4bolivia/blob/main/docs/data-infrastructure.md): scales, IDs, metadata, aggregation rules, and recipes for building indicators
157
+ - [Dataset pages](https://github.com/quarcs-lab/geo4bolivia/tree/main/docs/datasets): variable dictionaries, coverage, sources and citations
158
+ - [Website](https://quarcs-lab.github.io/geo4bolivia/): indicators, notebooks, web apps and insights
159
+
160
+ ## Citation
161
+
162
+ Mendez, C. (2026). *GeoDevelopment Observatory of Bolivia*. https://quarcs-lab.github.io/geo4bolivia/
163
+
164
+ MIT License. Original data sources are credited on each dataset page.
@@ -0,0 +1,136 @@
1
+ # geo4bolivia
2
+
3
+ **Subnational development data for Bolivia, ready to analyse, at every spatial scale.**
4
+
5
+ `geo4bolivia` is the Python package of the [GeoDevelopment Observatory of Bolivia](https://quarcs-lab.github.io/geo4bolivia/). It loads the observatory's indicators for Bolivia's 339 municipalities (population, night-time lights, 64 indicators of the Municipal Atlas of the SDGs, satellite embeddings...) as tidy panels, with boundaries for every scale. It also lets you **build your own indicators**: link your tables to the same unit IDs, summarise rasters over units, move data across scales and combine datasets. It works out of the box in Google Colab: every example below runs in a new Colab notebook (replace the placeholder files, such as your own table or raster, with yours).
6
+
7
+ ```python
8
+ !pip install -q geo4bolivia mapclassify # mapclassify: for scheme="quantiles"
9
+ import geo4bolivia as geo
10
+
11
+ geo.datasets() # what is available, at which scale and years
12
+ gdf = geo.load("sdg", variables="sdg1_2_mpi", years=2012, geometry=True) # 339 municipalities
13
+ gdf.plot(column="sdg1_2_mpi", scheme="quantiles", k=5, legend=True)
14
+ ```
15
+
16
+ [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/notebooks/empty.ipynb)
17
+
18
+ ## What it does
19
+
20
+ | Task | Functions |
21
+ | --- | --- |
22
+ | **Load** panels (one row per unit and year), names and boundaries | `datasets`, `dictionary`, `load`, `units`, `boundaries`, `crosswalk` |
23
+ | **Link** your own tables by unit names or codes (INE, DS4Bolivia), whatever the spelling | `link`, `check` |
24
+ | **Extract** indicators from rasters (Earth Engine exports, WorldPop, ...) | `zonal` |
25
+ | **Move** data up the hierarchy or onto grids and custom zones | `aggregate`, `overlay`, `overlay_weights` |
26
+ | **Combine** datasets at one scale and **save** new ones in the same format | `combine`, `save` |
27
+ | **Analyse** with [expdpy](https://cmg777.github.io/expdpy/) (panel exploration, fixed and random effects) and [geometrics](https://quarcs-lab.github.io/geometrics/) (convergence, spatial dependence, inequality) | `for_expdpy`, `for_geometrics` |
28
+
29
+ ## One ID for every unit, at every scale
30
+
31
+ Every unit has a **geo ID** that nests by prefix (GADM 4.1 hierarchy): municipality `BO-04-17-04` (La Paz) lies in province `BO-04-17` (Murillo), which lies in department `BO-04` (La Paz), which lies in Bolivia `BO`. INE codes and DS4Bolivia's `asdf_id` are kept as columns of `geo.units()`. Each dataset is a long panel keyed by `geo_id` and `year`.
32
+
33
+ | Scale | Units | Example |
34
+ | --- | --- | --- |
35
+ | `country` | 1 | `BO` |
36
+ | `department` | 9 | `BO-04` |
37
+ | `province` | 112 | `BO-04-17` |
38
+ | `municipality` | 339 | `BO-04-17-04` |
39
+
40
+ ## Build your own indicator in five lines
41
+
42
+ ```python
43
+ !pip install -q geo4bolivia
44
+ import pandas as pd
45
+ import geo4bolivia as geo
46
+
47
+ mine = pd.read_csv("schools_by_municipality.csv") # e.g. columns mun_id (INE code), year, schools
48
+ mine = geo.link(mine, scale="municipality", on="mun_id", key="mun_id") # 20101 -> BO-04-17-04
49
+ panel = geo.combine(["pop"], scale="municipality", extra=[mine])
50
+ panel["schools_per_10k"] = panel["schools"] / panel["pop"] * 1e4
51
+ geo.save(panel, "schools", scale="municipality", directory="my_data")
52
+ ```
53
+
54
+ [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/notebooks/empty.ipynb)
55
+
56
+ From a raster:
57
+
58
+ ```python
59
+ !pip install -q "geo4bolivia[raster]" # [raster] adds rasterio
60
+ import geo4bolivia as geo
61
+
62
+ lights = geo.zonal("viirs_2020.tif", scale="municipality", stats=["sum", "mean"], name="ntl", year=2020)
63
+ ```
64
+
65
+ [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/notebooks/empty.ipynb)
66
+
67
+ Then explore and model the panel with expdpy:
68
+
69
+ ```python
70
+ !pip install -q geo4bolivia expdpy
71
+ import numpy as np
72
+ import geo4bolivia as geo
73
+ import expdpy as ex
74
+
75
+ panel = geo.combine(["ntl", "pop"], scale="municipality", years=(2012, 2020))
76
+ panel["ln_pop"] = np.log(panel["pop"])
77
+ df, df_def = geo.for_expdpy(panel, labels={"ln_pop": "Log of population"})
78
+ df = ex.set_labels(df, df_def, set_panel=True)
79
+ ex.analyze_panel_table(df, "ln_NTLpc", ["ln_pop"]) # pooled, between, fixed and random effects
80
+ ```
81
+
82
+ [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/notebooks/empty.ipynb)
83
+
84
+ Or analyse it spatially with geometrics:
85
+
86
+ ```python
87
+ !pip install -q geo4bolivia geometrics
88
+ import numpy as np
89
+ import geo4bolivia as geo
90
+ import geometrics as gm
91
+
92
+ ntl = geo.load("ntl")
93
+ ntl["NTLpc"] = np.exp(ntl["ln_NTLpc"])
94
+ gdf, df, df_dict = geo.for_geometrics(ntl, labels={"NTLpc": "Night-time lights per capita"})
95
+ df = gm.set_labels(df, df_dict, set_panel=True)
96
+ gm.analyze_beta_convergence(df, "NTLpc", gdf=gdf, w=gm.make_weights(gdf)).interpret() # levels: logged internally
97
+ ```
98
+
99
+ [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/notebooks/empty.ipynb)
100
+
101
+ ## Without the package
102
+
103
+ Every file is also a plain URL, readable with pandas alone (preinstalled in Colab, so nothing to install):
104
+
105
+ ```python
106
+ import pandas as pd
107
+ df = pd.read_csv("https://raw.githubusercontent.com/quarcs-lab/geo4bolivia/main/data/municipality/ntl.csv")
108
+ ```
109
+
110
+ [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/notebooks/empty.ipynb)
111
+
112
+ ## Installation
113
+
114
+ In a Google Colab cell:
115
+
116
+ ```python
117
+ !pip install -q geo4bolivia # core: pandas, numpy, geopandas, pyarrow, requests, pyyaml (Colab has them)
118
+ !pip install -q "geo4bolivia[raster]" # + rasterio, for zonal()
119
+ !pip install -q git+https://github.com/quarcs-lab/geo4bolivia # development version
120
+ ```
121
+
122
+ [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/notebooks/empty.ipynb)
123
+
124
+ Python 3.11 or later. The data are not inside the package. It reads them from the [GitHub repository](https://github.com/quarcs-lab/geo4bolivia), so installation is quick and you always get the files the website links to. For reproducible research, pin a release of the data with `geo.load(..., ref="v0.1.0")` or the environment variable `GEO4BOLIVIA_REF=v0.1.0`.
125
+
126
+ ## Documentation
127
+
128
+ - [How the data infrastructure works](https://github.com/quarcs-lab/geo4bolivia/blob/main/docs/data-infrastructure.md): scales, IDs, metadata, aggregation rules, and recipes for building indicators
129
+ - [Dataset pages](https://github.com/quarcs-lab/geo4bolivia/tree/main/docs/datasets): variable dictionaries, coverage, sources and citations
130
+ - [Website](https://quarcs-lab.github.io/geo4bolivia/): indicators, notebooks, web apps and insights
131
+
132
+ ## Citation
133
+
134
+ Mendez, C. (2026). *GeoDevelopment Observatory of Bolivia*. https://quarcs-lab.github.io/geo4bolivia/
135
+
136
+ MIT License. Original data sources are credited on each dataset page.
@@ -0,0 +1,28 @@
1
+ # Project identity. See TEMPLATE.md and docs/data-infrastructure.md.
2
+ # Everything generic in the package reads its settings from here.
3
+
4
+ name: GeoDevelopment Observatory of Bolivia
5
+ short_name: GDO-Bolivia
6
+
7
+ # Python package (import name), CLI command and prefix of the environment
8
+ # variables (GEO4BOLIVIA_DATA_DIR, GEO4BOLIVIA_BASE_URL, GEO4BOLIVIA_REF).
9
+ package: geo4bolivia
10
+
11
+ # GitHub repository holding the published files, and the git ref an installed
12
+ # package reads from by default (a release tag freezes the data).
13
+ repository: quarcs-lab/geo4bolivia
14
+ default_ref: main
15
+
16
+ website: https://quarcs-lab.github.io/geo4bolivia/
17
+
18
+ country:
19
+ name: Bolivia
20
+ iso2: BO # prefix of every geo_id
21
+ iso3: BOL # GADM country code (GID_0)
22
+
23
+ # Equal-area projection for areas, crosswalk weights and overlays.
24
+ # An Albers equal-area projection fitted to Bolivia (standard parallels 11°S and 21°S).
25
+ equal_area_crs: "+proj=aea +lat_0=-16.5 +lon_0=-64.5 +lat_1=-11 +lat_2=-21 +datum=WGS84 +units=m +no_defs"
26
+
27
+ # Generated table listing every variable of every dataset.
28
+ catalog: definitions_gdo-bolivia.csv
@@ -0,0 +1,98 @@
1
+ [project]
2
+ name = "geo4bolivia"
3
+ version = "0.1.0"
4
+ description = "Subnational development data for Bolivia across spatial scales (GeoDevelopment Observatory of Bolivia)"
5
+ readme = "docs/python-package.md"
6
+ license = {text = "MIT"}
7
+ requires-python = ">=3.11"
8
+ authors = [
9
+ {name = "Carlos Mendez"},
10
+ ]
11
+
12
+ dependencies = [
13
+ # Kept small so `pip install geo4bolivia` is quick: Google Colab already has all of these
14
+ "pandas>=2.0",
15
+ "numpy>=1.24",
16
+ "requests>=2.31",
17
+ "geopandas>=0.14",
18
+ "pyarrow>=15",
19
+ "pyyaml>=6.0",
20
+ ]
21
+
22
+ keywords = ["bolivia", "geospatial", "regional development", "subnational data", "panel data", "gadm", "municipalities", "sdgs", "remote sensing"]
23
+ classifiers = [
24
+ "Programming Language :: Python :: 3",
25
+ "License :: OSI Approved :: MIT License",
26
+ "Operating System :: OS Independent",
27
+ "Intended Audience :: Science/Research",
28
+ "Topic :: Scientific/Engineering :: GIS",
29
+ ]
30
+
31
+ [project.optional-dependencies]
32
+ raster = ["rasterio>=1.3"] # geo4bolivia.zonal(): summarise rasters (GeoTIFF) over units
33
+
34
+ [project.scripts]
35
+ geo4bolivia = "geo4bolivia.cli:main"
36
+
37
+ [project.urls]
38
+ Homepage = "https://quarcs-lab.github.io/geo4bolivia/"
39
+ Documentation = "https://github.com/quarcs-lab/geo4bolivia/blob/main/docs/data-infrastructure.md"
40
+ Repository = "https://github.com/quarcs-lab/geo4bolivia"
41
+ Issues = "https://github.com/quarcs-lab/geo4bolivia/issues"
42
+
43
+ [dependency-groups]
44
+ analysis = [
45
+ # Visualization
46
+ "matplotlib>=3.7",
47
+ "seaborn>=0.12",
48
+ "plotly>=5.15",
49
+ "folium>=0.12", # interactive maps (GeoDataFrame.explore), as in Colab
50
+ # Spatial analysis
51
+ "contextily>=1.4",
52
+ "rasterio>=1.3",
53
+ "libpysal>=4.9",
54
+ "mapclassify>=2.6",
55
+ "esda>=2.5",
56
+ "splot>=1.1",
57
+ "mgwr>=2.2",
58
+ "inequality>=1.0",
59
+ # Econometrics and machine learning
60
+ "statsmodels>=0.14",
61
+ "scikit-learn>=1.3",
62
+ "xgboost>=2.0",
63
+ # Jupyter
64
+ "jupyter>=1.0",
65
+ "notebook>=7.0",
66
+ "jupytext>=1.19.1",
67
+ "geometrics>=0.1.3",
68
+ "expdpy>=0.5.2",
69
+ ]
70
+ dev = [
71
+ "pytest>=8.0",
72
+ ]
73
+
74
+ [build-system]
75
+ requires = ["hatchling"]
76
+ build-backend = "hatchling.build"
77
+
78
+ [tool.hatch.build.targets.wheel]
79
+ packages = ["src/geo4bolivia"]
80
+
81
+ # Ship project.yaml inside the package, so an installed copy knows its repository
82
+ [tool.hatch.build.targets.wheel.force-include]
83
+ "project.yaml" = "geo4bolivia/project.yaml"
84
+
85
+ # The source distribution holds the code only; data are read from GitHub
86
+ [tool.hatch.build.targets.sdist]
87
+ only-include = ["src", "project.yaml", "pyproject.toml", "docs/python-package.md", "LICENSE"]
88
+
89
+ [tool.uv]
90
+ package = true
91
+ default-groups = ["analysis", "dev"]
92
+ constraint-dependencies = [
93
+ "numba>=0.60,<0.62",
94
+ "llvmlite>=0.44,<0.45",
95
+ ]
96
+
97
+ [tool.pytest.ini_options]
98
+ testpaths = ["tests"]
@@ -0,0 +1,26 @@
1
+ """Load, link, aggregate and create geo-referenced development data across spatial scales.
2
+
3
+ >>> import geo4bolivia as geo
4
+ >>> geo.datasets() # what is available, at which scales and years
5
+ >>> df = geo.load("ntl") # panel: geo_id, year, variables
6
+ >>> gdf = geo.load("pop", geometry=True) # with boundaries
7
+ >>> geo.aggregate(geo.load("pop"), to="department", dataset="pop") # up the hierarchy
8
+ >>> mine = geo.link(my_table, scale="municipality", on="mun_id", key="mun_id") # your data -> geo_id
9
+ >>> geo.combine(["ntl", "pop"], scale="municipality", extra=[mine]) # one panel, one scale
10
+ >>> gdf, df, df_dict = geo.for_geometrics("ntl") # ready for the geometrics package
11
+ >>> df, df_def = geo.for_expdpy("ntl", groups=["department"]) # ready for the expdpy package
12
+
13
+ See docs/data-infrastructure.md in the repository for the full guide.
14
+ """
15
+
16
+ from .aggregate import aggregate, overlay, overlay_weights
17
+ from .bridge import for_expdpy, for_geometrics
18
+ from .create import check, combine, link, save, zonal
19
+ from .io import boundaries, crosswalk, datasets, dictionary, load, units
20
+ from .project import PACKAGE, config
21
+ from .scales import ancestors, scale_of
22
+ from .scales import table as scales
23
+
24
+ __all__ = ["aggregate", "ancestors", "boundaries", "check", "combine", "config", "crosswalk", "datasets", "dictionary",
25
+ "for_expdpy", "for_geometrics", "link", "load", "overlay", "overlay_weights", "save", "scale_of", "scales", "units", "zonal"]
26
+ __version__ = "0.1.0"