masharikiweather 0.1.0.dev1__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,212 @@
1
+ Metadata-Version: 2.4
2
+ Name: masharikiweather
3
+ Version: 0.1.0.dev1
4
+ Summary: A geostatistical extraction and alignment engine for East African weather and satellite data.
5
+ Author: Teofilo Ligawa
6
+ Requires-Python: >=3.9
7
+ Description-Content-Type: text/markdown
8
+ Requires-Dist: numpy>=1.24.0
9
+ Requires-Dist: pandas>=2.0.0
10
+ Requires-Dist: xarray>=2023.0.0
11
+ Requires-Dist: fsspec>=2023.6.0
12
+ Requires-Dist: huggingface_hub>=0.19.0
13
+ Requires-Dist: tqdm>=4.65.0
14
+ Requires-Dist: zarr<3.0.0
15
+ Requires-Dist: netCDF4>=1.6.4
16
+ Requires-Dist: h5netcdf>=1.2.0
17
+ Requires-Dist: pyarrow>=14.0.0
18
+ Requires-Dist: fastparquet>=2023.10.0
19
+ Requires-Dist: h5py>=3.12.1
20
+ Requires-Dist: scipy>=1.11.0
21
+ Requires-Dist: filter-stations>=0.7.1
22
+ Provides-Extra: ml
23
+ Requires-Dist: torch>=2.0.0; extra == "ml"
24
+ Requires-Dist: torchvision; extra == "ml"
25
+
26
+ # MasharikiWeather
27
+
28
+ ## Overview
29
+
30
+ **MasharikiWeather** is an open experimental initiative to create an **ML-ready, framework-agnostic weather dataset for East Africa**.
31
+ It draws inspiration from the [**PeakWeather**](https://huggingface.co/datasets/MeteoSwiss/PeakWeather) project — an integrated, harmonized, and machine-learning–ready global climate dataset.
32
+
33
+ **At the moment, this is to remain an in-house tool for DSAIL.**
34
+
35
+ The goal is to **study and reproduce PeakWeather’s design philosophy**, adapting its core principles to **African data realities** such as sparse station coverage, multimodal data sources, and irregular spatiotemporal grids.
36
+
37
+ Ultimately, MasharikiWeather aims to be a **multi-variable benchmark dataset** that supports **physics-based**, **AI-based**, and **hybrid forecasting** pipelines across frameworks like **PyTorch**, **TensorFlow**, **JAX**, and **NumPy**.
38
+
39
+ ---
40
+
41
+ ## Usage
42
+ Clone the repository and install the required dependencies:
43
+
44
+ ```bash
45
+ git clone https://github.com/DeKUT-DSAIL/MasharikiWeather.git
46
+ cd MasharikiWeather
47
+ pip install -r requirements.txt
48
+ ```
49
+
50
+ ### Authentication
51
+
52
+ This pipeline streams data directly from the DeKUT-DSAIL/weather-data Hugging Face repository. You must have a specific Hugging Face Access Token.
53
+
54
+ - If running locally, you can authenticate via the CLI: `huggingface-cli login`
55
+
56
+ - If running in Colab, securely store your token in the Colab Secrets manager.
57
+
58
+
59
+ ### Quickstart
60
+
61
+ ```python
62
+ from masharikiweather import MasharikiWeatherDataset
63
+
64
+ # 1. Initialize the Pipeline (Handles caching and network fusion)
65
+ ds = MasharikiWeatherDataset(
66
+ repo_id="DeKUT-DSAIL/weather-data",
67
+ token="YOUR_HF_TOKEN",
68
+ source_obs=["tahmo", "ghcnd"], # Fusing hourly and daily networks
69
+ freq="h",
70
+ years=[2023, 2024]
71
+ )
72
+
73
+ # 2. Extract Gridded Satellite/Reanalysis Context
74
+ gridded_data = ds.get_gridded_for_stations(
75
+ groups=["era5"],
76
+ stations=['TA00001', 'TA00283'],
77
+ variables=['total_precipitation'],
78
+ method="linear" # Bilinear interpolation
79
+ )
80
+
81
+ # 3. Generate ML Tensors (Aligned and Windowed)
82
+ ml_tensors = ds.get_windows(
83
+ window_size=24, # 24 hours of historical context
84
+ horizon_size=6, # 6 hours of prediction
85
+ stations=['TA00001', 'TA00283'],
86
+ gridded_url=["era5"],
87
+ as_xarray=True
88
+ )
89
+
90
+ print(ml_tensors.x) # Your aligned features
91
+ print(ml_tensors.y) # Your targets
92
+ ```
93
+
94
+ ## Objectives
95
+
96
+ 1. **Reproduce and understand the PeakWeather pipeline**
97
+ - Explore its dataset schema, preprocessing philosophy, and data fusion principles.
98
+ 2. **Develop an East Africa-centered multi-source fusion framework**
99
+ - Harmonize **station**, **reanalysis**, **satellite**, and **static prior** datasets in a unified structure.
100
+ 3. **Build a benchmark-ready, multi-variable dataset**
101
+ - Include precipitation, temperature, humidity, solar radiation, wind, and other key atmospheric variables.
102
+ 4. **Enable framework-agnostic ML integration**
103
+ - Support easy export and loading across ML frameworks using formats like **Zarr**, **NetCDF**, and **HDF5**.
104
+ 5. **Advance East African climate AI infrastructure**
105
+ - Provide standardized, transparent, and reproducible weather datasets tailored to African needs.
106
+
107
+ ---
108
+
109
+ ## Core Concept
110
+
111
+ East Africa’s meteorological landscape is characterized by:
112
+ - Sparse ground observations (TAHMO, GHCNd).
113
+ - Diverse gridded data products (ERA5, CHIRPS, TAMSAT, IMERG).
114
+ - Static surface properties that influence local weather (elevation, slope, aspect, land cover).
115
+ - Spatial and temporal inconsistencies across sources.
116
+
117
+ MasharikiWeather seeks to **bridge these gaps** through:
118
+ - **Spatiotemporal Graph Learning** of station, satellite, and reanalysis data.
119
+ - **Integration of static priors** to capture topographic and land–surface context.
120
+ - **Unified variable alignment** for consistent modeling inputs.
121
+ - **Multi-scale representation**, enabling both local and continental model evaluation.
122
+ - **ML-ready exports**, inspired by PeakWeather’s compatibility-first design.
123
+
124
+ ---
125
+
126
+ ## Data Sources
127
+
128
+ | Source | Type | Coverage | Variables | Role |
129
+ |--------|------|-----------|------------|------|
130
+ | **TAHMO** | In-situ (stations) | Sub-Saharan Africa | Precipitation, Temperature | Ground truth |
131
+ | **ERA5** | Reanalysis | Global | Full atmospheric suite | Physics-based baseline |
132
+ | **CHIRPS** | Satellite + Gauge | 1981–Present | Precipitation | Long-term rainfall |
133
+ | **TAMSAT** | Satellite | Africa | Precipitation | Bias-corrected rainfall |
134
+ | **IMERG** | Satellite | Global | Precipitation | Half-houly rainfall |
135
+ | **Static Priors (EE)** | Earth Engine Layers | Africa | Elevation, Slope, Aspect, Land Cover, Distance to Water | Geophysical context |
136
+ | **(Future)** ECMWF ML, FuXi, GraphCast, FourCastNet | Global | Precip, Temp, Wind, Radiation | ML & hybrid forecasts |
137
+
138
+ ---
139
+
140
+ ## Alignment with PeakWeather Roadmap
141
+
142
+ | PeakWeather Focus | MasharikiWeather Adaptation |
143
+ |--------------------|------------------------------|
144
+ | Global ML-ready weather dataset | East African-focused ML-ready dataset |
145
+ | Harmonized across ERA5, GFS, and observations | Fusion of TAHMO, ERA5, CHIRPS, TAMSAT, static priors |
146
+ | Precipitation-focused benchmarking | Multi-variable (precip, temp, humidity, radiation, topography) |
147
+ | Cloud-scale Zarr exports | Cloud and local exports via Zarr / NetCDF |
148
+ | Open and reproducible ML access | Reproducible African weather research |
149
+
150
+ ---
151
+
152
+ ## Phased Roadmap
153
+
154
+ ### Phase 1 — PeakWeather Exploration
155
+ - Study PeakWeather’s documentation, schema, and data loaders.
156
+ - Analyze its variable harmonization and metadata organization.
157
+ - Run sample ML-ready preprocessing on a small African region.
158
+
159
+ ### Phase 2 — MasharikiWeather Schema Design
160
+ - Define temporal resolution (e.g., 6-hourly or daily).
161
+ - Define spatial structure (station points vs gridded data).
162
+ - Standardize variable names and CF-compliant metadata.
163
+ - Establish coordinate references (lat/lon/time).
164
+
165
+ ### Phase 3 — TAHMO + ERA5 Integration
166
+ - Align station-based and gridded data through nearest-grid or interpolation.
167
+ - Handle irregular sampling and missing timestamps.
168
+ - Store as unified `xarray.Dataset` with metadata and attributes.
169
+
170
+ ### Phase 4 — Multi-source Expansion
171
+ - Add CHIRPS, IMERG and TAMSAT for multi-sensor rainfall comparison.
172
+ - Incorporate temperature, humidity, radiation, and wind from ERA5.
173
+ - Evaluate inter-product correlations, bias, and consistency.
174
+
175
+ ### Phase 5 — Integrate Static Priors
176
+ - Merge Earth Engine static features (elevation, slope, aspect, land cover, distance to water).
177
+ - Harmonize to match ERA5 and CHIRPS grids.
178
+ - Enable topography-aware model development.
179
+
180
+ ### Phase 6 — ML-Ready Export
181
+ - Export standardized, chunked datasets to **Zarr** and **NetCDF**.
182
+ - Develop lightweight data loaders for **PyTorch**, **TensorFlow**, and **JAX**.
183
+ - Preserve metadata and normalization info for each variable.
184
+
185
+ ### Phase 7 — Benchmark & Evaluation
186
+ - Implement baseline models using PeakWeather-style workflows.
187
+ - Compare model performance across variables and regions.
188
+ - Publish visual and quantitative evaluations.
189
+
190
+ ---
191
+
192
+
193
+ ## Guiding Principles
194
+
195
+ - **Reproducibility** — Version-controlled, scriptable data processing.
196
+ - **Transparency** — Clear documentation for every transformation step.
197
+ - **Scalability** — Built for cloud-scale workflows (DVC, Prefect, Zarr).
198
+ - **Inclusivity** — Designed around African data sources and use cases.
199
+ - **Framework-agnosticism** — ML-ready for PyTorch, TensorFlow, and beyond.
200
+
201
+ ---
202
+
203
+ ## Contributing
204
+ We welcome active experimentation and stress-testing from the DSAIL team! Whether you are testing a new spatial masking technique, adding a new satellite data source, or optimizing the data loaders, we want your contributions.
205
+
206
+ To ensure the core engine remains stable while we experiment, please review our [Contribution Guidelines](CONTRIBUTING.md) before pushing code. All new features and experiments should be developed on a separate branch and submitted via a Pull Request (PR) for peer review.
207
+
208
+ ## Credits
209
+ Developed as part of an effort to **advance localized, data-driven weather prediction for East Africa**,
210
+ inspired by **[PeakWeather](https://arxiv.org/abs/2506.13652)** and **[WeatherBench2](https://sites.research.google/gr/weatherbench/)**.
211
+
212
+ MasharikiWeather is a **step toward open, harmonized, and equitable climate AI infrastructure for East Africa**.
@@ -0,0 +1,187 @@
1
+ # MasharikiWeather
2
+
3
+ ## Overview
4
+
5
+ **MasharikiWeather** is an open experimental initiative to create an **ML-ready, framework-agnostic weather dataset for East Africa**.
6
+ It draws inspiration from the [**PeakWeather**](https://huggingface.co/datasets/MeteoSwiss/PeakWeather) project — an integrated, harmonized, and machine-learning–ready global climate dataset.
7
+
8
+ **At the moment, this is to remain an in-house tool for DSAIL.**
9
+
10
+ The goal is to **study and reproduce PeakWeather’s design philosophy**, adapting its core principles to **African data realities** such as sparse station coverage, multimodal data sources, and irregular spatiotemporal grids.
11
+
12
+ Ultimately, MasharikiWeather aims to be a **multi-variable benchmark dataset** that supports **physics-based**, **AI-based**, and **hybrid forecasting** pipelines across frameworks like **PyTorch**, **TensorFlow**, **JAX**, and **NumPy**.
13
+
14
+ ---
15
+
16
+ ## Usage
17
+ Clone the repository and install the required dependencies:
18
+
19
+ ```bash
20
+ git clone https://github.com/DeKUT-DSAIL/MasharikiWeather.git
21
+ cd MasharikiWeather
22
+ pip install -r requirements.txt
23
+ ```
24
+
25
+ ### Authentication
26
+
27
+ This pipeline streams data directly from the DeKUT-DSAIL/weather-data Hugging Face repository. You must have a specific Hugging Face Access Token.
28
+
29
+ - If running locally, you can authenticate via the CLI: `huggingface-cli login`
30
+
31
+ - If running in Colab, securely store your token in the Colab Secrets manager.
32
+
33
+
34
+ ### Quickstart
35
+
36
+ ```python
37
+ from masharikiweather import MasharikiWeatherDataset
38
+
39
+ # 1. Initialize the Pipeline (Handles caching and network fusion)
40
+ ds = MasharikiWeatherDataset(
41
+ repo_id="DeKUT-DSAIL/weather-data",
42
+ token="YOUR_HF_TOKEN",
43
+ source_obs=["tahmo", "ghcnd"], # Fusing hourly and daily networks
44
+ freq="h",
45
+ years=[2023, 2024]
46
+ )
47
+
48
+ # 2. Extract Gridded Satellite/Reanalysis Context
49
+ gridded_data = ds.get_gridded_for_stations(
50
+ groups=["era5"],
51
+ stations=['TA00001', 'TA00283'],
52
+ variables=['total_precipitation'],
53
+ method="linear" # Bilinear interpolation
54
+ )
55
+
56
+ # 3. Generate ML Tensors (Aligned and Windowed)
57
+ ml_tensors = ds.get_windows(
58
+ window_size=24, # 24 hours of historical context
59
+ horizon_size=6, # 6 hours of prediction
60
+ stations=['TA00001', 'TA00283'],
61
+ gridded_url=["era5"],
62
+ as_xarray=True
63
+ )
64
+
65
+ print(ml_tensors.x) # Your aligned features
66
+ print(ml_tensors.y) # Your targets
67
+ ```
68
+
69
+ ## Objectives
70
+
71
+ 1. **Reproduce and understand the PeakWeather pipeline**
72
+ - Explore its dataset schema, preprocessing philosophy, and data fusion principles.
73
+ 2. **Develop an East Africa-centered multi-source fusion framework**
74
+ - Harmonize **station**, **reanalysis**, **satellite**, and **static prior** datasets in a unified structure.
75
+ 3. **Build a benchmark-ready, multi-variable dataset**
76
+ - Include precipitation, temperature, humidity, solar radiation, wind, and other key atmospheric variables.
77
+ 4. **Enable framework-agnostic ML integration**
78
+ - Support easy export and loading across ML frameworks using formats like **Zarr**, **NetCDF**, and **HDF5**.
79
+ 5. **Advance East African climate AI infrastructure**
80
+ - Provide standardized, transparent, and reproducible weather datasets tailored to African needs.
81
+
82
+ ---
83
+
84
+ ## Core Concept
85
+
86
+ East Africa’s meteorological landscape is characterized by:
87
+ - Sparse ground observations (TAHMO, GHCNd).
88
+ - Diverse gridded data products (ERA5, CHIRPS, TAMSAT, IMERG).
89
+ - Static surface properties that influence local weather (elevation, slope, aspect, land cover).
90
+ - Spatial and temporal inconsistencies across sources.
91
+
92
+ MasharikiWeather seeks to **bridge these gaps** through:
93
+ - **Spatiotemporal Graph Learning** of station, satellite, and reanalysis data.
94
+ - **Integration of static priors** to capture topographic and land–surface context.
95
+ - **Unified variable alignment** for consistent modeling inputs.
96
+ - **Multi-scale representation**, enabling both local and continental model evaluation.
97
+ - **ML-ready exports**, inspired by PeakWeather’s compatibility-first design.
98
+
99
+ ---
100
+
101
+ ## Data Sources
102
+
103
+ | Source | Type | Coverage | Variables | Role |
104
+ |--------|------|-----------|------------|------|
105
+ | **TAHMO** | In-situ (stations) | Sub-Saharan Africa | Precipitation, Temperature | Ground truth |
106
+ | **ERA5** | Reanalysis | Global | Full atmospheric suite | Physics-based baseline |
107
+ | **CHIRPS** | Satellite + Gauge | 1981–Present | Precipitation | Long-term rainfall |
108
+ | **TAMSAT** | Satellite | Africa | Precipitation | Bias-corrected rainfall |
109
+ | **IMERG** | Satellite | Global | Precipitation | Half-houly rainfall |
110
+ | **Static Priors (EE)** | Earth Engine Layers | Africa | Elevation, Slope, Aspect, Land Cover, Distance to Water | Geophysical context |
111
+ | **(Future)** ECMWF ML, FuXi, GraphCast, FourCastNet | Global | Precip, Temp, Wind, Radiation | ML & hybrid forecasts |
112
+
113
+ ---
114
+
115
+ ## Alignment with PeakWeather Roadmap
116
+
117
+ | PeakWeather Focus | MasharikiWeather Adaptation |
118
+ |--------------------|------------------------------|
119
+ | Global ML-ready weather dataset | East African-focused ML-ready dataset |
120
+ | Harmonized across ERA5, GFS, and observations | Fusion of TAHMO, ERA5, CHIRPS, TAMSAT, static priors |
121
+ | Precipitation-focused benchmarking | Multi-variable (precip, temp, humidity, radiation, topography) |
122
+ | Cloud-scale Zarr exports | Cloud and local exports via Zarr / NetCDF |
123
+ | Open and reproducible ML access | Reproducible African weather research |
124
+
125
+ ---
126
+
127
+ ## Phased Roadmap
128
+
129
+ ### Phase 1 — PeakWeather Exploration
130
+ - Study PeakWeather’s documentation, schema, and data loaders.
131
+ - Analyze its variable harmonization and metadata organization.
132
+ - Run sample ML-ready preprocessing on a small African region.
133
+
134
+ ### Phase 2 — MasharikiWeather Schema Design
135
+ - Define temporal resolution (e.g., 6-hourly or daily).
136
+ - Define spatial structure (station points vs gridded data).
137
+ - Standardize variable names and CF-compliant metadata.
138
+ - Establish coordinate references (lat/lon/time).
139
+
140
+ ### Phase 3 — TAHMO + ERA5 Integration
141
+ - Align station-based and gridded data through nearest-grid or interpolation.
142
+ - Handle irregular sampling and missing timestamps.
143
+ - Store as unified `xarray.Dataset` with metadata and attributes.
144
+
145
+ ### Phase 4 — Multi-source Expansion
146
+ - Add CHIRPS, IMERG and TAMSAT for multi-sensor rainfall comparison.
147
+ - Incorporate temperature, humidity, radiation, and wind from ERA5.
148
+ - Evaluate inter-product correlations, bias, and consistency.
149
+
150
+ ### Phase 5 — Integrate Static Priors
151
+ - Merge Earth Engine static features (elevation, slope, aspect, land cover, distance to water).
152
+ - Harmonize to match ERA5 and CHIRPS grids.
153
+ - Enable topography-aware model development.
154
+
155
+ ### Phase 6 — ML-Ready Export
156
+ - Export standardized, chunked datasets to **Zarr** and **NetCDF**.
157
+ - Develop lightweight data loaders for **PyTorch**, **TensorFlow**, and **JAX**.
158
+ - Preserve metadata and normalization info for each variable.
159
+
160
+ ### Phase 7 — Benchmark & Evaluation
161
+ - Implement baseline models using PeakWeather-style workflows.
162
+ - Compare model performance across variables and regions.
163
+ - Publish visual and quantitative evaluations.
164
+
165
+ ---
166
+
167
+
168
+ ## Guiding Principles
169
+
170
+ - **Reproducibility** — Version-controlled, scriptable data processing.
171
+ - **Transparency** — Clear documentation for every transformation step.
172
+ - **Scalability** — Built for cloud-scale workflows (DVC, Prefect, Zarr).
173
+ - **Inclusivity** — Designed around African data sources and use cases.
174
+ - **Framework-agnosticism** — ML-ready for PyTorch, TensorFlow, and beyond.
175
+
176
+ ---
177
+
178
+ ## Contributing
179
+ We welcome active experimentation and stress-testing from the DSAIL team! Whether you are testing a new spatial masking technique, adding a new satellite data source, or optimizing the data loaders, we want your contributions.
180
+
181
+ To ensure the core engine remains stable while we experiment, please review our [Contribution Guidelines](CONTRIBUTING.md) before pushing code. All new features and experiments should be developed on a separate branch and submitted via a Pull Request (PR) for peer review.
182
+
183
+ ## Credits
184
+ Developed as part of an effort to **advance localized, data-driven weather prediction for East Africa**,
185
+ inspired by **[PeakWeather](https://arxiv.org/abs/2506.13652)** and **[WeatherBench2](https://sites.research.google/gr/weatherbench/)**.
186
+
187
+ MasharikiWeather is a **step toward open, harmonized, and equitable climate AI infrastructure for East Africa**.
@@ -0,0 +1,8 @@
1
+ """
2
+ MasharikiWeather: Spatiotemporal data fusion for East Africa.
3
+ """
4
+
5
+ from .dataset import MasharikiWeatherDataset, Windows
6
+
7
+ __version__ = "0.1.0"
8
+ __all__ = ["MasharikiWeatherDataset", "Windows"]