RadGEEToolbox 1.6.1__tar.gz → 1.6.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: RadGEEToolbox
3
- Version: 1.6.1
3
+ Version: 1.6.2
4
4
  Summary: Streamlined Multispectral & SAR Analysis for Google Earth Engine Python API
5
5
  Home-page: https://github.com/radwinskis/RadGEEToolbox
6
6
  Author: Mark Radwin
@@ -67,15 +67,15 @@ _____________
67
67
 
68
68
  ### Installing via pip
69
69
 
70
- To install `RadGEEToolbox` version 1.6.1 using pip (NOTE: it is recommended to create a new virtual environment):
70
+ To install `RadGEEToolbox` version 1.6.2 using pip (NOTE: it is recommended to create a new virtual environment):
71
71
 
72
72
  ```bash
73
- pip install RadGEEToolbox==1.6.1
73
+ pip install RadGEEToolbox==1.6.2
74
74
  ```
75
75
 
76
76
  ### Installing via Conda
77
77
 
78
- To install `RadGEEToolbox` version 1.6.1 using conda-forge (NOTE: it is recommended to create a new virtual environment):
78
+ To install `RadGEEToolbox` version 1.6.2 using conda-forge (NOTE: it is recommended to create a new virtual environment):
79
79
 
80
80
  ```bash
81
81
  conda install conda-forge::radgeetoolbox
@@ -106,7 +106,7 @@ To verify that `RadGEEToolbox` was installed correctly:
106
106
  python -c "import RadGEEToolbox; print(RadGEEToolbox.__version__)"
107
107
  ```
108
108
 
109
- You should see `1.6.1` printed as the version number.
109
+ You should see `1.6.2` printed as the version number.
110
110
 
111
111
  ________
112
112
  # Usage Example
@@ -38,15 +38,15 @@ _____________
38
38
 
39
39
  ### Installing via pip
40
40
 
41
- To install `RadGEEToolbox` version 1.6.1 using pip (NOTE: it is recommended to create a new virtual environment):
41
+ To install `RadGEEToolbox` version 1.6.2 using pip (NOTE: it is recommended to create a new virtual environment):
42
42
 
43
43
  ```bash
44
- pip install RadGEEToolbox==1.6.1
44
+ pip install RadGEEToolbox==1.6.2
45
45
  ```
46
46
 
47
47
  ### Installing via Conda
48
48
 
49
- To install `RadGEEToolbox` version 1.6.1 using conda-forge (NOTE: it is recommended to create a new virtual environment):
49
+ To install `RadGEEToolbox` version 1.6.2 using conda-forge (NOTE: it is recommended to create a new virtual environment):
50
50
 
51
51
  ```bash
52
52
  conda install conda-forge::radgeetoolbox
@@ -77,7 +77,7 @@ To verify that `RadGEEToolbox` was installed correctly:
77
77
  python -c "import RadGEEToolbox; print(RadGEEToolbox.__version__)"
78
78
  ```
79
79
 
80
- You should see `1.6.1` printed as the version number.
80
+ You should see `1.6.2` printed as the version number.
81
81
 
82
82
  ________
83
83
  # Usage Example
@@ -3,221 +3,50 @@ import pandas as pd
3
3
  import numpy as np
4
4
  class LandsatCollection:
