Roseanne Clement - PH450 Project Report

67
Roseanne Clement PH450 Project Report 1 Mapping Marine Sediments from Space for Renewable Energy Applications By Roseanne Clement 201045581 Supervisors: Dr David McKee and Professor Alex Cunningham PH450 Project Report Date submitted: 14/04/14 1 Abstract The aim of this project was to investigate the atmospheric correction algorithms that were present in the Sea-viewing Wide Field-of-View Sensor (SeaWiFS) Data Analysis System (SeaDAS), and use them to compare satellite-derived values of mineral suspended sediment (MSS) to in-situ values of turbidity. In validating this data, it can be used in future uses of comparison for sediment levels in the North Sea for renewable energy purposes.

Transcript of Roseanne Clement - PH450 Project Report

Page 1: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 1

Mapping Marine Sediments from Space

for Renewable Energy Applications

By Roseanne Clement 201045581

Supervisors: Dr David McKee and Professor Alex

Cunningham

PH450 Project Report

Date submitted: 14/04/14

1 Abstract

The aim of this project was to investigate the atmospheric correction algorithms that

were present in the Sea-viewing Wide Field-of-View Sensor (SeaWiFS) Data Analysis

System (SeaDAS), and use them to compare satellite-derived values of mineral

suspended sediment (MSS) to in-situ values of turbidity. In validating this data, it can

be used in future uses of comparison for sediment levels in the North Sea for renewable

energy purposes.

Page 2: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 2

Table of Contents

1 Abstract .................................................................................................................................... 1

2 Introduction .............................................................................................................................. 4

2.1 Ocean colour context ........................................................................................................ 4

2.2 Why atmospheric correction algorithms are needed......................................................... 6

2.3 Background of research in the atmospheric correction algorithms .................................. 7

2.4 Motivation ........................................................................................................................ 9

3 Theory .................................................................................................................................... 11

3.1 Algorithm Descriptions .................................................................................................. 12

3.2 Aerosol model selection ................................................................................................. 14

3.3 Data product description ................................................................................................. 16

4 Method ................................................................................................................................... 18

4.1 In-situ measurement protocols ........................................................................................ 18

4.1.1 Irish Sea and Bristol Channel in-situ ...................................................................... 18

4.1.2 Stonehaven in-situ ................................................................................................... 19

4.2 Ocean colour data set retrieval ....................................................................................... 19

4.3 Impact of atmospheric correction algorithm choice ....................................................... 20

4.4 MUMM atmospheric correction algorithm options ........................................................ 21

4.5 Time series evolution ...................................................................................................... 21

4.6 Seasonal analysis of time series data .............................................................................. 22

5 Results .................................................................................................................................... 23

5.1 Atmospheric correction algorithm validation ................................................................. 23

5.1.1 Impact of atmospheric correction algorithm on Rrs retrieval .................................. 23

5.2 Validation of sediment algorithm ................................................................................... 24

5.2.1 Analysis of aerosol reflectance ratio over seasonal cycle ....................................... 24

5.2.2 Comparison of in-situ data and remote sensing MSS time series for Stonehaven .. 28

5.3 Seasonal variations in the MSS data ............................................................................... 30

6 Discussion .............................................................................................................................. 33

6.1 Performance of atmospheric correction algorithms ........................................................ 33

6.2 Monitoring suspended sediment: capabilities and limitations ........................................ 36

6.3 Future work ..................................................................................................................... 37

7 Acknowledgments .................................................................................................................. 38

8 References .............................................................................................................................. 39

9 Appendix ................................................................................................................................ 43

Page 3: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 3

9.1 Linux Scripts ................................................................................................................... 43

9.1.1 Batch download and unzip files .............................................................................. 43

9.1.2 Conversion of L1A to L2 files - Default AC algorithm .......................................... 43

9.1.3 Conversion from L2 to HDF file - Default AC algorithm case .............................. 44

9.1.4 Conversion of L1B_LAC to L2 files - MUMM AC algorithm .............................. 44

9.1.5 Conversion of L2 to HDF file - MUMM AC algorithm case ................................. 45

9.1.6 Moving files from individual directories to directory for each year ....................... 46

9.2 MATLAB code ............................................................................................................... 46

9.2.1 Determination of AC algorithm .............................................................................. 46

9.2.2 MUMM AC procedure - Rayleigh-correctedreflectance plot ................................. 49

9.2.3 Time series production ............................................................................................ 49

9.2.4 Time series collation and display ............................................................................ 58

9.2.5 Comparison of seasonal averages of MSS and turbidity ........................................ 61

9.2.6 Comparison of aerosol reflectance ratios ................................................................ 61

9.2.7 Seasonal variations in MSS levels .......................................................................... 66

Page 4: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 4

2 Introduction

2.1 Ocean colour context

Ocean colour remote sensing allows an insight into the surface layer interactions between

physical dynamics and biogeochemical processes over large areas of the ocean. Imaging

radiometers on satellites allow daily coverage of the ocean's surface layer. Ocean colour

remote sensing is an important method, as using optical techniques such as imaging

radiometers, allows the biological activity of the ocean to be analysed.

The primary biological micro-organism within the water that is responsible for determining

the optical properties is phytoplankton, which is the basis of the aquatic food chain. The

process of photosynthesis allows the phytoplankton to act as a biological pump, whereby the

organism absorbs the inorganic nutrients, from the atmosphere as well as within water, into

organic compounds (Lindsey & Scott, 2010; Woods Hole Oceanographic Institution, 2014).

Phytoplankton can also be damaging to the health of the ocean, as certain Harmful Algal

Blooms (HABs) can produce dangerous biotoxins (Northwest Fisheries Science Centre,

2014). As marine life (e.g. fish and shellfish) eat this algae; this would then lead to them

being toxic for whoever eats them. Other phytoplankton blooms that could occur include ones

that could produce a dense bloom. The large amount of phytoplankton could cause the level

of oxygen within the water to be reduced (hypoxia), which could cause the ultimate death of

any animal within this area (Lindsey & Scott, 2010). Therefore, these detrimental blooms of

phytoplankton can cause a knock-on effect for our society, for example the loss of earnings to

industries such as the fisheries.

Although phytoplankton is on the microscopic scale (1µm-200µm), they can still be

accurately measured by means of remote sensing of the chlorophyll levels (Kirk, 1983). This

is due to phytoplankton growing by photosynthesis (as this is where they gain their energy),

and therefore chlorophyll. As chlorophyll is the molecule used within the photosynthesis

process to absorb red light, (which gives the ocean its blue-green colour), it is able to be

measured over global regions with the use of imaging radiometers on orbiting satellites.

Another important quantity that can be measured in the water is the level of mineral

suspended sediments (MSS). The sediments generally sink to the bottom of the water

column; therefore if there is any presence of such particles at the surface, it gives some

Page 5: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 5

indication that vertical mixing has occurred. This would be due to the water column being

disturbed, which causes the resuspension of bottom sediments.

The sediment level in the waters is very important to the environment, as it can affect factors

such as the biological quality of the water, and how the aquatic life reacts to it. If there were

an increase in the sediment level in an area that was not used to it, it could cause issues.

These could lead to anything from erosion of banks, to habitat disturbance, due to the

increase in suspended sediments. If the suspended sediment level is high enough, it could

lead to hypoxia in the water, which would cause marine mortality in the area (Greig, Sear &

Carling, 2005).

It is imperative to know the level of sediment within the water, not only for aquatic systems

benefits, but also for land management. There are many areas at risk of soil erosion, such as

the Lunan Water catchment in Eastern Scotland, where the soil erosion could end up

affecting the water (Vinten, Loades, Addy, Richards, Stutter, Cook, Watson, Taylor, Abel,

Baggaley, Ritchie & Jeffrey, 2014). This is because if there were surface erosion, the topsoil

is lost, which could have been used as fertile land. In addition to this, the soil would make its

way into the water stream, and increase the sediment level of the water. Moreover, the

pesticides and fertilisers that may have been used on this land would then contaminate the

water, as well as the other nutrients in the soil. This then affects the marine life, as well as

local communities who may depend on this as their water source. Phosphorus present in the

fine sediment could then be desorbed, which could also cause problems in the area (Vinten et

al., 2014). The loss of topsoil would also cause a reduction in soil productivity, and therefore

an economic loss to farmers (Ongley, 1996).

Precautions are usually in place in order for the sediment level to not get too high in the

waters, such as a sediment fence, which intercepts and traps the runoff from the top soil

(Scottish Environment Protection Agency, 2011). If the sediment got into an area of

contained waters, such as a reservoir, it can be treated with use of an active treatment system.

This process adds a chemical flocculent that allows for the sediment to be more easily

removed by filtration (Kneib, 2014). Although some safety measures are in place, it is still

paramount that the monitoring of these levels is accurate, as it can greatly affect the marine

ecosystem, as well as for those invested in the agriculture industry.

Page 6: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 6

Figure 1: Different origins of the light received by

a remote sensor above a water body (Kirk, 1983).

2.2 Why atmospheric correction algorithms are needed

The absorption and scattering of light within the water takes place due to the water being

made up of different constituents. As the spectral properties of light are known, the effect that

the water has on the light signal that is returned to the sensor can be analysed in order to find

out what caused the change in signal (Mobley, 1994). This effect on the light signal can give

information not only of the type of constituent that is causing the effect, but also the

concentration that it is in. This type of remote sensing is referred to as active remote sensing

(Mobley, 1994). Another method is passive remote sensing, which is when the measurement

is done by evaluating the naturally emitted or reflected electromagnetic radiation from the

water (Mobley, 1994). Specific algorithms from within the Sea-viewing Wide Field-of-View

Sensor (SeaWiFS) Data Analysis System (SeaDAS), allow for different data products within

the water to be established. A common type of data product that is calculated through the

algorithms in the system, and is used in this project, is the remote sensing reflectance (Rrs),

which is the ratio of the upwelling radiance and the downwelling irradiance, both just above

the sea surface.

The emergent flux of light from below the water surface is the required value to be extracted

from the photometers on the satellite, as it gives information about the underwater light field

and the composition of the water (Kirk, 1983). However, the photometers are not able to just

extract the emergent flux from below the water – they obtain just the general light flux in the

surrounding area. This includes other products such as the sunlight that is scattered within the

atmosphere, the reflection of skylight at the surface, as well as the reflection of solar beam at

the surface of the water, which can be seen in Figure 1.

Page 7: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 7

There are usually precautions which can be undertaken to try and avoid these other products,

such as the radiometer on the satellite being directed outside the solar glitter pattern, which

allows for the surface reflected solar beam to become negligible (Chen & Lu, 2009).

Accounting for the atmospheric parameters is where the problems with remote sensing

imagery begin. This is because they amount to 80-90% of the total radiance observed by the

satellite, which is due to the main factors of atmospheric Rayleigh scattering and the particle

(aerosol) scattering (Ruddick, Ovidio & Rijkeboar, 2000; Siegel, Wang, Maritorena &

Robinson, 2000).This is particularly visible in the blue region of the spectrum, as even in

clear waters the value for the water-leaving radiance is 10-15% of the total radiance at top of

atmosphere (TOA) (Ahmad, Franz, McClain, Kwiatkowska, Werdell, Shettle & Holben,

2010).

2.3 Background of research in the atmospheric correction algorithms

There are several evolutions of the atmospheric correction algorithms (herein referred to as

AC algorithms) that are present in SeaDAS. These allow for ocean colour data obtained from

the Moderate Resolution Imaging Spectrometer (MODIS) on board the Aqua satellite, to be

investigated by removing the effects of atmospheric parameters. These include: 2-band

model selection and iterative NIR correction, herein known as the default AC algorithm

(Stumpf, Arnone, Gould Jr, Martinolich & Ransibrahmanakul, 2003). There is also the 2-

band model selection and MUMM NIR correction, herein known as the MUMM AC

algorithm (Ruddick et al., 2000). Another is the 2-band model selection and NIR black pixel

assumption, herein known as the black pixel assumption AC algorithm (Gordon & Wang,

1994).

The black pixel assumption AC algorithm was the original algorithm for SeaDAS, where it

assumed that the signal at the near-infrared (NIR) wavebands of 748nm and 869nm were

equal to zero (Gordon & Wang, 1994; Wang, Son & Shi, 2009). From stating that the NIR

bands are zero, the aerosol scattering radiance at the NIR band can be extrapolated into

visible bands, by means of selecting an aerosol model, which then allows for the water-

leaving radiance to be obtained (Antoine, 2012). For more turbid waters (or Case 2 waters),

the water-leaving radiance in the NIR bands is not always zero due to the presence of water

constituents such as suspended sediments and coloured dissolved organic matter (CDOM)

(Feldman & Patt, 2002). This then makes the aerosol data become more difficult to

Page 8: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 8

differentiate from the signal, which in turn allows for the algorithm to overestimate radiances

in aerosol and aerosol-Rayleigh scattering (Chen & Yu, 2009). This leads to the

underestimation of the water-leaving radiance in the other bands, as well as occasionally

having negative values in the blue and green bands if an absorbing aerosol is present.

Therefore, due to these problems, this algorithm is not relied on as much now. An iterative

approach is now preferred, as it allows for the radiance in the NIR bands to be more

accurately approximated. The importance of the problems mentioned above can be seen in

Figure 2, which shows an image without any correction. Figure 3 shows the improvement

that the atmospheric correction algorithms were making at the time.

Figure 2: Black areas show where the occurrence of more than 50% of negative radiance values, the grey

areas are for when there was less than 50% of negative radiance values, and the white areas are where

there is no data (mostly land mass). This was for the period of 12-19 July 1998, at a wavelength of 412nm.

This image shows the problems that the black pixel assumption has, as there are many areas that are

reported as having negative radiance values (Robinson, Schmidt, McClain & Werdell, 2000).

Page 9: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 9

Most of the algorithms are a variant of the black pixel assumption AC algorithm, where they

use 2 NIR wavelengths (“2-band model selection”) to select an appropriate aerosol model.

The default AC algorithm chooses to estimate the water-leaving radiance, and attempts to

remove it from the top of atmosphere (TOA) signal prior to the aerosol selection, through an

iterative approach. The MUMM AC algorithm’s main condition is that there is spatial

homogeneity of the aerosol and water-leaving reflectance ratios, and therefore these

parameters can be applied for the whole image. In the default atmospheric correction

