SnowMapPy 0.0.1__py3-none-any.whl

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/__init__.py ADDED
@@ -0,0 +1,211 @@
1
+ """
2
+ SnowMapPy - MODIS Snow Cover Processing Package
3
+ ================================================
4
+
5
+ High-performance processing of MODIS NDSI (Normalized Difference Snow Index)
6
+ data from Google Earth Engine with Numba JIT-compiled gap-filling algorithms.
7
+
8
+ This package implements a scientifically validated 6-day moving window
9
+ algorithm for temporal gap-filling (3 days before + current + 2 days after),
10
+ combining Terra and Aqua observations with quality control based on the
11
+ MODIS snow cover classification scheme.
12
+
13
+ MEMORY OPTIMIZATION:
14
+ - Dask lazy loading prevents memory spikes during data operations
15
+ - Automatic optimal chunking based on data dimensions
16
+ - Streaming to Zarr for original data (no full materialization)
17
+ - Only the 6-day processing window is materialized in RAM
18
+ - Supports 20+ year time series on machines with 8GB RAM
19
+
20
+ Key Features:
21
+ - Cloud processing via Google Earth Engine
22
+ - Terra/Aqua sensor fusion with quality control
23
+ - Temporal interpolation (nearest, linear, cubic)
24
+ - Elevation-aware spatial snow correction (>1000m)
25
+ - Fast Zarr output with ZSTD compression
26
+ - Interactive command-line interface
27
+ - Automatic MODIS date validation (2000-02-24 onwards)
28
+
29
+ Quick Start:
30
+ >>> from SnowMapPy import process_modis_ndsi_cloud
31
+ >>> result, counters = process_modis_ndsi_cloud(
32
+ ... project_name="your-gee-project",
33
+ ... shapefile_path="study_area.shp",
34
+ ... start_date="2020-01-01",
35
+ ... end_date="2020-12-31",
36
+ ... output_path="./output",
37
+ ... save_original_data=True # Now memory-efficient with Dask!
38
+ ... )
39
+
40
+ Authors: Haytam Elyoussfi, Hatim Bechri, Mostafa Bousbaa
41
+ Version: 2.0.0
42
+ License: MIT
43
+ Repository: https://github.com/haytamelyo/SnowMapPy
44
+ """
45
+
46
+ __version__ = "0.0.1"
47
+ __author__ = "Haytam Elyoussfi, Hatim Bechri, Mostafa Bousbaa"
48
+ __email__ = "haytam.elyoussfi@um6p.ma"
49
+ __license__ = "MIT"
50
+
51
+ # Suppress warnings early - before other imports
52
+ import warnings
53
+ warnings.filterwarnings('ignore')
54
+
55
+ # Core functionality
56
+ from .core import (
57
+ # Data I/O
58
+ save_as_zarr,
59
+ save_as_zarr_optimized,
60
+ find_optimal_zarr_params,
61
+ load_dem_and_nanmask,
62
+ load_shapefile,
63
+ load_zarr_dataset,
64
+
65
+ # Spatial operations
66
+ clip_dem_to_roi,
67
+ check_overlap,
68
+ reproject_raster,
69
+ reproject_shp,
70
+ handle_reprojection,
71
+
72
+ # Temporal interpolation
73
+ interpolate_temporal,
74
+ get_interpolation_methods,
75
+ validate_interpolation_method,
76
+
77
+ # Quality control
78
+ validate_modis_class,
79
+ get_valid_modis_classes,
80
+ get_invalid_modis_classes,
81
+ create_modis_class_mask,
82
+ apply_modis_quality_mask,
83
+
84
+ # Utilities
85
+ extract_date,
86
+ generate_file_lists,
87
+ get_map_dimensions,
88
+ generate_time_series,
89
+
90
+ # Date validation utilities
91
+ validate_modis_date_range,
92
+ MODIS_FIRST_AVAILABLE_DATE,
93
+ prompt_user_date_adjustment,
94
+
95
+ # Optimal chunking utilities
96
+ calculate_optimal_chunks,
97
+ estimate_memory_for_processing,
98
+
99
+ # Console utilities
100
+ suppress_warnings,
101
+ print_banner,
102
+ print_section,
103
+ print_config,
104
+ print_success,
105
+ print_error,
106
+ print_warning,
107
+ print_info,
108
+ print_complete,
109
+ )
110
+
111
+ # Cloud processing (main entry points)
112
+ from .cloud import (
113
+ modis_time_series_cloud,
114
+ process_modis_ndsi_cloud,
115
+ process_files_array,
116
+ load_modis_cloud_data,
117
+ initialize_earth_engine
118
+ )
119
+
120
+ # Expose Numba kernels for advanced users
121
+ from ._numba_kernels import (
122
+ interpolate_nearest_3d,
123
+ interpolate_linear_3d,
124
+ interpolate_cubic_3d,
125
+ merge_terra_aqua_3d,
126
+ apply_elevation_snow_correction,
127
+ apply_spatial_snow_correction,
128
+ clip_values_3d,
129
+ apply_nanmask_3d,
130
+ INVALID_CLASSES
131
+ )
132
+
133
+
134
+ __all__ = [
135
+ # Version info
136
+ '__version__',
137
+ '__author__',
138
+
139
+ # Main entry points
140
+ 'process_modis_ndsi_cloud',
141
+ 'modis_time_series_cloud',
142
+
143
+ # Core - Data I/O
144
+ 'save_as_zarr',
145
+ 'save_as_zarr_optimized',
146
+ 'find_optimal_zarr_params',
147
+ 'load_dem_and_nanmask',
148
+ 'load_shapefile',
149
+ 'load_zarr_dataset',
150
+
151
+ # Core - Spatial
152
+ 'clip_dem_to_roi',
153
+ 'check_overlap',
154
+ 'reproject_raster',
155
+ 'reproject_shp',
156
+ 'handle_reprojection',
157
+
158
+ # Core - Temporal
159
+ 'interpolate_temporal',
160
+ 'get_interpolation_methods',
161
+ 'validate_interpolation_method',
162
+
163
+ # Core - Quality
164
+ 'validate_modis_class',
165
+ 'get_valid_modis_classes',
166
+ 'get_invalid_modis_classes',
167
+ 'create_modis_class_mask',
168
+ 'apply_modis_quality_mask',
169
+
170
+ # Core - Utils
171
+ 'extract_date',
172
+ 'generate_file_lists',
173
+ 'get_map_dimensions',
174
+ 'generate_time_series',
175
+
176
+ # Core - Date validation
177
+ 'validate_modis_date_range',
178
+ 'MODIS_FIRST_AVAILABLE_DATE',
179
+ 'prompt_user_date_adjustment',
180
+
181
+ # Core - Optimal chunking
182
+ 'calculate_optimal_chunks',
183
+ 'estimate_memory_for_processing',
184
+
185
+ # Core - Console utilities
186
+ 'suppress_warnings',
187
+ 'print_banner',
188
+ 'print_section',
189
+ 'print_config',
190
+ 'print_success',
191
+ 'print_error',
192
+ 'print_warning',
193
+ 'print_info',
194
+ 'print_complete',
195
+
196
+ # Cloud
197
+ 'process_files_array',
198
+ 'load_modis_cloud_data',
199
+ 'initialize_earth_engine',
200
+
201
+ # Numba kernels (advanced)
202
+ 'interpolate_nearest_3d',
203
+ 'interpolate_linear_3d',
204
+ 'interpolate_cubic_3d',
205
+ 'merge_terra_aqua_3d',
206
+ 'apply_elevation_snow_correction',
207
+ 'apply_spatial_snow_correction',
208
+ 'clip_values_3d',
209
+ 'apply_nanmask_3d',
210
+ 'INVALID_CLASSES',
211
+ ]