RadGEEToolbox 1.6.8__tar.gz → 1.6.9__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.
- {radgeetoolbox-1.6.8 → radgeetoolbox-1.6.9}/PKG-INFO +5 -5
- {radgeetoolbox-1.6.8 → radgeetoolbox-1.6.9}/README.md +4 -4
- {radgeetoolbox-1.6.8 → radgeetoolbox-1.6.9}/RadGEEToolbox/LandsatCollection.py +27 -4
- {radgeetoolbox-1.6.8 → radgeetoolbox-1.6.9}/RadGEEToolbox/Sentinel1Collection.py +27 -4
- {radgeetoolbox-1.6.8 → radgeetoolbox-1.6.9}/RadGEEToolbox/Sentinel2Collection.py +20 -5
- {radgeetoolbox-1.6.8 → radgeetoolbox-1.6.9}/RadGEEToolbox/__init__.py +1 -1
- {radgeetoolbox-1.6.8 → radgeetoolbox-1.6.9}/RadGEEToolbox.egg-info/PKG-INFO +5 -5
- {radgeetoolbox-1.6.8 → radgeetoolbox-1.6.9}/pyproject.toml +1 -1
- {radgeetoolbox-1.6.8 → radgeetoolbox-1.6.9}/setup.py +1 -1
- {radgeetoolbox-1.6.8 → radgeetoolbox-1.6.9}/LICENSE.txt +0 -0
- {radgeetoolbox-1.6.8 → radgeetoolbox-1.6.9}/RadGEEToolbox/CollectionStitch.py +0 -0
- {radgeetoolbox-1.6.8 → radgeetoolbox-1.6.9}/RadGEEToolbox/GetPalette.py +0 -0
- {radgeetoolbox-1.6.8 → radgeetoolbox-1.6.9}/RadGEEToolbox/VisParams.py +0 -0
- {radgeetoolbox-1.6.8 → radgeetoolbox-1.6.9}/RadGEEToolbox.egg-info/SOURCES.txt +0 -0
- {radgeetoolbox-1.6.8 → radgeetoolbox-1.6.9}/RadGEEToolbox.egg-info/dependency_links.txt +0 -0
- {radgeetoolbox-1.6.8 → radgeetoolbox-1.6.9}/RadGEEToolbox.egg-info/requires.txt +0 -0
- {radgeetoolbox-1.6.8 → radgeetoolbox-1.6.9}/RadGEEToolbox.egg-info/top_level.txt +0 -0
- {radgeetoolbox-1.6.8 → radgeetoolbox-1.6.9}/setup.cfg +0 -0
- {radgeetoolbox-1.6.8 → radgeetoolbox-1.6.9}/tests/test_landsat_collection.py +0 -0
- {radgeetoolbox-1.6.8 → radgeetoolbox-1.6.9}/tests/test_sentinel1_collection.py +0 -0
- {radgeetoolbox-1.6.8 → radgeetoolbox-1.6.9}/tests/test_sentinel2_collection.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: RadGEEToolbox
|
|
3
|
-
Version: 1.6.
|
|
3
|
+
Version: 1.6.9
|
|
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
|
|
@@ -172,15 +172,15 @@ _____________
|
|
|
172
172
|
|
|
173
173
|
### Installing via pip
|
|
174
174
|
|
|
175
|
-
To install `RadGEEToolbox` version 1.6.
|
|
175
|
+
To install `RadGEEToolbox` version 1.6.9 using pip (NOTE: it is recommended to create a new virtual environment):
|
|
176
176
|
|
|
177
177
|
```bash
|
|
178
|
-
pip install RadGEEToolbox==1.6.
|
|
178
|
+
pip install RadGEEToolbox==1.6.9
|
|
179
179
|
```
|
|
180
180
|
|
|
181
181
|
### Installing via Conda
|
|
182
182
|
|
|
183
|
-
To install `RadGEEToolbox` version 1.6.
|
|
183
|
+
To install `RadGEEToolbox` version 1.6.9 using conda-forge (NOTE: it is recommended to create a new virtual environment):
|
|
184
184
|
|
|
185
185
|
```bash
|
|
186
186
|
conda install conda-forge::radgeetoolbox
|
|
@@ -211,7 +211,7 @@ To verify that `RadGEEToolbox` was installed correctly:
|
|
|
211
211
|
python -c "import RadGEEToolbox; print(RadGEEToolbox.__version__)"
|
|
212
212
|
```
|
|
213
213
|
|
|
214
|
-
You should see `1.6.
|
|
214
|
+
You should see `1.6.9` printed as the version number.
|
|
215
215
|
|
|
216
216
|
### Want to Visualize Data? Install These Too
|
|
217
217
|
|
|
@@ -143,15 +143,15 @@ _____________
|
|
|
143
143
|
|
|
144
144
|
### Installing via pip
|
|
145
145
|
|
|
146
|
-
To install `RadGEEToolbox` version 1.6.
|
|
146
|
+
To install `RadGEEToolbox` version 1.6.9 using pip (NOTE: it is recommended to create a new virtual environment):
|
|
147
147
|
|
|
148
148
|
```bash
|
|
149
|
-
pip install RadGEEToolbox==1.6.
|
|
149
|
+
pip install RadGEEToolbox==1.6.9
|
|
150
150
|
```
|
|
151
151
|
|
|
152
152
|
### Installing via Conda
|
|
153
153
|
|
|
154
|
-
To install `RadGEEToolbox` version 1.6.
|
|
154
|
+
To install `RadGEEToolbox` version 1.6.9 using conda-forge (NOTE: it is recommended to create a new virtual environment):
|
|
155
155
|
|
|
156
156
|
```bash
|
|
157
157
|
conda install conda-forge::radgeetoolbox
|
|
@@ -182,7 +182,7 @@ To verify that `RadGEEToolbox` was installed correctly:
|
|
|
182
182
|
python -c "import RadGEEToolbox; print(RadGEEToolbox.__version__)"
|
|
183
183
|
```
|
|
184
184
|
|
|
185
|
-
You should see `1.6.
|
|
185
|
+
You should see `1.6.9` printed as the version number.
|
|
186
186
|
|
|
187
187
|
### Want to Visualize Data? Install These Too
|
|
188
188
|
|
|
@@ -2879,6 +2879,7 @@ class LandsatCollection:
|
|
|
2879
2879
|
def iterate_zonal_stats(
|
|
2880
2880
|
self,
|
|
2881
2881
|
geometries,
|
|
2882
|
+
band=None,
|
|
2882
2883
|
reducer_type="mean",
|
|
2883
2884
|
scale=30,
|
|
2884
2885
|
geometry_names=None,
|
|
@@ -2894,6 +2895,7 @@ class LandsatCollection:
|
|
|
2894
2895
|
|
|
2895
2896
|
Args:
|
|
2896
2897
|
geometries (ee.Geometry, ee.Feature, ee.FeatureCollection, list, or tuple): Input geometries for which to extract statistics. Can be a single ee.Geometry, an ee.Feature, an ee.FeatureCollection, a list of (lon, lat) tuples, or a list of ee.Geometry objects. Be careful to NOT provide coordinates as (lat, lon)!
|
|
2898
|
+
band (str, optional): The name of the band to use for statistics. If None, the first band is used. Defaults to None.
|
|
2897
2899
|
reducer_type (str, optional): The ee.Reducer to use, e.g., 'mean', 'median', 'max', 'sum'. Defaults to 'mean'. Any ee.Reducer method can be used.
|
|
2898
2900
|
scale (int, optional): Pixel scale in meters for the reduction. Defaults to 30.
|
|
2899
2901
|
geometry_names (list, optional): A list of string names for the geometries. If provided, must match the number of geometries. Defaults to None.
|
|
@@ -2911,6 +2913,12 @@ class LandsatCollection:
|
|
|
2911
2913
|
TypeError: If geometries input type is unsupported.
|
|
2912
2914
|
"""
|
|
2913
2915
|
img_collection_obj = self
|
|
2916
|
+
if band:
|
|
2917
|
+
img_collection_obj = LandsatCollection(collection=img_collection_obj.collection.select(band))
|
|
2918
|
+
else:
|
|
2919
|
+
first_image = img_collection_obj.image_grab(0)
|
|
2920
|
+
first_band = first_image.bandNames().get(0)
|
|
2921
|
+
img_collection_obj = LandsatCollection(collection=img_collection_obj.collection.select([first_band]))
|
|
2914
2922
|
# Filter collection by dates if provided
|
|
2915
2923
|
if dates:
|
|
2916
2924
|
img_collection_obj = LandsatCollection(
|
|
@@ -2993,18 +3001,33 @@ class LandsatCollection:
|
|
|
2993
3001
|
stats_fc = image.reduceRegions(
|
|
2994
3002
|
collection=features, reducer=reducer, scale=scale, tileScale=tileScale
|
|
2995
3003
|
)
|
|
2996
|
-
|
|
3004
|
+
|
|
3005
|
+
def guarantee_reducer_property(f):
|
|
3006
|
+
has_property = f.propertyNames().contains(reducer_type)
|
|
3007
|
+
return ee.Algorithms.If(has_property, f, f.set(reducer_type, -9999))
|
|
3008
|
+
fixed_stats_fc = stats_fc.map(guarantee_reducer_property)
|
|
3009
|
+
|
|
3010
|
+
return fixed_stats_fc.map(lambda f: f.set('image_date', image_date))
|
|
2997
3011
|
|
|
2998
3012
|
results_fc = ee.FeatureCollection(img_collection_obj.collection.map(calculate_stats_for_image)).flatten()
|
|
2999
3013
|
df = LandsatCollection.ee_to_df(results_fc, remove_geom=True)
|
|
3000
3014
|
|
|
3001
3015
|
# Checking for issues
|
|
3002
3016
|
if df.empty:
|
|
3003
|
-
print("No results found for the given parameters. Check if the geometries intersect with the images, if the dates filter is too restrictive, or if the provided bands are empty.")
|
|
3004
|
-
return df
|
|
3017
|
+
# print("No results found for the given parameters. Check if the geometries intersect with the images, if the dates filter is too restrictive, or if the provided bands are empty.")
|
|
3018
|
+
# return df
|
|
3019
|
+
raise ValueError("No results found for the given parameters. Check if the geometries intersect with the images, if the dates filter is too restrictive, or if the provided bands are empty.")
|
|
3005
3020
|
if reducer_type not in df.columns:
|
|
3006
3021
|
print(f"Warning: Reducer '{reducer_type}' not found in results.")
|
|
3007
|
-
return df
|
|
3022
|
+
# return df
|
|
3023
|
+
|
|
3024
|
+
# Get the number of rows before dropping nulls for a helpful message
|
|
3025
|
+
initial_rows = len(df)
|
|
3026
|
+
df.dropna(subset=[reducer_type], inplace=True)
|
|
3027
|
+
df = df[df[reducer_type] != -9999]
|
|
3028
|
+
dropped_rows = initial_rows - len(df)
|
|
3029
|
+
if dropped_rows > 0:
|
|
3030
|
+
print(f"Warning: Discarded {dropped_rows} results due to failed reductions (e.g., no valid pixels in geometry).")
|
|
3008
3031
|
|
|
3009
3032
|
# Reshape DataFrame to have dates as index and geometry names as columns
|
|
3010
3033
|
pivot_df = df.pivot(index='image_date', columns='geo_name', values=reducer_type)
|
|
@@ -1634,6 +1634,7 @@ class Sentinel1Collection:
|
|
|
1634
1634
|
def iterate_zonal_stats(
|
|
1635
1635
|
self,
|
|
1636
1636
|
geometries,
|
|
1637
|
+
band=None,
|
|
1637
1638
|
reducer_type="mean",
|
|
1638
1639
|
scale=10,
|
|
1639
1640
|
geometry_names=None,
|
|
@@ -1649,6 +1650,7 @@ class Sentinel1Collection:
|
|
|
1649
1650
|
|
|
1650
1651
|
Args:
|
|
1651
1652
|
geometries (ee.Geometry, ee.Feature, ee.FeatureCollection, list, or tuple): Input geometries for which to extract statistics. Can be a single ee.Geometry, an ee.Feature, an ee.FeatureCollection, a list of (lon, lat) tuples, or a list of ee.Geometry objects. Be careful to NOT provide coordinates as (lat, lon)!
|
|
1653
|
+
band (str, optional): The name of the band to use for statistics. If None, the first band is used. Defaults to None.
|
|
1652
1654
|
reducer_type (str, optional): The ee.Reducer to use, e.g., 'mean', 'median', 'max', 'sum'. Defaults to 'mean'. Any ee.Reducer method can be used.
|
|
1653
1655
|
scale (int, optional): Pixel scale in meters for the reduction. Defaults to 10.
|
|
1654
1656
|
geometry_names (list, optional): A list of string names for the geometries. If provided, must match the number of geometries. Defaults to None.
|
|
@@ -1666,6 +1668,12 @@ class Sentinel1Collection:
|
|
|
1666
1668
|
TypeError: If geometries input type is unsupported.
|
|
1667
1669
|
"""
|
|
1668
1670
|
img_collection_obj = self
|
|
1671
|
+
if band:
|
|
1672
|
+
img_collection_obj = Sentinel1Collection(collection=img_collection_obj.collection.select(band))
|
|
1673
|
+
else:
|
|
1674
|
+
first_image = img_collection_obj.image_grab(0)
|
|
1675
|
+
first_band = first_image.bandNames().get(0)
|
|
1676
|
+
img_collection_obj = Sentinel1Collection(collection=img_collection_obj.collection.select([first_band]))
|
|
1669
1677
|
# Filter collection by dates if provided
|
|
1670
1678
|
if dates:
|
|
1671
1679
|
img_collection_obj = Sentinel1Collection(
|
|
@@ -1748,18 +1756,33 @@ class Sentinel1Collection:
|
|
|
1748
1756
|
stats_fc = image.reduceRegions(
|
|
1749
1757
|
collection=features, reducer=reducer, scale=scale, tileScale=tileScale
|
|
1750
1758
|
)
|
|
1751
|
-
|
|
1759
|
+
|
|
1760
|
+
def guarantee_reducer_property(f):
|
|
1761
|
+
has_property = f.propertyNames().contains(reducer_type)
|
|
1762
|
+
return ee.Algorithms.If(has_property, f, f.set(reducer_type, -9999))
|
|
1763
|
+
fixed_stats_fc = stats_fc.map(guarantee_reducer_property)
|
|
1764
|
+
|
|
1765
|
+
return fixed_stats_fc.map(lambda f: f.set('image_date', image_date))
|
|
1752
1766
|
|
|
1753
1767
|
results_fc = ee.FeatureCollection(img_collection_obj.collection.map(calculate_stats_for_image)).flatten()
|
|
1754
1768
|
df = Sentinel1Collection.ee_to_df(results_fc, remove_geom=True)
|
|
1755
1769
|
|
|
1756
1770
|
# Checking for issues
|
|
1757
1771
|
if df.empty:
|
|
1758
|
-
print("No results found for the given parameters. Check if the geometries intersect with the images, if the dates filter is too restrictive, or if the provided bands are empty.")
|
|
1759
|
-
return df
|
|
1772
|
+
# print("No results found for the given parameters. Check if the geometries intersect with the images, if the dates filter is too restrictive, or if the provided bands are empty.")
|
|
1773
|
+
# return df
|
|
1774
|
+
raise ValueError("No results found for the given parameters. Check if the geometries intersect with the images, if the dates filter is too restrictive, or if the provided bands are empty.")
|
|
1760
1775
|
if reducer_type not in df.columns:
|
|
1761
1776
|
print(f"Warning: Reducer '{reducer_type}' not found in results.")
|
|
1762
|
-
return df
|
|
1777
|
+
# return df
|
|
1778
|
+
|
|
1779
|
+
# Get the number of rows before dropping nulls for a helpful message
|
|
1780
|
+
initial_rows = len(df)
|
|
1781
|
+
df.dropna(subset=[reducer_type], inplace=True)
|
|
1782
|
+
df = df[df[reducer_type] != -9999]
|
|
1783
|
+
dropped_rows = initial_rows - len(df)
|
|
1784
|
+
if dropped_rows > 0:
|
|
1785
|
+
print(f"Warning: Discarded {dropped_rows} results due to failed reductions (e.g., no valid pixels in geometry).")
|
|
1763
1786
|
|
|
1764
1787
|
# Reshape DataFrame to have dates as index and geometry names as columns
|
|
1765
1788
|
pivot_df = df.pivot(index='image_date', columns='geo_name', values=reducer_type)
|
|
@@ -4,7 +4,7 @@ import numpy as np
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
# ---- Reflectance scaling for Sentinel-2 L2A (HARMONIZED) ----
|
|
7
|
-
_S2_SR_BANDS = ["B1","B2","B3","B4","B5","B6","B7","B8","B8A","B9","
|
|
7
|
+
_S2_SR_BANDS = ["B1","B2","B3","B4","B5","B6","B7","B8","B8A","B9","B11","B12"]
|
|
8
8
|
_S2_SCALE = 0.0001 # offset 0.0
|
|
9
9
|
|
|
10
10
|
def _scale_s2_sr(img):
|
|
@@ -2497,18 +2497,33 @@ class Sentinel2Collection:
|
|
|
2497
2497
|
stats_fc = image.reduceRegions(
|
|
2498
2498
|
collection=features, reducer=reducer, scale=scale, tileScale=tileScale
|
|
2499
2499
|
)
|
|
2500
|
-
|
|
2500
|
+
|
|
2501
|
+
def guarantee_reducer_property(f):
|
|
2502
|
+
has_property = f.propertyNames().contains(reducer_type)
|
|
2503
|
+
return ee.Algorithms.If(has_property, f, f.set(reducer_type, -9999))
|
|
2504
|
+
fixed_stats_fc = stats_fc.map(guarantee_reducer_property)
|
|
2505
|
+
|
|
2506
|
+
return fixed_stats_fc.map(lambda f: f.set('image_date', image_date))
|
|
2501
2507
|
|
|
2502
2508
|
results_fc = ee.FeatureCollection(img_collection_obj.collection.map(calculate_stats_for_image)).flatten()
|
|
2503
2509
|
df = Sentinel2Collection.ee_to_df(results_fc, remove_geom=True)
|
|
2504
2510
|
|
|
2505
2511
|
# Checking for issues
|
|
2506
2512
|
if df.empty:
|
|
2507
|
-
print("No results found for the given parameters. Check if the geometries intersect with the images, if the dates filter is too restrictive, or if the provided bands are empty.")
|
|
2508
|
-
return df
|
|
2513
|
+
# print("No results found for the given parameters. Check if the geometries intersect with the images, if the dates filter is too restrictive, or if the provided bands are empty.")
|
|
2514
|
+
# return df
|
|
2515
|
+
raise ValueError("No results found for the given parameters. Check if the geometries intersect with the images, if the dates filter is too restrictive, or if the provided bands are empty.")
|
|
2509
2516
|
if reducer_type not in df.columns:
|
|
2510
2517
|
print(f"Warning: Reducer '{reducer_type}' not found in results.")
|
|
2511
|
-
return df
|
|
2518
|
+
# return df
|
|
2519
|
+
|
|
2520
|
+
# Get the number of rows before dropping nulls for a helpful message
|
|
2521
|
+
initial_rows = len(df)
|
|
2522
|
+
df.dropna(subset=[reducer_type], inplace=True)
|
|
2523
|
+
df = df[df[reducer_type] != -9999]
|
|
2524
|
+
dropped_rows = initial_rows - len(df)
|
|
2525
|
+
if dropped_rows > 0:
|
|
2526
|
+
print(f"Warning: Discarded {dropped_rows} results due to failed reductions (e.g., no valid pixels in geometry).")
|
|
2512
2527
|
|
|
2513
2528
|
# Reshape DataFrame to have dates as index and geometry names as columns
|
|
2514
2529
|
pivot_df = df.pivot(index='image_date', columns='geo_name', values=reducer_type)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: RadGEEToolbox
|
|
3
|
-
Version: 1.6.
|
|
3
|
+
Version: 1.6.9
|
|
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
|
|
@@ -172,15 +172,15 @@ _____________
|
|
|
172
172
|
|
|
173
173
|
### Installing via pip
|
|
174
174
|
|
|
175
|
-
To install `RadGEEToolbox` version 1.6.
|
|
175
|
+
To install `RadGEEToolbox` version 1.6.9 using pip (NOTE: it is recommended to create a new virtual environment):
|
|
176
176
|
|
|
177
177
|
```bash
|
|
178
|
-
pip install RadGEEToolbox==1.6.
|
|
178
|
+
pip install RadGEEToolbox==1.6.9
|
|
179
179
|
```
|
|
180
180
|
|
|
181
181
|
### Installing via Conda
|
|
182
182
|
|
|
183
|
-
To install `RadGEEToolbox` version 1.6.
|
|
183
|
+
To install `RadGEEToolbox` version 1.6.9 using conda-forge (NOTE: it is recommended to create a new virtual environment):
|
|
184
184
|
|
|
185
185
|
```bash
|
|
186
186
|
conda install conda-forge::radgeetoolbox
|
|
@@ -211,7 +211,7 @@ To verify that `RadGEEToolbox` was installed correctly:
|
|
|
211
211
|
python -c "import RadGEEToolbox; print(RadGEEToolbox.__version__)"
|
|
212
212
|
```
|
|
213
213
|
|
|
214
|
-
You should see `1.6.
|
|
214
|
+
You should see `1.6.9` printed as the version number.
|
|
215
215
|
|
|
216
216
|
### Want to Visualize Data? Install These Too
|
|
217
217
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "RadGEEToolbox"
|
|
7
|
-
version = "1.6.
|
|
7
|
+
version = "1.6.9"
|
|
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.
|
|
5
|
+
version="1.6.9",
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|