Introduction to GIS for ecologists

gis

I have the difficult task to give an introduction to GIS to master students in ecology and conservation. The lecture has to be done in 1h to save time for some practice.

I chose to make a quick introduction to GIS with an overview of the possible applications. Then most of the presentation will be dedicated to giving the students some keys to avoid the classic problems waiting for GIS newbies namely:

  • geographic coordinate systems and projections;
  • feature creation;
  • data management.

This is a kind of survival kit resulting from my previous experience being in charge of GIS in Conservation Agencies.

You can find the LateX sources of the presentation in my GIT here.

The pdf is available here (please note that I unsuccessfully tried to embed a GIF in a pdf via LateX resulting in a quite strange animation on slide 16).

By the way: happy new year!

Advertisements

Stable isotopes mixing model for published data

Stable isotopes are more and more used in ecology studies. They represent a very efficient way to study food webs and analyses are now cheap enough to allow their use by anyone.

fig2x_expectedincrease

Fig: Isotopic views of food webs in the Everglades (McCutchan et al., 2003)

I am particularly interested in source partitioning, ie in assessing the relative contribution of different sources in the diet of consumers. This was until recently achieved using two sources mixing models and most of the papers were referring to Phillips and Gregg (2001). Nowadays everybody is using Bayesian mixing models and some very user-friendly R packages have been released. We could cite MixSIAR that even come with a GUI.

But all the packages and models are designed to perform the source partitioning of consumers using the raw isotopes values for consumers and the mean + sd values for sources. That makes sense because it is what almost everybody wants to do.

In my case, as I want to use data from previously published studies for a meta-analysis, this is an issue. Indeed, as studies use different models and different fractionation values for the same organisms, I need to recalculate the source partitioning for all studies with the same model and same fractionation values. But most of the studies only reports mean + sd isotope values for consumers. So I had to start from scratch and make a new Bayesian mixing model that allows me to include as a prior the sd of consumers.

I am not a statistician so I asked Andrew Parnell for help. Indeed, he developed simmr, which is already able to compute source partitioning from a unique consumer value but without taking sd into account.

With his precious help we obtained this with y_mean the mean isotope values for the consumer and sigma_obs the standard error for the consumer isotope values:

model {
# Likelihood
for (j in 1:J) {
for (i in 1:N) {
y_mean[i,j] ~ dnorm(inprod(p*q[,j], s_mean[,j]+c_mean[,j]) / inprod(p,q[,j]), 1/var_y[j])
}
var_y[j] <- inprod(pow(p*q[,j],2),pow(s_sd[,j],2)+pow(c_sd[,j],2))/pow(inprod(p,q[,j]),2)
+ pow(sigma_obs[,j],2) + pow(sigma[j],2)
}

# Prior on sigma
for(j in 1:J) { sigma[j] ~ dunif(0,0.01) }

# CLR prior on p
p[1:K] <- expf/sum(expf)
for(k in 1:K) {
expf[k] <- exp(f[k])
f[k] ~ dnorm(mu_f[k],1/pow(sigma_f[k],2))
}
# Prior on mu
for(k in 1:K) {
mu_f[k] ~ dnorm(0,1)
sigma_f[k] ~ dgamma(2,1)
}

}

You just have to run it with rjags. I will try to put an example it on my GIT with an Rnotebook soon.

If you are completely new in this area, I strongly recommend looking here for Andrew’s amazing courses….

 

Scripting raster calculation in QGIS

I am now extracting landuse data from raster images. These images are quite big as they cover the entire world.

One classical first step to reduce computation time, or simply to limit a raster to the extent of the other one is to fold the two rasters. I need to do this for at least 100 watersheds. In QGIS, you can use:

  • the native rastercalculator but it has no batch calculation option
  • r.map.calc from GRASS tools but I don’t know why I only get nan values…
  • raster calculator from SAGA

As I have recently started to learn Python, I wrote a script for QGIS raster calculator to perform the same operation on several rasters.

We want:
– to multiply each raster by the same other one,
– to chose the raster from the ones that are already loaded in QGIS.

Here is the script to add to QGIS (Processing > Scripts > Tools > Add script from file):

##Multiple raster fold=name
##Raster=multiple raster
##Raster_2=raster
##OUT=folder

import glob, qgis
from PyQt4.QtCore import QFileInfo
from qgis.analysis import QgsRasterCalculatorEntry, QgsRasterCalculator
from qgis.core import QgsMapLayerRegistry, QgsRasterLayer

# Split rasters
layers = Raster.split(‘;’)
output_path = OUT + “/”
suffix = “_suffix.tif”

# Get raster to fold old the other with

var = processing.getObjectFromUri(Raster_2)
Raster_2 = QgsRasterCalculatorEntry()
Raster_2.ref = ‘var@1’
Raster_2.raster = var
Raster_2.bandNumber = 1

for ras in layers:
# Get layer object
lyr = processing.getObjectFromUri(ras)
entries = []
ras = QgsRasterCalculatorEntry()
ras.ref = ‘lyr@1’
ras.raster = lyr
ras.bandNumber = 1
entries.append( ras )
entries.append( Raster_2 )

# Define the calcul to be made
calc = QgsRasterCalculator( ‘lyr@1 * var@1′, output_path + lyr.name() + suffix,’GTiff’, lyr.extent(), lyr.width(), lyr.height(), entries )
calc.processCalculation()

