Spatial Panel Analysis Method in R

I just posted a new project on my software page. It's a fixed effects panel analysis function. It uses a method from econometrics to detect trends over time across a window of pixels. This increases the robustness of trend analysis as compared to a pixel by pixel regression analysis. An added benefit is the speed you gain as you downscale the original data by a factor defined by the panel size used. The function makes use of the Panel Data Econometrics "plm" package in R.  A detailed overview can be found in this publication.

For a project in the Alaska I ran a quick analysis on MODIS GPP trends across the whole dataset (2001-2013). Below you see the results of a panel analyis of the MODIS GPP data using a panel size of 11 or roughly ~1/10 a degree. Given the pronounced warming of the Arctic a steady increase in GPP is noted across Alaska (up to 0.03 Kg C m -2).

fixed effects panel analysis of MODIS GPP over time

The Jornada experimental range

The Jornada LTER just after a thunderstorm.[/caption]

The image above shows a view across the landscape at the Jornada experimental range or Long Term Ecological Research (LTER) site in the northern Chihuahuan Desert, approximately 25 km northeast of Las Cruces, New Mexico, USA (+32.5 N, -106.8 W, elevation 1188 m), the largest desert in North America and one of the largest deserts in the world.

The Jornada LTER was established by the U.S. Department of Agriculture (USDA) in 1912 on Presidential Executive Order, with four main research goals:

  1. Methods for assessment and monitoring of rangelands at landscape, watershed, and regional scales
  2. Ecologically-based technologies for remediation of degraded rangelands
  3. Animal behavior-based strategies for livestock management
  4. Predictive models of ecosystem responses to changes in climate and other management-dependent and independent drivers.

My current research focusses on phenology and vegetation growth in arid ecosystems, including rangelands such as those at the Jornada LTER. The image above shows the thunderstorms and associated showers passing across the landscape in the distance, lit by a low evening sun. Unlike forest ecosystems these shrub- and grassland ecosystems derive much of their growth from these intermittent pulses of rain, which allow for fast vegetation growth. However, the pulses of water are not well retained as they are quickly used by the vegetation, evaporated from the surface, drained away. As quick as the growth of these ecosystems can progress just after the rain, is their demise when a few weeks without rain pass.

AMP planner 2, Ubuntu amd64 deb package

I picked up my UAV work again. However, I was annoyed by the fact that the standard debian package of the APM planner 2 does not install nicely on the latest Ubuntu 14.04 LTS install because of the upgraded openscenegraph99 libraries (which mess up dependencies).

As such I changed the control file on the original debian package, repackaged it and giving some softlinking the package should installs nicely without triggering any errors in your package manager.

!! The nightly builds of the APM planner now address the above issue. I encourage you to download a nightly build or latest release when using Ubuntu 14.04. My bitbucket repository is offline as of now. !!

Awaiting an update of the official APM planner deb file on the main site you can download my file (at your own discretion) and read the installation instructions here: https://bitbucket.org/khufkens/apm-planner-fix.

 

DaymetR, an official Daymet R package

I have described my DaymetR scripts in previous posts (here and here). However, some communication with Michele Thornton a DAYMET admin at Oak Ridge National Laboratories brought to light some issues in the way I handled specifying a region of interest. Mainly, the reprojection of the netcdf ancillary files at the edges. This is a typical issue when reprojecting raster data. As a solution I requested a shape file of the grid tiles instead of a raster and Michele kindly provided.

After cleaning up my code I also decided to wrap both the single pixel location as well as the gridded data extraction tools in a proper R package!! The package also includes the map by default so no additional data needs to be downloaded. However, I do provide the shapefile of the DAYMET grid tiles separately.

You can download my first R package on my bitbucket page linked to on my software page or by following this link. I validated the code after the recent changes in server setup at DAYMET, and all seems to be fine. Please report any bugs if you find any.

Basic GIS in R

Recently I had to help out a colleague with processing some spatial data in R. The overall goal was to find landscape parameters (topography, soil characteristics, etc.) within the neighbourhood of a flux tower.

The below  code gives a short introduction on how to extract data from both raster and shapefiles (vector data), very common operations .  I will add more tips and tricks as I come across them.

# Load libraries.
# For raster data
require(raster)

# For vector data
require(sp)

# Set flux tower coordinates.
lat= 45.2041
lon=-68.7402

# Define lat / lon projection.
lat_lon <- CRS("+init=epsg:4326")

# Define UTM projection.
utm <- CRS( "+proj=utm +zone=19 +north +ellps=WGS84 +datum=WGS84 +no_defs")

# Read in the coordinates and assign them a projection, # otherwise they remain just 'numbers'
location <- SpatialPoints(cbind(lon,lat), lat_lon)

# Convert to utm using the above projection string
# using spTransform.
location_utm <- spTransform(location, utm)

# Load raster Digital Terrain Map (DTM) data.
# If the raster data has no projection,
# you will have to assign a projection.
# I assume the file has a projection.
dtm <- raster('DTM.tif')

# Relative height of the location of the tower.
dtm_data <- extract(dtm,location_utm)

# Read in soil shapefile.
soils <-  readShapeSpatial("soils.shp")

# Assign projection to the soils.shp file
# if not provided.
proj4string(soils) <- utm

# Extract soil polygon attributes.
soil_attributes <- over(location_utm,soils)

 

Pagination


© 2018. All rights reserved.

Powered by Hydejack v7.5.1