algorithm, the aerosol reflectance ratio is calculated on a pixel-by-pixel basis. This means

that the aerosol model that is picked per pixel is assumed constant for a few continuous pixels

along the scan swath (Ruddick et al., 2000).

2.4 Motivation

There is huge current interest in the renewable energy sector. This involves installations of

renewable energy equipment being mounted on the seabed. However, this could potentially

disrupt the natural sedimentation process in the area that they are installed in. Being able to

monitor the sediment levels in these types of areas is a very important method. It would

enable not only for the ability to model the impact of energy installations on local mixing

Figure 3: This is the same as Figure 2, but involved third level processing algorithms, which

reduced the level of negative radiance values (black areas), and therefore increased the levels of

positive radiance values (grey areas) (Robinson et al., 2000).

Page 10: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 10

regimes, but also of downstream sedimentation rates. Also, any possible erosion of the

installed equipment by the sediment could be monitored.

For example, an installation of a wind farm or underwater turbines could potentially clog up

the suspended sediments in the area they are installed in. This would not only cause damage

to the materials due to the abrasion of the sediments with the equipment, but also to the

ecosystem, as the high concentration of nutrients could have a knock-on effect to the

surrounding environment. Therefore, constructing a time series of the before and after

implementation of such equipment could be used in order to monitor the marine environment

closely.

This type of analysis can be used on an image, such like that in Figure 4. This shows a

LANDAT image taken to show the effect of the sediment levels at a wind farm in the Thames

Estuary. The little dots that be seen in the image are the individual wind turbines. It is clear

that they are making a difference to the sediment level in this area, as they are causing this

stripe pattern to occur due to the placement of these turbines affecting the sediments natural

plume pattern.

Figure 4: LANDSAT image gained from Dr David McKee (University of Strathclyde), showing the

sediment levels at a wind farm in the Thames Estuary.

Page 11: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 11

3 Theory

The emergent flux of light from below the surface, Lw, can be related to the upwelling light

flux below the surface, Lu, through use of Equation 1 (Austin, 1980).

To obtain the data for Lw, an atmospheric correction algorithm is performed to account for

the atmospheric parameters that are disrupting the satellite signal from showing the true value

of Lw. Accounting for these atmospheric parameters is where the problems with remote

sensing imagery arise. The atmospheric correction equation is shown in Equation 2 (Chen &

Yu, 2009).

Where Lt(λ) is the total radiance received by the sensor; Lr(λ) is the Rayleigh scattering

radiance; La(λ) is the aerosol scattering radiance; Lra(λ) is the multiple scattering between

Rayleigh and aerosol radiances; T(λ) is the direct transmittance of the atmosphere or Beam

Transmittance; Lg(λ) is the contribution from specular reflection of direct sunlight from the

sea surface (sun glitter); Lb(λ) is the radiance from the bottom of the water; t(λ) is the diffuse

transmittance between the sea surface and the sensor; Lwc(λ) is the contribution from sunlight

and skylight reflecting off of the individual whitecaps on the surface; w is the covering rate of

whitecaps; Lw(λ) is the water-leaving radiance.

Equation 2 is often reduced to Equation 3, as Lg(λ) can be disregarded by the tilting of the

satellite away from the sun, and Lra(λ) can also be ignored if the multiple scattering is small

(Gordon & Wang, 1994). This allows Lw to be more easily computed, as quantities such as La

can be calculated easily (Gordon & Wang, 1992), as well as t (Robinson et al., 2000).

The reflectance and radiance can be easily converted to one another through the following

equation:

(1)

(2)

(3)

(4)

Page 12: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 12

Where Fo is the extra-terrestrial solar irradiance at a wavelength λ and θ0 is the solar zenith

angle.

Therefore, in terms of reflectance, Equation 3 it can be viewed as:

In the processing of ρt, another quantity is corrected for, the Rayleigh corrected reflectance,

ρc. This is a quantity that has been corrected for gas absorption, Rayleigh scattering, white-

caps and glitter (Gordon, 1994; Gordon, 1997; Goyens, Jamet & Schroeder, 2013).

This value of ρc can then be related to the quantities required in Equation 5, as the top of

atmosphere has now been corrected for certain quantities, therefore the desired product of ρw

is as follows (Ruddick et al., 2000):

Where the multiple scattering reflectance, ρam, is:

3.1 Algorithm Descriptions

The black pixel assumption is the theory used in the original AC algorithms. It assumes that

the water-leaving radiance, Lw, is equal to zero in the near-infrared (NIR) bands, which

means that the water would absorb all light in this part of the spectrum. This would then

allow for the contribution of the atmosphere, and consequently then the water-leaving

radiance to be calculated for the NIR bands. With reference to Equation 4, this would

therefore mean that ρw would be equal to zero. This then means that Equation 7 becomes ρc =

ρam for the NIR bands. From this value, an extrapolation occurs from the NIR to the visible

bands through use of an appropriate aerosol model (see section 3.2 Aerosol model selection).

However, this assumption of zero Lw in the NIR bands is an inaccurate one. Turbid waters

sometimes have some measureable values of Lw due to constituents of the optically complex

waters. Therefore, to overcome this issue, a new AC algorithm was introduced that allowed

for these values of Lw in the NIR bands to be included in the process: the default atmospheric

(5)

(6)

(7)

(8)

Page 13: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 13

correction algorithm ("2-band model selection and iterative NIR correction" in SeaDAS)

(Bailey, Franz & Werdell, 2010; Stumpf et al., 2003).

It uses an iterative approach which includes a bio-optical model (Maritorena & O'Reilly,

2000; Siegel et al., 2000). It begins with the black pixel assumption (zero values for Lw in the

NIR), so that the values for the Lw in the visible spectrum could be calculated. These

estimates from the blue-green region are then inputted into a bio-optical model which uses

the chlorophyll concentration to work out several quantities, that are used to work out Lw.

This process is re-iterated until the chlorophyll concentration is within 20% of the previous

iteration, up to a maximum of four iterations, to which it terminates.

In updates of the default AC algorithm there included alterations to the iteration control that

occurred within the algorithm. This involved changes such as dampening between iterations,

which allowed for the NIR reflectance being returned to be averaged with the previous

iteration (Bailey et al., 2003). This then permitted for any large fluctuations in the reflectance

values to be minimised.

The MUMM atmospheric correction algorithm (Ruddick et al., 2000) is built on the

assumptions that 1) the atmosphere composition does not vary significantly and 2) the sea-

water in the NIR region is largely determined by pure water absorption, which is invariant.

The algorithm allows the user choose the calibration parameters based on these assumptions:

aerosol reflectance ratio, ε, and the water leaving reflectance ratio, α, where these ratios are

defined as follows (Ruddick et al., 2000):

As well as:

Where, ρam(i)

, is the multiple-scattering aerosol reflectance at waveband i, and aw(i)

, is the pure

water absorption coefficient at waveband i. The value for α is already worked out for the

wavebands in use by SeaDAS, therefore this does not need to be changed from its value of

(9)

(10)

Page 14: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 14

1.945. This parameter of α is what decides on the NIR reflectance spectra shape (Ruddick, De

Cauwer, Park & Moore, 2006).

These parameters are then included in the aerosol selection step; which is vital in the

atmospheric correction process (see section 3.2 Aerosol model selection). To use the MUMM

approach, the values for the Rayleigh-corrected reflectance, ρc (rhom in SeaDAS), were

calculated at the 748 and 869nm wavebands. These are then to be plotted against each other

in the form of a scatter plot, where these parameter ratios can then be extracted. These

parameters are then put into the SeaDAS software for the MUMM approach to be

implemented. This then allows for the aerosol model to be chosen with reference to the

parameters. This can then be used with Equation 7 in order to obtain the desired product of ρw

or consequently Lw.

3.2 Aerosol model selection

To estimate the atmospheric correction, an aerosol model is needed. With the provided values

of ρam in the NIR region, hence knowing ε, the two closest aerosol models are chosen from a

look-up table. These values are like that of Figure 5 and 6, which represent the aerosol

models for different solar zenith angles.

Therefore, knowing what the value of ε is for 748nm and 869nm (or 7th and 8th waveband),

allows the correct aerosol to be chosen. Through extrapolation, the values for the

corresponding ε of each waveband, to the 8th waveband can be determined.

Page 15: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 15

Figure 5: Maritime (M), coastal (C), tropospheric (T) and oceanic (O) aerosol models extrapolation

curves for ε, where the relative humidity values are referred to in the legend as %, for a solar zenith angle

of θ0 = 0°, sensor zenith angle θ=45° and relative azimuthal angle ϕ = 90° (Wang, 2000).

Figure 6: Maritime (M), coastal (C), tropospheric (T) and oceanic (O) aerosol models extrapolation

curves for ε, where the relative humidity values are referred to in the legend as %, for a solar zenith angle

of θ0 = 60° , sensor zenith angle θ=45° and relative azimuthal angle ϕ = 90° (Wang, 2000).

Page 16: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 16

There are several types of aerosol models used that can be seen in Figures 5 and 6 (Antoine &

Morel, 2011; Gohin, Druon & Lampert, 2002; Gordon & Wang, 1994; Shettle & Fenn, 1979;

Wang, 2000):

Oceanic: This model was introduced as most of the pixels were being processed with

the default aerosol model, which is the maritime 99% one. This model has the lowest

value of ε out of all the models.

Tropospheric: This model has no oceanic contributions. It represents the particles that

are present above the boundary layer, that are not as easily affected by local sources.

This sort of model can be used near ground level, when the conditions are clear, calm,

and pollution free. This models value of ε is very high compared to the other models.

Maritime: 99% of the particles in this model have the tropospheric characteristics, and

1% oceanic. Refraction and radius of particles are dependent on the relative humidity.

This model is used within the boundary layer (0-2km from the sea surface). The value

of ε to use this model is close to 1.

Coastal: 99.5% of the particles in this model have the tropospheric characters, and

0.5% of the oceanic. This models refraction and radius of the particles are also

dependent on the relative humidity. The value of ε to use this model is typically quite

high.

Each of these models depends on the wavelength and relative humidity, which is clear to see

in Figure 5 and 6. This strong variation in ε with aerosol model and relative humidity is due

to the swelling. This causes an increase in the particle size, with increasing relative humidity,

which reduces the spectral variation of ε.

The default AC algorithm does this analysis of the aerosol model per pixel (it usually

assumes that the best-fitting model is continuous for a few pixels along the scan swath). This

means that a different aerosol type and concentration is established at every pixel.

The MUMM AC algorithm is based on the fact that the value of ε is homogenous in a small

area; therefore the same aerosol type is used throughout the process.

3.3 Data product description

There are many different data products that can be chosen when processing in SeaDAS, but

the ones used in this report are remote sensing reflectance, Rrs(λ) and the mineral suspended

sediment, MSS.

Page 17: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 17

Rrs is a commonly used estimated data product that is used in many other algorithms. It is a

measure of how much of the downwelling light that is incident onto the water surface is

returned upwards. It is defined as follows (Mobley, 1994):

Where, Lu is the upwelling radiance above the surface, and Ed is the downwelling irradiance

above the surface, at a given wavelength λ.

The other data product analysed in this report was MSS. This product is used in this report to

see if any correlation occurs between the turbidity of waters, which is a measure of how clear

the water is, and the MSS level. It is defined as being related to Rrs at the wavelength of

667nm in the following equation (Neil et al., 2012):

Where the subscripts of (u) and (l) represent the upper and lower values of MSS.

(11)

(12)

(13)

Page 18: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 18

Figure 7: Location of stations used that took in-situ measurements

in the Bristol Channel. Station 5 represents the clear waters and

station 24 that represents turbid waters.

4 Method

4.1 In-situ measurement protocols

4.1.1 Irish Sea and Bristol Channel in-situ

The testing of the AC algorithms took place first with some in-situ data within the Bristol

Channel and Irish Sea, which comprised of different stations in this area. This data set that

was used was also analysed in the paper by Cunningham, Ramage and McKee (2013), with

additional stations that were used, and then examined, in the paper by Mitchell, Cunningham

and McKee (2014). Ten of the stations were tested initially, but the stations that were

focussed on for this report were station 5 to display clear water results, and station 24 to

display turbid water results. These station's locations can be viewed in Figure 7. The latitude

and longitude of these stations are: station 5 (51.1325,-5.4166) and station 24 (51.5403, -

3.9527).

The data set includes values of Ed(λ) and Lu(λ) which were measured on wavebands which

were centred on 412, 443, 490, 510, 554, 665 and 700nm using a SeaWiFS Profiling

Multichannel Radiometer (SPMR, Satlantic). This data underwent some processing and

Page 19: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 19

extrapolation in order to get the sub-surface values for Ed and Lu. From the values of Ed(λ),

and Lu(λ), the values for Rrs(λ) could be derived with use of Equation 11.

4.1.2 Stonehaven in-situ

The data set used once the atmospheric correction algorithm most suitable for turbid waters

was determined, was provided by Professor Mike Heath (University of Strathclyde). The

instrument used was a SAIV CTD, ST470, which allowed for data to be retrieved. In this

report, the data that was used was depth (m) and turbidity (Formazin Turbidity Units - FTU).

The location that these measurements were made at can be seen in Figure 8, whose precise

co-ordinates are marked by the black square at (56.964, -2.112).

Figure 8: In-situ location of turbidity measurements,

represented by the black square in the centre of the image.

4.2 Ocean colour data set retrieval

As the data set needed was to cover 2007-2010, batch processing techniques were used in

order to streamline the process. The data for one image is usually downloaded individually as

a L1A_LAC file for a specific area from the Ocean Color website

(http://oceancolor.gsfc.nasa.gov), which is run by NASA/Goddard Space Flight Center

(GSFC). This file can then be processed using SeaDAS, which is the software used for image

analysis processing of the satellite data.

Page 20: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 20

The data used in this project was acquired from the MODIS sensor, which is aboard the Aqua

satellite. The band centres wavelengths for this sensor are 412, 443, 469, 488, 531, 547, 555,

645, 667, 678, 748 and 869 nm. Once the data has been extracted, it can then be processed

through to a Level 1A (L1A) and GEO file in SeaDAS. These files contain the raw radiance

from all the bands, as well as the geolocation. From the L1A and GEO files, the Level

1B(L1B) file can then be processed. This file will contain all data concerning the calibrated

and geolocated radiances generated from the L1A, as well as some additional data, such as

errors. Next, the 3 files of L1A, GEO and L1B are used to process the Level 2 (L2) file. This

L2 file contains the data for the geophysical values for each pixel for specific user-selected

data products. The processing of the L2 file is also where the atmospheric correction

algorithm takes place, where it can be selected manually in the Graphical User Interface

(GUI) or through scripting. When there is no atmospheric correction algorithm included in

the script, this means that the default was used.

In order to streamline this process, scripts were created which allowed for the files that were

needed (i.e. cloud free days between 2007 and 2010), to be batch downloaded and processed

within the Linux system. For this data to be readable for MATLAB, they then had to be

converted into Hierarchical Data Format (HDF). The scripts that were used in this process

can be found in the Appendix 9.1.

4.3 Impact of atmospheric correction algorithm choice

The data set used in the determination of the most reliable AC algorithm was the Irish Sea

data set. This allowed for the comparison of different stations of in-situ points to be used,

which was ideal due to this report requiring a specific water type. Ten different stations in the

Bristol Channel/Irish Sea were tested with the different AC algorithms in order for a better

understanding of how they worked with data, by comparing the results to in-situ data.

The type of water that was important in this study was a turbid area, as this would then be

similar to the Stonehaven area, therefore station 24 was chosen to base the analysis on for this

report. From using station 24 from the Irish Sea data set, the comparison of the in-situ data

and the satellite data with different AC algorithms, could be used in the determination of the

most suitable AC algorithm. This was completed with the use of the HDF version of the files

created by the different atmospheric correction algorithms, and MATLAB. The data product

that was important in this report, was the value for Rrs(667), as this is the quantity used to

calculate MSS. Therefore, the data for Rrs(λ) was imported into MATLAB, where a 5 by 5

Page 21: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 21

pixel averaging occurred. This was completed for each AC algorithm, where it was stored in

an Excel graph for ease of use, where it could be easily transported back into MATLAB for

analysis. The code involved in this process can be found in the Appendix 9.2.1.

4.4 MUMM atmospheric correction algorithm options

In order to use the MUMM AC algorithm, certain steps were taken in order to follow the

procedure outlined in the paper by Ruddick et al (2000). First, the values for the Rayleigh-

corrected reflectances, ρc, for the wavebands of 748 and 869nm were processed and extracted

in SeaDAS to then be converted into a HDF file. A scatter plot of these two quantities was

then created in order to extract the value for the aerosol reflectance ratio, ε. The gradient of

the line that fits the majority of the outer points (when it is 869nm vs 748nm) is the inverse of

the value ε. This value is slightly different for every image, but due to the nature of this

project where a large amount of processed days were needed, it was decided that an average

value of ε would be used, calculated from a range of days. In order to make this a fair an

average as possible, different seasons were used in the averaging in order to get a good

spread of different data for the area. The code involved with plotting these points and the fits

associated with them, is shown in Appendix 9.2.2.

Once the average ε was calculated, it could then be used to process the data. As the files

would be exactly the same up until the L2 file, it could be processed from L1B_LAC, rather

than L1A_LAC to save time. This also used similar scripting to when the default AC was

used, and can be seen in Appendix 9.1.4 and 9.1.5.

4.5 Time series evolution

In order to compare the in-situ Stonehaven data and the satellite-derived data with different

AC algorithms applied, a time series was produced. First, the values used in this time series

were turbidity (FTU) for Professor Mike Heath's data (University of Strathclyde), and MSS

(g m-3

) derived from Equations 12 and 13. From these values, they could then be used in a

time series script, which was completed by modifying Catherine Mitchell's algorithms

(University of Strathclyde). These can be seen in Appendix 9.2.3. Once the time series was

created for the satellite-derived data, it could then be compared to the in-situ data. This

procedure can be seen in Appendix 9.2.4, where the code for importing the time series from

Appendix 9.2.3.4 was used.

Page 22: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 22

4.6 Seasonal analysis of time series data

Further analysis of the time series data was completed, which included taking seasonal

averages of the MSS levels and in-situ turbidity data, so that they could be examined for a

correlation between the two. The code to do this is present in Appendix 9.2.5.

This then led onto what the seasonal change in MSS levels looked like, not only at the in-situ

point, but for a wider area. This would allow for the seasonal change to be more closely

examined, to see if it were just the in-situ point that had the changes, or if a wider area did as

well. Therefore, 4 days from the satellite-derived data were to be chosen in order to represent

the 4 seasons.

As the AC algorithm will make a difference to the value of the MSS level, the difference

between the MSS level from the default and the MUMM AC algorithms were also

investigated. In order to complete this for a wider area, rather than just the in-situ point, it

was chosen to plot these onto a mapped image for 2 of the seasons. These tasks were

completed with use of Appendix 9.2.7.

Page 23: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 23

5 Results

5.1 Atmospheric correction algorithm validation

The different AC algorithms that were tested in this project, were the default setting, black

pixel assumption and the MUMM correction. In order to test the implications of the AC

algorithms chosen, a point with known high turbidity in the Bristol Channel was selected in

testing these algorithms by comparing to in-situ data; this point was station 24. This station

was then compared to one with clear waters, which was station 5, in order to display the

difference that is made due to turbidity. The precise locations of these stations were station

5: (51.1325. -5.4166) and station 24: (51.5403, -3.9527), where the locations can also be seen

in Figure 7.

5.1.1 Impact of atmospheric correction algorithm on Rrs retrieval

With use of the code in Appendix 9.2.1, Figures 9 and 10 could be produced for stations 5

and 24.

Figure 9: Rrs levels for the AC algorithms of default, black pixel assumption and MUMM, tested against

in-situ data for a clear water station (station 5).

Page 24: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 24

Figure 10: Comparison of AC algorithms (default, black pixel assumption and MUMM) to in-situ data for

Rrs levels at a turbid station (station 24) in the Bristol Channel.

This shows the difference that the AC algorithm can have on the Rrs values for each

waveband, and how dependent the value is on the optical properties of the water.

5.2 Validation of sediment algorithm

In the pursuit of finding the most suitable AC algorithm for this project, it was decided that it

would be worth taking a time series of both the default AC algorithm and the MUMM AC

algorithm. This would allow for any uncertainty in the assumptions within the previous tests

to be eased.

5.2.1 Analysis of aerosol reflectance ratio over seasonal cycle

As explained in the paper by Ruddick et al. (2000), the first step in the MUMM approach is

to produce a scatter plot of the Rayleigh-corrected reflectances for the 7th and 8th wavebands

for the area in question. This would then allow for the aerosol reflectance ratio, ε, to be

determined.

Page 25: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 25

Figure 11: A scatter plot of the Rayleigh-corrected reflectances at 748 and 869 nm, for the first stage of

the MUMM AC algorithm process. The red line represents the average ε from 6 different plots, and the

black dashed line represents the default ε.

The scatter plot has been done in this configuration of the 8th waveband against the 7th

waveband as the paper by Ruddick et al. (2000) displays their scatter plots with the 8th

waveband against the 7th waveband. However, it should be stressed that the value of ε will

then be the inverse of the gradient decided here, as Equation 9 declares that this value is the

7th waveband over the 8th waveband.

The black dashed line present on Figure 11 represents the default value of ε for the MUMM

AC algorithm, which is 1. The red line is the inverse value of the average ε of six different

days, which were within a spread of 2007-2010, including the different seasons. This value

was calculated as 0.9825. A table of the dates used, and the corresponding values of ε can be

found in Table 1 below:

Page 26: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 26

Season Date MATLAB gradient ε

Winter 02/01/2007 1.06 0.943

02/02/2007 1.01 0.99

Spring 29/03/2009 0.99 1.01

Summer 08/08/2007 0.99 1.01

Autumn 23/10/2008 1.05 0.99

25/10/2010 1.01 0.952

Average ε 0.9825

Table 1: Corresponding gradients of the lines required for the MUMM approach for the selected area for

different dates within different seasons

To showcase the difference that the value of ε makes in this report, Figure 12 and 13 have

been constructed via the code in Appendix 9.2.6, which also uses the code in Appendix

9.2.6.1. The image that was chosen was from 02/01/2007. With reference to Table 1, this

image had the largest value of ε from the test set away from the default value of 1; therefore

this would likely show the largest likeliest magnitude of error that could occur in the end

values for the MSS level.

Page 27: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 27

Figure 12: Rrs(667) difference between individual ε chosen for this day (0.9430), and default ε that the

software chooses if the user does not change it (1), for the MUMM AC algorithm process.

Figure 12 displays the difference in Rrs(667) for the individual value of ε for this particular

day, which was 0.943, as can be seen in Table 1, and the average ε, which was 0.9825. This

shows a difference in Rrs(667) of 0.0009 sr-1

. However, once this number is used in Equation

12, it gives a difference in values of approximately 0.7 g m-3

for the upper bound of the MSS

level.

Figure 13: Rrs(667) difference between individual ε chosen for this particular day (0.9430) and the

average ε chosen from Table 1 (0.9825), for the MUMM AC algorithm process.

Page 28: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 28

Figure 13 shows the small difference between the values of Rrs(667) when processed using

the individual ε with the MUMM AC algorithm, and the average ε. As can be seen, there is

not as large a difference in these values compared to Figure 12. The point of interest showed

a difference in Rrs(667) of approximately 0.0005 sr-1

, which amounts to 0.3 g m-3

for the MSS

upper bound level. Therefore, this error should be taken into consideration when using the

average ε in this report.

5.2.2 Comparison of in-situ data and remote sensing MSS time series for Stonehaven

With use of the code in Appendix 9.2.4 and 9.2.3.4, the turbidity from Professor Mike

Heath's data could be compared to the satellite-derived MSS data for the time period of 2007-

2010. The results of which can be shown in Figure 14 and 15. The red line represents the in-

situ data, which is measured in FTU. The green error bars and blue errors bars represent the

MSS upper and lower levels for the MUMM AC algorithm and the default AC algorithm,

respectively, which is measured in g m-3

.

Page 29: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 29

Fig

ure

14

& 1

5:

Tim

e se

ries

da

ta f

or

the

dif

feren

t A

C a

lgo

rith

ms

ap

pli

ed

. T

he

top

tim

e se

rie

s (F

igu

re 1

4)

sho

ws

the

sate

llit

e-d

eriv

ed M

SS

lev

els

fro

m

usi

ng

th

e

def

au

lt A

C a

lgo

rith

m,

rep

rese

nte

d b

y t

he

erro

r b

ars

to

sh

ow

th

e u

pp

er a

nd

lo

wer

bo

un

ds

of

thes

e le

vel

s. T

he

bo

tto

m t

ime

seri

es (

Fig

ure

15

) h

as

the

MU

MM

AC

alg

ori

thm

ap

pli

ed t

o t

he

MS

S d

ata

, w

her

e i

t is

rere

sen

ted

by

gre

en e

rro

r b

ars

to

sh

ow

th

e u

pp

er a

nd

lo

wer

bo

un

ds.

Page 30: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 30

5.3 Seasonal variations in the MSS data

To analyse this data more, the seasonal average level of MSS and turbidity were calculated

for each year, which can be shown in Figure 16. This further shows the correlation between

the MSS and the turbidity levels, as the overall shapes follow the same typical path.

Furthermore, it also shows that the highest levels of turbidity are during the winter seasons.

Figure 16 showed that there was a clear seasonal variation in the MSS levels; therefore

mapped images of different seasons were also produced, in order to see if it were only the in-

situ point that was experiencing this, or if it were a wider area trend. These can be seen in

Figure 17-20, which shows the upper MSS levels for different seasons, processed with the

MUMM AC algorithm.

The seasonal variation however now needs to be compared based on the AC algorithms, as

these can be seen to differ a lot by viewing Figures 14 and 15. In order to evaluate the

difference that the AC algorithm makes to the surrounding area, Figure 21 & 22 were

produced. These display the differences that the default and MUMM AC algorithms make in

the spring (29/03/09), and in the autumn (25/10/10).

Figure 16: Seasonal averages split into years for the satellite-derived MSS upper values with the MUMM

correction applied, and in-situ turbidity values.

Page 31: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 31

Figure 17-20: Seasonal variation in the MSS upper level. Figure 17: Top left -winter (02/01/2007), Figure

18: Top right- spring (29/03/2009), Figure 19: Bottom left- summer (08/08/07) and Figure 20: Bottom

right- autumn (25/10/10). These were produced with the MUMM AC algorithm (average ε used = 0.9825).

Page 32: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 32

Figure 21 & 22: Difference in MSS level for the upper bound, for the MUMM and default AC algorithms.

Figure 21: Left - spring difference (29/03/2009) Figure 22: Right - autumn difference (25/10/10).

Page 33: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 33

6 Discussion

6.1 Performance of atmospheric correction algorithms

Out of the 3 AC algorithms that were tested, it was decided that MUMM would be the AC

algorithm to go forward with in this project, due to a number of reasons. First, the paper by

Ruddick et al. (2000), designed this algorithm in order to test turbid waters. Also, with

reference to Figure 10, the results of the MUMM AC algorithm were the closest to the in-situ

data set.

In looking at Figure 9, the AC algorithm does not make as significant a difference on the

values for Rrs when measured in clear waters, therefore if the dataset to be examined was in a

clear water area, the default AC algorithm may still be the best.

These factors contributed to then the testing of the MUMM algorithm, and going through the

stages in order to process with this algorithm. To affirm this algorithm, and further test its

accuracy, it was also chosen to test it alongside the default AC algorithm in the later stages.

One error that is present in the MUMM AC algorithm's processing stages is present at the

processing of the value of ε. This value is based on 'eye-balling' the correct line which fits

most of the outermost points on the Rayleigh-corrected reflectances graph (Figure 11).

Therefore this is a large room for error, as if different people tested this algorithm, each

person could have a different idea of what fitted the best. Also, it requires a specific area; too

big and there will be too much data from other sources of the water that could interfere with

the results, and processing time would rapidly increase; too small and there won't be enough

data points to select the line to go through. Therefore, the testing of the value of ε, and the

accuracy of this algorithm through validation through comparison to in-situ were very

important parts to establish in this report.

In order to process this dataset as a batch, rather than individually, it was chosen to use an

average value for ε. To verify that this would not cause a considerable amount of error in the

resultant values, some testing was further analysed. Figure 12 and 13 both display the

difference that the value of ε has on the resultant value for Rrs(667). Figure 12 shows the

difference between when the image's individual value of ε was used through processing, and

the default value of ε. For the point from which the in-situ data was taken, there was a

roughly 0.0009 sr-1

difference. This may not appear to be a significant difference, but due to

Page 34: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 34

the end result measuring the MSS levels, once the Rrs(667) value is used in Equation 12, it

becomes a difference of roughly 0.7 g m-3

for the upper bound.

The effect of the ε value was further tested through means of the difference between the

image's individual ε, and the average value of ε, where the values are found in Table 1, which

is shown in Figure 13. It can be seen that there is not as large a difference between the values

as Figure 12. The point of interest showed a difference in Rrs(667) of roughly 0.0005 sr-1

,

which amounts to 0.3 g m-3

for the MSS upper bound level. Therefore in this case, from using

this average value of ε rather than the default value, the error in the Rrs(667) was more than

halved. This displayed the most extreme of cases found during the analysis of different

image's individual ε; therefore at most, there should not be any errors greater than 0.3 g m-3

for the MSS upper bound.

The validation of this algorithm was then executed by comparing the values of the satellite-

derived quantities of MSS levels with different AC algorithms applied, to the in-situ data

courtesy of Professor Mike Heath (University of Strathclyde). This comparison of extensive

data can be seen in Figures 14 and 15. Figure 14 shows the default AC algorithm plotted with

the in-situ data for MSS levels against the turbidity, and Figure 15 shows the same, but with

the MUMM AC algorithm applied. These show a correlation between turbidity and MSS

levels, as the in-situ data lies within most of the error bars (which represents the upper and

lower bounds of the MSS level). There are however, a few outliers, but this is only the case

for a few circumstances. What is also noticeable is a lack of default values in comparison to

the MUMM values. After close analysis of the individual images that worked for the MUMM

AC algorithm and not the default, it was seen that the default had a tendency to flag close to

the coast, which is where the in-situ point was. This then meant that within the default

algorithm, there was a condition which was met for this area, and so it could not display an

appropriate value for the pixel. This condition however was not met for the MUMM AC

algorithm, which gives some idea that this flagging could be due to the turbidity of the area,

as there is a common issue of the default algorithm flagging close to the coastline. Therefore,

this gives some indication at the more robust algorithm, as the MUMM AC managed to

overcome the shortfalls of the default algorithm, thus displaying more valid points.

Further analysis of the satellite-derived values of MSS from the MUMM algorithm compared

to the in-situ turbidity data through seasonal averages per year, was also completed, as can be

seen in Figure 16. It can be seen that not only do they correlate, but there is a very clear

Page 35: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 35

seasonal variability in these values. There are also significantly higher levels of MSS and

turbidity in the winter months, and low in the summer months. This is expected, as this

means the water is calmer and therefore clearer in the summer. This is due to the weather in

the winter months generally being more stormy than in the summertime. Wind causes the

waves to become more aggressive, and therefore this increases the friction between the water

and the bottom sediments, thus causing resuspension. In the summertime, the sunlight allows

the water to become thermally stratified. With the water being warmer on the top layer, it

creates a barrier to the sediments due to a change in density, and therefore the sediments will

settle. Once it gets less warm, such as in the autumn months, this thermal stratification

dissipates, therefore the sediments undergo the resuspension again from the input of the wind.

Other inputs are also feasible, such as the stormy weather could cause the topsoil from close

coastal agricultural areas to be blown into the water, therefore raising the sediment level.

To analyse if this were just the case for the in-situ area, mapped images were produced with

the MUMM AC algorithm, to represent the seasonal variation in the upper bound of the MSS

level, which can be seen in Figures 17-20. These confirm the results in Figure 16 – that there

is a clear rise in MSS levels in the winter at the in-situ point. In the spring, it is seen that the

increased MSS seems to have moved south, therefore presenting the in-situ point with

decreased MSS at this time. The summer has very little MSS in the area examined, and they

build up again in the autumn, which again confirms what it seen in Figure 16. Figure 16

combined with Figures 17-20 show that a cyclic pattern occurs with the MSS values, with

increased values in winter, and decrease in summer. This gives some indication that this

process is due to that explained previously; thermal stratification occurring in the summer,

and stormy weather in the winter.

A further analysis was then required from the previous step, as the MSS levels are still

dependent on the AC algorithm chosen. The seasonal images for Figure 17-20 were plotted

with the MUMM AC algorithm, therefore it is vital to display the error that could be in these.

This was done by mapping the difference in the upper bound of the MSS level for the default

and MUMM AC algorithm, and was shown for the spring and autumn images, which can be

seen in Figure 21 and 22. Figure 21 shows that in the springtime there is significant

difference in the MSS levels for this day, predominantly in the range of 1-2 g m-3

. This is

quite a large error, considering that for this in-situ area, the higher values are 4 g m-3

,

therefore meaning that there could be as much as a 50% error, dependent on the AC

Page 36: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 36

algorithm chosen. This reiterates the importance of making sure that the AC algorithm is

suitable for the chosen area, and points to some future work of more analysis in this area.

6.2 Monitoring suspended sediment: capabilities and limitations

This report has shown that in the data set used, the MUMM AC algorithm worked the most

efficiently; it was robust in the sense that it produced data where the default AC algorithm did

not, and it also produced a great match up to the in-situ data. Therefore, this shows that in this

case, the MSS level could be easily monitored with use of ocean colour remote sensing.

However, there are limitations to this, which were mentioned previously. This includes the

fact that the values of the MUMM AC algorithm seem to differ a lot from the default

algorithm depending on the season, as can be seen in Figure 21 and 22. As explained in

section 6.1, it could even amount to a 50% error in the results in this case. This means that a

further analysis is needed into the MUMM AC algorithm, and possibly more in-situ match

ups would be a suitable direction in confirming the validity of this algorithm for other areas.

However, for this area, it can be seen that the MUMM AC algorithm is the better match to the

data due to its reliability in the amount of results, which can be seen in Figure 15.

Another limitation which is present is within the procedure of the MUMM AC algorithm, is

that it needs an individual value of ε for each image. This therefore introduces some error into

the data set, as in this case an average ε was used in order to batch process. Therefore, there is

some great opportunity to create an algorithm that would be able to judge this value of ε per

image, rather than just assume one value for the whole data set. This would then also produce

some consistency in the results, as the current method of evaluating the value of ε is through

judging at what gradient of the line fits best to the outermost points. However, programming

such an algorithm could be a risky procedure, as this could potentially lead to an even larger

error if the incorrect value of ε was chosen. Therefore, for the work needed at the moment,

the best method seems to be to select a few days across a wide range, and take an average

value for ε, which was the method used in this report. An improvement on this could be to

take a wider range than done in this report, and calculate an average ε; however this could be

seen as unnecessary, as the values did not vary too much.

The benefits of being able to use an average value of ε for the dataset, is that a vast amount of

data can then be processed in a shorter amount of time. This would allow for time series

datasets to be produced for a wide range of data, such as over a larger timeframe. This could

be useful in a scenario such as in the monitoring of marine renewable sites, where, for

Page 37: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 37

example, underwater turbines could be implemented in the area. A time series dataset could

be taken after some time after implementation to monitor if there was any change in the

suspended sediment level. This would allow for the marine environment to be considered

when using the area for renewable sources. A negative reaction in the area could be if the

sediment was getting blocked up in the area, and therefore affecting the marine life. This sort

of change would be echoed in the time series dataset as an increase in suspended sediment

level. This sort of analysis is important, as then the right measures could be taken in order to

restore the area to a suitable environment that does not affect marine life.

6.3 Future work

Further analysis of this dataset would be ideal in further validating the in-situ data as well as

the satellite-derived products. As the dataset provided by Professor Mike Heath (University

of Strathclyde) provided a vast amount of other data for 2007-2010, more tests could be

easily completed. This could include the comparison of in-situ chlorophyll measurements,

and satellite-derived chlorophyll measurements. Also, the in-situ data included their derived

value of attenuation coefficient, which could then be compared to the satellite-derived

quantity of attenuation coefficient (Kd). These analyses would give a further insight into the

accuracy of the AC algorithms, and would allow for an appropriate algorithm to be used in

future work in this area. This would then allow for the satellite-derived products to be trusted

in giving estimates of such values for this area. Further in-situ data points along the Eastern

coast of Scotland would also be a great project, as this would allow further analysis of the

choice of the AC algorithms for this area, to further affirm the data in this report.

Also, more closely examining the seasonal variation in the MSS levels, and then perhaps the

chlorophyll and Kd levels would be an interesting insight into how these products are related

to one another. Observing the months that overlap the spring and the summer would be an

advantage in understanding this area, as this would allow the points at which the MSS levels

decrease, to be seen more accurately. This could be completed by means of creating a time

series on the mapped image of the variation. This would be a beneficial tool in seeing the

points where the MSS level varies the most substantially, and eventually the chlorophyll and

Kd levels.

Page 38: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 38

7 Acknowledgments

I would like to thank my supervisors, but primarily Dr David McKee, who offered endless

amounts of support and advice throughout the year, and always had time for my questions. I

am extremely grateful for the time and help that was given.

I would also like to thank the PhD students for allowing me to work in their lab, who were

always available for any questions I had, no matter how silly they seemed. In particular,

Catherine Mitchell was a great help, and provided me with some very helpful code to work

with in this project. Also, thanks to Christopher Nicol, who gained me access to a server to

make my processing that bit easier.

Page 39: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 39

8 References

Ahmad, Z., Franz, B. A., McClain, C. R., Kwiatkowska, E. J., Werdell, J., Shettle, E. P. &

Holben, B. N. (2010). New aerosol models for the retrieval of aerosol optical

thickness and normalised water-leaving radiances from the SeaWiFS and MODIS

sensors over coastal regions and open oceans. Applied Optics, 49 (29), pp. 5545-

5560.

Antoine, D. (2012). Ocean-colour observations from a geostationary orbit. Dartmouth, N.S.:

International Ocean-Colour Coordinating Group.

Antoine, D. & Morel, A. (2011). MERIS ATBD 2.7 - Atmospheric Correction of the MERIS

observations Over Ocean Case 1 waters. [report] Laboratoire D'Océanographie De

Villefranche.

Austin, R. (1980). Gulf of Mexico, ocean-color surface-truth measurements.Boundary-Layer

Meteorology, 18 (3), pp. 269-285.

Bailey, S. (2013). "Aerosol determination", paper presented at International Ocean Color

Science Meeting. Darmstadt, Germany, 6th May 2013.

Bailey, S. W., Franz, B. A. & Werdell, P. J. (2010). Estimation of near-infrared water-leaving

reflectance for satellite ocean color data processing. Optics Express, 18 (7), pp. 7521-

7527.

Bailey, S. W., Robinson, W. D. & Franz, B. A. (2003). Modifications to the SeaWiFS NIR

Correction. In: Hooker, S. B. & Firestone, E. R. eds. (2003). NASA Tech. Memo.

2003-206892 Vol 22. Greenbelt, Maryland: NASA Goddard Space Flight Center,

pp.26-28.

Begler, C. (2008). Matlab - mproj. [online] Retrieved from:

http://mooring.ucsd.edu/software/matlab/doc/toolbox/geo/mproj.html [Accessed: 4

Apr 2014].