5
5
  """
6
- Class object representing a combined collection of NASA/USGS Landsat 5, 8, and 9 TM & OLI surface reflectance satellite images at 30 m/px from Google Earth Engine.
6
+ Represents a user-defined collection of NASA/USGS Landsat 5, 8, and 9 TM & OLI surface reflectance satellite images at 30 m/px from Google Earth Engine (GEE).
7
7
 
8
- This class provides methods to filter, process, and analyze Landsat satellite imagery for a given period and region.
8
+ This class enables simplified definition, filtering, masking, and processing of multispectral Landsat imagery.
9
+ It supports multiple spatial and temporal filters, caching for efficient computation, and direct computation of
10
+ key spectral indices like NDWI, NDVI, halite index, and more. It also includes utilities for cloud masking,
11
+ mosaicking, zonal statistics, and transect analysis.
9
12
 
10
- Inspect the documentation or source code for details on the methods and properties available.
11
-
12
- Arguments:
13
- start_date (str): Start date string in format of yyyy-mm-dd for filtering collection (required unless collection is provided)
14
-
15
- end_date (str): End date string in format of yyyy-mm-dd for filtering collection (required unless collection is provided)
16
-
17
- tile_row (int or list): WRS-2 tile row of Landsat image (required unless boundary or collection is provided) - see https://www.usgs.gov/landsat-missions/landsat-shapefiles-and-kml-files
13
+ Initialization can be done by providing filtering parameters or directly passing in a pre-filtered GEE collection.
18
14
 
19
- tile_path (int or list): WRS-2 tile path of Landsat image (required unless boundary or collection is provided) - see https://www.usgs.gov/landsat-missions/landsat-shapefiles-and-kml-files
20
-
21
- cloud_percentage_threshold (int): Integer percentage threshold where only imagery with cloud % less than threshold will be provided (defaults to 100)
15
+ Inspect the documentation or source code for details on the methods and properties available.
22
16
 
23
- boundary (ee.Geometry): Boundary for filtering images to images that intersect with the boundary shape (optional) - will override tile specifications
24
-
25
- collection (ee.ImageCollection): Optional argument to provide an ee.ImageCollection object to be converted to a LandsatCollection object - will override other arguments!
17
+ Args:
18
+ start_date (str): Start date in 'YYYY-MM-DD' format. Required unless `collection` is provided.
19
+ end_date (str): End date in 'YYYY-MM-DD' format. Required unless `collection` is provided.
20
+ tile_row (int or list of int): WRS-2 tile row(s) to filter by. Ignored if `boundary` or `collection` is provided. See https://www.usgs.gov/landsat-missions/landsat-shapefiles-and-kml-files
21
+ tile_path (int or list of int): WRS-2 tile row(s) to filter by. Ignored if `boundary` or `collection` is provided. See https://www.usgs.gov/landsat-missions/landsat-shapefiles-and-kml-files
22
+ cloud_percentage_threshold (int, optional): Max allowed cloud cover percentage. Defaults to 100.
23
+ boundary (ee.Geometry, optional): A geometry for filtering to images that intersect with the boundary shape. Overrides `tile_path` and `tile_row` if provided.
24
+ collection (ee.ImageCollection, optional): A pre-filtered Landsat ee.ImageCollection object to be converted to a LandsatCollection object. Overrides all other filters.
26
25
 
27
26
  Attributes:
28
- collection: Returns an ee.ImageCollection object from any LandsatCollection image collection object
29
-
30
- _dates_list: Cache storage for dates_list property attribute
31
-
32
- _dates: Cahce storgage for dates property attribute
33
-
34
- ndwi_threshold: Default threshold for masking ndwi imagery
35
-
36
- ndvi_threshold: Default threshold for masking ndvi imagery
37
-
38
- halite_threshold: Default threshold for masking halite imagery
39
-
40
- gypsum_threshold: Default threshold for masking gypsum imagery
41
-
42
- turbidity_threshold: Default threshold for masking turbidity imagery
43
-
44
- chlorophyll_threshold: Default threshold for masking chlorophyll imagery
45
-
46
- _masked_clouds_collection: Cache storage for masked_clouds_collection property attribute
47
-
48
- _masked_water_collection: Cache storage for masked_water_collection property attribute
49
-
50
- _masked_to_water_collection: Cache storage for masked_to_water_collection property attribute
51
-
52
- _geometry_masked_collection: Cache storage for mask_to_polygon method
53
-
54
- _geometry_masked_out_collection: Cache storage for mask_out_polygon method
55
-
56
- _median: Cache storage for median property attribute
57
-
58
- _mean: Cache storage for mean property attribute
59
-
60
- _max: Cache storage for max property attribute
61
-
62
- _min: Cache storage for min property attribute
63
-
64
- _ndwi: Cache storage for ndwi property attribute
65
-
66
- _ndvi: Cache storage for ndvi property attribute
67
-
68
- _halite: Cache storage for halite property attribute
69
-
70
- _gypsum: Cache storage for gypsum property attribute
71
-
72
- _turbidity: Cache storage for turbidity property attribute
73
-
74
- _chlorophyll: Cache storage for chlorophyll property attribute
75
-
76
- _LST: Cache storage for LST property attribute
77
-
78
- _MosaicByDate: Cache storage for MosaicByDate property attribute
79
-
80
- Property attributes:
81
- dates_list (returns: Server-Side List): Unreadable Earth Engine list of image dates (server-side)
82
-
83
- dates (returns: Client-Side List): Readable pythonic list of image dates (client-side)
84
-
85
- masked_clouds_collection (returns: LandsatCollection image collection): Returns collection with clouds masked (transparent) for each image
86
-
87
- masked_water_collection (returns: LandsatCollection image collection): Returns collection with water pixels masked (transparent) for each image
88
-
89
- masked_to_water_collection (returns: LandsatCollection image collection): Returns collection with pixels masked to water (transparent) for each image (masks land and cloud pixels)
90
-
91
- max (returns: ee.Image): Returns a temporally reduced max image (calculates max at each pixel)
92
-
93
- median (returns: ee.Image): Returns a temporally reduced median image (calculates median at each pixel)
94
-
95
- mean (returns: ee.Image): Returns a temporally reduced mean image (calculates mean at each pixel)
96
-
97
- min (returns: ee.Image): Returns a temporally reduced min image (calculates min at each pixel)
98
-
99
- MosaicByDate (returns: LandsatCollection image collection): Mosaics image collection where images with the same date are mosaiced into the same image. Calculates total cloud percentage for subsequent filtering of cloudy mosaics.
100
-
101
- gypsum (returns: ee.ImageCollection): Returns LandsatCollection image collection of singleband gypsum index rasters
102
-
103
- halite (returns: ee.ImageCollection): Returns LandsatCollection image collection of singleband halite index rasters
104
-
105
- LST (returns: ee.ImageCollection): Returns LandsatCollection image collection of singleband land-surface-temperature rasters (Celcius)
106
-
107
- ndwi (returns: ee.ImageCollection): Returns LandsatCollection image collection of singleband NDWI (water) rasters
108
-
109
- ndvi (returns: ee.ImageCollection): Returns LandsatCollection image collection of singleband NDVI (vegetation) rasters
110
-
111
- turbidity (returns: ee.ImageCollection): Returns LandsatCollection image collection of singleband NDTI (turbidity) rasters
112
-
113
- chlorophyll (returns: ee.ImageCollection): Returns LandsatCollection image collection of singleband KIVU (relative chlorophyll-a) rasters
114
-
115
- Methods:
116
- get_filtered_collection(self)
117
-
118
- get_boundary_filtered_collection(self)
119
-
120
- ndwi_collection(self, threshold, ng_threshold=None)
121
-
122
- ndvi_collection(self, threshold, ng_threshold=None)
123
-
124
- halite_collection(self, threshold, ng_threshold=None)
125
-
126
- gypsum_collection(self, threshold, ng_threshold=None)
127
-
128
- turbidity_collection(self, threshold, ng_threshold=None)
129
-
130
- chlorophyll_collection(self, threshold, ng_threshold=None)
131
-
132
- masked_water_collection_NDWI(self, threshold)
133
-
134
- masked_to_water_collection_NDWI(self, threshold)
135
-
136
- surface_temperature_collection(self)
137
-
138
- mask_to_polygon(self, polygon)
139
-
140
- mask_out_polygon(self, polygon)
141
-
142
- mask_halite(self, threshold, ng_threshold=None)
143
-
144
- mask_halite_and_gypsum(self, halite_threshold, gypsum_threshold, halite_ng_threshold=None, gypsum_ng_threshold=None)
145
-
146
- PixelAreaSumCollection(self, band_name, geometry, threshold, scale, maxPixels)
147
-
148
- image_grab(self, img_selector)
149
-
150
- custom_image_grab(self, img_col, img_selector)
151
-
152
- image_pick(self, img_date)
153
-
154
- CollectionStitch(self, img_col2)
155
-
156
- transect_iterator(self, lines, line_names, save_folder_path, reducer='mean', n_segments=None, dist_interval=30, to_pandas=True)
157
-
158
- iterate_zonal_stats(self, coordinates, buffer_size=1, reducer_type='mean', scale=10, tileScale=1, coordinate_names=None, file_path=None, dates=None)
159
-
160
- Static Methods:
161
- image_dater(image)
162
-
163
- landsat5bandrename(img)
164
-
165
- landsat_ndwi_fn(image, threshold, ng_threshold=None)
166
-
167
- landsat_ndvi_fn(image, threshold, ng_threshold=None)
168
-
169
- landsat_halite_fn(image, threshold, ng_threshold=None)
170
-
171
- landsat_gypsum_fn(image, threshold, ng_threshold=None)
172
-
173
- landsat_ndti_fn(image, threshold, ng_threshold=None)
174
-
175
- landsat_kivu_chla_fn(image, threshold, ng_threshold=None)
176
-
177
- MaskWaterLandsat(image)
178
-
179
- MaskToWaterLandsat(image)
180
-
181
- MaskWaterLandsatByNDWI(image, threshold, ng_threshold=None)
182
-
183
- MaskToWaterLandsatByNDWI(image, threshold, ng_threshold=None)
184
-
185
- halite_mask(image, threshold, ng_threshold=None)
186
-
187
- gypsum_and_halite_mask(image, halite_threshold, gypsum_threshold, halite_ng_threshold=None, gypsum_ng_threshold=None)
188
-
189
- maskL8clouds(image)
190
-
191
- temperature_bands(img)
192
-
193
- landsat_LST(image)
194
-
195
- PixelAreaSum(image, band_name, geometry, threshold=-1, scale=30, maxPixels=1e12)
196
-
197
- dNDWIPixelAreaSum(image, geometry, band_name='ndwi', scale=30, maxPixels=1e12)
198
-
199
- extract_transect(image, line, reducer="mean", n_segments=100, dist_interval=None, scale=None, crs=None, crsTransform=None, tileScale=1.0, to_pandas=False)
200
-
201
- transect(image, lines, line_names, reducer='mean', n_segments=None, dist_interval=30, to_pandas=True)
202
-
203
- extract_zonal_stats_from_buffer(image, coordinates, buffer_size=1, reducer_type='mean', scale=10, tileScale=1, coordinate_names=None)
204
-
205
- Usage:
206
- The LandsatCollection object alone acts as a base object for which to further filter or process to indices or spatial reductions
207
-
208
- To use the LandsatCollection functionality, use any of the built in class attributes or method functions. For example, using class attributes:
209
-
210
- image_collection = LandsatCollection(start_date, end_date, tile_row, tile_path, cloud_percentage_threshold)
211
-
212
- ee_image_collection = image_collection.collection #returns ee.ImageCollection from provided argument filters
213
-
214
- latest_image = image_collection.image_grab(-1) #returns latest image in collection as ee.Image
215
-
216
- cloud_masked_collection = image_collection.masked_clouds_collection #returns cloud-masked LandsatCollection image collection
217
-
218
- NDWI_collection = image_collection.ndwi #returns NDWI LandsatCollection image collection
219
-
220
- latest_NDWI_image = NDWI_collection.image_grab(-1) #Example showing how class functions work with any LandsatCollection image collection object, returning latest ndwi image
27
+ collection (ee.ImageCollection): The filtered or user-supplied image collection converted to an ee.ImageCollection object.
28
+
29
+ Raises:
30
+ ValueError: Raised if required filter parameters are missing, or if both `collection` and other filters are provided.
31
+
32
+ Note:
33
+ See full usage examples in the documentation or notebooks:
34
+ https://github.com/radwinskis/RadGEEToolbox/tree/main/Example%20Notebooks
35
+
36
+ Examples:
37
+ >>> from RadGEEToolbox import LandsatCollection
38
+ >>> import ee
39
+ >>> ee.Initialize()
40
+ >>> image_collection = LandsatCollection(
41
+ ... start_date='2023-06-01',
42
+ ... end_date='2023-06-30',
43
+ ... tile_row=32,
44
+ ... tile_path=38,
45
+ ... cloud_percentage_threshold=20
46
+ ... )
47
+ >>> cloud_masked = image_collection.masked_clouds_collection
48
+ >>> latest_image = cloud_masked.image_grab(-1)
49
+ >>> ndwi_collection = image_collection.ndwi
221
50
  """
222
51
  def __init__(self, start_date=None, end_date=None, tile_row=None, tile_path=None, cloud_percentage_threshold=None, boundary=None, collection=None):
223
52
  if collection is None and (start_date is None or end_date is None):
@@ -4,144 +4,59 @@ import pandas as pd
4
4
  import numpy as np
5
5
  class Sentinel1Collection:
6
6
  """
7
- Class object representing a collection of Sentinel-1 C-band Synthetic Aperture Radar (SAR) GRD data at 10 m/px resolution from Google Earth Engine (GEE). Units of backscatter are in decibels (dB) by default.
7
+ Represents a user-defined collection of ESA Sentinel-1 C-band Synthetic Aperture Radar (SAR) GRD data at 10 m/px resolution from Google Earth Engine (GEE). Units of backscatter are in decibels (dB) by default.
8
8
 
9
- This class module provides methods to filter, process, and analyze Sentinel-1 satellite imagery for a given period and region.
9
+ This class enables simplified definition, filtering, masking, and processing of Seninel-1 SAR imagery.
10
+ It supports multiple spatial and temporal filters, multilooking and speckle filtering, caching for efficient computation, and direct conversion between log and linear backscatter scales. It also includes utilities for
11
+ mosaicking, zonal statistics, and transect analysis.
10
12
 
11
- Inspect the documentation or source code for details on the methods and properties available.
12
-
13
- Arguments:
14
- start_date (str): Start date string in format of yyyy-mm-dd for filtering collection (required unless collection is provided)
15
-
16
- end_date (str): End date string in format of yyyy-mm-dd for filtering collection (required unless collection is provided)
17
-
18
- relative_orbit_start (int or list): Relative orbit start number for filtering collection (required unless collection is provided)
19
-
20
- relative_orbit_stop (int or list): Relative orbit stop number for filtering collection (required unless collection is provided)
21
-
22
- instrument_mode (str or list): Instrument mode for filtering collection, with options of IW, EW, or SM (optional - defaults to IW)
23
-
24
- polarization (str or list): Polarization bands in image for filtering collection. Options: ['VV'], ['HH'], ['VV', 'VH'], or ['HH', 'HV'] (optional; default is ['VV', 'VH'])
25
-
26
- bands (str or list): Band(s) of interest in each image (optional, must match polarization type; default is ['VV', 'VH'])
13
+ Initialization can be done by providing filtering parameters or directly passing in a pre-filtered GEE collection.
27
14
 
28
- orbit_direction (str or list): Orbit direction for filtering collection. Options: 'ASCENDING' and/or 'DESCENDING' (required unless collection is provided). For example, ['ASCENDING', 'DESCENDING'] will include both ascending and descending images.
29
-
30
- boundary (ee.Geometry): Boundary for filtering images to images that intersect with the boundary shape (optional)
15
+ Inspect the documentation or source code for details on the methods and properties available.
31
16
 
32
- resolution_meters (int): Resolution in meters for filtering collection. Options of 10, 25, or 40 (required unless collection is provided; NOTE: this is for filtering the GEE collection, not multilooking/reprojecting)
33
-
34
- collection (ee.ImageCollection): Optional argument to provide an ee.ImageCollection object to be converted to a Sentinel1Collection object - will override other arguments!
17
+ Args:
18
+ start_date (str): Start date in 'YYYY-MM-DD' format. Required unless `collection` is provided.
19
+ end_date (str): End date in 'YYYY-MM-DD' format. Required unless `collection` is provided.
20
+ relative_orbit_start (int or list): Relative orbit start number for filtering collection. Required unless `collection` is provided.
21
+ relative_orbit_stop (int or list): Relative orbit stop number for filtering collection. Required unless `collection` is provided.
22
+ instrument_mode (str or list, optional): Instrument mode for filtering collection, with options of 'IW', 'EW', or 'SM'. Defaults to 'IW'
23
+ polarization (str or list, optional): Polarization bands in image for filtering collection. Options: ['VV'], ['HH'], ['VV', 'VH'], or ['HH', 'HV']. Default is ['VV', 'VH'].
24
+ bands (str or list, optional): Desired band(s). Must match polarization type. Default is ['VV', 'VH']
25
+ orbit_direction (str or list): Orbit direction for filtering collection. Options: 'ASCENDING' and/or 'DESCENDING'. Required unless `collection` is provided. For example, ['ASCENDING', 'DESCENDING'] will include both ascending and descending images.
26
+ boundary (ee.Geometry, optional): A geometry for filtering to images that intersect with the boundary shape. Overrides `relative_orbit_start` and `relative_orbit_stop` if provided.
27
+ resolution_meters (int): Resolution in meters for filtering collection. Options of 10, 25, or 40. Required unless collection is provided. NOTE: this is for filtering the GEE collection, not multilooking/reprojecting)
28
+ collection (ee.ImageCollection, optional): A pre-filtered Sentinel-1 ee.ImageCollection object to be converted to a Sentinel1Collection object. Overrides all other filters.
35
29
 
36
30
  Attributes:
37
- collection: Returns an ee.ImageCollection object from any Sentinel1Collection image collection object
38
-
39
- _dates_list: Cache storage for dates_list property attribute
40
-
41
- _dates: Cahce storgage for dates property attribute
42
-
43
- _geometry_masked_collection: Cache storage for mask_to_polygon method
44
-
45
- _geometry_masked_out_collection: Cache storage for mask_out_polygon method
46
-
47
- _median: Cache storage for median property attribute
48
-
49
- _mean: Cache storage for mean property attribute
50
-
51
- _max: Cache storage for max property attribute
52
-
53
- _min: Cache storage for min property attribute
54
-
55
- _MosaicByDate: Cache storage for MosaicByDate property attribute
56
-
57
- _PixelAreaSumCollection: Cache storage for PixelAreaSumCollection property attribute
58
-
59
- _speckle_filter: Cache storage for speckle_filter property attribute
60
-
61
- _Sigma0FromDb: Cache storage for Sigma0FromDb property attribute
62
-
63
- _DbFromSigma0: Cache storage for DbFromSigma0 property attribute
64
-
65
- _multilook: Cache storage for multilook property attribute
66
-
67
- Property attributes:
68
- dates_list (returns: Server-Side List): Unreadable Earth Engine list of image dates (server-side)
69
-
70
- dates (returns: Client-Side List): Readable pythonic list of image dates (client-side)
71
-
72
- max (returns: ee.Image): Returns a temporally reduced max image (calculates max at each pixel)
73
-
74
- median (returns: ee.Image): Returns a temporally reduced median image (calculates median at each pixel)
75
-
76
- mean (returns: ee.Image): Returns a temporally reduced mean image (calculates mean at each pixel)
77
-
78
- min (returns: ee.Image): Returns a temporally reduced min image (calculates min at each pixel)
79
-
80
- MosaicByDate (returns: Sentinel1Collection image collection): Mosaics image collection where images with the same date are mosaiced into the same image. Calculates total cloud percentage for subsequent filtering of cloudy mosaics.
81
-
82
- Sigma0FromDb (returns: Sentinel1Collection image collection): Converts image collection from decibels to sigma0
83
-
84
- DbFromSigma0 (returns: Sentinel1Collection image collection): Converts image collection from sigma0 to decibels
85
-
86
- multilook (returns: Sentinel1Collection image collection): Multilooks image collection by specified number of looks (1, 2, 3, or 4)
87
-
88
- speckle_filter (returns: Sentinel1Collection image collection): Applies speckle filter to image collection
89
-
90
- Methods:
91
- get_filtered_collection(self)
92
-
93
- get_boundary_filtered_collection(self)
94
-
95
- mask_to_polygon(self, polygon)
96
-
97
- mask_out_polygon(self, polygon)
98
-
99
- PixelAreaSumCollection(self, band_name, geometry, threshold, scale, maxPixels)
100
-
101
- image_grab(self, img_selector)
102
-
103
- custom_image_grab(self, img_col, img_selector)
104
-
105
- image_pick(self, img_date)
106
-
107
- CollectionStitch(self, img_col2)
108
-
109
- transect_iterator(self, lines, line_names, save_folder_path, reducer='mean', n_segments=None, dist_interval=30, to_pandas=True)
110
-
111
- iterate_zonal_stats(self, coordinates, buffer_size=1, reducer_type='mean', scale=40, tileScale=1, coordinate_names=None, file_path=None, dates=None)
112
-
113
- Static Methods:
114
- image_dater(image)
115
-
116
- PixelAreaSum(image, band_name, geometry, threshold=-1, scale=30, maxPixels=1e12)
117
-
118
- multilook_fn(image, looks)
119
-
120
- leesigma(image, KERNEL_SIZE, geometry, Tk=7, sigma=0.9, looks=1)
121
-
122
- extract_transect(image, line, reducer="mean", n_segments=100, dist_interval=None, scale=None, crs=None, crsTransform=None, tileScale=1.0, to_pandas=False)
123
-
124
- transect(image, lines, line_names, reducer='mean', n_segments=None, dist_interval=30, to_pandas=True)
125
-
126
- extract_zonal_stats_from_buffer(image, coordinates, buffer_size=1, reducer_type='mean', scale=40, tileScale=1, coordinate_names=None)
127
-
128
-
129
- Usage:
130
- The Sentinel1Collection object alone acts as a base object for which to further filter or process to indices or spatial reductions
131
-
132
- To use the Sentinel1Collection functionality, use any of the built in class attributes or method functions. For example, using class attributes:
133
-
134
- image_collection = Sentinel1Collection(start_date, end_date, tile_row, tile_path, cloud_percentage_threshold)
135
-
136
- ee_image_collection = image_collection.collection #returns ee.ImageCollection from provided argument filters
137
-
138
- latest_image = image_collection.image_grab(-1) #returns latest image in collection as ee.Image
139
-
140
- cloud_masked_collection = image_collection.masked_clouds_collection #returns cloud-masked Sentinel1Collection image collection
141
-
142
- NDWI_collection = image_collection.ndwi #returns NDWI Sentinel1Collection image collection
143
-
144
- latest_NDWI_image = NDWI_collection.image_grab(-1) #Example showing how class functions work with any Sentinel1Collection image collection object, returning latest ndwi image
31
+ collection (ee.ImageCollection): The filtered or user-supplied image collection converted to an ee.ImageCollection object.
32
+
33
+ Raises:
34
+ ValueError: Raised if required filter parameters are missing, or if both `collection` and other filters are provided.
35
+
36
+ Note:
37
+ See full usage examples in the documentation or notebooks:
38
+ https://github.com/radwinskis/RadGEEToolbox/tree/main/Example%20Notebooks
39
+
40
+ Examples:
41
+ >>> from RadGEEToolbox import Sentinel1Collection
42
+ >>> import ee
43
+ >>> ee.Initialize()
44
+ >>> counties = ee.FeatureCollection('TIGER/2018/Counties')
45
+ >>> salt_lake_county = counties.filter(ee.Filter.And(
46
+ ... ee.Filter.eq('NAME', 'Salt Lake'),
47
+ ... ee.Filter.eq('STATEFP', '49')))
48
+ >>> salt_lake_geometry = salt_lake_county.geometry()
49
+ >>> SAR_collection = Sentinel1Collection(
50
+ ... start_date='2024-05-01',
51
+ ... end_date='2024-05-31',
52
+ ... instrument_mode='IW',
53
+ ... polarization=['VV', 'VH'],
54
+ ... orbit_direction='DESCENDING',
55
+ ... boundary=salt_lake_geometry,
56
+ ... resolution_meters=10
57
+ ... )
58
+ >>> latest_image = SAR_collection.image_grab(-1)
59
+ >>> mean_SAR_backscatter = SAR_collection.mean
145
60
  """
146
61
  def __init__(self, start_date=None, end_date=None, relative_orbit_start=None, relative_orbit_stop=None, instrument_mode=None, polarization=None, bands=None, orbit_direction=None, boundary=None, resolution=None, resolution_meters=None, collection=None):
147
62
  if collection is None and (start_date is None or end_date is None):
@@ -3,214 +3,52 @@ import pandas as pd
3
3
  import numpy as np
4
4
  class Sentinel2Collection:
5
5
  """
6
- Class object representing a collection of ESA Sentinel-2 MSI surface reflectance satellite images at 10 m/px resolution from Google Earth Engine.
6
+ Represents a user-defined collection of ESA Sentinel-2 MSI surface reflectance satellite images at 10 m/px from Google Earth Engine (GEE).
7
7
 
8
- This class provides methods to filter, process, and analyze Sentinel-2 satellite imagery for a given period and region.
8
+ This class enables simplified definition, filtering, masking, and processing of multispectral Sentinel-2 imagery.
9
+ It supports multiple spatial and temporal filters, caching for efficient computation, and direct computation of
10
+ key spectral indices like NDWI, NDVI, halite index, and more. It also includes utilities for cloud masking,
11
+ mosaicking, zonal statistics, and transect analysis.
9
12
 
10
- Inspect the documentation or source code for details on the methods and properties available.
11
-
12
- Arguments:
13
- start_date (str): Start date string in format of yyyy-mm-dd for filtering collection (required unless collection is provided)
14
-
15
- end_date (str): End date string in format of yyyy-mm-dd for filtering collection (required unless collection is provided)
16
-
17
- tile (str or list): MGRS tile(s) of Sentinel image (required unless boundary, relative_orbit_number, or collection is provided) | user is allowed to provide multiple tiles as list (note tile specifications will override boundary or orbits) - see https://hls.gsfc.nasa.gov/products-description/tiling-system/
18
-
19
- cloud_percentage_threshold (int): Integer percentage threshold where only imagery with cloud % less than threshold will be provided (defaults to 100)
13
+ Initialization can be done by providing filtering parameters or directly passing in a pre-filtered GEE collection.
20
14
 
21
- nodata_threshold (int): Integer percentage threshold where only imagery with nodata pixels encompassing a % less than the threshold will be provided (defaults to 100)
15
+ Inspect the documentation or source code for details on the methods and properties available.
22
16
 
23
- boundary (ee.Geometry): Boundary for filtering images to images that intersect with the boundary shape (optional) - can be used in conjunction with relative_orbit_number
24
-
25
- relative_orbit_number (int or list): Relative orbit number(s) to filter collection (optional) - can be used in conjunction with boundary | provide multiple values as list
26
-
27
- collection (ee.ImageCollection): Optional argument to convert an ee.ImageCollection object to a Sentinel2Collection object - will override other arguments!
17
+ Args:
18
+ start_date (str): Start date in 'YYYY-MM-DD' format. Required unless `collection` is provided.
19
+ end_date (str): End date in 'YYYY-MM-DD' format. Required unless `collection` is provided.
20
+ tile (str or list): MGRS tile(s) of Sentinel image. Required unless `boundary`, `relative_orbit_number`, or `collection` is provided. The user is allowed to provide multiple tiles as list (note tile specifications will override boundary or orbits). See https://hls.gsfc.nasa.gov/products-description/tiling-system/
21
+ cloud_percentage_threshold (int, optional): Max allowed cloud cover percentage. Defaults to 100.
22
+ nodata_threshold (int, optional): Integer percentage threshold where only imagery with nodata pixels encompassing a % less than the threshold will be provided (defaults to 100)
23
+ boundary (ee.Geometry, optional): A geometry for filtering to images that intersect with the boundary shape. Overrides `tile` if provided.
24
+ relative_orbit_number (int or list, optional): Relative orbit number(s) to filter collection. Provide multiple values as list
25
+ collection (ee.ImageCollection, optional): A pre-filtered Sentinel-2 ee.ImageCollection object to be converted to a Sentinel2Collection object. Overrides all other filters.
28
26
 
29
27
  Attributes:
30
- collection (returns: ee.ImageCollection): Returns an ee.ImageCollection object from any Sentinel2Collection image collection object
31
-
32
- _dates_list: Cache storage for dates_list property attribute
33
-
34
- _dates: Cahce storgage for dates property attribute
35
-
36
- ndwi_threshold: Default threshold for masking ndwi imagery
37
-
38
- ndvi_threshold: Default threshold for masking ndvi imagery
39
-
40
- halite_threshold: Default threshold for masking halite imagery
41
-
42
- gypsum_threshold: Default threshold for masking gypsum imagery
43
-
44
- turbidity_threshold: Default threshold for masking turbidity imagery
45
-
46
- chlorophyll_threshold: Default threshold for masking chlorophyll imagery
47
-
48
- _masked_clouds_collection: Cache storage for masked_clouds_collection property attribute
49
-
50
- _masked_water_collection: Cache storage for masked_water_collection property attribute
51
-
52
- _masked_to_water_collection: Cache storage for masked_to_water_collection property attribute
53
-
54
- _geometry_masked_collection: Cache storage for mask_to_polygon method
55
-
56
- _geometry_masked_out_collection: Cache storage for mask_out_polygon method
57
-
58
- _median: Cache storage for median property attribute
59
-
60
- _mean: Cache storage for mean property attribute
61
-
62
- _max: Cache storage for max property attribute
28
+ collection (ee.ImageCollection): The filtered or user-supplied image collection converted to an ee.ImageCollection object.
63
29
 
64
- _min: Cache storage for min property attribute
30
+ Raises:
31
+ ValueError: Raised if required filter parameters are missing, or if both `collection` and other filters are provided.
65
32
 
66
- _ndwi: Cache storage for ndwi property attribute
67
-
68
- _ndvi: Cache storage for ndvi property attribute
69
-
70
- _halite: Cache storage for halite property attribute
71
-
72
- _gypsum: Cache storage for gypsum property attribute
73
-
74
- _turbidity: Cache storage for turbidity property attribute
75
-
76
- _chlorophyll: Cache storage for chlorophyll property attribute
77
-
78
- _MosaicByDate: Cache storage for MosaicByDate property attribute
79
-
80
- Property Attributes:
81
- dates_list (returns: Server-Side List): Unreadable Earth Engine list of image dates (server-side)
82
-
83
- dates (returns: Client-Side List): Readable pythonic list of image dates (client-side)
84
-
85
- masked_clouds_collection (returns: Sentinel2Collection image collection): Returns collection with clouds masked (transparent) for each image
86
-
87
- masked_to_water_collection (returns: Sentinel2Collection image collection): Returns collection masked to just water pixels
88
-
89
- masked_water_collection (returns: Sentinel2Collection image collection): Returns collection with water pixels masked
90
-
91
- max (returns: ee.Image): Returns a temporally reduced max image (calculates max at each pixel)
92
-
93
- median (returns: ee.Image): Returns a temporally reduced median image (calculates median at each pixel)
94
-
95
- mean (returns: ee.Image): Returns a temporally reduced mean image (calculates mean at each pixel)
96
-
97
- min (returns: ee.Image): Returns a temporally reduced min image (calculates min at each pixel)
98
-
99
- ndwi (returns: ee.ImageCollection): Returns Sentinel2Collection image collection of singleband NDWI (water) rasters
100
-
101
- ndvi (returns: ee.ImageCollection): Returns Sentinel2Collection image collection of singleband NDVI (vegetation) rasters
102
-
103
- halite (returns: ee.ImageCollection): Returns Sentinel2Collection image collection of singleband halite index rasters
104
-
105
- gypsum (returns: ee.ImageCollection): Returns Sentinel2Collection image collection of singleband gypsum index rasters
106
-
107
- turbidity (returns: ee.ImageCollection): Returns Sentinel2Collection image collection of singleband NDTI (turbidity) rasters
108
-
109
- chlorophyll (returns: ee.ImageCollection): Returns Sentinel2Collection image collection of singleband 2BDA (relative chlorophyll-a) rasters
110
-
111
- MosaicByDate (returns: Sentinel2Collection image collection): Mosaics image collection where images with the same date are mosaiced into the same image. Calculates total cloud percentage for subsequent filtering of cloudy mosaics.
112
-
113
- Methods:
114
- ndwi_collection(self, threshold)
115
-
116
- ndvi_collection(self, threshold)
33
+ Note:
34
+ See full usage examples in the documentation or notebooks:
35
+ https://github.com/radwinskis/RadGEEToolbox/tree/main/Example%20Notebooks
117
36
 
118
- halite_collection(self, threshold)
119
-
120
- gypsum_collection(self, threshold)
121
-
122
- turbidity_collection(self, threshold)
123
-
124
- chlorophyll_collection(self, threshold)
125
-
126
- get_filtered_collection(self)
127
-
128
- get_boundary_filtered_collection(self)
129
-
130
- get_orbit_filtered_collection(self)
131
-
132
- get_orbit_and_boundary_filtered_collection(self)
133
-
134
- mask_to_polygon(self, polygon)
135
-
136
- mask_out_polygon(self, polygon)
137
-
138
- masked_water_collection_NDWI(self, threshold)
139
-
140
- masked_to_water_collection_NDWI(self, threshold)
141
-
142
- mask_halite(self, threshold)
143
-
144
- mask_halite_and_gypsum(self, halite_threshold, gypsum_threshold)
145
-
146
- PixelAreaSumCollection(self, band_name, geometry, threshold, scale, maxPixels)
147
-
148
- image_grab(self, img_selector)
149
-
150
- custom_image_grab(self, img_col, img_selector)
151
-
152
- image_pick(self, img_date)
153
-
154
- CollectionStitch(self, img_col2)
155
-
156
- transect_iterator(self, lines, line_names, save_folder_path, reducer='mean', n_segments=None, dist_interval=30, to_pandas=True)
157
-
158
- iterate_zonal_stats(self, coordinates, buffer_size=1, reducer_type='mean', scale=10, tileScale=1, coordinate_names=None, file_path=None, dates=None)
159
-
160
- Static Methods:
161
- image_dater(image)
162
-
163
- sentinel_ndwi_fn(image, threshold)
164
-
165
- sentinel_ndvi_fn(image, threshold)
166
-
167
- sentinel_halite_fn(image, threshold)
168
-
169
- sentinel_gypsum_fn(image, threshold)
170
-
171
- sentinel_turbidity_fn(image, threshold)
172
-
173
- sentinel_chlorophyll_fn(image, threshold)
174
-
175
- MaskWaterS2(image)
176
-
177
- MaskToWaterS2(image)
178
-
179
- MaskWaterS2ByNDWI(image, threshold)
180
-
181
- MaskToWaterS2ByNDWI(image, threshold)
182
-
183
- halite_mask(image, threshold)
184
-
185
- gypsum_and_halite_mask(image, halite_threshold, gypsum_threshold)
186
-
187
- MaskCloudsS2(image)
188
-
189
- PixelAreaSum(image, band_name, geometry, threshold=-1, scale=30, maxPixels=1e12)
190
-
191
- extract_transect(image, line, reducer="mean", n_segments=100, dist_interval=None, scale=None, crs=None, crsTransform=None, tileScale=1.0, to_pandas=False)
192
-
193
- transect(image, lines, line_names, reducer='mean', n_segments=None, dist_interval=30, to_pandas=True)
194
-
195
- extract_zonal_stats_from_buffer(image, coordinates, buffer_size=1, reducer_type='mean', scale=10, tileScale=1, coordinate_names=None)
196
-
197
-
198
- Usage:
199
- The Sentinel2Collection object alone acts as a base object for which to further filter or process to indices or spatial reductions
200
-
201
- To use the Sentinel2Collection functionality, use any of the built in class attributes or method functions. For example, using class attributes:
202
-
203
- image_collection = Sentinel2Collection(start_date, end_date, tile, cloud_percentage_threshold)
204
-
205
- ee_image_collection = image_collection.collection #returns ee.ImageCollection from provided argument filters
206
-
207
- latest_image = image_collection.image_grab(-1) #returns latest image in collection as ee.Image
208
-
209
- cloud_masked_collection = image_collection.masked_clouds_collection #returns cloud-masked Sentinel2Collection image collection
210
-
211
- NDWI_collection = image_collection.ndwi #returns NDWI Sentinel2Collection image collection
212
-
213
- latest_NDWI_image = NDWI_collection.image_grab(-1) #Example showing how class functions work with any Sentinel2Collection image collection object, returning latest ndwi image
37
+ Examples:
38
+ >>> from RadGEEToolbox import Sentinel2Collection
39
+ >>> import ee
40
+ >>> ee.Initialize()
41
+ >>> image_collection = Sentinel2Collection(
42
+ ... start_date='2023-06-01',
43
+ ... end_date='2023-06-30',
44
+ ... tile=['12TUL', '12TUM', '12TUN'],
45
+ ... cloud_percentage_threshold=20,
46
+ ... nodata_threshold=10,
47
+ ... )
48
+ >>> mosaic_collection = image_collection.MosaicByDate #mosaic images/tiles with same date
49
+ >>> cloud_masked = mosaic_collection.masked_clouds_collection #mask out clouds
50
+ >>> latest_image = cloud_masked.image_grab(-1) #grab latest image for viewing
51
+ >>> ndwi_collection = cloud_masked.ndwi #calculate ndwi for all images
214
52
  """
