Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ee_username = 'projects/pyregence-ee/'
- asset_id_base = 'assets/prediction-output-frap-tsf/CA'
- bucket_name = 'prediction-output-frap-tsf'
- folder_path = '/Users/bbhandar/Downloads/prediction-output-frap-tsf/CA'
- tiff_files = [f for f in os.listdir(folder_path) if f.endswith('.tif')]
- for tiff_file in tiff_files:
- asset_id = f'{ee_username}{asset_id_base}/Prediction-CA_{tiff_file.replace(".tif", "")}'
- gcs_path = f'gs://{bucket_name}/{tiff_file}'
- command = f'earthengine upload image --asset_id={asset_id} {gcs_path}'
- print(command)
- #subprocess.run(command, shell=True)
- for tiff_file in tiff_files:
- year = int(tiff_file.replace(".tif", "").split("_")[2])
- asset_id = f'{ee_username}{asset_id_base}/pred_risk_{year}'
- gcs_path = f'gs://{bucket_name}/{tiff_file}'
- command = f'earthengine asset set --time_start {year}-01-01 --time_end {year}-12-31 --cite https://drive.google.com/drive/folders/1yQYV28xJGQzOF-KTD4qW0VqSQoB5SwHB {asset_id}'
- print(command)
- #subprocess.run(command, shell=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement