fix(DEM_SuPER): 修复DEM数据下载拼接逻辑bug.
This commit is contained in:
parent
bc6977ce11
commit
e1997c102e
@ -22,7 +22,7 @@ Step2: Process DEM data
|
|||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Authors: Hong Xie
|
Authors: Hong Xie
|
||||||
Last Updated: 2025-07-03
|
Last Updated: 2025-08-05
|
||||||
===============================================================================
|
===============================================================================
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -183,13 +183,13 @@ def process_granule(
|
|||||||
dem.rio.write_crs("EPSG:4326", inplace=True)
|
dem.rio.write_crs("EPSG:4326", inplace=True)
|
||||||
dem.attrs["scale_factor"] = 1
|
dem.attrs["scale_factor"] = 1
|
||||||
dem_raster_list.append(dem)
|
dem_raster_list.append(dem)
|
||||||
if len(dem_raster_list) > 1:
|
if len(dem_raster_list) >= 1:
|
||||||
if name == "slope" or name == "aspect":
|
if name == "slope" or name == "aspect":
|
||||||
dem_mosaiced = mosaic_images(dem_raster_list, nodata=-9999)
|
dem_mosaiced = mosaic_images(dem_raster_list, nodata=-9999)
|
||||||
else:
|
else:
|
||||||
dem_mosaiced = mosaic_images(dem_raster_list, nodata=-32768)
|
dem_mosaiced = mosaic_images(dem_raster_list, nodata=-32768)
|
||||||
if roi is not None and clip:
|
if roi is not None and clip:
|
||||||
dem_mosaiced = clip_image(dem_mosaiced, roi)
|
dem_mosaiced = clip_image(dem_mosaiced, roi, clip_by_box=True)
|
||||||
dem_mosaiced.rio.to_raster(output_file, driver="COG", compress="DEFLATE")
|
dem_mosaiced.rio.to_raster(output_file, driver="COG", compress="DEFLATE")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error(f"Error processing files in {name}: {e}")
|
logging.error(f"Error processing files in {name}: {e}")
|
||||||
@ -211,6 +211,7 @@ def main(region: list, asset_name: list, tile_id: str):
|
|||||||
unzip_dir = os.path.join(download_dir, "UNZIP")
|
unzip_dir = os.path.join(download_dir, "UNZIP")
|
||||||
output_dir = os.path.join(output_root_dir, "TIF", tile_id)
|
output_dir = os.path.join(output_root_dir, "TIF", tile_id)
|
||||||
os.makedirs(unzip_dir, exist_ok=True)
|
os.makedirs(unzip_dir, exist_ok=True)
|
||||||
|
os.makedirs(output_dir, exist_ok=True)
|
||||||
results_urls_file = f"{output_root_dir}\\NASADEM_{tile_id}_results_urls.json"
|
results_urls_file = f"{output_root_dir}\\NASADEM_{tile_id}_results_urls.json"
|
||||||
if not os.path.isfile(results_urls_file):
|
if not os.path.isfile(results_urls_file):
|
||||||
results_urls = earthdata_search(asset_name, roi=bbox)
|
results_urls = earthdata_search(asset_name, roi=bbox)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user