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