Showing posts with label Landsat. Show all posts
Showing posts with label Landsat. Show all posts

Saturday, 29 April 2017

Some nice clear satellite images of Cornwall with Landsat 8 and Sentinel 2

The launch of Sentinel 2A and 2B as part of the European Space Agency's Copernicus Program, has increased the frequency with which medium resolution satellite imagery in optical and near infrared is available.

Landsat 8 (and 7) are also still operating, which take a given frame every 16 days each.

Landsat 7 unfortunately has a scan line corrector fault that means there are stripes of missing data:

There was a particularly cloud free image of Cornwall on Landsat 8 on 27th March 2017, which I show below, displayed using tuiview.

On the left is a visible light band combination using bands 2, 3 and 4 which are broadband blue, green and red bands, and on the right I use band 7 (which is known as SWIR2, which stands for short-wave infrared 2, at around 2.2 micrometres wavelength), band 5 (near infrared), and band 4 (red, but shown as blue here). Infrared bands can be a bit confusing, especially if you have been exposed to both terrestrial remote sensing and astronomers terminology.

A somewhat closer view, with Truro at the top-right, showing Falmouth, the Fal estuary, Camborne and Redruth, and Stithians Reservoir in the centre.
Sentinel 2 has also captured some good clear images recently in the area, such as this. These are processed in the Sentinel 2 Toolbox within the Sentinel Application Platform, using sen2cor to process to Level 2A (surface reflectance)

This is from 18th April 2017, with a clear view of parts of Cornwall.
Sentinel 2 also took a mostly clear (apart from some high cloud) image on 27th March 2017:


The top image uses bands 2, 3 and 4 for the blue, green and red channels respectively, and the bottom uses 2, 8 (842nm) and 12 (2190nm).
Since the different bands are at different resolutions, when using the Sentinel Application Platform it is necessary to resample the output under the Raster menu, to process it further. This can produce a very large file, so I used the GeoTIFF / BigTIFF option because otherwise it would produce a file larger than a standard GeoTIFF file can be, when the 10m resolution is used. This can then be converted to a .KEA file for a smaller file size with gdal_translate.

The reason the file size is enormous is the output from resampling has 45 bands, because although it outputs only 10 data bands, that is 2, 3, 4, 5, 6,7 ,8 , 8a, 11 and 12, there are also atmosphere optical depth, water vapour, cloud probability, snow probability, and a scene classification, and then bands describing zenith angle, solar angle for every bands. As an uncompressed GeoTIFF this was 22 gigabytes for each tile, but is less than 1GB as a KEA (and I selected only the first 15 bands using rsgislib).
Four Sentinel 2 tiles combined (UUA, UUB, UVA, and UVB) to provide an overview of Cornwall and Devon - with border overplotted in QGIS - visible light

Using Band 12 = red, Band 8 = green and Band 2 = blue.
I have also opened them in QGIS and overplotted a map based on OpenStreetMap:

Sentinel 2 - 18th April 2017 - visible light
Sentinel 2 - 18th April 2017 - Band 12 (2.2 μm), Band 8 (842nm), and Band 2 (blue).
Landsat 8 - 27th March 2017 - Bands 4 3 and 2 (visible light)
Landsat 8 - 27th March 2017 - Bands 7, 5 and 2


Sentinel 2 - 26th March 2017 - visible light


Sentinel 2 - 26th March 2017 - Bands 12, 8, 2

Another possible band combination of the 18th April image, which is visible light but with the red and green channels swapped, and blue stretched a bit further to attempt to see the bluebells in the woodland shown from Sentinel2. The location is just to the right of the gridlines crossing at 183000, 41000





I will blog again about some of these when I have some time to experiment with processing. I have used the Sentinel 2 Toolbox and sen2cor to process the images, but I would also like to try ARCSI for processing from Level 1C to surface reflectance for Sentinel 2.



Monday, 31 August 2015

A Python based utility to examine geotagged photos in Landsat

I have been wondering about how it might be possible to automatically decide on land cover classification rules, as I mentioned in previous posts.

I realised the first step was to create a way of using a list of the images of the ground reference points and their coordinates, to examine the images together with remote-sensed images.

I've made a Python program that takes in a list of image file names and their latitude and longitude co-ordinates from a csv file, and uses these to make a subset of an area of a Landsat image 3km x 3km, and display a spectrum of a smaller area around the point. I presently use an area of 120m x 120m which is 4x4 Landsat pixels.

The code expects a layerstacked image of the optical and near-infrared bands, of which there are 6 for Landsat 7, and 7 for Landsat 8.
It will convert the lat/long coordinates, to OSGB grid references for labelling, and if specified to projected UTM coordinates which the Landsat images are released in.
The output below uses a Landsat 8 image in UTM30N, it is labelled in OSGB, I believe UTM30N grid north is fairly close to OSGB36.

Starting with a few of the pictures from the MSc fieldtrips I mentioned:

