thêm chức năng train trên odc predict trên planetary
This commit is contained in:
+5
-3
@@ -30,7 +30,7 @@ def load_sentinel2_stac(
|
||||
Args:
|
||||
bbox: Bounding box (lon_min, lat_min, lon_max, lat_max)
|
||||
date_range: Tuple of start and end dates
|
||||
bands: List of bands to load (default: ['red', 'nir', 'scl'])
|
||||
bands: List of bands to load (default: ['B02', 'B03', 'B04', 'B08', 'B8A', 'B11', 'B12', 'SCL'])
|
||||
resolution: Spatial resolution in meters
|
||||
chunks: Dask chunk sizes
|
||||
|
||||
@@ -38,7 +38,8 @@ def load_sentinel2_stac(
|
||||
xarray.Dataset with Sentinel-2 data
|
||||
"""
|
||||
if bands is None:
|
||||
bands = ['red', 'nir', 'blue', 'green', 'nir08', 'swir16', 'swir22', 'SCL']
|
||||
# Use correct Planetary Computer band names for Sentinel-2 L2A
|
||||
bands = ['B02', 'B03', 'B04', 'B08', 'B8A', 'B11', 'B12', 'SCL']
|
||||
|
||||
print(f"🔍 Searching Sentinel-2 data...")
|
||||
print(f" Bbox: {bbox}")
|
||||
@@ -194,11 +195,12 @@ def mask_clean_s2(data, scl_band='SCL'):
|
||||
return result
|
||||
|
||||
|
||||
def calculate_ndvi(data, nir_band='nir08', red_band='red'):
|
||||
def calculate_ndvi(data, nir_band='B08', red_band='B04'):
|
||||
"""
|
||||
Calculate NDVI from Sentinel-2 data
|
||||
"""
|
||||
print(f"📊 Calculating NDVI using {nir_band} and {red_band}...")
|
||||
|
||||
|
||||
if nir_band not in data.data_vars or red_band not in data.data_vars:
|
||||
print(f"⚠ Warning: Required bands not found")
|
||||
|
||||
Reference in New Issue
Block a user