Main Page/Research/MSB/processing model/20090607
From phurvitz
< Main Page | Research | MSB | processing model
Processing Steps with scripts named
Contents
Download
Concatenate individual files
- Establishes unique ID field (seq_id) for each point in the subject's data
Create lines, perform initial activity parsing
- Encodes all geographic features as 3D, where the Z coordinate is inherited from the seq_id value for the coordinate
- Creates PostGIS tables:
- sid_filtered_points
- sid_line
- Creates 3 shapefiles:
- sid_filtered_points.shp (all initial points, classified)
- sid_stat{,unedited}.shp (stationary bouts)
- sid_move{,unedited}.shp (moving bouts)
- Dumps XYZ data as sid_xyzmb.raw.dat.
Manual editing
Each data set (stat, move) needs to be manually reviewed and edited.
- Obviously erroneous vertices (waaaay out) should be deleted (using Ian-ko's tools http://www.ian-ko.com/)
- Ranges of incorrectly coded data should be flagged for recoding
- Vertices need to be identified, using vertex editor in ArcMap.
- Note range of vertices for recoding and place in file recode.txt, with pattern start, end, code, e.g. to specify a range for recoding to stationary:
- 2197, 2480, 0
Apply manual edits
- Reads edited shapefiles (sid_move.shp and sid_stat.shp) into PostGIS as sid_move_intermediate and sid_stat_intermediate and joins them as sid_intermediate.
- Dumps Z coordinates (seq_id) from edited data
- Reads raw Z coordinates (from sid_xyzmb.raw.dat)
- Compares list of raw and edited coordinates, and deletes necessary coordinates
- Recodes activity by recode.txt
- Pushes data to PostGIS as sid_line_edit
- Dumps new versions of shapefiles from PostGIS
- sid_move.shp
- sid_stat.shp
- Allows repeted edit cycles.
Trip, stop, and dwell
- Potentially a method for getting stops: line_edit_to_points.R
- It takes each trip's points and "straightens" them out to allow for measuring the focal count of points in a radius
- It counts the number of points in the radii seq(50,150,25) for each measured point
- There may be thresholds for what is a "stop" based on focal counts.
- This graph may help.
foo <- function(x, y) { dat <- x[x$trip.id==y,] start <- round(min(dat$seq.id), -2) at <- seq(start, max(dat$seq.id), 100) mini <- with(dat, min(rcount.50, rcount.75, rcount.100, rcount.125, rcount.150)) maxi <- with(dat, max(rcount.50, rcount.75, rcount.100, rcount.125, rcount.150)) with(dat, plot(seq.id, rcount.150, ty="l", ylim=c(mini, maxi), xaxt="n") ) abline(h=max(dat$rcount.150)/2, lty=3) axis(1, at=at) color.list <- c("red", "green", "magenta", "blue") radius.list <- c(50,75,100,125) for (i in 1:length(color.list)) { radius <- radius.list[i] color <- color.list[i] cmd.draw <- sprintf("lines(dat$seq.id, dat$rcount.%s, col=\"%s\")", radius, color) eval(parse(text=cmd.draw)) cmd.draw.abline <- sprintf("abline(h=max(dat$rcount.%s)/2, lty=3, col=\"%s\")", radius, color) eval(parse(text=cmd.draw.abline)) } }