Looking at the ways in which satellite images from Sentinel could be used to examine underlying bedrock types. In this second of a three part series, we look at ways of accessing satellite data from the Sentinel satellites.
Geological Survey Ireland is producing wonderful data resources, impossible to resist when it comes to doing some analysis. In this post, welook at bedrock data, what you would see after sweeping away all the soil and loose covering from the ground. Bedrock is stuff like sandstone, limestone, igneous rock….
I was interested to see how overlying vegetation depends on the bedrock; specifically if the colours from satellite images taken at different times of year could be used to take a guess at what lies beneath.
This requires two suites of information, the bedrock data from GSI and the satellite data from Copernicus-Sentinel. The first we’ll download directly and store locally from this resource, the second we’ll access using the R package, sen2r (but we’ll also end up downloading and storing image files locally, but sen2R
will help scope them out).
This was originally written as one post, but then it got so long I decided to split it into three parts:
This post is largely inspired by the work of Ewa Grabska and a WhyR presentation she made in 2020. She has a much clearer and in-depth view of the topic than I do.
Getting access to Sentinel satellite data requires making an account at scihub. It’s free and open access. And once you have your login details you can do most of the leg work without leaving rstudio thanks to the sen2r
and getSpatialData
packages. As we’ll see, the only time we’ll leave rstudio is to unzip a downloaded file.
The first thing to do is to set an area of interest (aoi) using the set_aoi()
function from getSpatialData
. This pulls up a map of the globe in the rstudio viewer panel that can be zomed and panned to the geographical area of interest. When you’re there, click on the area select tool (black box on the left), place that on the map, and then click Done. This is shown below:
You can check that all has worked well using the getSpatialData::get_aoi()
and the getSpatialData::view_aoi()
functions.
Next, we set the time frame of interest (early Summer is shown below), and the satellite platform de choix (Sentinel-2). And then we log in to Copernicus; a dialogue box will pop up asking you for your password.
time_range = c("2022-05-03", "2022-07-28") #set time range
platform = "Sentinel-2" #choose platform
login_CopHub("eugene100hickey")
Now it’s time to see what Sentinel kows about this patch of Earth in this time period. The getSpatialData::getSentinelRecords()
function is our friend here.
query <- getSentinel_records(time_range, "Sentinel-2")
This query
is an sf
object and is work looking at in detail. It could contains hundreds of individual records from Sentinel. It tells us about the size of each of the image file collections, what instrument on board the satellite was used, the precise time of measurement (always around mid-day, of course) as well as estimates of water coverage, snow and ice, and, importantly for images of Ireland, the amount of cloud cover.
We’ll filter on this last one, clouds may be beautiful, but they’re of no scientific interest here. In our case, this reduces the number of Sentinel fields from the hundreds down to a few tens.
query5 <- query |> filter(cloudcov < 5)
Satellite | Date & Time | File Size | Cloud Cover (%) | Water (%) |
---|---|---|---|---|
Sentinel-2B | 2022-07-15 12:03:59 | 58.49 MB | 3.3 | 96.7 |
Sentinel-2A | 2022-07-10 12:04:11 | 41.95 MB | 0.0 | NA |
Sentinel-2B | 2022-06-29 11:43:59 | 34.61 MB | 0.6 | NA |
Sentinel-2A | 2022-06-07 11:54:11 | 221.81 MB | 3.5 | NA |
Sentinel-2B | 2022-06-05 12:03:59 | 53.65 MB | 0.0 | 100.0 |
Sentinel-2A | 2022-06-04 11:44:01 | 733.53 MB | 0.0 | 82.1 |
Sentinel-2A | 2022-05-15 11:43:51 | 34.70 MB | 0.3 | 99.7 |
Sentinel-2B | 2022-05-06 12:03:59 | 52.99 MB | 1.9 | 98.1 |
Before downloading all this data, it’s good to have a sneak preview as to what they look like. To that end, we’ll use the getSpatialData::get_previews()
function and then take a look with the getSpatialData::view_previews()
function.
records <- get_previews(query, dir_out = "/home/some-directory/")
view_previews(records)
# you can also see an individual record with, e.g. view_previews(records[1,])
This gives a mosaic of Sentinel captures, something like as seen below:
set_archive("/home/some-directory/my-archive")
getSentinel_data(records[10,])
This gives a zipped file. We unpack this where we want it to live. Later on, the files we care about will end up in a subfolder called GRANULE/Some-Sentinel-ID/IMG-DATA
, where Some-Sentinel-ID
is a long string made from a combination of image time, instrument, date…. This leads to a bunch of (mostly) jp2
files corresponding to different wavelength bands from blue to far infrared.
From these image files, the only ones we’ll use will be the ******_B02.jp2
(red band), ******_B03.jp2
(green band), ******_B04.jp2
(blue band), and ******_B08.jp2
(IR band). We’ll see in the next installment how to stack these in to one image, and how to connect the colours back to our bedrock data.
If you see mistakes or want to suggest changes, please create an issue on the source repository.
Text and figures are licensed under Creative Commons Attribution CC BY 4.0. Source code is available at https://github.com/eugene100hickey/fizzics, unless otherwise noted. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".
For attribution, please cite this work as
Eugene (2023, Jan. 19). Euge: Satellites and Bedrock - Part II. Retrieved from https://www.fizzics.ie/posts/2023-01-19-satellites-and-bedrock-part-ii/
BibTeX citation
@misc{eugene2023satellites, author = {Eugene, }, title = {Euge: Satellites and Bedrock - Part II}, url = {https://www.fizzics.ie/posts/2023-01-19-satellites-and-bedrock-part-ii/}, year = {2023} }