The images below are from Landsat 8 in July 2014, with the fieldtrips in Feb/March 2014. The versions in the Google+ album below are from Landsat 7 data from March 2007.

There is a little caveat I will make that certain of the ground level pictures are looking at a point a distance away from the coordinates that are where the photographer was standing.
Also the GPS sometimes made catastrophic errors, and occasionally I have manually edited the coordinates by taking an average of other pictures at the same site (within a small area).

Update:

The code is now available on my Bitbucket account. It only works on Linux and is likely to still be a bit rough and ready at the time of writing.
I have also uploaded the output of the fieldwork ground reference points as a Google+ album.

On the Penglais campus at the back entrance of the Llandinam building.

Ynyslas dunes near Borth


Foreshore

Borth Bog


An area of decidious woodland near Tal y Bont

Some upland grassland with Dr Pete Bunting

Vaccinium near Nant y Arian


Dead larch

Looking west, towards Taylor's Leat, an ingenious method of providing water to drive a wheel to power mining machinery in the 19th century.


Next to Nant y Moch reservoir dam

Tuesday, 30 June 2015

A little more on the "omission error" for the woodland areas

To have a bit more of a look at the areas that are woodland in OS VectorMap and not classed as woodland in the classification, I here show where these areas are on the satellite images, and the classes that these areas are in fact assigned.

June 2006


Showing the areas indicated as woodland in OS VectorMap but not by the classification outlined in black, overlaid on the Landsat 7 image from 9th June 2006 (bands 5,4,3). large version

Showing the actual classifications the "omission error" areas were assigned. large version

March 2007


Showing the areas indicated as woodland in OS VectorMap but not by the classification outlined in black, overlaid on the Landsat 7 image from 24th March 2007 (bands 5,4,3). large version

Showing the actual classifications the "omission error" areas were assigned. larger version

September 2013

Showing the areas indicated as woodland in OS VectorMap but not by the classification outlined in black, overlaid on the Landsat 8 image from 24th September 2013 (bands 6,5,4). Some areas that display in pink here appear to be recently felled forest areas that have a weak reflectance in NIR (shown in green), but strong in SWIR1 (shown in red) with some reflectance in red (shown in the blue channel here). large version

Showing the actual classifications the "omission error" areas were assigned, and the 'cloud' areas. Some shaded areas are spuriously being classified as water. large version

Sunday, 28 June 2015

Errors in the land cover assessment

Last time, I mentioned I was going to compare the ground control points to the classification.
Before I do that, I thought I'd compare the extents of classified woodland and water to OS VectorMap data.

I show the "commission error" - where the classification indicated something where OS VectorMap didn't, and "omission error" where OS VectorMap indicated something but the classification didn't.
Not all of the difference may be error in the classification, there may have been real change on the ground between the epoch of the image and the OS VectorMap data, or what is marked out as a woodland areas on VectorMap may include clearings, felled areas, or partially forested areas that were often classified as "Mosaic".

June 2006

RGB (9th June 2006)

NIR:SWIR1:Red 9th June 2006

 
large version There are a few areas of cloud shadow and other areas falsely classified as water. In addition there are some areas of cloud which may not be real. The woodland is generally underpredicted relative to OS VectorMap, the "omission error" areas are often classified as "Mosaic".

March 2007

 
RGB 24th March 2007
NIR:SWIR1:Red 24th March 2007

large version This is perhaps the most accurate of the woodland classifications, though some of the woodland areas are missed particularly in the east of the image (where perhaps cloud is interfering to some extent) and is often classified as "mosaic". There are a few areas of bogusly classified water in topographic shadow areas

 

September 2013

RGB (24th September 2013)
NIR:SWIR1:Red

large version Extensive areas of thin cloud appear in this image, woodland is overpredicted relative to OSVectorMap. It is likely that, late in the growing season, other vegetation has increased in NDVI and is perhaps masquerading as forest, or the subtle shadows of thin cloud are affecting the classification. Again some topographic shadowed areas are erroneously classed as water.
It is evident that the kind of first-order adjustment for seasonal change in NDVI etc. is not really adequate to prevent large shifts between classes, instead it is likely to be necessary to examine each landcover class in detail to see how its spectral properties change across the growing season.

Tuesday, 23 June 2015

Revisiting Land Cover assignment using Landsat

As part of one of the modules for my MSc in Remote Sensing and Planetary Science at Aberystwyth University, I did an assignment on land cover classification in Wales, using the LandSat satellites. I used data from Landsat 7 and Landsat 8.

The final maps from the assignment were somewhat basic, which I have revised below though I haven't changed the classification itself.

The classification scheme, was a rule-based one, where the rules were refined based on ground-control points taken using fieldwork.

I have put them into QGIS here, and added placename labels for context.

This is the first part of my revisiting this assignment. In future I will also say a little more about the ground control points from the fieldwork and how the results of the classification correspond to what was seen on the ground, and take this a little further than in the assignment report.
What would be really great, is to be able to automatically adjust a ruleset, rather than doing this by hand hard-coding into the scripts.