215
53
 
216
54
  def __init__(self, start_date=None, end_date=None, tile=None, cloud_percentage_threshold=None, nodata_threshold=None, boundary=None, relative_orbit_number=None, collection=None):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: RadGEEToolbox
3
- Version: 1.6.1
3
+ Version: 1.6.2
4
4
  Summary: Streamlined Multispectral & SAR Analysis for Google Earth Engine Python API
5
5
  Home-page: https://github.com/radwinskis/RadGEEToolbox
6
6
  Author: Mark Radwin
@@ -67,15 +67,15 @@ _____________
67
67
 
68
68
  ### Installing via pip
69
69
 
70
- To install `RadGEEToolbox` version 1.6.1 using pip (NOTE: it is recommended to create a new virtual environment):
70
+ To install `RadGEEToolbox` version 1.6.2 using pip (NOTE: it is recommended to create a new virtual environment):
71
71
 
72
72
  ```bash
73
- pip install RadGEEToolbox==1.6.1
73
+ pip install RadGEEToolbox==1.6.2
74
74
  ```
75
75
 
76
76
  ### Installing via Conda
77
77
 
78
- To install `RadGEEToolbox` version 1.6.1 using conda-forge (NOTE: it is recommended to create a new virtual environment):
78
+ To install `RadGEEToolbox` version 1.6.2 using conda-forge (NOTE: it is recommended to create a new virtual environment):
79
79
 
80
80
  ```bash
81
81
  conda install conda-forge::radgeetoolbox
@@ -106,7 +106,7 @@ To verify that `RadGEEToolbox` was installed correctly:
106
106
  python -c "import RadGEEToolbox; print(RadGEEToolbox.__version__)"
107
107
  ```
108
108
 
109
- You should see `1.6.1` printed as the version number.
109
+ You should see `1.6.2` printed as the version number.
110
110
 
111
111
  ________
112
112
  # Usage Example
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "RadGEEToolbox"
7
- version = "1.6.1"
7
+ version = "1.6.2"
8
8
  description = "Streamlined Multispectral & SAR Analysis for Google Earth Engine Python API"
9
9
  authors = [
10
10
  {name = "Mark Radwin", email = "markradwin@gmail.com"}
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="RadGEEToolbox",
5
- version="1.6.1",
5
+ version="1.6.2",
6
6
  author="Mark Radwin",
7
7
  author_email="markradwin@gmail.com",
8
8
  description="Streamlined Multispectral & SAR Analysis for Google Earth Engine Python API",
File without changes
File without changes