Chen, X. & Lu, Z. (2009). Remote sensing of water environment. In: Li, D., Shan, J. & Gong,

J. eds. (2009). Geospatial technology for earth observation. New York: Springer, pp.

431-471.

Page 40: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 40

Cunningham, A., Ramage, L. & McKee, D. (2013). Relationships between inherent optical

properties and the depth of penetration of solar radiation in optically complex coastal

waters. Journal Of Geophysical Research: Oceans, 118 (5), pp. 2310-2317.

Feldman, G. C. & Patt, F. S. (2003). Introduction to the Fourth SeaWiFS Reprocessing. In:

Hooker, S. B. & Firestone, E. R. eds. (2003). NASA Tech. Memo. 2003-206892 Vol

22. Greenbelt, Maryland: NASA Goddard Space Flight Center, pp. 4-11.

Gohin, F., Druon, J. & Lampert, L. (2002). A five channel chlorophyll concentration

algorithm applied to SeaWiFS data processed by SeaDAS in coastal

waters.International Journal Of Remote Sensing, 23 (8), pp. 1639-1661.

Gordon, H. R. & Wang, M. (1994). Retrieval of water-leaving radiance and aerosol optical

thickness over the oceans with SeaWiFS: a preliminary algorithm. Applied Optics, 33

(3), pp. 443-452.

Gordon, H. R. & Wang, M. (1994). Influence of oceanic whitecaps on atmospheric correction

of ocean-color sensors. Applied Optics, 33 (33), pp. 7754-7763.

Gordon, H. R. & Wang, M. (1992). Surface-roughness considerations for atmospheric

correction of ocean color sensors. I: The Rayleigh-scattering component. Applied

Optics, 31 (21), pp. 4247-4260.

Goyens, C., Jamet, C. & Schroeder, T. (2013). Evaluation of four atmospheric correction

algorithms for MODIS-Aqua images over contrasted coastal waters. Remote Sensing

Of Environment, 131, pp. 63-75.

Kirk, J. T. O. (1983). Light and photosynthesis in aquatic ecosystems. Cambridge [England]:

Cambridge University Press.

Kneib, F. (2014). Active treatment system solves tough stormwater challenge at mining

operation. [online] Retrieved from:

http://www.waterworld.com/articles/iww/print/volume-13/issue-3/columns/active-

treatment-system-solves-tough-stormwater-challenge-at-mining-operation.html

[Accessed: 06 Apr 2014].

Page 41: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 41

Lindsey, R. & Scott, M. (2010). What are Phytoplankton? : Feature Articles. [online]

Retrieved from: http://earthobservatory.nasa.gov/Features/Phytoplankton/ [Accessed:

10 Mar 2014].

Maritorena, S. & O'Reilly, J. E. (2000). OC2v2: Update on the Initial Operational SeaWiFS

Chlorophyll a Algorithm. In: Hooker, S. B. & Firestone, E. R. eds. (2000). NASA

Tech. Memo. 2000-206892. Vol 10. Greenbelt, Maryland: NASA Goddard Space

