SnowMapPy 1.0.1__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.
- snowmappy-1.0.1/MANIFEST.in +7 -0
- snowmappy-1.0.1/PKG-INFO +242 -0
- snowmappy-1.0.1/README.md +182 -0
- snowmappy-1.0.1/SnowMapPy.egg-info/PKG-INFO +242 -0
- snowmappy-1.0.1/SnowMapPy.egg-info/SOURCES.txt +31 -0
- snowmappy-1.0.1/SnowMapPy.egg-info/dependency_links.txt +1 -0
- snowmappy-1.0.1/SnowMapPy.egg-info/requires.txt +24 -0
- snowmappy-1.0.1/SnowMapPy.egg-info/top_level.txt +4 -0
- snowmappy-1.0.1/TESTING.md +54 -0
- snowmappy-1.0.1/cloud/__init__.py +11 -0
- snowmappy-1.0.1/cloud/auth.py +22 -0
- snowmappy-1.0.1/cloud/loader.py +91 -0
- snowmappy-1.0.1/cloud/processor.py +398 -0
- snowmappy-1.0.1/core/__init__.py +25 -0
- snowmappy-1.0.1/core/data_io.py +180 -0
- snowmappy-1.0.1/core/quality.py +142 -0
- snowmappy-1.0.1/core/spatial.py +131 -0
- snowmappy-1.0.1/core/temporal.py +36 -0
- snowmappy-1.0.1/core/utils.py +54 -0
- snowmappy-1.0.1/local/__init__.py +12 -0
- snowmappy-1.0.1/local/file_handler.py +38 -0
- snowmappy-1.0.1/local/preparator.py +146 -0
- snowmappy-1.0.1/local/processor.py +141 -0
- snowmappy-1.0.1/requirements.txt +34 -0
- snowmappy-1.0.1/setup.cfg +4 -0
- snowmappy-1.0.1/setup.py +47 -0
- snowmappy-1.0.1/tests/__init__.py +1 -0
- snowmappy-1.0.1/tests/test_cloud/__init__.py +1 -0
- snowmappy-1.0.1/tests/test_cloud/real_cloud_test.py +414 -0
- snowmappy-1.0.1/tests/test_cloud/test_basic_cloud.py +219 -0
- snowmappy-1.0.1/tests/test_core/__init__.py +1 -0
- snowmappy-1.0.1/tests/test_core/test_quality.py +69 -0
- snowmappy-1.0.1/tests/test_local/__init__.py +1 -0
snowmappy-1.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: SnowMapPy
|
|
3
|
+
Version: 1.0.1
|
|
4
|
+
Summary: A comprehensive Python package for processing MODIS NDSI data from local files and Google Earth Engine
|
|
5
|
+
Home-page: https://github.com/Hbechri/SnowMapPy
|
|
6
|
+
Author: Haytam Elyoussfi
|
|
7
|
+
Author-email: haytam.elyoussfi@um6p.ma
|
|
8
|
+
Project-URL: Bug Reports, https://github.com/Hbechri/SnowMapPy/issues
|
|
9
|
+
Project-URL: Source, https://github.com/Hbechri/SnowMapPy
|
|
10
|
+
Project-URL: Documentation, https://github.com/Hbechri/SnowMapPy#readme
|
|
11
|
+
Keywords: modis,snow,remote sensing,earth engine,gis,hydrology
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
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: Programming Language :: Python :: 3.8
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: GIS
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Atmospheric Science
|
|
23
|
+
Requires-Python: >=3.8
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
Requires-Dist: numpy==2.1.0
|
|
26
|
+
Requires-Dist: scipy==1.15.2
|
|
27
|
+
Requires-Dist: pandas==2.2.3
|
|
28
|
+
Requires-Dist: rasterio==1.4.3
|
|
29
|
+
Requires-Dist: geopandas==1.0.1
|
|
30
|
+
Requires-Dist: pyproj==3.7.1
|
|
31
|
+
Requires-Dist: shapely==2.1.0
|
|
32
|
+
Requires-Dist: affine==2.4.0
|
|
33
|
+
Requires-Dist: xarray==2025.3.1
|
|
34
|
+
Requires-Dist: zarr==3.0.6
|
|
35
|
+
Requires-Dist: numcodecs==0.16.0
|
|
36
|
+
Requires-Dist: h5py==3.13.0
|
|
37
|
+
Requires-Dist: netCDF4==1.7.2
|
|
38
|
+
Requires-Dist: earthengine-api==1.5.9
|
|
39
|
+
Requires-Dist: geemap==0.35.3
|
|
40
|
+
Requires-Dist: tqdm==4.66.4
|
|
41
|
+
Requires-Dist: joblib==1.4.2
|
|
42
|
+
Requires-Dist: python-dateutil==2.9.0
|
|
43
|
+
Requires-Dist: matplotlib==3.10.1
|
|
44
|
+
Provides-Extra: dev
|
|
45
|
+
Requires-Dist: pytest>=6.0; extra == "dev"
|
|
46
|
+
Requires-Dist: flake8>=3.8; extra == "dev"
|
|
47
|
+
Requires-Dist: black>=21.0; extra == "dev"
|
|
48
|
+
Dynamic: author
|
|
49
|
+
Dynamic: author-email
|
|
50
|
+
Dynamic: classifier
|
|
51
|
+
Dynamic: description
|
|
52
|
+
Dynamic: description-content-type
|
|
53
|
+
Dynamic: home-page
|
|
54
|
+
Dynamic: keywords
|
|
55
|
+
Dynamic: project-url
|
|
56
|
+
Dynamic: provides-extra
|
|
57
|
+
Dynamic: requires-dist
|
|
58
|
+
Dynamic: requires-python
|
|
59
|
+
Dynamic: summary
|
|
60
|
+
|
|
61
|
+
# SnowMapPy ๐จ๏ธ
|
|
62
|
+
|
|
63
|
+
A comprehensive Python package for processing MODIS NDSI (Normalized Difference Snow Index) data from both local files and Google Earth Engine, with advanced quality control and temporal interpolation capabilities.
|
|
64
|
+
|
|
65
|
+
## ๐ Table of Contents
|
|
66
|
+
|
|
67
|
+
- [Features](#features)
|
|
68
|
+
- [Installation](#installation)
|
|
69
|
+
- [Quick Start](#quick-start)
|
|
70
|
+
- [Package Structure](#package-structure)
|
|
71
|
+
- [Usage Examples](#usage-examples)
|
|
72
|
+
- [Testing](#testing)
|
|
73
|
+
- [Contributing](#contributing)
|
|
74
|
+
- [License](#license)
|
|
75
|
+
|
|
76
|
+
## โจ Features
|
|
77
|
+
|
|
78
|
+
- **๐ Cloud Processing**: Download and process MODIS NDSI data directly from Google Earth Engine
|
|
79
|
+
- **๐พ Local Processing**: Process locally stored MODIS NDSI files
|
|
80
|
+
- **๐ Quality Control**: Advanced masking using NDSI_Snow_Cover_Class for data validation
|
|
81
|
+
- **โฐ Temporal Interpolation**: Fill missing data points using spatial and temporal interpolation
|
|
82
|
+
- **๐บ๏ธ Spatial Operations**: Clip data to regions of interest using shapefiles or bounding boxes
|
|
83
|
+
- **๐ Data Export**: Save processed data in Zarr format for efficient storage and access
|
|
84
|
+
- **๐งช Comprehensive Testing**: Unit tests and real-world processing tests
|
|
85
|
+
|
|
86
|
+
## ๐ Installation
|
|
87
|
+
|
|
88
|
+
### Option 1: Install from PyPI (Recommended)
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
pip install SnowMapPy
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Option 2: Install from GitHub
|
|
95
|
+
|
|
96
|
+
1. **Clone the repository:**
|
|
97
|
+
```bash
|
|
98
|
+
git clone https://github.com/Hbechri/SnowMapPy.git
|
|
99
|
+
cd SnowMapPy/package
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
2. **Install the package:**
|
|
103
|
+
```bash
|
|
104
|
+
pip install -e .
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Prerequisites
|
|
108
|
+
|
|
109
|
+
- Python 3.8+
|
|
110
|
+
- Google Earth Engine account (for cloud processing)
|
|
111
|
+
- Required Python packages (automatically installed with the package)
|
|
112
|
+
|
|
113
|
+
### Google Earth Engine Setup (for cloud processing)
|
|
114
|
+
|
|
115
|
+
1. **Sign up for Google Earth Engine:**
|
|
116
|
+
- Visit [https://earthengine.google.com/](https://earthengine.google.com/)
|
|
117
|
+
- Sign up for an account
|
|
118
|
+
|
|
119
|
+
2. **Authenticate:**
|
|
120
|
+
```bash
|
|
121
|
+
earthengine authenticate
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## ๐ฏ Quick Start
|
|
125
|
+
|
|
126
|
+
### Cloud Processing Example
|
|
127
|
+
|
|
128
|
+
```python
|
|
129
|
+
from SnowMapPy.cloud.processor import process_modis_ndsi_cloud
|
|
130
|
+
|
|
131
|
+
# Process MODIS NDSI data from Google Earth Engine
|
|
132
|
+
result = process_modis_ndsi_cloud(
|
|
133
|
+
project_name="your-gee-project",
|
|
134
|
+
shapefile_path="path/to/roi.shp",
|
|
135
|
+
start_date="2023-01-01",
|
|
136
|
+
end_date="2023-01-31",
|
|
137
|
+
output_path="output/",
|
|
138
|
+
file_name="snow_cover"
|
|
139
|
+
)
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Local Processing Example
|
|
143
|
+
|
|
144
|
+
```python
|
|
145
|
+
from SnowMapPy.local.processor import process_modis_ndsi_local
|
|
146
|
+
|
|
147
|
+
# Process locally stored MODIS NDSI files
|
|
148
|
+
result = process_modis_ndsi_local(
|
|
149
|
+
mod_dir="path/to/MOD/files/",
|
|
150
|
+
myd_dir="path/to/MYD/files/",
|
|
151
|
+
dem_file="path/to/dem.tif",
|
|
152
|
+
output_path="output/",
|
|
153
|
+
file_name="local_snow_cover"
|
|
154
|
+
)
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## ๐ Package Structure
|
|
158
|
+
|
|
159
|
+
```
|
|
160
|
+
SnowMapPy/
|
|
161
|
+
โโโ core/ # Shared functionality
|
|
162
|
+
โ โโโ data_io.py # Data input/output operations
|
|
163
|
+
โ โโโ quality.py # Quality control functions
|
|
164
|
+
โ โโโ spatial.py # Spatial operations
|
|
165
|
+
โ โโโ temporal.py # Temporal interpolation
|
|
166
|
+
โ โโโ utils.py # Utility functions
|
|
167
|
+
โโโ cloud/ # Google Earth Engine processing
|
|
168
|
+
โ โโโ auth.py # GEE authentication
|
|
169
|
+
โ โโโ loader.py # Data loading from GEE
|
|
170
|
+
โ โโโ processor.py # Cloud processing pipeline
|
|
171
|
+
โโโ local/ # Local file processing
|
|
172
|
+
โ โโโ file_handler.py # File management
|
|
173
|
+
โ โโโ preparator.py # Data preparation
|
|
174
|
+
โ โโโ processor.py # Local processing pipeline
|
|
175
|
+
โโโ tests/ # Test suite
|
|
176
|
+
โโโ test_core/ # Core functionality tests
|
|
177
|
+
โโโ test_cloud/ # Cloud processing tests
|
|
178
|
+
โโโ test_local/ # Local processing tests
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## ๐ Usage Examples
|
|
182
|
+
|
|
183
|
+
### Quality Control
|
|
184
|
+
|
|
185
|
+
```python
|
|
186
|
+
from SnowMapPy.core.quality import get_invalid_modis_classes, apply_modis_quality_mask
|
|
187
|
+
|
|
188
|
+
# Get invalid MODIS class values
|
|
189
|
+
invalid_classes = get_invalid_modis_classes()
|
|
190
|
+
print(f"Invalid classes: {invalid_classes}")
|
|
191
|
+
|
|
192
|
+
# Apply quality mask to data
|
|
193
|
+
masked_data = apply_modis_quality_mask(value_data, class_data)
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Spatial Operations
|
|
197
|
+
|
|
198
|
+
```python
|
|
199
|
+
from SnowMapPy.core.spatial import clip_dem_to_roi
|
|
200
|
+
|
|
201
|
+
# Clip DEM to region of interest
|
|
202
|
+
clipped_dem = clip_dem_to_roi(dem_data, shapefile_path)
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## ๐งช Testing
|
|
206
|
+
|
|
207
|
+
Run the test suite:
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
# Run all tests
|
|
211
|
+
python -m pytest tests/
|
|
212
|
+
|
|
213
|
+
# Run specific test categories
|
|
214
|
+
python tests/test_core/test_quality.py
|
|
215
|
+
python tests/test_cloud/test_basic_cloud.py
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
For detailed testing instructions, see [TESTING.md](TESTING.md).
|
|
219
|
+
|
|
220
|
+
## ๐ค Contributing
|
|
221
|
+
|
|
222
|
+
1. Fork the repository
|
|
223
|
+
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
|
224
|
+
3. Commit your changes (`git commit -m 'Add amazing feature'`)
|
|
225
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
226
|
+
5. Open a Pull Request
|
|
227
|
+
|
|
228
|
+
## ๐ License
|
|
229
|
+
|
|
230
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
231
|
+
|
|
232
|
+
## ๐ Acknowledgments
|
|
233
|
+
|
|
234
|
+
- Google Earth Engine team for providing the platform
|
|
235
|
+
- NASA for MODIS data
|
|
236
|
+
- The open-source geospatial community
|
|
237
|
+
|
|
238
|
+
## ๐ Support
|
|
239
|
+
|
|
240
|
+
- **Issues**: [GitHub Issues](https://github.com/Hbechri/SnowMapPy/issues)
|
|
241
|
+
- **Documentation**: [GitHub README](https://github.com/Hbechri/SnowMapPy#readme)
|
|
242
|
+
- **Email**: haytam.elyoussfi@um6p.ma
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
# SnowMapPy ๐จ๏ธ
|
|
2
|
+
|
|
3
|
+
A comprehensive Python package for processing MODIS NDSI (Normalized Difference Snow Index) data from both local files and Google Earth Engine, with advanced quality control and temporal interpolation capabilities.
|
|
4
|
+
|
|
5
|
+
## ๐ Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Features](#features)
|
|
8
|
+
- [Installation](#installation)
|
|
9
|
+
- [Quick Start](#quick-start)
|
|
10
|
+
- [Package Structure](#package-structure)
|
|
11
|
+
- [Usage Examples](#usage-examples)
|
|
12
|
+
- [Testing](#testing)
|
|
13
|
+
- [Contributing](#contributing)
|
|
14
|
+
- [License](#license)
|
|
15
|
+
|
|
16
|
+
## โจ Features
|
|
17
|
+
|
|
18
|
+
- **๐ Cloud Processing**: Download and process MODIS NDSI data directly from Google Earth Engine
|
|
19
|
+
- **๐พ Local Processing**: Process locally stored MODIS NDSI files
|
|
20
|
+
- **๐ Quality Control**: Advanced masking using NDSI_Snow_Cover_Class for data validation
|
|
21
|
+
- **โฐ Temporal Interpolation**: Fill missing data points using spatial and temporal interpolation
|
|
22
|
+
- **๐บ๏ธ Spatial Operations**: Clip data to regions of interest using shapefiles or bounding boxes
|
|
23
|
+
- **๐ Data Export**: Save processed data in Zarr format for efficient storage and access
|
|
24
|
+
- **๐งช Comprehensive Testing**: Unit tests and real-world processing tests
|
|
25
|
+
|
|
26
|
+
## ๐ Installation
|
|
27
|
+
|
|
28
|
+
### Option 1: Install from PyPI (Recommended)
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pip install SnowMapPy
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Option 2: Install from GitHub
|
|
35
|
+
|
|
36
|
+
1. **Clone the repository:**
|
|
37
|
+
```bash
|
|
38
|
+
git clone https://github.com/Hbechri/SnowMapPy.git
|
|
39
|
+
cd SnowMapPy/package
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
2. **Install the package:**
|
|
43
|
+
```bash
|
|
44
|
+
pip install -e .
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Prerequisites
|
|
48
|
+
|
|
49
|
+
- Python 3.8+
|
|
50
|
+
- Google Earth Engine account (for cloud processing)
|
|
51
|
+
- Required Python packages (automatically installed with the package)
|
|
52
|
+
|
|
53
|
+
### Google Earth Engine Setup (for cloud processing)
|
|
54
|
+
|
|
55
|
+
1. **Sign up for Google Earth Engine:**
|
|
56
|
+
- Visit [https://earthengine.google.com/](https://earthengine.google.com/)
|
|
57
|
+
- Sign up for an account
|
|
58
|
+
|
|
59
|
+
2. **Authenticate:**
|
|
60
|
+
```bash
|
|
61
|
+
earthengine authenticate
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## ๐ฏ Quick Start
|
|
65
|
+
|
|
66
|
+
### Cloud Processing Example
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
from SnowMapPy.cloud.processor import process_modis_ndsi_cloud
|
|
70
|
+
|
|
71
|
+
# Process MODIS NDSI data from Google Earth Engine
|
|
72
|
+
result = process_modis_ndsi_cloud(
|
|
73
|
+
project_name="your-gee-project",
|
|
74
|
+
shapefile_path="path/to/roi.shp",
|
|
75
|
+
start_date="2023-01-01",
|
|
76
|
+
end_date="2023-01-31",
|
|
77
|
+
output_path="output/",
|
|
78
|
+
file_name="snow_cover"
|
|
79
|
+
)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Local Processing Example
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
from SnowMapPy.local.processor import process_modis_ndsi_local
|
|
86
|
+
|
|
87
|
+
# Process locally stored MODIS NDSI files
|
|
88
|
+
result = process_modis_ndsi_local(
|
|
89
|
+
mod_dir="path/to/MOD/files/",
|
|
90
|
+
myd_dir="path/to/MYD/files/",
|
|
91
|
+
dem_file="path/to/dem.tif",
|
|
92
|
+
output_path="output/",
|
|
93
|
+
file_name="local_snow_cover"
|
|
94
|
+
)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## ๐ Package Structure
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
SnowMapPy/
|
|
101
|
+
โโโ core/ # Shared functionality
|
|
102
|
+
โ โโโ data_io.py # Data input/output operations
|
|
103
|
+
โ โโโ quality.py # Quality control functions
|
|
104
|
+
โ โโโ spatial.py # Spatial operations
|
|
105
|
+
โ โโโ temporal.py # Temporal interpolation
|
|
106
|
+
โ โโโ utils.py # Utility functions
|
|
107
|
+
โโโ cloud/ # Google Earth Engine processing
|
|
108
|
+
โ โโโ auth.py # GEE authentication
|
|
109
|
+
โ โโโ loader.py # Data loading from GEE
|
|
110
|
+
โ โโโ processor.py # Cloud processing pipeline
|
|
111
|
+
โโโ local/ # Local file processing
|
|
112
|
+
โ โโโ file_handler.py # File management
|
|
113
|
+
โ โโโ preparator.py # Data preparation
|
|
114
|
+
โ โโโ processor.py # Local processing pipeline
|
|
115
|
+
โโโ tests/ # Test suite
|
|
116
|
+
โโโ test_core/ # Core functionality tests
|
|
117
|
+
โโโ test_cloud/ # Cloud processing tests
|
|
118
|
+
โโโ test_local/ # Local processing tests
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## ๐ Usage Examples
|
|
122
|
+
|
|
123
|
+
### Quality Control
|
|
124
|
+
|
|
125
|
+
```python
|
|
126
|
+
from SnowMapPy.core.quality import get_invalid_modis_classes, apply_modis_quality_mask
|
|
127
|
+
|
|
128
|
+
# Get invalid MODIS class values
|
|
129
|
+
invalid_classes = get_invalid_modis_classes()
|
|
130
|
+
print(f"Invalid classes: {invalid_classes}")
|
|
131
|
+
|
|
132
|
+
# Apply quality mask to data
|
|
133
|
+
masked_data = apply_modis_quality_mask(value_data, class_data)
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Spatial Operations
|
|
137
|
+
|
|
138
|
+
```python
|
|
139
|
+
from SnowMapPy.core.spatial import clip_dem_to_roi
|
|
140
|
+
|
|
141
|
+
# Clip DEM to region of interest
|
|
142
|
+
clipped_dem = clip_dem_to_roi(dem_data, shapefile_path)
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## ๐งช Testing
|
|
146
|
+
|
|
147
|
+
Run the test suite:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
# Run all tests
|
|
151
|
+
python -m pytest tests/
|
|
152
|
+
|
|
153
|
+
# Run specific test categories
|
|
154
|
+
python tests/test_core/test_quality.py
|
|
155
|
+
python tests/test_cloud/test_basic_cloud.py
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
For detailed testing instructions, see [TESTING.md](TESTING.md).
|
|
159
|
+
|
|
160
|
+
## ๐ค Contributing
|
|
161
|
+
|
|
162
|
+
1. Fork the repository
|
|
163
|
+
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
|
164
|
+
3. Commit your changes (`git commit -m 'Add amazing feature'`)
|
|
165
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
166
|
+
5. Open a Pull Request
|
|
167
|
+
|
|
168
|
+
## ๐ License
|
|
169
|
+
|
|
170
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
171
|
+
|
|
172
|
+
## ๐ Acknowledgments
|
|
173
|
+
|
|
174
|
+
- Google Earth Engine team for providing the platform
|
|
175
|
+
- NASA for MODIS data
|
|
176
|
+
- The open-source geospatial community
|
|
177
|
+
|
|
178
|
+
## ๐ Support
|
|
179
|
+
|
|
180
|
+
- **Issues**: [GitHub Issues](https://github.com/Hbechri/SnowMapPy/issues)
|
|
181
|
+
- **Documentation**: [GitHub README](https://github.com/Hbechri/SnowMapPy#readme)
|
|
182
|
+
- **Email**: haytam.elyoussfi@um6p.ma
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: SnowMapPy
|
|
3
|
+
Version: 1.0.1
|
|
4
|
+
Summary: A comprehensive Python package for processing MODIS NDSI data from local files and Google Earth Engine
|
|
5
|
+
Home-page: https://github.com/Hbechri/SnowMapPy
|
|
6
|
+
Author: Haytam Elyoussfi
|
|
7
|
+
Author-email: haytam.elyoussfi@um6p.ma
|
|
8
|
+
Project-URL: Bug Reports, https://github.com/Hbechri/SnowMapPy/issues
|
|
9
|
+
Project-URL: Source, https://github.com/Hbechri/SnowMapPy
|
|
10
|
+
Project-URL: Documentation, https://github.com/Hbechri/SnowMapPy#readme
|
|
11
|
+
Keywords: modis,snow,remote sensing,earth engine,gis,hydrology
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
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: Programming Language :: Python :: 3.8
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: GIS
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Atmospheric Science
|
|
23
|
+
Requires-Python: >=3.8
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
Requires-Dist: numpy==2.1.0
|
|
26
|
+
Requires-Dist: scipy==1.15.2
|
|
27
|
+
Requires-Dist: pandas==2.2.3
|
|
28
|
+
Requires-Dist: rasterio==1.4.3
|
|
29
|
+
Requires-Dist: geopandas==1.0.1
|
|
30
|
+
Requires-Dist: pyproj==3.7.1
|
|
31
|
+
Requires-Dist: shapely==2.1.0
|
|
32
|
+
Requires-Dist: affine==2.4.0
|
|
33
|
+
Requires-Dist: xarray==2025.3.1
|
|
34
|
+
Requires-Dist: zarr==3.0.6
|
|
35
|
+
Requires-Dist: numcodecs==0.16.0
|
|
36
|
+
Requires-Dist: h5py==3.13.0
|
|
37
|
+
Requires-Dist: netCDF4==1.7.2
|
|
38
|
+
Requires-Dist: earthengine-api==1.5.9
|
|
39
|
+
Requires-Dist: geemap==0.35.3
|
|
40
|
+
Requires-Dist: tqdm==4.66.4
|
|
41
|
+
Requires-Dist: joblib==1.4.2
|
|
42
|
+
Requires-Dist: python-dateutil==2.9.0
|
|
43
|
+
Requires-Dist: matplotlib==3.10.1
|
|
44
|
+
Provides-Extra: dev
|
|
45
|
+
Requires-Dist: pytest>=6.0; extra == "dev"
|
|
46
|
+
Requires-Dist: flake8>=3.8; extra == "dev"
|
|
47
|
+
Requires-Dist: black>=21.0; extra == "dev"
|
|
48
|
+
Dynamic: author
|
|
49
|
+
Dynamic: author-email
|
|
50
|
+
Dynamic: classifier
|
|
51
|
+
Dynamic: description
|
|
52
|
+
Dynamic: description-content-type
|
|
53
|
+
Dynamic: home-page
|
|
54
|
+
Dynamic: keywords
|
|
55
|
+
Dynamic: project-url
|
|
56
|
+
Dynamic: provides-extra
|
|
57
|
+
Dynamic: requires-dist
|
|
58
|
+
Dynamic: requires-python
|
|
59
|
+
Dynamic: summary
|
|
60
|
+
|
|
61
|
+
# SnowMapPy ๐จ๏ธ
|
|
62
|
+
|
|
63
|
+
A comprehensive Python package for processing MODIS NDSI (Normalized Difference Snow Index) data from both local files and Google Earth Engine, with advanced quality control and temporal interpolation capabilities.
|
|
64
|
+
|
|
65
|
+
## ๐ Table of Contents
|
|
66
|
+
|
|
67
|
+
- [Features](#features)
|
|
68
|
+
- [Installation](#installation)
|
|
69
|
+
- [Quick Start](#quick-start)
|
|
70
|
+
- [Package Structure](#package-structure)
|
|
71
|
+
- [Usage Examples](#usage-examples)
|
|
72
|
+
- [Testing](#testing)
|
|
73
|
+
- [Contributing](#contributing)
|
|
74
|
+
- [License](#license)
|
|
75
|
+
|
|
76
|
+
## โจ Features
|
|
77
|
+
|
|
78
|
+
- **๐ Cloud Processing**: Download and process MODIS NDSI data directly from Google Earth Engine
|
|
79
|
+
- **๐พ Local Processing**: Process locally stored MODIS NDSI files
|
|
80
|
+
- **๐ Quality Control**: Advanced masking using NDSI_Snow_Cover_Class for data validation
|
|
81
|
+
- **โฐ Temporal Interpolation**: Fill missing data points using spatial and temporal interpolation
|
|
82
|
+
- **๐บ๏ธ Spatial Operations**: Clip data to regions of interest using shapefiles or bounding boxes
|
|
83
|
+
- **๐ Data Export**: Save processed data in Zarr format for efficient storage and access
|
|
84
|
+
- **๐งช Comprehensive Testing**: Unit tests and real-world processing tests
|
|
85
|
+
|
|
86
|
+
## ๐ Installation
|
|
87
|
+
|
|
88
|
+
### Option 1: Install from PyPI (Recommended)
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
pip install SnowMapPy
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Option 2: Install from GitHub
|
|
95
|
+
|
|
96
|
+
1. **Clone the repository:**
|
|
97
|
+
```bash
|
|
98
|
+
git clone https://github.com/Hbechri/SnowMapPy.git
|
|
99
|
+
cd SnowMapPy/package
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
2. **Install the package:**
|
|
103
|
+
```bash
|
|
104
|
+
pip install -e .
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Prerequisites
|
|
108
|
+
|
|
109
|
+
- Python 3.8+
|
|
110
|
+
- Google Earth Engine account (for cloud processing)
|
|
111
|
+
- Required Python packages (automatically installed with the package)
|
|
112
|
+
|
|
113
|
+
### Google Earth Engine Setup (for cloud processing)
|
|
114
|
+
|
|
115
|
+
1. **Sign up for Google Earth Engine:**
|
|
116
|
+
- Visit [https://earthengine.google.com/](https://earthengine.google.com/)
|
|
117
|
+
- Sign up for an account
|
|
118
|
+
|
|
119
|
+
2. **Authenticate:**
|
|
120
|
+
```bash
|
|
121
|
+
earthengine authenticate
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## ๐ฏ Quick Start
|
|
125
|
+
|
|
126
|
+
### Cloud Processing Example
|
|
127
|
+
|
|
128
|
+
```python
|
|
129
|
+
from SnowMapPy.cloud.processor import process_modis_ndsi_cloud
|
|
130
|
+
|
|
131
|
+
# Process MODIS NDSI data from Google Earth Engine
|
|
132
|
+
result = process_modis_ndsi_cloud(
|
|
133
|
+
project_name="your-gee-project",
|
|
134
|
+
shapefile_path="path/to/roi.shp",
|
|
135
|
+
start_date="2023-01-01",
|
|
136
|
+
end_date="2023-01-31",
|
|
137
|
+
output_path="output/",
|
|
138
|
+
file_name="snow_cover"
|
|
139
|
+
)
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Local Processing Example
|
|
143
|
+
|
|
144
|
+
```python
|
|
145
|
+
from SnowMapPy.local.processor import process_modis_ndsi_local
|
|
146
|
+
|
|
147
|
+
# Process locally stored MODIS NDSI files
|
|
148
|
+
result = process_modis_ndsi_local(
|
|
149
|
+
mod_dir="path/to/MOD/files/",
|
|
150
|
+
myd_dir="path/to/MYD/files/",
|
|
151
|
+
dem_file="path/to/dem.tif",
|
|
152
|
+
output_path="output/",
|
|
153
|
+
file_name="local_snow_cover"
|
|
154
|
+
)
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## ๐ Package Structure
|
|
158
|
+
|
|
159
|
+
```
|
|
160
|
+
SnowMapPy/
|
|
161
|
+
โโโ core/ # Shared functionality
|
|
162
|
+
โ โโโ data_io.py # Data input/output operations
|
|
163
|
+
โ โโโ quality.py # Quality control functions
|
|
164
|
+
โ โโโ spatial.py # Spatial operations
|
|
165
|
+
โ โโโ temporal.py # Temporal interpolation
|
|
166
|
+
โ โโโ utils.py # Utility functions
|
|
167
|
+
โโโ cloud/ # Google Earth Engine processing
|
|
168
|
+
โ โโโ auth.py # GEE authentication
|
|
169
|
+
โ โโโ loader.py # Data loading from GEE
|
|
170
|
+
โ โโโ processor.py # Cloud processing pipeline
|
|
171
|
+
โโโ local/ # Local file processing
|
|
172
|
+
โ โโโ file_handler.py # File management
|
|
173
|
+
โ โโโ preparator.py # Data preparation
|
|
174
|
+
โ โโโ processor.py # Local processing pipeline
|
|
175
|
+
โโโ tests/ # Test suite
|
|
176
|
+
โโโ test_core/ # Core functionality tests
|
|
177
|
+
โโโ test_cloud/ # Cloud processing tests
|
|
178
|
+
โโโ test_local/ # Local processing tests
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## ๐ Usage Examples
|
|
182
|
+
|
|
183
|
+
### Quality Control
|
|
184
|
+
|
|
185
|
+
```python
|
|
186
|
+
from SnowMapPy.core.quality import get_invalid_modis_classes, apply_modis_quality_mask
|
|
187
|
+
|
|
188
|
+
# Get invalid MODIS class values
|
|
189
|
+
invalid_classes = get_invalid_modis_classes()
|
|
190
|
+
print(f"Invalid classes: {invalid_classes}")
|
|
191
|
+
|
|
192
|
+
# Apply quality mask to data
|
|
193
|
+
masked_data = apply_modis_quality_mask(value_data, class_data)
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Spatial Operations
|
|
197
|
+
|
|
198
|
+
```python
|
|
199
|
+
from SnowMapPy.core.spatial import clip_dem_to_roi
|
|
200
|
+
|
|
201
|
+
# Clip DEM to region of interest
|
|
202
|
+
clipped_dem = clip_dem_to_roi(dem_data, shapefile_path)
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## ๐งช Testing
|
|
206
|
+
|
|
207
|
+
Run the test suite:
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
# Run all tests
|
|
211
|
+
python -m pytest tests/
|
|
212
|
+
|
|
213
|
+
# Run specific test categories
|
|
214
|
+
python tests/test_core/test_quality.py
|
|
215
|
+
python tests/test_cloud/test_basic_cloud.py
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
For detailed testing instructions, see [TESTING.md](TESTING.md).
|
|
219
|
+
|
|
220
|
+
## ๐ค Contributing
|
|
221
|
+
|
|
222
|
+
1. Fork the repository
|
|
223
|
+
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
|
224
|
+
3. Commit your changes (`git commit -m 'Add amazing feature'`)
|
|
225
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
226
|
+
5. Open a Pull Request
|
|
227
|
+
|
|
228
|
+
## ๐ License
|
|
229
|
+
|
|
230
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
231
|
+
|
|
232
|
+
## ๐ Acknowledgments
|
|
233
|
+
|
|
234
|
+
- Google Earth Engine team for providing the platform
|
|
235
|
+
- NASA for MODIS data
|
|
236
|
+
- The open-source geospatial community
|
|
237
|
+
|
|
238
|
+
## ๐ Support
|
|
239
|
+
|
|
240
|
+
- **Issues**: [GitHub Issues](https://github.com/Hbechri/SnowMapPy/issues)
|
|
241
|
+
- **Documentation**: [GitHub README](https://github.com/Hbechri/SnowMapPy#readme)
|
|
242
|
+
- **Email**: haytam.elyoussfi@um6p.ma
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
MANIFEST.in
|
|
2
|
+
README.md
|
|
3
|
+
TESTING.md
|
|
4
|
+
requirements.txt
|
|
5
|
+
setup.py
|
|
6
|
+
SnowMapPy.egg-info/PKG-INFO
|
|
7
|
+
SnowMapPy.egg-info/SOURCES.txt
|
|
8
|
+
SnowMapPy.egg-info/dependency_links.txt
|
|
9
|
+
SnowMapPy.egg-info/requires.txt
|
|
10
|
+
SnowMapPy.egg-info/top_level.txt
|
|
11
|
+
cloud/__init__.py
|
|
12
|
+
cloud/auth.py
|
|
13
|
+
cloud/loader.py
|
|
14
|
+
cloud/processor.py
|
|
15
|
+
core/__init__.py
|
|
16
|
+
core/data_io.py
|
|
17
|
+
core/quality.py
|
|
18
|
+
core/spatial.py
|
|
19
|
+
core/temporal.py
|
|
20
|
+
core/utils.py
|
|
21
|
+
local/__init__.py
|
|
22
|
+
local/file_handler.py
|
|
23
|
+
local/preparator.py
|
|
24
|
+
local/processor.py
|
|
25
|
+
tests/__init__.py
|
|
26
|
+
tests/test_cloud/__init__.py
|
|
27
|
+
tests/test_cloud/real_cloud_test.py
|
|
28
|
+
tests/test_cloud/test_basic_cloud.py
|
|
29
|
+
tests/test_core/__init__.py
|
|
30
|
+
tests/test_core/test_quality.py
|
|
31
|
+
tests/test_local/__init__.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|