The Data

Landsat is a programme of Earth observation satellites launched by NASA and operated in cooperation with the US Geological Survey.

They have the capability to take data in several visible light bands, near infrared, short-wave infrared (this is longer wavelength than near-infrared but the common terminology in Earth Observation), and thermal infrared.

Landsat 8 has a slightly different range of wavelengths than Landsat 7, additionally having the 'Coastal' band in band 1 at a slightly shorter wavelength than the Blue band.

The area of study for the assignment was an area of mid-Wales including Aberystwth, and upland areas around Pumlumon.

We were set the images from Landsat 7 from March 2007 and June 2006 to work from, and I additionally used a Landsat 8 image from September 2013. Landsat 7 developer a scan line corrector fault. which resulted in black stripes where no data was collected.

The black no data stripes were ignored, in this classification, my view was to classify based on the data that exists, and perhaps use a nearest neighbour interpolation right at the end after classification if desired.

The various Landsat bands allow an overview of land cover types, based on the differing reflectance spectral properties of vegetation of various types, water, and non-vegetated surfaces. Living vegetation is strongly reflectant in the green and near-infrared, with dead vegetation reflecting more strongly at the longer 'short-wave infrared'.


A bank of cloud coincides with the area of study on 6th July 2013
Landsat 7: 9th June 2006, using Bands 3, 2 and 1 (red, green and blue) as RGB.

Landsat 7: 9th June 2006, using Bands 4, 6 and 3 (NIR, SWIR1 and red) as RGB.

Landsat 7: 24th March 2007, using bands 3, 2 and 1 (red, green, blue) as RGB.

Landsat 7: 24th March 2007, using bands 4, 6 and 3 (NIR, SWIR1, red) as RGB.
Landsat 8: 24th September 2013, bands 4, 3 and 2 (red, green, blue) as RGB.

Landsat 8: 24th September 2013, bands 5, 6 and 4 (NIR, SWIR1, red) as RGB.

Classification

A rule based classification was used, inspired broadly speaking by the various Richard Lucas et al. papers: Lucas et al. 2007 Lucas et al. 2011.

Before classification, I first segmented to objects, for which I used the routine in the Python RSGISLib libraries:
The 9th June 2006 image, segmented in RSGISLib using the runShepherdSegmentation method with 120 clusters and a minimum object size of 9 pixels (8100 sq.m), colourized randomly.
In fact I segmented the image three different ways, in the assignment writeup I exclusively used the objects from segmenting the 24th March 2007 Landsat 7 image.
I made a kind of first order seasonal adjustment to the images, based on band averages in areas not classified as cloud or water. It was not entirely successful in creating a consistent classification as seen below.

Ruleset

The ruleset I first developed on the March 2007 image because that had areas of cloud and therefore an opportunity to get the cloud masking right first.
There are three stages to the process, first the Level 1A classification that delineates water (by low NIR and SWIR brightness), cloud (by high levels in the blue band), shadow (by thresholds in Blue, NIR, and SWIR1), and non-vegatation (by normalised differential vegatation index (NIR, R)).



After this, in Level 1 split the vegetated areas into woodland, wetland, and heath, and grasslands into unimproved, semi-improved and improved by NDVI.


Level 2 classification splits woodland into broadleaf and coniferous, and wetlands into blanket bog and flush, and the upland vegetation further.
For the other images, I made a first-order seasonal adjustment based on the average band values in non-water and non-cloud objects, effectively attempting to adjust back to the March image. I adjust the NDVI by half of its actual change to avoid overcorrection of the grassland classes, and the Lucas et al. 2011 heath detection index by a manually set value of +3000 in June and +5000 in September.

24th March 2007 segmentation

This was what I used in my report. There is a substantial area under cloud in the SE of the image. I have masked out areas that have No Data in one or both images.
The cloud areas are shown in the SE, generally woodland and water extents are well-recovered. large version
Unfortunately some detail is lost in the uplands, and some areas are spuriously classified as non-vegetated. large version

Modification of the cloud threshold was needed to mask out the extensive areas of thin cloud covering parts of the image. Some spurious water bodies are shown which are in face topographic shadow misclassified as water. large version


6th June 2006 segmentation

 
Again, the summer image does not differentiate the different type of upland vegetation well. The cloud shadow on Borth Bog is misclassified as water. large version

The summer 2006 image is segmented and the spring 2007 data applied, there are some spurious classifications in the cloud shadow areas. large version

The September 2013 data, again showing some spurious areas of water, and some errors around the margins of cloud. large version

24th September 2013 segmentation

I only present the 24th September 2013 data, for this segmentation, due to problems that would be caused by the Landsat 7 no data stripes.

Using the Landsat 8 image for segmentation avoids the stripes of no data, but delimiting the edges of thin cloud is difficult and may result in spurious classifications around the edges. The upland vegetation is not well delineated, with large areas assigned to 'unimproved grassland' or 'Molinia-dominated upland grassland'. large version