Created
February 7, 2024 03:44
-
-
Save robbibt/3b85bfc5c394bc7bba536969455b1426 to your computer and use it in GitHub Desktop.
Create virtual raster for files on S3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import s3fs | |
| import pandas as pd | |
| s3 = s3fs.S3FileSystem(anon=True) | |
| file_list = s3.glob( | |
| "dea-public-data-dev/derivative/ga_ls8cls9c_gm_cyear_3/4-0-0/*/*/2023--P1Y/ga_ls8cls9c_gm_cyear_3_*_2023--P1Y_final_nbart_red.tif" | |
| ) | |
| pd.DataFrame(file_list).iloc[:, 0].str.replace( | |
| "dea-public-data-dev/", | |
| "/vsicurl/https://dea-public-data-dev.s3-ap-southeast-2.amazonaws.com/", | |
| ).to_csv("geomad_red.txt", sep="\t", index=False, header=False) | |
| !gdalbuildvrt -input_file_list geomad_red.txt -vrtnodata -9999 geomad_red.vrt |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Also helps to manually add statistics:
And remove the
OverviewListline: