satcube 0.1.0__py3-none-any.whl → 0.1.2__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.
Potentially problematic release.
This version of satcube might be problematic. Click here for more details.
- satcube/cloud_detection.py +154 -18
- satcube/cloud_detection_old.py +24 -0
- satcube/download.py +65 -0
- satcube/download_old.py +82 -0
- satcube/main.py +2 -2
- satcube/utils.py +64 -1081
- satcube/utils_old.py +1087 -0
- satcube-0.1.2.dist-info/METADATA +224 -0
- satcube-0.1.2.dist-info/RECORD +12 -0
- {satcube-0.1.0.dist-info → satcube-0.1.2.dist-info}/WHEEL +1 -1
- satcube/__init__.py +0 -3
- satcube-0.1.0.dist-info/METADATA +0 -31
- satcube-0.1.0.dist-info/RECORD +0 -9
- {satcube-0.1.0.dist-info → satcube-0.1.2.dist-info}/LICENSE +0 -0
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: satcube
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: A Python package to create cloud-free monthly composites by fusing Landsat and Sentinel-2 data.
|
|
5
|
+
Home-page: https://github.com/IPL-UV/satcube
|
|
6
|
+
Author: Cesar Aybar
|
|
7
|
+
Author-email: fcesar.aybar@uv.es
|
|
8
|
+
Requires-Python: >=3.10,<4.0
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Provides-Extra: full
|
|
14
|
+
Requires-Dist: cubexpress (>=0.1.2)
|
|
15
|
+
Requires-Dist: earthengine-api (>=0.1.4.0) ; extra == "full"
|
|
16
|
+
Requires-Dist: fastcubo (>=0.0.999)
|
|
17
|
+
Requires-Dist: mlstac (>=0.4.0)
|
|
18
|
+
Requires-Dist: numpy (>=1.25.0)
|
|
19
|
+
Requires-Dist: pandas (>=2.0.0)
|
|
20
|
+
Requires-Dist: pydantic (>=2.8.0)
|
|
21
|
+
Requires-Dist: rasterio (>=1.2.0) ; extra == "full"
|
|
22
|
+
Requires-Dist: requests (>=2.26.0)
|
|
23
|
+
Requires-Dist: satalign (>=0.0.999)
|
|
24
|
+
Requires-Dist: scikit-learn (>=1.2.0) ; extra == "full"
|
|
25
|
+
Requires-Dist: segmentation-models-pytorch (>=0.3.0) ; extra == "full"
|
|
26
|
+
Requires-Dist: torch (>=2.0.0) ; extra == "full"
|
|
27
|
+
Requires-Dist: xarray (>=2023.7.0)
|
|
28
|
+
Project-URL: Documentation, https://ipl-uv.github.io/satcube/
|
|
29
|
+
Project-URL: Repository, https://github.com/IPL-UV/satcube
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
|
|
32
|
+
#
|
|
33
|
+
|
|
34
|
+
<p align="center">
|
|
35
|
+
<img src="https://huggingface.co/datasets/JulioContrerasH/DataMLSTAC/resolve/main/banner_satcube.png" width="33%">
|
|
36
|
+
</p>
|
|
37
|
+
|
|
38
|
+
<p align="center">
|
|
39
|
+
<em>A Python package for managing Sentinel-2 satellite data cubes</em> 🚀
|
|
40
|
+
</p>
|
|
41
|
+
|
|
42
|
+
<p align="center">
|
|
43
|
+
<a href='https://pypi.python.org/pypi/satcube'>
|
|
44
|
+
<img src='https://img.shields.io/pypi/v/satcube.svg' alt='PyPI' />
|
|
45
|
+
</a>
|
|
46
|
+
<a href="https://opensource.org/licenses/MIT" target="_blank">
|
|
47
|
+
<img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License">
|
|
48
|
+
</a>
|
|
49
|
+
<a href="https://github.com/psf/black" target="_blank">
|
|
50
|
+
<img src="https://img.shields.io/badge/code%20style-black-000000.svg" alt="Black">
|
|
51
|
+
</a>
|
|
52
|
+
<a href="https://pycqa.github.io/isort/" target="_blank">
|
|
53
|
+
<img src="https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336" alt="isort">
|
|
54
|
+
</a>
|
|
55
|
+
</p>
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
**GitHub**: [https://github.com/IPL-UV/satcube](https://github.com/IPL-UV/satcube) 🌐
|
|
60
|
+
|
|
61
|
+
**PyPI**: [https://pypi.org/project/satcube/](https://pypi.org/project/satcube/) 🛠️
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## **Overview** 📊
|
|
66
|
+
|
|
67
|
+
**satcube** is a Python package designed for efficient management, processing, and analysis of Sentinel-2 satellite image cubes. It allows for downloading, cloud masking, gap filling, and super-resolving Sentinel-2 imagery, as well as creating monthly composites and performing interpolation.
|
|
68
|
+
|
|
69
|
+
## **Key Features** ✨
|
|
70
|
+
- **Satellite image download**: Retrieve Sentinel-2 images from Earth Engine efficiently. 🛰️
|
|
71
|
+
- **Cloud masking**: Automatically remove clouds from Sentinel-2 images. ☁️
|
|
72
|
+
- **Gap filling**: Fill missing data using methods like linear interpolation and histogram matching. 🧩
|
|
73
|
+
- **Super-resolution**: Apply super-resolution models to enhance image quality. 🔍
|
|
74
|
+
- **Monthly composites**: Aggregate images into monthly composites with various statistical methods. 📅
|
|
75
|
+
- **Temporal smoothing**: Smooth reflectance values across time using interpolation techniques. 📈
|
|
76
|
+
## **Installation** ⚙️
|
|
77
|
+
|
|
78
|
+
Install the latest version from PyPI:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
pip install satcube
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## **How to use** 🛠️
|
|
85
|
+
|
|
86
|
+
### **Basic usage: working with sentinel-2 data** 🌍
|
|
87
|
+
|
|
88
|
+
#### **Load libraries**
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
import ee
|
|
92
|
+
import satcube
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
#### **Authenticate and initialize earth engine**
|
|
96
|
+
|
|
97
|
+
```python
|
|
98
|
+
ee.Authenticate()
|
|
99
|
+
ee.Initialize(project="ee-csaybar-real")
|
|
100
|
+
```
|
|
101
|
+
#### **Download model weights**
|
|
102
|
+
```python
|
|
103
|
+
outpath = satcube.download_weights(path="weights")
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
#### **Create a satellite dataCube**
|
|
107
|
+
```python
|
|
108
|
+
datacube = satcube.SatCube(
|
|
109
|
+
coordinates=(-77.68598590138802,-8.888223962022263),
|
|
110
|
+
sensor=satcube.Sentinel2(weight_path=outpath, edge_size=384),
|
|
111
|
+
output_dir="wendy01",
|
|
112
|
+
max_workers=12,
|
|
113
|
+
device="cuda",
|
|
114
|
+
)
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
### **Query and process sentinel-2 data** 🛰️
|
|
119
|
+
|
|
120
|
+
#### **Query the sentinel-2 image collection**
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
# Query the Sentinel-2 image collection
|
|
124
|
+
table_query = datacube.metadata_s2()
|
|
125
|
+
|
|
126
|
+
# Filter images based on cloud cover and remove duplicates
|
|
127
|
+
table_query_subset = table_query[table_query["cs_cdf"] > 0.30]
|
|
128
|
+
table_query_subset = table_query_subset.drop_duplicates(subset="img_date")
|
|
129
|
+
mgrs_tile_max = table_query_subset["mgrs_title"].value_counts().idxmax()
|
|
130
|
+
table_query_subset = table_query_subset[table_query_subset["mgrs_title"] == mgrs_tile_max]
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
#### **Download sentinel-2 images**
|
|
134
|
+
|
|
135
|
+
```python
|
|
136
|
+
table_download = datacube.download_s2_image(table_query_subset)
|
|
137
|
+
```
|
|
138
|
+
#### **Cloud masking**
|
|
139
|
+
|
|
140
|
+
```python
|
|
141
|
+
# Remove clouds from the images
|
|
142
|
+
table_nocloud = datacube.cloudmasking_s2(table_download)
|
|
143
|
+
table_nocloud = table_nocloud[table_nocloud["cloud_cover"] < 0.75]
|
|
144
|
+
table_nocloud.reset_index(drop=True, inplace=True)
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
#### **Gap filling**
|
|
148
|
+
|
|
149
|
+
```python
|
|
150
|
+
# Fill missing data in the images
|
|
151
|
+
table_nogaps = datacube.gapfilling_s2(table_nocloud)
|
|
152
|
+
table_nogaps = table_nogaps[table_nogaps["match_error"] < 0.1]
|
|
153
|
+
```
|
|
154
|
+
### **Monthly composites and image smoothing 📅**
|
|
155
|
+
|
|
156
|
+
#### **Create monthly composites**
|
|
157
|
+
|
|
158
|
+
```python
|
|
159
|
+
# Generate monthly composites
|
|
160
|
+
table_composites = datacube.monthly_composites_s2(
|
|
161
|
+
table_nogaps, agg_method="median", date_range=("2016-01-01", "2024-07-31")
|
|
162
|
+
)
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
#### **Interpolate missing data**
|
|
166
|
+
|
|
167
|
+
```python
|
|
168
|
+
# Interpolate missing months if necessary
|
|
169
|
+
table_interpolate = datacube.interpolate_s2(table=table_composites)
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
#### **Smooth reflectance values**
|
|
173
|
+
|
|
174
|
+
```python
|
|
175
|
+
# Smooth reflectance values across time
|
|
176
|
+
table_smooth = datacube.smooth_s2(table=table_interpolate)
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### **Super-resolution and visualization** 📐
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
#### **Super-resolution**
|
|
184
|
+
|
|
185
|
+
```python
|
|
186
|
+
# Apply super-resolution to the image cube
|
|
187
|
+
# table_final = datacube.super_s2(table_smooth)
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
#### **Display images**
|
|
192
|
+
|
|
193
|
+
```python
|
|
194
|
+
# Display the images from the data cube
|
|
195
|
+
datacube.display_images(table=table_smooth)
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
#### **Create a GIF**
|
|
199
|
+
|
|
200
|
+
```python
|
|
201
|
+
# !apt-get install imagemagick
|
|
202
|
+
import os
|
|
203
|
+
os.system("convert -delay 20 -loop 0 wendy01/z_s2_07_smoothed_png/temp_07*.png animation.gif")
|
|
204
|
+
|
|
205
|
+
from IPython.display import Image
|
|
206
|
+
Image(filename='animation.gif', width=500)
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
<p align="center">
|
|
210
|
+
<img src="https://huggingface.co/datasets/JulioContrerasH/DataMLSTAC/resolve/main/gif_satcube.gif" width="100%">
|
|
211
|
+
</p>
|
|
212
|
+
|
|
213
|
+
#### **Smooth reflectance values**
|
|
214
|
+
|
|
215
|
+
```python
|
|
216
|
+
# Smooth reflectance values across time
|
|
217
|
+
table_smooth = datacube.smooth_s2(table=table_interpolate)
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## **Supported features and filters** ✨
|
|
221
|
+
|
|
222
|
+
- **Cloud masking:** Efficient removal of clouds from satellite images.
|
|
223
|
+
- **Resampling methods:** Various methods for resampling and aligning imagery.
|
|
224
|
+
- **Super-resolution:** ONNX-based models for improving image resolution.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
satcube/cloud_detection.py,sha256=QSzeqCF63kJHzejbrXKL10x-kLxK0iorHvJNALoHYbA,5848
|
|
2
|
+
satcube/cloud_detection_old.py,sha256=7MviF8QlT2tj6QC3seepr8SZU0nHOK9Pji8AU94Z2q0,751
|
|
3
|
+
satcube/dataclass.py,sha256=TAAKouyTts5eMtVXRmwWgJb5EaUXryEtkKMtt1O8TKM,934
|
|
4
|
+
satcube/download.py,sha256=Tl6_o3ffYIQ5nYmy7D4g3nGoUmd9Zq9_CbhFCH92ffY,1587
|
|
5
|
+
satcube/download_old.py,sha256=Y7dUgq7Gl7jVKHZl5x9cpxALN9T6dCjtZwNjBiq1CAA,2647
|
|
6
|
+
satcube/main.py,sha256=BpQJbPXl6Ydj6X3pX2lFepH7w1-cfJ3LeTTsTmQih6s,14841
|
|
7
|
+
satcube/utils.py,sha256=wQl4ZSrocSZSSU6hjwCA2CYIv8p3deiX8PUKxJRr3yc,1952
|
|
8
|
+
satcube/utils_old.py,sha256=UBCI2oaL7E5MEjebobnyqGqgOtK6jU9O3t-c58JqZ0k,35057
|
|
9
|
+
satcube-0.1.2.dist-info/LICENSE,sha256=YdB4BQMkMzWuKvXRIpQR4g91IQ_pwA5PSH2lNM97zFI,1070
|
|
10
|
+
satcube-0.1.2.dist-info/METADATA,sha256=7zRn-OymbNtHGU3vUWBu7WNBvjcQI_I3xXDh6pW2i9Q,6777
|
|
11
|
+
satcube-0.1.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
12
|
+
satcube-0.1.2.dist-info/RECORD,,
|
satcube/__init__.py
DELETED
satcube-0.1.0.dist-info/METADATA
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: satcube
|
|
3
|
-
Version: 0.1.0
|
|
4
|
-
Summary: A Python package to create cloud-free monthly composites by fusing Landsat and Sentinel-2 data.
|
|
5
|
-
Home-page: https://github.com/IPL-UV/satcube
|
|
6
|
-
Author: Cesar Aybar
|
|
7
|
-
Author-email: fcesar.aybar@uv.es
|
|
8
|
-
Requires-Python: >=3.10,<4.0
|
|
9
|
-
Classifier: Programming Language :: Python :: 3
|
|
10
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
-
Requires-Dist: earthengine-api (>=0.1.4.0)
|
|
12
|
-
Requires-Dist: fastcubo (>=0.0.999)
|
|
13
|
-
Requires-Dist: matplotlib (>=3.7.0)
|
|
14
|
-
Requires-Dist: numpy (>=1.25.0)
|
|
15
|
-
Requires-Dist: pandas (>=2.0.0)
|
|
16
|
-
Requires-Dist: phicloudmask (>=0.0.2)
|
|
17
|
-
Requires-Dist: pydantic (>=2.8.0)
|
|
18
|
-
Requires-Dist: rasterio (>=1.2.0)
|
|
19
|
-
Requires-Dist: requests (>=2.26.0)
|
|
20
|
-
Requires-Dist: satalign (>=0.0.999)
|
|
21
|
-
Requires-Dist: scikit-learn (>=1.2.0)
|
|
22
|
-
Requires-Dist: segmentation-models-pytorch (>=0.2.0)
|
|
23
|
-
Requires-Dist: torch (>=2.0.0)
|
|
24
|
-
Requires-Dist: xarray (>=2023.7.0)
|
|
25
|
-
Project-URL: Documentation, https://ipl-uv.github.io/satcube/
|
|
26
|
-
Project-URL: Repository, https://github.com/IPL-UV/satcube
|
|
27
|
-
Description-Content-Type: text/markdown
|
|
28
|
-
|
|
29
|
-
# satcube
|
|
30
|
-
|
|
31
|
-
[colab code](https://colab.research.google.com/drive/1)
|
satcube-0.1.0.dist-info/RECORD
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
satcube/__init__.py,sha256=Tib3dgX1UTZZS9eO91bLicTYjnl4w5uYMQzB9l4R01k,134
|
|
2
|
-
satcube/cloud_detection.py,sha256=7MviF8QlT2tj6QC3seepr8SZU0nHOK9Pji8AU94Z2q0,751
|
|
3
|
-
satcube/dataclass.py,sha256=TAAKouyTts5eMtVXRmwWgJb5EaUXryEtkKMtt1O8TKM,934
|
|
4
|
-
satcube/main.py,sha256=n77L_Oeip99G0KcBqHCunaE-uwn3_yVPmLNzGmfgffQ,14833
|
|
5
|
-
satcube/utils.py,sha256=UBCI2oaL7E5MEjebobnyqGqgOtK6jU9O3t-c58JqZ0k,35057
|
|
6
|
-
satcube-0.1.0.dist-info/LICENSE,sha256=YdB4BQMkMzWuKvXRIpQR4g91IQ_pwA5PSH2lNM97zFI,1070
|
|
7
|
-
satcube-0.1.0.dist-info/WHEEL,sha256=bbU3AyvhQ312rVm7zzRQjs6axI1UYWC3nmFA2E6FFSI,88
|
|
8
|
-
satcube-0.1.0.dist-info/METADATA,sha256=Jcrxcsiq4oBkdJ2FEO6ClyOQpq4fUErsfDxv5s4bzfI,1124
|
|
9
|
-
satcube-0.1.0.dist-info/RECORD,,
|
|
File without changes
|