Package: georeader-spaceml
georeaderRead data from rasters: very few dependencies, reads from cloud storage and lazy loading.Install# From pippipinstallgeoreader-spaceml# From GitHubpipinstallgit+https://github.com/spaceml-org/georeader#egg=georeader# Install with Google dependencies (to read objects from Google Cloud Storage or Google Earth Engine)pipinstallgit+https://github.com/spaceml-org/georeader#egg=georeader[google]# Install with Planetary Computer requirementspipinstallgit+https://github.com/spaceml-org/georeader#egg=georeader[microsoftplanetary]Getting started# This snippet requires:# pip install fsspec gcsfs google-cloud-storageimportosos.environ["GS_NO_SIGN_REQUEST"]="YES"fromgeoreader.readersimportS2_SAFE_readerfromgeoreaderimportreadcords_read=(-104.394,32.026)# long, latcrs_cords="EPSG:4326"s2_safe_path=S2_SAFE_reader.s2_public_bucket_path("S2B_MSIL1C_20191008T173219_N0208_R055_T13SER_20191008T204555.SAFE")s2obj=S2_SAFE_reader.s2loader(s2_safe_path,out_res=10,bands=["B04","B03","B02"])# copy to local avoids http errors specially when not using a Google project.# This will only copy the bands set up above B04, B03 and B02s2obj=s2obj.cache_product_to_local_dir(".")# See also read.read_from_bounds, read.read_from_polygon for different ways of croping an imagedata=read.read_from_center_coords(s2obj,cords_read,shape=(2040,4040),crs_center_coords=crs_cords)data_memory=data.load()# this loads the data to memorydata_memory# GeoTensor object>>  Transform: | 10.00, 0.00, 537020.00|
| 0.00,-10.00, 3553680.00|
| 0.00, 0.00, 1.00|
         Shape: (3, 2040, 4040)
         Resolution: (10.0, 10.0)
         Bounds: (537020.0, 3533280.0, 577420.0, 3553680.0)
         CRS: EPSG:32613
         fill_value_default: 0In the.valuesattribute we have the plain numpy array that we can plot withshow:fromrasterio.plotimportshowshow(data_memory.values/3500,transform=data_memory.transform)Saving theGeoTensoras a COG GeoTIFF:fromgeoreader.saveimportsave_cog# Supports writing in bucket location (e.g. gs://bucket-name/s2_crop.tif)save_cog(data_memory,"s2_crop.tif",descriptions=s2obj.bands)TutorialsSentinel-2:Reading Sentinel-2 images from the public Google bucketExplore metadata of Sentinel-2 objectQuery Sentinel-2 images over a location and time span, mosaic and plot themOther:Tutorial to read overlapping tiles from a GeoTIFF and a Sentinel-2 imageExample of reading a Proba-V image overlapping with Sentinel-2 forcing same resolutionWork with EMIT imagesRead high resolution tile layersUsed in other projects:georeader with ml4floods to automatically download and produce flood extent maps: the Kherson Dam Break examplegeoreader with STARCOP to simulate Sentinel-2 from AVIRIS imagesgeoreader with STARCOP to run plume detection in EMIT imagesCitationIf you find this code useful please cite:@article{portales-julia_global_2023,
	title = {Global flood extent segmentation in optical satellite images},
	volume = {13},
	issn = {2045-2322},
	doi = {10.1038/s41598-023-47595-7},
	number = {1},
	urldate = {2023-11-30},
	journal = {Scientific Reports},
	author = {Portalés-Julià, Enrique and Mateo-García, Gonzalo and Purcell, Cormac and Gómez-Chova, Luis},
	month = nov,
	year = {2023},
	pages = {20316},
}
@article{ruzicka_starcop_2023,
	title = {Semantic segmentation of methane plumes with hyperspectral machine learning models},
	volume = {13},
	issn = {2045-2322},
	url = {https://www.nature.com/articles/s41598-023-44918-6},
	doi = {10.1038/s41598-023-44918-6},
	number = {1},
	journal = {Scientific Reports},
	author = {Růžička, Vít and Mateo-Garcia, Gonzalo and Gómez-Chova, Luis and Vaughan, Anna, and Guanter, Luis and Markham, Andrew},
	month = nov,
	year = {2023},
	pages = {19999},
}