Skip to content

Commit de33b24

Browse files
committed
refactor: address review comments on GPW integration and fix pickle bug
1 parent b0ccc3a commit de33b24

3 files changed

Lines changed: 23 additions & 16 deletions

File tree

.vscode/settings.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"githubPullRequests.ignoredPullRequestBranches": [
3+
"main"
4+
]
5+
}

CPU_GEE-Data_Cube_Generator-F2A.ipynb

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"\n",
1111
"## Introduction\n",
1212
"\n",
13-
"This Colab notebook is designed to process and analyze geospatial data using Google Earth Engine (GEE). It focuses on deriving topographic, climatic, and spectral information for a specified region of interest (ROI). By leveraging GEE's powerful cloud computing capabilities, this workflow enables efficient data handling and export of key environmental variables for further analysis.\n",
13+
"This Colab notebook is designed to process and analyze geospatial data using Google Earth Engine (GEE). It focuses on deriving topographic, climatic, vegetation structure and spectral information for a specified region of interest (ROI). By leveraging GEE's powerful cloud computing capabilities, this workflow enables efficient data handling and export of key environmental variables for further analysis.\n",
1414
"\n",
1515
"\n",
1616
"### What Does This Notebook Do?:\n",
@@ -24,6 +24,7 @@
2424
"\n",
2525
"- Topographic Variables: Elevation, slope, aspect, landforms, and topographic position index (TPI).\n",
2626
"- Climate Variables: Total precipitation and average temperature over a defined period.\n",
27+
"- Structural Variables: Vegetation Height derived from the GPW dataset (30 m resolution). This dataset provides wall-to-wall coverage of all terrestrial ecosystems, used here to represent pre-fire standing fuel from the prior calendar year.\n",
2728
"- Spectral Indices: NDVI, NDBI, NDWI, and EVI derived from Sentinel-2 imagery.\n",
2829
"- Sentinel-2 Variables: Red, Green, Blue, R1, R2, R3, NIR, R4, SWIR1, and SWIR2 bands with cloud correction included.\n",
2930
"- Radar Data: VV and VH polarizations from Sentinel-1 with slope correction applied.\n",
@@ -623,12 +624,12 @@
623624
"metadata": {},
624625
"outputs": [],
625626
"source": [
626-
"# Vegetation Height data from Global Pasture Watch (using season_year - 1 for pre-fire state)\n",
627-
"canopy_collection = ee.ImageCollection(\"projects/global-pasture-watch/assets/gsvh-30m/v1/short-veg-height_m\")\n",
628-
"\n",
627+
"# GPW provides median vegetation height for all terrestrial ecosystems (not limited to short veg)\n",
628+
"veg_height_collection = ee.ImageCollection(\"projects/global-pasture-watch/assets/gsvh-30m/v1/short-veg-height_m\")\n",
629629
"veg_height = apply_region_mask(\n",
630-
" canopy_collection.filterDate(f'{season_year-1}-01-01', f'{season_year}-01-01') \\\n",
630+
" veg_height_collection.filterDate(f'{season_year-1}-01-01', f'{season_year}-01-01') \\\n",
631631
" .median() \\\n",
632+
" # The dataset stores values as scaled integers; multiply by 0.1 to convert to meters\n",
632633
" .multiply(0.1) \\\n",
633634
" .rename('veg_height') \\\n",
634635
" .toFloat(),\n",
@@ -1115,8 +1116,8 @@
11151116
"batch_2 = [\n",
11161117
" (tpi, 'TPI', 'tpi', region), # 05 minutes aprox\n",
11171118
" (landform, 'Landform', 'landform', region), # 03 minutes aprox\n",
1118-
" (climate_variables, 'Climate Variables', 'climate_variables', region),\n",
1119-
" (veg_height, 'Vegetation Height', 'veg_height', region), # 06 minutes aprox\n",
1119+
" (climate_variables, 'Climate Variables', 'climate_variables', region), # 06 minutes aprox\n",
1120+
" (veg_height, 'Vegetation Height', 'veg_height', region), # 06 minutes aprox\n",
11201121
"]\n",
11211122
"\n",
11221123
"batch_3 = [\n",

GPU_and_CPU_GEE-Data_Cube_Generator-F2A.ipynb

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"\n",
1111
"## Introduction\n",
1212
"\n",
13-
"This Colab notebook is designed to process and analyze geospatial data using Google Earth Engine (GEE). It focuses on deriving topographic, climatic, and spectral information for a specified region of interest (ROI). By leveraging GEE's powerful cloud computing capabilities, this workflow enables efficient data handling and export of key environmental variables for further analysis.\n",
13+
"This Colab notebook is designed to process and analyze geospatial data using Google Earth Engine (GEE). It focuses on deriving topographic, climatic, vegetation structure and spectral information for a specified region of interest (ROI). By leveraging GEE's powerful cloud computing capabilities, this workflow enables efficient data handling and export of key environmental variables for further analysis.\n",
1414
"\n",
1515
"\n",
1616
"### What Does This Notebook Do?:\n",
@@ -24,6 +24,7 @@
2424
"\n",
2525
"- Topographic Variables: Elevation, slope, aspect, landforms, and topographic position index (TPI).\n",
2626
"- Climate Variables: Total precipitation and average temperature over a defined period.\n",
27+
"- Structural Variables: Vegetation Height derived from the GPW dataset (30 m resolution). This dataset provides wall-to-wall coverage of all terrestrial ecosystems, used here to represent pre-fire standing fuel from the prior calendar year.\n",
2728
"- Spectral Indices: NDVI, NDBI, NDWI, and EVI derived from Sentinel-2 imagery.\n",
2829
"- Sentinel-2 Variables: Red, Green, Blue, R1, R2, R3, NIR, R4, SWIR1, and SWIR2 bands with cloud correction included.\n",
2930
"- Radar Data: VV and VH polarizations from Sentinel-1 with slope correction applied.\n",
@@ -646,12 +647,12 @@
646647
"metadata": {},
647648
"outputs": [],
648649
"source": [
649-
"# Vegetation Height data from Global Pasture Watch (using season_year - 1 for pre-fire state)\n",
650-
"canopy_collection = ee.ImageCollection(\"projects/global-pasture-watch/assets/gsvh-30m/v1/short-veg-height_m\")\n",
651-
"\n",
650+
"# GPW provides median vegetation height for all terrestrial ecosystems (not limited to short veg)\n",
651+
"veg_height_collection = ee.ImageCollection(\"projects/global-pasture-watch/assets/gsvh-30m/v1/short-veg-height_m\")\n",
652652
"veg_height = apply_region_mask(\n",
653-
" canopy_collection.filterDate(f'{season_year-1}-01-01', f'{season_year}-01-01') \\\n",
653+
" veg_height_collection.filterDate(f'{season_year-1}-01-01', f'{season_year}-01-01') \\\n",
654654
" .median() \\\n",
655+
" # The dataset stores values as scaled integers; multiply by 0.1 to convert to meters\n",
655656
" .multiply(0.1) \\\n",
656657
" .rename('veg_height') \\\n",
657658
" .toFloat(),\n",
@@ -1092,7 +1093,7 @@
10921093
"with open('/content/processed_data.pkl', 'wb') as f:\n",
10931094
" pickle.dump(data, f)\n",
10941095
"\n",
1095-
"print(\"Data Serilized and saved as processed_data.pkl\")"
1096+
"print(\"Data Serialized and saved as processed_data.pkl\")"
10961097
]
10971098
},
10981099
{
@@ -1168,7 +1169,7 @@
11681169
"# Access the variables\n",
11691170
"landform = data['landform']\n",
11701171
"tpi = data['tpi']\n",
1171-
"nasadem_variables = data['elevation_variables']\n",
1172+
"nasadem_variables = data['nasadem_variables']\n",
11721173
"climate_variables = data['climate_variables']\n",
11731174
"veg_height = data['veg_height'] \n",
11741175
"sentinel2_collections = data['sentinel2_collections']\n",
@@ -1260,8 +1261,8 @@
12601261
"batch_2 = [\n",
12611262
" (tpi, 'TPI', 'tpi', region), # 05 minutes aprox\n",
12621263
" (landform, 'Landform', 'landform', region), # 03 minutes aprox\n",
1263-
" (climate_variables, 'Climate Variables', 'climate_variables', region),\n",
1264-
" (veg_height, 'Vegetation Height', 'veg_height', region), # 06 minutes aprox\n",
1264+
" (climate_variables, 'Climate Variables', 'climate_variables', region), # 06 minutes aprox\n",
1265+
" (veg_height, 'Vegetation Height', 'veg_height', region), # 06 minutes aprox\n",
12651266
"]\n",
12661267
"\n",
12671268
"batch_3 = [\n",

0 commit comments

Comments
 (0)