Download Sentinel 2 data from GCP
Project description
googlesat
This software is designed to download Sentinel 2 (L1C & L2A) from Google Cloud Platform and does not require an google account and a creation of a GCP project for data searching or downloading.
You can read more about the public Google data access here and for Sentinel-2 data here.
Introduction
The googlesat
Python package is developed for searching and downloading data from GCP. In the GCP bucket, Google, to help locate data of interest, has published an index CSV file for both product types (L1C, L2A) of the Sentinel-2 data that are available for downloading.
Using googlesat
the index CSV file is downloaded; either for L1C, L2A or both (a seperate database for each product type is created) and inserted in a SQLite database in order to avoid using Google's BigQuery, that requires an Google account and a creation of a GCP project for data searching. Every time a user runs the software the database if needed (CSV file is updated by Google daily) gets the required updates.
Also, a downloader is provided with this software to download the results from querying the database. The downloading procedure is done without using gsutils
, so a convertion method of gs
to simple https
links is developed. Then, the downloader use these links to download the manifest.xml
file and extracts all the required informations from the file to build the SAFE format folder structure and download the rest of the files (images, metadata, etc). You can find more information about the SAFE folder structure here.
Installation Notes
Install googlesat
using pip
by running the following commands:
git clone https://github.com/alekfal/googlesat.git
cd googlesat/
pip install .
Quickstart
Search and download data for a specific UTM tile by providing a name, the product level, cloud coverage limit and start-end date.
import dateutil
import time
import os
import pandas as pd
from googlesat.sentinel import get_metadata, query, geometry_from_file
from googlesat.utils import get_links, create_connection, get_cache_dir
from googlesat.downloader import get_data
level = "L2A"
db_file, table_name = get_metadata(level = level)
cc_limit = 40
date_start = dateutil.parser.isoparse('2021-10-15')
date_end = dateutil.parser.isoparse('2021-10-30')
tile = "34SEJ"
result = query(db_file, table_name, cc_limit, date_start, date_end, tile)
result = get_links(result)
# Get data
GOOGLE_SAT_DATA = "/path/to/store/"
scenes = result["URL"].tolist()
for scene in scenes:
get_data(scene, GOOGLE_SAT_DATA)
Search and download data for multiple UTM tiles by providing their names, the product level, cloud coverage limit and start-end date.
import dateutil
import time
import os
import pandas as pd
from googlesat.sentinel import get_metadata, query, geometry_from_file
from googlesat.utils import get_links, create_connection, get_cache_dir
from googlesat.downloader import get_data
level = "L1C"
db_file, table_name = get_metadata(level = level)
cc_limit = 60
date_start = dateutil.parser.isoparse('2021-10-15')
date_end = dateutil.parser.isoparse('2021-10-30')
tile = ["34TGL", "34TGM", "34SEJ"]
result = query(db_file, table_name, cc_limit, date_start, date_end, tile)
result = get_links(result)
# Get data
GOOGLE_SAT_DATA = "/path/to/store/"
scenes = result["URL"].tolist()
for scene in scenes:
get_data(scene, GOOGLE_SAT_DATA)
Search and download data by providing a geometry file (e.g GeoJSON), the product level, cloud coverage limit and start-end date.
import dateutil
import time
import os
import pandas as pd
from googlesat.sentinel import get_metadata, query, geometry_from_file
from googlesat.utils import get_links, create_connection, get_cache_dir
from googlesat.downloader import get_data
db_file, table_name = get_metadata(level = level)
cc_limit = 40
date_start = dateutil.parser.isoparse('2021-10-15')
date_end = dateutil.parser.isoparse('2021-10-30')
file = "./data/test.geojson"
tiles = geometry_from_file(file)
result = query(db_file, table_name, cc_limit, date_start, date_end, tiles)
result = get_links(result)
# Get data
GOOGLE_SAT_DATA = "/path/to/store/"
scenes = result["URL"].tolist()
for scene in scenes:
get_data(scene, GOOGLE_SAT_DATA)
References
This software is based on the open source project fetchLandsatSentinelFromGoogleCloud.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file googlesat-0.0.1a1.tar.gz
.
File metadata
- Download URL: googlesat-0.0.1a1.tar.gz
- Upload date:
- Size: 4.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 711ac3f876e427fc40a9f788e06e9101de638a58a40914aca838170e756799d4 |
|
MD5 | 92a1d11e1861b4ea1646eec296d88f6d |
|
BLAKE2b-256 | 9ef38083da6875b9b785f2bfc5015255642dc82683ae9e68f6d88f3bee305520 |
File details
Details for the file googlesat-0.0.1a1-py3-none-any.whl
.
File metadata
- Download URL: googlesat-0.0.1a1-py3-none-any.whl
- Upload date:
- Size: 4.3 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7d5c913c6a4a325b74066bd0aee60d20250672e483455a56882e6a13f448bcc |
|
MD5 | 979b421fcbb13aeafd1536c1b752383b |
|
BLAKE2b-256 | adcc257c76d3853db3000d7ccf50bcd02ab37b5b6d772b13e0f8301179f7ec83 |