批量删除Google Earth Engine云资产

问题描述 投票:0回答:1

Google Earth Engine中没有资产管理界面,资产只能一项一项删除。如何快速删除一批资产?

libgee google-cloud-asset-inventory
1个回答
0
投票
import ee

ee.Initialize()    
asset_list_path = {'id': 'projects/Your/assets'}    
asset_list = ee.data.getList(asset_list_path)

print("Asset list:")
for asset in asset_list:
    print(asset['id'])


#Define a list of assets to delete (indices 0 to 18).    
assets_to_delete = asset_list[0:19]

for asset in assets_to_delete:
    asset_path = asset['id']
    try:
        ee.data.deleteAsset(asset_path)
        print("Asset deleted:", asset_path)
    except Exception as e:
        print("Failed to delete asset:", asset_path)
        print("Error:", e)
© www.soinside.com 2019 - 2024. All rights reserved.