# Load the results in QGIS
for results in glob.glob(output_path + “*” + suffix):
fileInfo = QFileInfo(results)
path = fileInfo.filePath()
baseName = fileInfo.baseName()
layer = QgsRasterLayer(path, baseName)
QgsMapLayerRegistry.instance().addMapLayer(layer)

 

 

 

Seminar at Karlstad University: “Conservation of highly endangered species does not necessarily lead to biodiversity conservation”

I gave a seminar last week at Karlstad University for students and colleagues. As students are now following a course on Conservation biology I chose to make a talk using results from my PhD and Aurélien Besnard ‘s PhD. Indeed our PhDs were part of the same project.

The idea was to take the example of the Loire Valley where the conservation strategy of grasslands is mainly based on the protection of the Corn crex (Crex crex) but does not allow the conservation of other grassland briding birds, arthropods and plants.

A Corn crex male singing. Cutting meadows too early kills Corn crex broods

A very good example of the low efficiency of the ‘umbrella species’ conservation strategy!

You can download the pdf here and the Latex sources are on my GIT here.

The papers related to this seminar are:

  • Besnard AG, Secondi J (2014) Hedgerows diminish the value of meadows for grassland birds: Potential conflicts for agri-environment schemes. Agric Ecosyst Environ 189:21–27 . doi: 10.1016/j.agee.2014.03.014 (pdf)
  • Humbert J-Y, Pellet J, Buri P, Arlettaz R (2012) Does delaying the first mowing date benefit biodiversity in meadowland? Environ Evid 1:9 . doi: 10.1186/2047-2382-1-9
  • Lafage D, Maugenest S, Bouzillé J-B, Pétillon J (2015) Disentangling the influence of local and landscape factors on alpha and beta diversities: opposite response of plants and ground-dwelling arthropods in wet meadows. Ecol Res 30:1025–1035 . doi: doi:10.1007/s11284-015-1304-0 (pdf)
  • Lafage D, Pétillon J (2016) Relative importance of management and natural flooding on spider, carabid and plant assemblages in extensively used grasslands along the Loire. Basic Appl Ecol 17:535–545 . doi: 10.1016/j.baae.2016.04.002 (pdf)
  • Lafage D, Pétillon J (2014) Impact of cutting date on carabids and spiders in a wet meadow. Agric Ecosyst Environ 185:1–8 (pdf)

 

 

Papers

  • Lafage D, Bonis A, Rapinel S, Bouzillé J-B (2017) Using landscape metrics on satelite imagery o assess the conservation satus of Natura 2000 habitats. In: Prodrome et cartographie des végétations de France. Documents phytosociologiques, Saint Mandé, France (pdf)
  • Lafage D, Maugenest S, Bouzillé J-B, Pétillon J (2015a) Disentangling the influence of local and landscape factors on alpha and beta diversities: opposite response of plants and ground-dwelling arthropods in wet meadows. Ecol Res 30:1025–1035 . doi: doi:10.1007/s11284-015-1304-0 (pdf)
  • Lafage D, Papin C, Secondi J, et al (2015b) Short term recolonisation by arthropod after a spring flood, with a focus on spiders and carabids. Ecohyrdology 8:1584–1599 . doi: 10.1002/eco.1606 (pdf)
  • Lafage D, Pétillon J (2016) Relative importance of management and natural flooding on spider, carabid and plant assemblages in extensively used grasslands along the Loire. Basic Appl Ecol 17:535–545 . doi: 10.1016/j.baae.2016.04.002 (pdf)
  • Lafage D, Pétillon J (2014) Impact of cutting date on carabids and spiders in a wet meadow. Agric Ecosyst Environ 185:1–8 (pdf)
  • Lafage D, Secondi J, Georges A, et al (2014) Satellite-derived vegetation indices as surrogate of species richness and abundance of ground beetles in temperate floodplains. Insect Conserv Divers 7: 327-333
  • Laffaille P, Briand C, Fatin D, et al (2005) Point sampling the abundance of European eel (Anguilla anguilla) in freshwater areas. Arch für Hydrobiol 162:91–98 (pdf)
  • Varet M, Burel F, Lafage D, Pétillon J (2013) Age-dependent colonisation of urban habitats : a diachronic approach using carabid beetles and spiders. Anim Biol 63:257–269 (pdf)

Presentation

I recently started a post-doc in the NRRV group at Karlstad University to work on aquatic/terrestrial exchanges. I started research after working 10 years in Nature Reserves and Conservation Agencies where I was specialised in terrestrial fauna monitoring and conservation (mainly birds, invertebrates and bats), statistics, GIS and database management.

I completed my doctorate in 2014 from the Muséum National d’Histoire Naturelle de Paris (France). My PhD thesis was dealing with the impact of management practices and natural perturbations (mainly flooding) on arthropods (spiders and carabid beetles) and plants in meadows. It also included a study using remote sensing technics to map vegetation associations using satellite imagery.

I consider myself as a community ecologist with a particular focus on arthropods.

In the NRRV group, I will particularly work on a meta-analysis on the landscape drivers of aquatic/terrestrial fluxes. I will mainly focus on studies using stable isotopes for diet partitionning.

As I have a particular interest in what we could call ‘perturbation ecology’ I will also work on food webs after spring floods.

I have also the chance to be the co-advisor of a PhD based in Norway aiming at forecasting the impact of climate change on fishing spiders repartition in Scandinavia.

Finally, I will also be involved in various projects where my skills in terrestrial arthropod ecology are required.