Flight Center, pp. 3-8.

Mitchell, C., Cunningham, A. & McKee, D. (2014). Remote sensing of shelf sea optical

properties: Evaluation of a quasi-analytical approach for the Irish Sea. Remote

Sensing Of Environment, 143, pp. 142-153.

Mobley, C. D. (1994). Light and Water. San Diego: Academic Press.

Northwest Fisheries Science Centre. (2014). HABs and Biotoxins: Phytoplankton. [online]

Retrieved from: http://www.nwfsc.noaa.gov/hab/habs_toxins/phytoplankton/

[Accessed: 10 Mar 2014].

Ongley, E. (1996). Sediment Measurements. In: Bartram, J. & Ballance, R. eds.

(1996). Water Quality Monitoring. London: E & FN Spon, pp. 301-315.

Robinson, W. D., Schmidt, G. M., McClain, C. R. & Werdell, P. J. (2000). Changes Made in

the Operational SeaWiFS Processing. In: Hooker, S. B. & Firestone, E. R. eds.

(2000). NASA Tech. Memo. 2000-206892. Vol 10. Greenbelt, Maryland: NASA

Goddard Space Flight Center, pp12-28.

Ruddick, K., De Cauwer, V., Park, Y. & Moore, G. (2006). Seaborne measurements of near

infrared water-leaving reflectance: The similarity spectrum for turbid waters.

American Society Of Luminology And Oceanography, 51 (2), pp. 1167-1179.

Ruddick, K. G., Ovidio, F. & Rijkeboar, M. (2000). Atmospheric correction of SeaWiFS

imagery over turbid coastal waters. Applied Optics, 39 (6), pp. 897-912.

Scottish Environment Protection Agency. (2011). The Water Environment (Controlled

Activities)(Scotland) Regulations 2011. A Practical Guide. [report].

Page 42: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 42

Shettle, E. P. & Fenn, R. W. (1979). Models for the aerosols of the lower atmosphere and the

effects of humidity variations on their optical properties.

Siegel, D. A., Wang, M., Maritorena, S. & Robinson, W. (2000). Atmospheric correction of

satellite ocean color imagery: the black pixel assumption. Applied Optics, 39 (21), pp.

3582-3591.

Stumpf, R. P., Arnone, R. A., Gould Jr, R. W., Martinolich, P. M. & Ransibrahmanakul, V.

(2003). A partially coupled ocean-atmosphere model for retrieval of water-leaving

radiance from SeaWiFS in coastal waters. In: Hooker, S. B. & Firestone, E. R. eds.

(2003). NASA Tech. Memo. 2003-206892 Vol 22. Greenbelt, Maryland: NASA

Goddard Space Flight Center, pp. 51--59.

Vinten, A., Loades, K., Addy, S., Richards, S., Stutter, M., Cook, Y., Watson, H., Taylor, C.,

Abel, C., Baggaley, N., Ritchie, R. & Jeffrey, W.(2014). Reprint of: Assessment of

the use of sediment fences for control of erosion and sediment phosphorus loss after

potato harvesting on sloping land. Science Of The Total Environment, 468, pp. 1234-

1244.

Wang, M. (2000). The SeaWiFS atmospheric correction algorithm updates. Seawifs

Postlaunch Calibration And Validation Analyses, Part, 1, pp. 57-63.

Wang, M., Son, S. & Shi, W. (2009). Evaluation of MODIS SWIR and NIR-SWIR

atmospheric correction algorithms using SeaBASS data. Remote Sensing Of

Environment, 113 (3), pp. 635-644.

Woods Hole Oceanographic Institution. (2014). Phytoplankton : Woods Hole Oceanographic

Institution. [online] Retrieved from: http://www.whoi.edu/main/topic/phytoplankton

[Accessed: 10 Mar 2014].

Page 43: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 43

9 Appendix

9.1 Linux Scripts

9.1.1 Batch download and unzip files

#batch downloads from text file which has a list of files to be downloaded

#and unzips them in the same directory

#to be downloaded in the form

#http://oceandata.sci.gsfc.nasa.gov/cgi/getfile/A2010153132500.L1A_LAC.bz2/

#written by Roseanne Clement

while read line; #reading each line of the text file

do

