BRB AdehabitatLT help

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

BRB AdehabitatLT help

waterdogdan
Hello all,

  I would like to like to create UDs of each animal (killer whales) using
biased Brownian Bridge (adehabitatLT), then stack all the rasters to then
make UDs of the whole population, then compare volume overlap of subsets of
the population.

  Is this sequence correct?   Does anyone have any sample code that might
help with a section?  I am fairly new to R, but can adapt code.

Import data
Remove duplicate time entries
Change projection from WGS84 to AlaskaAlbers 3338
Create trajectory
Create UDs
Calculate UD areas, contours
# I have everything running until here

Create grid (asc)
Rasterize UDs
Stack rasters for individual tags
Create UDs from raster stacks for population subsets.
Use volume overlap to look at subset habitat use overlap

Thanks!

Dan

ps.  The following code seems to work so far with my data.  Any
recommendations are welcome!

#####################

library(rgdal)
library(grid)

library(sp)
library(gstat)

library(gdata)
library(maptools)

library(shapefiles)
library(splancs)


library(adehabitatHR)
library(adehabitatLT)
library(adehabitatMA)
library(adehabitatHS)

# read in the raw data set...
rawin <- AJ36.KW_PWS.KF_2013_all_DAR.
filtered_r25d3lc2_24Mar2014.xslx

#only one animal, from which to make a trajectory...

rawin <- rawin[which(rawin$animal == "AJ36_2013"),]

# remove locations with exactly the same date and time (incompatible with
#TRJ objects)
rawin <- rawin[which(rawin$deltahr != 0),]

rawlatlon <- rawin[,c ("longitud","latitude")]
rawid <- rawin[,c ("animal")]


# create coordinates
coordinates(rawin) <- c("longitud", "latitude")
coordinates(rawlatlon) <- c("longitud", "latitude")
proj4string(rawlatlon) <- CRS("+proj=longlat +datum=WGS84")

##  project in Alaska Albers EPSG 3338
rawAlb <- spTransform(rawlatlon,CRS("+proj=aea +lat_1=55 +lat_2=65
+lat_0=50 +lon_0=-154 +x_0=0 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m
+no_defs" ))
crawAlb <- cbind(coordinates(rawAlb))

x <-crawAlb[,c("longitud")]
y <-crawAlb[,c ("latitude")]
dfrawinx = data.frame(rawin)
rawinx <-cbind(dfrawinx,x,y)

#define a POSIXct datetime variable...

dates <- as.POSIXct(paste(rawinx$gmt_date, rawinx$gmt_hour, rawinx$gmt_min,
rawinx$gmt_sec),format="%m/%d/%Y %H %M %S", tz="GMT")

### sort the tracking data chronologically
rawinx <- rawinx[order(dates),]

### Creation of the object of class "traj"
trj <- as.ltraj(id = rawinx$animal, xy = rawinx[,c("x", "y")], date = dates)
plot(trj)

##############
# Calculate UDs
##############

# Calculation of parameter D, 'Diffusion parameter', in squared "units" per
#second

diffPar <- BRB.D(trj, Tmax=180*60, Lmin=50)

#Calculate UD, using diffusion parameter
ud <- BRB(trj, D = diffPar, Tmax = 180*60, tau = 300, Lmin = 100, hmin=100,
same4all=FALSE, extent=0.01)


 vud <- getvolumeUD(ud)
 image(vud)
 contour(vud, add=TRUE, nlevels=3, levels=c(50,75,95),  col = c("red",
"blue", "black"),lwd=c(2,1.5,1), drawlabels=TRUE)
 title("UD")

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo