đã chạy được Mic supplyer trên ODC
This commit is contained in:
@@ -135,7 +135,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"execution_count": null,
|
||||
"id": "3cd69645",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
@@ -830,34 +830,36 @@
|
||||
" date = item.datetime.strftime(\"%Y-%m-%d\")\n",
|
||||
" cloud = item.properties.get(\"eo:cloud_cover\", \"N/A\")\n",
|
||||
" print(f\" [{i+1}] {date} - Cloud: {cloud}%\")\n",
|
||||
" \n",
|
||||
"\n",
|
||||
" # Re-sign items to ensure fresh URLs (keep as pystac objects)\n",
|
||||
" print(f\"\\n🔑 Signing STAC items...\")\n",
|
||||
" items_s2 = [planetary_computer.sign(item) for item in items_s2]\n",
|
||||
" \n",
|
||||
" # Load Sentinel-2 data (without Dask chunks)\n",
|
||||
" print(f\"\\n⏳ Loading Sentinel-2 data...\")\n",
|
||||
"\n",
|
||||
" # Load Sentinel-2 data with 6 spectral bands for better classification\n",
|
||||
" print(f\"\\n⏳ Loading Sentinel-2 data (6 bands for improved accuracy)...\")\n",
|
||||
" ds_s2 = stac_load(\n",
|
||||
" items_s2,\n",
|
||||
" bands=[\"B04\", \"B08\", \"SCL\"], # Red (B04), NIR (B08), Scene Classification (SCL)\n",
|
||||
" bands=[\"B02\", \"B03\", \"B04\", \"B08\", \"B11\", \"B12\", \"SCL\"], # Blue, Green, Red, NIR, SWIR1, SWIR2, SCL\n",
|
||||
" crs=\"EPSG:32648\",\n",
|
||||
" resolution=20, # 20m resolution (4x smaller data than 10m)\n",
|
||||
" bbox=bbox,\n",
|
||||
" patch_url=planetary_computer.sign, # Re-sign URLs during loading\n",
|
||||
" fail_on_error=False, # Skip problematic tiles instead of crashing\n",
|
||||
" )\n",
|
||||
" \n",
|
||||
"\n",
|
||||
" # Rename bands to simpler names\n",
|
||||
" ds_s2 = ds_s2.rename({\"B04\": \"red\", \"B08\": \"nir\", \"SCL\": \"scl\"})\n",
|
||||
" \n",
|
||||
" ds_s2 = ds_s2.rename({\"B02\": \"blue\", \"B03\": \"green\", \"B04\": \"red\",\n",
|
||||
" \"B08\": \"nir\", \"B11\": \"swir1\", \"B12\": \"swir2\", \"SCL\": \"scl\"})\n",
|
||||
"\n",
|
||||
" print(f\"\\n✅ Sentinel-2 loaded!\")\n",
|
||||
" print(f\" Shape: {dict(ds_s2.dims)}\")\n",
|
||||
" print(f\" Variables: {list(ds_s2.data_vars)}\")\n",
|
||||
" print(f\" Bands: blue, green, red, nir, swir1, swir2, scl\")\n",
|
||||
" display(ds_s2)\n",
|
||||
"else:\n",
|
||||
" print(f\"❌ No Sentinel-2 scenes found\")\n",
|
||||
"\n",
|
||||
" ds_s2 = Noneprint(\"=\"*70)\n"
|
||||
" ds_s2 = None\n",
|
||||
"print(\"=\"*70)\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user