wget ${line%/*};

done < filedownload_IS.txt #filename of text file

seadas -em -b unzip.sh #extracts the data from file

9.1.2 Conversion of L1A to L2 files - Default AC algorithm

#!/bin/sh

#script originally made by Catherine Mitchell

#edited by Roseanne Clement for the Stonehaven area

for FILE in *L1A_LAC

do

# The line below assumes an extension, and creates a base name without that extension

BASE=`echo $FILE |awk -F. '{ print $1 }'`

GEOFILE=${BASE}.GEO

L1BFILE=${BASE}.L1B_LAC

L2FILE=${BASE}.L2_LAC

HDFFILE=${BASE}.hdf

echo "generating $GEOFILE file..."

# process the L1A file to GEO

modis_GEO.py $FILE -o $GEOFILE

# extract a subscene from the MODIS file

modis_L1A_extract.py $FILE $GEOFILE

echo "generating $L1BFILE file..."

# process the L1A/GEO subscene files to L1B

modis_L1B.py $FILE $GEOFILE -o $L1BFILE

echo "determining ancillary data..."

# determine ancillary data

getanc.py $L1BFILE

# the above command creates a file in l2gen's par file format called L1BFILE.anc

# process the L1B subscene to L2

echo "Processing $L1BFILE to Level 2.."

# NOTE! customize the l2gen parameters here

Page 44: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 44

l2gen ifile=$L1BFILE geofile=$GEOFILE ofile1=$L2FILE \

l2prod1='Rrs_412, Rrs_443, Rrs_488, Rrs_531, Rrs_547, Rrs_667, Rrs_678, Rrs_748, Rrs_869, chlor_a,

Kd_490, sst' \

gas_opt=15 resolution=250 south=56.15 north=57.75 west=-3 east=-1.3 \

par=${L1BFILE}.anc >$BASE.log

#echo "L2 file generated. Output to HDF...."

seadas -em -b outputhdf_combination.txt

#echo "HDF file generated"

done

echo "Processing complete!"

9.1.3 Conversion from L2 to HDF file - Default AC algorithm case

#this script is called upon in previous code

#originally done by Catherine Mitchell

#edited by Roseanne Clement

#creates a HDF file to readable for MATLAB

L2FILES=findfile('*.L2_LAC')

for i=0, n_elements(L2FILES)-1 do begin & $

L2FILE=L2FILES(i) & $

BASE=strmid(L2FILE,0,14) & $

HDFFILE=BASE+'.hdf' & $

load, L2FILE, ftype='modis',

prod_name=['Rrs_412','Rrs_443','Rrs_488','Rrs_531','Rrs_547','Rrs_667','Rrs_678','Rrs_748','Rrs_869','chlor_a',

'Kd_490','sst'] & $

mapimg, bands=[1,2,3,4,5,6,7,8,9,10,11,12], xsize=500, ysize=500, LIMIT=[56.15,-3,57.75,-1.3],

/MERCATOR & $

out, /data, band=13, HDFFILE, ftype='hdf', dfmt=5, /geo & $

out, /data, band=14, HDFFILE, ftype='hdf', dfmt=5, /geo, append=1 & $

out, /data, band=15, HDFFILE, ftype='hdf', dfmt=5, /geo, append=1 & $

out, /data, band=16, HDFFILE, ftype='hdf', dfmt=5, /geo, append=1 & $

out, /data, band=17, HDFFILE, ftype='hdf', dfmt=5, /geo, append=1 & $

out, /data, band=18, HDFFILE, ftype='hdf', dfmt=5, /geo, append=1 & $

out, /data, band=19, HDFFILE, ftype='hdf', dfmt=5, /geo, append=1 & $

out, /data, band=20, HDFFILE, ftype='hdf', dfmt=5, /geo, append=1 & $

out, /data, band=21, HDFFILE, ftype='hdf', dfmt=5, /geo, append=1 & $

out, /data, band=22, HDFFILE, ftype='hdf', dfmt=5, /geo, append=1 & $

out, /data, band=23, HDFFILE, ftype='hdf', dfmt=5, /geo, append=1 & $

out, /data, band=24, HDFFILE, ftype='hdf', dfmt=5, /geo, append=1 & $

out, /data, band=25, HDFFILE, ftype='hdf', dfmt=5, /geo, append=1 & $

out, /nav, band=13, HDFFILE, ftype='hdf', append=1 & $

endfor

9.1.4 Conversion of L1B_LAC to L2 files - MUMM AC algorithm

#original code by Catherine Mitchell, edited by Roseanne Clement

find /home/Marine/mhb10152/Documents/Stonehaven/ -name '*.L1B_LAC' \

> /home/Marine/mhb10152/Documents/Stonehaven/Lfiles.txt

Page 45: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 45

while read line; #reading each line of the text file

do

new=${line%/*}; #extracting path to file and changing directory to that file

cd $new

for FILE in *L1B_LAC

do

# The line below assumes an extension, and creates a base name without that extension

BASE=`echo $FILE |awk -F. '{ print $1 }'`

GEOFILE=${BASE}.GEO

L1BFILE=${BASE}.L1B_LAC

L2FILE=${BASE}.L2_LAC

HDFFILE=${BASE}.hdf

echo "determining ancillary data..."

# determine ancillary data

getanc.py $L1BFILE

# the above command creates a file in l2gen's par file format called L1BFILE.anc

# process the L1B subscene to L2

echo "Processing $L1BFILE to Level 2.."

# NOTE! customize the l2gen parameters here

l2gen ifile=$L1BFILE geofile=$GEOFILE ofile1=$L2FILE \

l2prod1='Rrs_412,Rrs_443,Rrs_488,Rrs_531,Rrs_547,Rrs_667,Rrs_678,Rrs_748,Rrs_869,chlor_a,Kd_490,l2_f

lags' \

proc_land=1 proc_sst=1 \

aer_opt=-10 \

mumm_alpha=1.945 mumm_gamma=1.0000 mumm_epsilon=0.9825 \

gas_opt=15 resolution=1000 north=57.75 south=56.15 east=-1.3 west=-3 \

par=${L1BFILE}.anc >$BASE.log

echo "L2 file generated. Output to HDF...."

seadas -em -b /home/Marine/mhb10152/Documents/Stonehaven/2007002123000/OutputHDF_Rrs.txt

echo "HDF file generated"

done

done < Lfiles.txt

9.1.5 Conversion of L2 to HDF file - MUMM AC algorithm case

#original code by Catherine Mitchell, edited by Roseanne Clement

L2FILES=findfile('*.L2_LAC')

for i=0, n_elements(L2FILES)-1 do begin & $

L2FILE=L2FILES(i) & $

BASE=strmid(L2FILE,0,14) & $

HDFFILE=BASE+'.hdf' & $

load, L2FILE, ftype='modis',

prod_name=['Rrs_412','Rrs_443','Rrs_488','Rrs_531','Rrs_547','Rrs_667','Rrs_678','Rrs_748','Rrs_869','chlor_a',

'Kd_490'] & $

mapimg, bands=[1,2,3,4,5,6,7,8,9,10,11], xsize=500, ysize=500, LIMIT=[56.15,-3,57.75,-1.3], /MERCATOR &

$

out, /data, band=12, HDFFILE, ftype='hdf', dfmt=5, /geo & $

out, /data, band=13, HDFFILE, ftype='hdf', dfmt=5, /geo, append=1 & $

out, /data, band=14, HDFFILE, ftype='hdf', dfmt=5, /geo, append=1 & $

Page 46: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 46

out, /data, band=15, HDFFILE, ftype='hdf', dfmt=5, /geo, append=1 & $

out, /data, band=16, HDFFILE, ftype='hdf', dfmt=5, /geo, append=1 & $

out, /data, band=17, HDFFILE, ftype='hdf', dfmt=5, /geo, append=1 & $

out, /data, band=18, HDFFILE, ftype='hdf', dfmt=5, /geo, append=1 & $

out, /data, band=19, HDFFILE, ftype='hdf', dfmt=5, /geo, append=1 & $

out, /data, band=20, HDFFILE, ftype='hdf', dfmt=5, /geo, append=1 & $

out, /data, band=21, HDFFILE, ftype='hdf', dfmt=5, /geo, append=1 & $

out, /data, band=22, HDFFILE, ftype='hdf', dfmt=5, /geo, append=1 & $

out, /data, band=23, HDFFILE, ftype='hdf', dfmt=5, /geo, append=1 & $

out, /data, band=24, HDFFILE, ftype='hdf', dfmt=5, /geo, append=1 & $

out, /nav, band=12, HDFFILE, ftype='hdf', append=1 & $

endfor

9.1.6 Moving files from individual directories to directory for each year

# written by Roseanne Clement

find /media/sdd1/Stonehaven_Pentland -name '*.hdf' \

> /media/sdd1/Stonehaven_Pentland/hdf_m2files.txt

while read line; #reading each line of the text file

do

new=${line%/*}; #extracting path to file and changing directory to that file

cd $new

L2FILE=${BASE}.L2_LAC

HDFFILE=${BASE}.hdf

for FILE in *hdf

do

mv -f FILE M /media/sdd1/Stonehaven_Pentland/M_0.9825

done

done < hdf_m2files.txt

9.2 MATLAB code

9.2.1 Determination of AC algorithm

9.2.1.1 Import Rrs and pixel averaging

%% Imports all Rrs and lat/long data from hdf files in directory chosen % %Calculates the averaging of the pixel, 5x5

% Code by Roseanne Clement fileName='C:\seadas_shared\Rosie\Atmos_2\def\A2006205124000.hdf'; %Import Rrs, Latitude and Longitude etc Rrs_412=hdfread(fileName,'Mapped - Rrs_412'); Rrs_443=hdfread(fileName,'Mapped - Rrs_443'); Rrs_488=hdfread(fileName,'Mapped - Rrs_488'); Rrs_531=hdfread(fileName,'Mapped - Rrs_531'); Rrs_547=hdfread(fileName,'Mapped - Rrs_547'); Rrs_667=hdfread(fileName,'Mapped - Rrs_667'); Rrs_678=hdfread(fileName,'Mapped - Rrs_678'); Rrs_748=hdfread(fileName,'Mapped - Rrs_748');

Page 47: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 47

Rrs_869=hdfread(fileName,'Mapped - Rrs_869'); lat=hdfread(fileName,'Latitude'); long=hdfread(fileName,'Longitude'); % % % % Rrs_412(Rrs_412<0)=NaN; Rrs_443(Rrs_443<0)=NaN; Rrs_488(Rrs_488<0)=NaN; Rrs_531(Rrs_531<0)=NaN; Rrs_547(Rrs_547<0)=NaN; Rrs_667(Rrs_667<0)=NaN; Rrs_678(Rrs_678<0)=NaN; Rrs_748(Rrs_748<0)=NaN; Rrs_869(Rrs_869<0)=NaN; %% Rrs values for station 24 % Averages the lat/long pixel with 5 surround it, then returns the values % into the vector Rrs_vec % %Station 24 lat_co24=186; long_co24=412; Rrs_vec24(:,1)=averagepixel(lat_co24,long_co24,Rrs_412,5); Rrs_vec24(:,2)=averagepixel(lat_co24,long_co24,Rrs_443,5); Rrs_vec24(:,3)=averagepixel(lat_co24,long_co24,Rrs_488,5); Rrs_vec24(:,5)=averagepixel(lat_co24,long_co24,Rrs_531,5); Rrs_vec24(:,6)=averagepixel(lat_co24,long_co24,Rrs_547,5); Rrs_vec24(:,9)=averagepixel(lat_co24,long_co24,Rrs_667,5); Rrs_vec24(:,10)=averagepixel(lat_co24,long_co24,Rrs_678,5); Rrs_vec24(:,12)=averagepixel(lat_co24,long_co24,Rrs_748,5); Rrs_vec24(:,13)=averagepixel(lat_co24,long_co24,Rrs_869,5);

9.2.1.1.1 Average pixel (Catherine Mitchell)

function pixav = averagepixel(pixelrow,pixelcolumn,variable,n) % Written by Catherine Mitchell % syntax: averagepixel(pixelrow,pixelcolumn,variable,n) % % Averaging a nxn grid of pixels centred on one pixel, where VARIABLE % is the data matrix and PIXELROW & PIXELCOLUMN give the row and column % respectively of the centre pixel. % % Any NaN values present in the nxn grid are ignored % % This function won't average any pixels on the edge of the matrix, i.e. it % requires the centre pixel to be surrounded by 8 pixels

col=repmat(1:n,1,n)'; row=repmat(1:n,n,1); row=row(:); idx = col + n.*(row-1);

Page 48: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 48

pixelstoaverage(idx,:) = [pixelrow+row-((n+1)/2) pixelcolumn+col-((n+1)/2)];

indices = sub2ind(size(variable),pixelstoaverage(:,1),pixelstoaverage(:,2));

pixav = nanmean(variable(indices));

9.2.1.2 Comparison of AC algorithms

% %imports excel file data for AC graph

% Code by Roseanne Clement [data, txt]= xlsread('G:\Project\Data files\Atmos_correction_Rrs_new.xlsx','BC06'); % selects the data for station 24 d24=data(81:89,1:13); wavebands=data(80:80,1:13); d412=d24(1:9,1); d443=d24(1:9,2); d488=d24(1:9,3); d510=d24(7:9,4); d531=d24(1:6,5); d547=d24(1:6,6); d554=d24(7:9,7); d665=d24(7:9,8); d667=d24(1:6,9); d678=d24(1:6,10); d700=d24(7:9,11); d748=d24(1:6,12); d869=d24(1:6,13); % satellite data includes different AC algorithms dsat=cat(2,d412(1:6),d443(1:6),d488(1:6),d531,d547,d667,d678,d748,d869); dins=cat(2,d412(7:9),d443(7:9),d488(7:9),d510,d554,d665,d700); dins=dins(3,1:7); dsat=dsat(1:4,1:9); satwave=wavebands([1:3 5:6 9:10 12:13]); inswave=wavebands([1:4 7:8 11]); figure % plots the default AC plot(satwave,dsat(1,:),'--','Color','r'); hold on; % bpa AC plot(satwave,dsat(2,:),'--','Color','m'); hold on; % MUMM AC plot(satwave,dsat(4,:),'-','Color','b','LineWidth',2.5); hold on; % in situ data plot(inswave,dins,'-','Color','g','LineWidth',2.5); xlabel('Waveband (nm)'); axis([412 869 0 0.014]); ylabel('Rrs Value (sr^-^1)'); title('Comparison of Atmospheric Correction Algorithms to in situ'); legend('Default','BPA','MUMM','in situ');

Page 49: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 49

9.2.2 MUMM AC procedure - Rayleigh-correctedreflectance plot

fileName='G:\Project\hdf\Stonehaven\rhom\A2008296130500_rhom.hdf'; rhom_748=hdfread(fileName,'Mapped - rhom_748'); rhom_869=hdfread(fileName,'Mapped - rhom_869'); rhom_7=(rhom_748(80:424,1:500)); rhom_8=(rhom_869(80:424,1:500));

r_748=reshape(rhom_7,172500,1); r_869=reshape(rhom_8,172500,1); r_748(r_748<-0.01)=NaN; r_748(r_748>0.04)=NaN; r_869(r_869<-0.01)=NaN; r_869(r_869>0.04)=NaN;

figure scatter(r_748,r_869,'x'); hold on; %def epsilon (dot dash) 1 line3=refline(1,0); set(line3,'LineStyle','-.','Color','k'); % average epsilon 0.9825 line5=refline(1.0178,0); set(line5,'LineStyle','-','Color','r'); ylabel('Rayleigh corrected reflectances at 869nm'); xlabel('Rayleigh corrected reflectances at 748nm'); xlim([0 0.030]); ylim([0 0.030]); title('Rayleigh corrected reflectance graph for the analysis of epsilon');

9.2.3 Time series production

9.2.3.1 Import all the HDF files

% Originally done by Catherine Mitchell, edited by Roseanne Clement

% Imports all hdf files from within one parent directory with lots of

% subdirectories.

% Collates required L2 products & dates of files and saves to a .mat file.

% This is done yearly, so end up with individual .mat files for each year,

% with naming format:

% StXXXsat.mat where St is for Stonehaven

% XXXX is replaced by the year e.g. 2007

% sat indicates variables that are products obtained

% straight from SeaDAS (e.g. Rrs,...)

tic

%% selecting required files

directory1 = 'E:\Stonehaven_Pentland\Stonehaven\2007'; %parent directory of location of hdf files

directory2 = 'E:\Stonehaven_Pentland\Stonehaven\2008';

directory3 = 'E:\Stonehaven_Pentland\Stonehaven\2009';

directory4 = 'E:\Stonehaven_Pentland\Stonehaven\2010';

Page 50: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 50

directory = 'C:\Users\MORSE\Documents\Project\Time Series Data\'; %location to save .mat file of collated

data

alldirectories = cat(2,{directory1},{directory2},{directory3},{directory4});

for j = 1:4;

reqdir = alldirectories{j};

allfiles = getAllFiles(reqdir);

idx = ~cellfun(@isempty,strfind(allfiles,'.hdf')); %change this if looking for a different file extension

directories = allfiles(idx,:);

fileidx = cellfun(@(x)regexp(x,'\w*.hdf'),directories);

numfiles = length(directories);

for num = 1:numfiles

filenames{num,j} = directories{num}(fileidx(num):end);

req_directories{num,j} = directories{num}(1:(fileidx(num)-1));

end

clear num fileidx idx allfiles numfiles

end

clear j directory1 directory2 directory3 directory4 reqdir

clear directories alldirectories

%% importing data

dayofyear = cell(numfiles,8); %preallocating

for j=1:4

files = filenames(:,j);

numfiles = length(files);

data = cell(numfiles,9); %preallocating

for num = 1:numfiles;

disptext = strcat(num2str(j),' : ',num2str(num));

disp(disptext)

if isempty(req_directories{num,j})

continue

else

cd(req_directories{num,j});

end

dayofyear{num} = files{num}(6:8);

year = files{1}(2:5);

fileinfo=hdfinfo(files{num});

fileinfo2=cat(2,fileinfo.SDS(1:11),fileinfo.SDS(6),fileinfo.SDS(6),fileinfo.SDS(13:14));

fileinfo3(1).Filename=fileinfo.Filename;

fileinfo3(1).SDS=struct(fileinfo2);

sdsinfo=fileinfo3.SDS;

Names={sdsinfo.Name};

chloridx = ~cellfun(@isempty,strfind(Names,'chlor_a'));

Rrsidx = ~cellfun(@isempty,strfind(Names,'Rrs'));

Kdidx = ~cellfun(@isempty,strfind(Names,'Kd_490'));

mssuidx = ~cellfun(@isempty,strfind(Names,'Rrs_667'));

msslidx = ~cellfun(@isempty,strfind(Names,'Rrs_667'));

idx = chloridx | Rrsidx | Kdidx | mssuidx | msslidx ;

Page 51: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 51

variables = Names(idx);

numvar = length(variables);

for var=1:numvar

variabledata = variables{var};

data{num,var}=hdfread(files{num},variabledata);

end

if num == 1

Latitude = hdfread(files{num},'Latitude');

Longitude = hdfread(files{num},'Longitude');

end

clear fileinfo fileinfo2 fileinfo3 sdsinfo numvar var variabledata Rrsidx chloridx Kdidx mssuidx msslidx

idx variables Names

end

data( all(cellfun(@isempty,data),2), : ) = [] ;

files( all(cellfun(@isempty,files),2), : ) = [] ;

varname = strcat('data',year);

assignin('base',varname,data);

clear numfiles num data

%% determining date from day of year

dayofyear = cellfun(@str2num,dayofyear);

dates = doy2date(dayofyear',cellfun(@str2num,repmat({year},1,length(dayofyear))));

dates = datestr(dates);

dates = cellstr(dates);

dates = cat(2,dates,files);

datesname = strcat('dates',year);

assignin('base',datesname,dates);

clear dates

%% sorting & saving data into a .mat file

fileinfo=hdfinfo(files{end});

fileinfo2=cat(2,fileinfo.SDS(1:11),fileinfo.SDS(13:14));

fileinfo2(1).Filename=fileinfo.Filename;

fileinfo2(1).SDS=struct(fileinfo2);

sdsinfo=fileinfo2.SDS;

Names=cat(2,{sdsinfo.Name},'Mapped - MSS_Upper','Mapped - MSS_Lower');

latidx = ~cellfun(@isempty,strfind(Names,'Lat'));

lonidx = ~cellfun(@isempty,strfind(Names,'Lon'));

idx = latidx | lonidx ;

Names = Names(~idx);

Names = cellfun(@(x)strrep(x,'Mapped - ',''),Names,'uniformoutput',false);

info = {strcat('This .mat file contains satellite data from,',year);...

'The data is from the cloud free days as identified by Roseanne';...

'These were reprocessed from L1A to give Rrs412 - Rrs667, Kd_490, chlor_a';...

'Region covered: north = 57.75, south = 56.15, east = -1.3, west = -3';...

'Mapped via mercator projection for smaller region: [-1.3 -3] [56.15 57.75]';...

'"data" is a nxm cell, where m = number of variables which are given in "Names"';...

' and n = number of files, dates of which are given in "dates"'};

Page 52: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 52

cd (directory) %change directory to where you want the data saved

matfilename = strcat('St',year,'sat');

save(matfilename,'Latitude','Longitude',varname,'Names',datesname,'info','-v7.3');

evalin('caller',['clear ',varname]);

evalin('caller',['clear ',datesname]);

clear dayofyear year fileinfo fileinfo2 sdsinfo Names latidx lonidx idx Names info matfilename

clear varname datesname files

end

toc

9.2.3.2 Flagging certain values to NaNs

%%Taking the data from the yearly satellite data .mat files (e.g.

% %St2007sat.mat) and setting the "flagged" values to NaN. The "flagged"

%% values are the land/cloud pixels and also at any point when the swath

%% only covers half the required area so don't actually have any data

%% over part of the image. The selected cut-off values for each variable

%% come from inspecting the HDF outputs for a few satellite images.

%%

%% NB - for Rrs667, the condition for estimating "erronous" values from

%% Rrs488 and Rrs547 (in the Lee QAAv5 update pdf) is carried out first,

%% before setting all negative values to NaN

%% Code originally made by Catherine Mitchell

%% edited by Roseanne Clement

cd('C:\Users\MORSE\Documents\Project\Time Series Data\');

year = {'2007','2008','2009','2010'};

for j = 1:4

txt = ['loading matfile: ' num2str(j)];

disp(txt);

matname = strcat('St',year{j},'sat.mat');

matObj = matfile(matname);

Names = matObj.Names;

dataname = strcat('data',year{j});

numim = whos(matObj,dataname);

numim = numim.size(1);

details = whos('-file',matname);

varnames = {details.name};

data = cell(numim,13);

for im = 1:numim

txt = ['matfile: ' num2str(j) ' Image: ' num2str(im)];

disp(txt);

satdata = matObj.(varnames{4});

satdata = satdata(im,:);

% Rrs

Page 53: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 53

Rrsidx = ~cellfun(@isempty,strfind(Names,'Rrs'));

Rrs = satdata(:,Rrsidx);

Rrsnames = Names(Rrsidx);

clear idx Rrsidx

[~,numvar] = size(Rrs);

for entry = 1:(numvar-1)

Rrs{entry}(Rrs{entry} <= 0 | Rrs{entry} > 0.048)=NaN;

end

Rrs667idx = ~cellfun(@isempty,strfind(Rrsnames,'Rrs_667'));

Rrs547idx = ~cellfun(@isempty,strfind(Rrsnames,'Rrs_547'));

Rrs488idx = ~cellfun(@isempty,strfind(Rrsnames,'Rrs_488'));

Rrs443idx = ~cellfun(@isempty,strfind(Rrsnames,'Rrs_443'));

Rrs667 = Rrs(:,Rrs667idx);

Rrs547 = Rrs(:,Rrs547idx);

Rrs488 = Rrs(:,Rrs488idx);

flagged=Rrs667{1} > 20*(Rrs547{1}.^1.5) | Rrs667{1} < 0.9*(Rrs547{1}.^1.7);

Rrs667{1}(flagged) = 1.27*(Rrs547{1}(flagged).^1.47)...

+ 0.00018*((Rrs488{1}(flagged)./Rrs547{1}(flagged)).^-3.19);

Rrs667{1}(Rrs667{1}<=0 | Rrs667{1} > 0.048) = NaN;

Rrs(:,Rrs667idx) = Rrs667;

%mss

Rrs_667=Rrs667{1};

MSSu=26014.*((Rrs_667).^2)+916.*(Rrs_667)-0.13;

MSSl=2508.*((Rrs_667).^2)+768.*(Rrs_667)-0.77;

mss_u=cell(1);

mss_l=cell(1);

mss_u{1}=MSSu;

mss_l{1}=MSSl;

clear Rrs443idx Rrs488idx Rrs547idx Rrs667idx Rrsidx Rrs547 Rrs488 Rrs667 entry file flagged

%chlor_a

chloridx = ~cellfun(@isempty,strfind(Names,'chlor_a'));

chlor_a = cell2mat(satdata(:,chloridx));

chlor_a(chlor_a < -3277) = NaN;

Chlor_a=cell(1);

Chlor_a{1}=chlor_a;

%Kd

Kdidx = ~cellfun(@isempty,strfind(Names,'Kd_490'));

Kd_490 = cell2mat(satdata(:,Kdidx));

Kd_490(Kd_490 > 6.55) = NaN;

kd_490=cell(1);

kd_490{1}=Kd_490;

clear chloridx Kdidx satdata

Page 54: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 54

data(im,:) = cat(2,Rrs,Chlor_a{1},kd_490{1},mss_u{1},mss_l{1});

clear Rrs Kd_490 chlor_a mss_u mss_l

end

assignin('base',dataname,data);

clear data

txt = ['saving to matfile: ' num2str(j)];

disp(txt);

save(matname,dataname,'-v7.3','-append')

keep year

% NB this keep.m is from the file exchange,

% and needs to be in the Time Series Data folder

end

9.2.3.3 Reduce the resolution to specific point

%%This script is taking the data from the yearly .mat files of satellite

%% data from the Stonehaven times series (i.e. the file St2007sat.mat).

%% The resolution of the data is then reduced from the 500x500 matrices

%% to 49x71 matrices. The reduction was done by averaging an 7x7 pixel

%% box around a centre location. If the 7x7 box contained more than

%% half clouds, it was ignored and set to NaN. A time series can now be

%% looked at for each matrix entry - so we have a total of 3479

%% individual time series which cover the Stonehaven area.

%% The data is output into individual text files by variable and by year.

%% The data is output as 3479x1 vectors corresponding to each day, with a

%% latitude and longitude vector of 3479x1 each, so the daily data

%% vectors can be reshaped back into corresponding 49x71 matrices.

%% Code originally done by Catherine Mitchell.

%% Edited by Roseanne Clement.

tic

% finding the centre of the grid squares

for i=1:49

for j=1:71

centrepixelsrow(i) = 7*i-3;

centrepixelscol(j) = 7*j-3;

end

end

clear i j

centrepixelsrow = repmat(centrepixelsrow',71,1);

centrepixelscol = reshape(centrepixelscol(ones(1,49),:),1,[])';

centrepixels = cat(2,centrepixelsrow,centrepixelscol);

clear centrepixelsrow centrepixelscol

%% locating and sorting .mat files

reqdir = 'C:\Users\MORSE\Documents\Project\Time Series Data';

allfiles = getAllFiles(reqdir);

idx = ~cellfun(@isempty,strfind(allfiles,'.mat'));

Page 55: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 55

allfiles = allfiles(idx); clear idx

N = length(allfiles);

for j = 1:N %dealing with each .mat file individually

%% importing required data from .mat file

matobj = matfile(allfiles{j});

details = whos('-file',allfiles{j});

varnames = {details.name};

dataidx = ~cellfun(@isempty,strfind(varnames,'data'));

datesidx = ~cellfun(@isempty,strfind(varnames,'dates'));

Namesidx = ~cellfun(@isempty,strfind(varnames,'Names'));

data = matobj.(varnames{dataidx});

dates = matobj.(varnames{datesidx});

Names = matobj.(varnames{Namesidx});

[numim numvar] = size(data);

year = varnames{dataidx}(end-3:end);

clear dataidx datesidx Namesidx details

%% reducing resolution

region = zeros(numim,numvar,3479);

for im = 1:numim

txt = ['matfile: ' num2str(j) ' Reducing image: ' num2str(im)];

disp(txt);

for var = 1:numvar

for i=1:3479

box = data{im,var}((centrepixels(i,1)-3):(centrepixels(i,1)+3),...

(centrepixels(i,2)-3):(centrepixels(i,2)+3));

nancount = sum(isnan(box(:)));

if nancount < 24 % only averaging boxes with cloud cover of <50%

region(im,var,i) = averagepixel(centrepixels(i,1),centrepixels(i,2),data{im,var},7);

end

clear box nancount

end

end

end

clear im var numim clear txt

region(region <= 0) = NaN;

region(imag(region) ~= 0) = NaN;

if j == 1 %importing and reducing Latitudes and Longitudes & reducing resolution

for i=1:3479

latidx = ~cellfun(@isempty,strfind(varnames,'Lat'));

lonidx = ~cellfun(@isempty,strfind(varnames,'Lon'));

Latitude = matobj.(varnames{latidx});

Longitude = matobj.(varnames{lonidx});

lat(i) = averagepixel(centrepixels(i,1),centrepixels(i,2),Latitude,7);

Page 56: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 56

long(i) = averagepixel(centrepixels(i,1),centrepixels(i,2),Longitude,7);

end

end

clear i latidx lonidx Latitude Longitude varnames

%% writing variables to different text files

for var=1:numvar

txt = ['matfile: ' num2str(j) ' Exporting variable : ' num2str(var)];

disp(txt)

filename = strcat('C:\Users\MORSE\Documents\Project\Time Series Data\',...

Names{var},'_',year,'.txt');

tsdata = squeeze(region(:,var,:));

tsdata = cat(1,lat,long,tsdata);

fid = fopen(filename,'w');

if strncmp(Names{var},'z1',2)

name = Names{var};

name = name(1:end-1);

fprintf(fid,['Time series data from ' year ' for ' name '.\r\n']);

else

fprintf(fid,['Time series data from ' year ' for ' Names{var} '.\r\n']);

end

fprintf(fid,'Resolution was reduced so now have a 49x71 grid covering the region (rather than the original

500x500).\r\n');

fprintf(fid,'The value for each grid box was obtained by averaging 7x7 pixel box around the centre of each

grid box.\r\n');

fprintf(fid,'If the grid box contained more than 50%% cloud it was ignored (set to NaN).\r\n');

fprintf(fid,'\r\n'); fprintf(fid,'\r\n'); fprintf(fid,'\r\n');

fprintf(fid,' ');

fprintf(fid,'%s ',dates{:,1});

fprintf(fid,'\r\n');

fprintf(fid,' Latitude Longitude');

fprintf(fid,'\r\n');

dlmwrite(filename,tsdata','-append','delimiter','\t','precision','%11.5f');

fclose(fid);

end

clear var txt numvar Names data dates fid region year tsdata

end

%%

clear N allfiles

toc

9.2.3.4 Import time series

function [data lat long dates] = ImportTimeSeries(var)

% Imports the time series data for variable VAR from the yearly text files

% (e.g. chlor_a_2007, chlor_a_2008,...) and combines into a full time series from

% 2007 - 2010, for the reduced resolution Stonehaven data.

%

% [DATA LAT LONG DATES] = ImportTimeSeries(VAR)

%

% VAR = string of the required variable, the first part of the text file

% name e.g. for the chlor_a time series VAR = 'chlor_a'

Page 57: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 57

% DATA = a 3479 x N matrix, where N = the number of points in the time

% series, and 1215 is the number of points in the reduced

% resolution data matrices (i.e. 49 x 71 matrices)

% LAT = a 3479 x 1 vector, with latitude values corresponding to each

% row on the DATA matrix

% LONG = a 3479 x 1 vector, with longitude values corresponding to each

% row on the DATA matrix

% DATES = a N x 3 cell, where N = number of points in the time series,

% the 1st column contains the dates corresponding to each column

% in the DATA matrix, the 2nd column is the file names and the

% 3rd column is the date as a serial date

%

% Code is originally done by Catherine Mitchell

% Edited by Roseanne Clement

reqdir = 'C:\Users\MORSE\Documents\Project\Time Series Data\'; datefile = 'C:\Users\MORSE\Documents\Projects\Time Series Data\Dates.txt';

dir1 = 'E:\Stonehaven_Pentland\Stonehaven'; allfiles = getAllFiles(dir1); idx = ~cellfun(@isempty,strfind(allfiles,'.hdf')); directories = allfiles(idx,:); req_directories = cellfun(@(x)regexprep(x,'\w*.hdf',''),directories,'uniformoutput',false); fileidx = cellfun(@(x)regexp(x,'\w*.hdf'),directories); numfiles = length(directories); for num = 1:numfiles; files{num,:} = directories{num}(fileidx(num):end); end numfiles = length(files); dayofyear = cell(numfiles,1); %preallocating year = cell(numfiles,1); %preallocating data = cell(numfiles); %preallocating for num = 1:numfiles; disp(num) cd(req_directories{num}); dayofyear{num} = files{num}(6:8); year{num} = files{num}(2:5); end dayofyear = cellfun(@str2num,dayofyear); year = cellfun(@str2num,year); dates_1 = doy2date(dayofyear',year'); dates_1 = datestr(dates_1); dates_1 = cellstr(dates_1); datesall = cat(2,dates_1,files);

% allfiles = getAllFiles(reqdir); %finding all the .mat files - including within the subdirectories

dirData = dir(reqdir); % finding all the files within the directory dirIndex = [dirData.isdir]; allfiles = {dirData(~dirIndex).name}';

idx = ~cellfun(@isempty,strfind(allfiles,var));

Page 58: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 58

allfiles = allfiles(idx); N = length(allfiles); loc=strcat(reqdir,allfiles); for p=1:N; alldata(p) = importdata(loc{p},'\t'); end data = alldata.data;

datesall = importdata(datefile); %sorting dates datesall = cellfun(@(x)strsplit(x,' '),datesall,'UniformOutput',false); for j=1:length(datesall); dates(j,1) = datesall(j,1); dates{j,3} = datenum(dates(j,1)); end for j = 2:length(dates) if strcmp(dates(j,1),dates(j-1,1)) == 1 time = dates{j,2}(2:14); daymonth = datestr(doy2date(str2double(time(5:7)),str2double(time(1:4))),'ddmmyy'); dates{j,3} =

datenum(str2double(time(1:4)),str2double(daymonth(3:4)),str2double(daymonth(1:2)),str2double(time(8:9)),str

2double(time(10:11)),str2double(time(12:13))); end end

dates = alldata.textdata{8,1}; dates = strsplit(dates,' '); dates(cellfun(@isempty,dates)) = []; clear alldata for j=2:N %sorting data alldata = importdata(loc{j,:},'\t',9); newdata = alldata.data(:,3:end); data = cat(2,data,newdata); newdates = alldata.textdata{8,1}; newdates = strsplit(newdates,' '); newdates(cellfun(@isempty,newdates)) = []; dates = cat(2,dates,newdates); clear newdata alldata newdates end lat = data(:,1); long = data(:,2); data(:,1:2) = [];

clear allfiles N j idx reqdir var

9.2.4 Time series collation and display

%% Imports Time Series for specific variable %

% Code by Roseanne Clement

% %default AC [MSSl LAT LONG DATES]=ImportTimeSeries('MSS_Lower');

Page 59: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 59

[MSSu LAT LONG DATES]=ImportTimeSeries('MSS_Upper'); % MUMM AC epsilon=0.9430 [MSSl_m LAT_m LONG_m DATES_m]=ImportTimeSeriesM('MSS_Lower'); [MSSu_m LAT_m LONG_m DATES_m]=ImportTimeSeriesM('MSS_Upper'); % MUMM AC epsilon=0.9825 [MSSl_m2 LAT_m2 LONG_m2 DATES_m2]=ImportTimeSeriesM_9825('MSS_Lower'); [MSSu_m2 LAT_m2 LONG_m2 DATES_m2]=ImportTimeSeriesM_9825('MSS_Upper'); % loads Mike's data [data, txt]= xlsread('C:\Users\MORSE\Documents\Project\M Data\Turbidity.xlsx'); %chooses the dates matrix in order to use datetick later on dates=[DATES{:,3}]; %reshapes the lat and long vectors lat_r=reshape(LAT,49,71); long_r=reshape(LONG,49,71); lat_r(:,2:71)=[]; long_r(2:49,:)=[]; %used once in order to find the linear point lin_1=sub2ind([49, 71], 36, 38); %1849 Ml=MSSl(1849,:); Mu=MSSu(1849,:); % datesm=[DATES_m{:,3}]; %reshapes the lat and long vectors lat_rm=reshape(LAT_m,49,71); long_rm=reshape(LONG_m,49,71); lat_rm(:,2:71)=[]; long_rm(2:49,:)=[];

Mlm=MSSl_m(1849,:); Mum=MSSu_m(1849,:); % lat_rm2=reshape(LAT_m2,49,71); long_rm2=reshape(LONG_m2,49,71); lat_rm2(:,2:71)=[]; long_rm2(2:49,:)=[];

datesm2=[DATES_m2{:,3}]; Mlm2=MSSl_m2(1849,:); Mum2=MSSu_m2(1849,:); % %steps taken to make the date MATLAB readable for Mike's data for each year for i=1:numel(data(:,1)); date07(i)=datenum(data(i,1),data(i,2),data(i,3)); end data07=cat(2,date07',data(:,4)); % for i=1:numel(data(:,6)); date08(i)=datenum(data(i,6),data(i,7),data(i,8)); end data08=cat(2,date08',data(:,9)); % for i=1:numel(data(:,11));

Page 60: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 60

date09(i)=datenum(data(i,11),data(i,12),data(i,13)); end data09=cat(2,date09',data(:,14)); % for i=1:numel(data(:,16)); date10(i)=datenum(data(i,16),data(i,17),data(i,18)); end data10=cat(2,date10',data(:,19)); % % concatenates the dates and data files into one matrix, where each % column is a different year m_dates=cat(2,date07',date08',date09',date10'); m_turbid=cat(2,data07(:,2),data08(:,2),data09(:,2),data10(:,2)); % % this sets the limit on the turbid value m_turbid(m_turbid>6.5)=NaN; % m_turbid=m_turbid.*0.9946; % % used in order to set the error bars from the mid point between the % Mu and Ml for u=1:numel(Mu); M_mid(u)=nanmean([Mu(u),Ml(u)]); M_diff(u)=(Mu(u)-M_mid(u)); end

for um=1:numel(Mum); M_midm(um)=nanmean([Mum(um),Mlm(um)]); M_diffm(um)=(Mum(um)-M_midm(um)); end

for umt=1:numel(Mum2); M_midm2(umt)=nanmean([Mum2(umt),Mlm2(umt)]); M_diffm2(umt)=(Mum2(umt)-M_midm2(umt)); end

figure % plots the values of MSS upper and MSS lower as error bars ax1=gca; hold on;

% plots the error bars for the default AC e_d=errorbar(dates,M_mid,M_diff,'rs','MarkerEdgeColor','b','MarkerSize',3,'Color','b','LineWidth',1.75);

%sets the x axis to date datetick; hold on % plots the error bars for mumm (0.9430)

%

e_m=errorbar(datesm,M_midm,M_diffm,'rs','MarkerEdgeColor','g','MarkerSize',3,'Color','g','LineWidth',1.75);

% hold on

%plots the error bars for mumm (0.9825) e_m2=errorbar(datesm2,M_midm2,M_diffm2,'rs','MarkerEdgeColor','g','MarkerSize',3,'Color','g','LineWidth',1.

75); hold on

Page 61: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 61

datetick; ylim([0 5.5]); datetick; hold on ylabel('MSS (g/m^3)'); xlabel('Date'); hold on ax2=axes('Position',get(ax1,'Position'),'YAxisLocation','right',... 'Color','none','YLim',[0 5.5]); linkaxes([ax1 ax2],'x'); hold on plot(m_dates,m_turbid,'r-

s','MarkerEdgeColor','k','MarkerFaceColor','r','LineWidth',2,'MarkerSize',3,'Color','r','Parent',ax2); datetick; hold on; ylabel('Turbidity (FTU)'); xlim([733020 734535]); ylim([0 5.5]); hold on; title('Turbidity comparison between satellite and in situ data'); l1=legend(ax1,'Default','MUMM'); set(l1,'Location','NorthWest'); l2=legend(ax2,'in situ'); set(l2,'Location','NorthEast','Color','none'); hold off

9.2.5 Comparison of seasonal averages of MSS and turbidity

% imports excel file data for graph [data, txt]= xlsread('G:\MSS Correlation.xlsx','Sheet3'); is=data(:,1); mss=data(:,2); y=['Wi07';'Sp07';'Su07';'Au07';'Wi08';'Sp08';'Su08';'Au08';'Wi09';'Sp09';'Su09';'Au09';'Wi10';'Sp10';'Su10';'Au1

0']; figure plot(1:16,mss,1:16,is); set(gca,'XTick',(1:16)); set(gca,'XTickLabel',y); ylabel('Turbidity/MSS'); xlabel('Season and year'); axis([1 16 0 3.5]); legend('MSS Upper','In-situ Turbidity');

9.2.6 Comparison of aerosol reflectance ratios

%% Imports Rrs and lat/long data from hdf files in directory chosen fileNamed='G:\Project\hdf\Stonehaven\2007_ac_comp\A2007002123000_mummdefscript2.hdf'; fileNamei='G:\Project\hdf\Stonehaven\2007_ac_comp\A2007002123000_mummindscript2.hdf'; fileNamea='G:\Project\hdf\Stonehaven\2007_ac_comp\A2007002123000_mummavescript4.hdf'; %Import Rrs, Latitude and Longitude etc % Rrs 667 for the default epsilon MUMM values Rrs_667d=hdfread(fileNamed,'Mapped - Rrs_667'); % Rrs 667 for the individual epsilon MUMM files values Rrs_667i=hdfread(fileNamei,'Mapped - Rrs_667'); % Rrs 667 for the average epsilon MUMM values

Page 62: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 62

Rrs_667a=hdfread(fileNamea,'Mapped - Rrs_667'); lat=hdfread(fileNamed,'Latitude'); long=hdfread(fileNamed,'Longitude');

% Neil et al. equations for MSS upper and lower Mud=26014.*((Rrs_667d).^2)+916.*(Rrs_667d)-0.13; Mld=2508.*((Rrs_667d).^2)+768.*(Rrs_667d)-0.77;

Mui=26014.*((Rrs_667i).^2)+916.*(Rrs_667i)-0.13; Mli=2508.*((Rrs_667i).^2)+768.*(Rrs_667i)-0.77;

Mua=26014.*((Rrs_667a).^2)+916.*(Rrs_667a)-0.13; Mla=2508.*((Rrs_667a).^2)+768.*(Rrs_667a)-0.77;

%Location north=57.75; south=56.15; east=-1.3; west=-3; % difference between MSS upper for individual and default Muid=Mui-Mud; % difference between MSS upper for individual and average Muia=Mui-Mua;

% map the values of the difference figure m_proj('mercator','longitudes',[west east],'latitudes',[south north]); %Muid is the variable m_pcolor(long,lat,Muid); shading flat; m_gshhs_i('patch',[0.5 0.5 0.5], 'edgecolor','k'); m_grid('box','fancy','tickdir','out','linestyle','none'); h=colorbar; [X,Y]=m_ll2xy(-2.112,56.964); line(X,Y,'marker','square','markersize',4,'color','black','markerfacecolor','black'); set(gcf,'renderer','zbuffer'); colormap(SeadasChlMap) caxis([0 1.5]) title ('MSS Upper - MUMM ind - MUMM def')

figure m_proj('mercator','longitudes',[west east],'latitudes',[south north]); %Muia is the variable m_pcolor(long,lat,Muia); shading flat; m_gshhs_i('patch',[0.5 0.5 0.5], 'edgecolor','k'); m_grid('box','fancy','tickdir','out','linestyle','none'); h=colorbar; [X,Y]=m_ll2xy(-2.112,56.964); line(X,Y,'marker','square','markersize',4,'color','black','markerfacecolor','black'); set(gcf,'renderer','zbuffer');

Page 63: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 63

colormap(SeadasChlMap) caxis([0 1.5]) title ('MSS Upper - MUMM ind - MUMM ave')

9.2.6.1 Map projection (Begler, 2008)

function m_proj(proj,varargin) % M_PROJ Initializes map projections info, putting the result into a structure % % M_PROJ('get') tells you the current state % M_PROJ('set') gives you a list of all possibilities % M_PROJ('set','proj name') gives info about a projection in the % 'get' list. % M_PROJ('proj name','property',value,...) initializes a projection. % % % see also M_GRID, M_LL2XY, M_XY2LL.

% Rich Pawlowicz ([email protected]) 2/Apr/1997 % % This software is provided "as is" without warranty of any kind. But % it's mine, so you can't sell it. % % 20/Sep/01 - Added support for other coordinate systems. % 25/Feb/07 - Swapped "get" and "set" at lines 34 and 47 % to make it consistent with the help % (and common Matlab style) % - Added lines 62-70 & 74 % to harden against error when no proj is set % (fixes thanks to Lars Barring)

global MAP_PROJECTION MAP_VAR_LIST MAP_COORDS

% Get all the projections projections=m_getproj;

if nargin==0, proj='usage'; end;

proj=lower(proj);

switch proj,

case 'set', % Print out their names if nargin==1, disp(' '); disp('Available projections are:'); for k=1:length(projections), disp([' ' projections(k).name]); end; else k=m_match(varargin{1},projections(:).name);

Page 64: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 64

eval(['X=' projections(k).routine '(''set'',projections(k).name);']); disp(X); end;

case 'get', % Get the values of all set parameters if nargin==1, if isempty(MAP_PROJECTION), disp('No map projection initialized'); m_proj('usage'); else k=m_match(MAP_PROJECTION.name,projections(:).name); eval(['X=' projections(k).routine '(''get'');']); disp('Current mapping parameters -'); disp(X); end; else if isempty(MAP_PROJECTION), k=m_match(varargin{1},projections(:).name); eval(['X=' projections(k).routine '(''set'',projections(k).name);']); X=strvcat(X, ... ' ', ... '**** No projection is currently defined ****', ... ['**** USE "m_proj(''' varargin{1} ''',<see options above>)" ****']); disp(X); else k=m_match(varargin{1},projections(:).name); eval(['X=' projections(k).routine '(''get'');']); disp(X); end; end;

case 'usage', disp(' '); disp('Possible calling options are:'); disp(' ''usage'' - this list'); disp(' ''set'' - list of projections'); disp(' ''set'',''projection'' - list of properties for projection'); disp(' ''get'' - get current mapping parameters (if defined)'); disp(' ''projection'' <,properties> - initialize projection\n');

otherwise % If a valid name, give the usage. k=m_match(proj,projections(:).name); MAP_PROJECTION=projections(k);

eval([ projections(k).routine '(''initialize'',projections(k).name,varargin{:});']);

% With the projection store what coordinate system we are using to define it. if isempty(MAP_COORDS), m_coord('geographic'); end; MAP_PROJECTION.coordsystem=MAP_COORDS;

Page 65: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 65

end;

%--------------------------------------------------------- function projections=m_getproj; % M_GETPROJ Gets a list of the different projection routines % and returns a structure containing both their % names and the formal name of the projection. % (used by M_PROJ).

% Rich Pawlowicz ([email protected]) 9/May/1997 % % 9/May/97 - fixed paths for Macs (thanks to Dave Enfield) % % 7/05/98 - VMS pathnames (thanks to Helmut Eggers) % Get all the projections lpath=which('m_proj'); fslashes=findstr(lpath,'/'); bslashes=findstr(lpath,'\'); colons=findstr(lpath,':'); closparantheses=findstr(lpath,']'); if ~isempty(fslashes), lpath=[ lpath(1:max(fslashes)) 'private/']; elseif ~isempty(bslashes), lpath=[ lpath(1:max(bslashes)) 'private\']; elseif ~isempty(closparantheses), % for VMS computers only, others don't use ']' in filenames lpath=[ lpath(1:max(closparantheses)-1) '.private]']; else, lpath=[ lpath(1:max(colons)) 'private:']; end;

w=dir([lpath 'mp_*.m']);

if isempty(w), % Not installed correctly disp('**********************************************************'); disp('* ERROR - Can''t find anything in a /private subdirectory *'); disp('* m_map probably unzipped incorrectly - please *'); disp('* unpack again, preserving directory structure *'); disp('* *'); disp('* ...Abandoning m_proj now. *'); error('**********************************************************'); end; l=1; projections=[]; for k=1:length(w), funname=w(k).name(1:(findstr(w(k).name,'.'))-1); projections(l).routine=funname; eval(['names= ' projections(l).routine '(''name'');']); for m=1:length(names); projections(l).routine=funname; projections(l).name=names{m};

Page 66: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 66

l=l+1; end; end; %---------------------------------------------------------- function match=m_match(arg,varargin); % M_MATCH Tries to match input string with possible options

% Rich Pawlowicz ([email protected]) 2/Apr/1997

match=strmatch(lower(arg),cellstr(lower(char(varargin))));

if length(match)>1, error(['Projection ''' arg ''' not a unique specification']); elseif isempty(match), error(['Projection ''' arg ''' not recognized']);

end;

9.2.7 Seasonal variations in MSS levels

% Code to plot the seasonal changes

% fileName='F:\Stonehaven_Pentland\Stonehaven_MUMMCorr_0.9825\2007\A2007002123000.hdf'; %

Winter

fileName='F:\Stonehaven_Pentland\Stonehaven_MUMMCorr_0.9825\2009\A2009088132000.hdf'; %Spring

% fileName='F:\Stonehaven_Pentland\Stonehaven_MUMMCorr_0.9825\2007\A2007220130500.hdf';

%Summer

% fileName='F:\Stonehaven_Pentland\Stonehaven_MUMMCorr_0.9825\2010\A2010298123000.hdf';

%Autumn

% fileName2='F:\Stonehaven_Pentland\Stonehaven_DefCorr\2007\A2007002123000.hdf';

fileName2='F:\Stonehaven_Pentland\Stonehaven_DefCorr\2009\A2009088132000.hdf';

% fileName2='F:\Stonehaven_Pentland\Stonehaven_DefCorr\2007\A2007220130500.hdf';

% fileName2='F:\Stonehaven_Pentland\Stonehaven_DefCorr\2010\A2010298123000.hdf';

% open file

fopen(fileName);

fopen(fileName2);

%Import Rrs_667, Latitude and Longitude etc

Rrs_667=hdfread(fileName,'Mapped - Rrs_667');

Rrs_667d=hdfread(fileName2,'Mapped - Rrs_667');

lat=hdfread(fileName,'Latitude');

long=hdfread(fileName,'Longitude');

%Location

north=57.75;

south=56.15;

east=-1.3;

west=-3;

Rrs_667(Rrs_667<0)=NaN;

Rrs_667d(Rrs_667d<0)=NaN;

MSS_u=26014.*((Rrs_667).^2)+ 916.*(Rrs_667)-0.13;

MSS_l=2508.*((Rrs_667).^2)+768.*(Rrs_667)-0.77;

MSS_ud=26014.*((Rrs_667d).^2)+ 916.*(Rrs_667d)-0.13;

Page 67: Roseanne Clement - PH450 Project Report

Roseanne Clement PH450 Project Report 67

MSS_ld=2508.*((Rrs_667d).^2)+768.*(Rrs_667d)-0.77;

MSS_u_diff=MSS_u-MSS_ud;

MSS_l_diff=MSS_l-MSS_ld;

%% Mapping

figure

m_proj('mercator','longitudes',[west east],'latitudes',[south north]);

%MSS_u is the variable

m_pcolor(long,lat,MSS_u_diff);

shading flat;

m_gshhs_i('patch',[0.5 0.5 0.5], 'edgecolor','k');

m_grid('box','fancy','tickdir','out','linestyle','none');

h=colorbar;

ylabel(h,'g m^-^3');

[X,Y]=m_ll2xy(-2.112,56.964);

%Marker details

line(X,Y,'marker','square','markersize',4,'color','black','markerfacecolor','black');

set(gcf,'renderer','zbuffer');

colormap(SeadasChlMap)

%Scale of colour

caxis([-0.5 2])