You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For an unknown reason, large sections of the North American coastline are not mapping correctly using the fmap function. The locations of the fit_ssm output are mapped correctly, including dates and error ellipses, but much of the northern hemisphere is not. I have tried several different dependencies for the fmap function (e.g., rgeos, geos, ggmap) but nothing seems to fix it. I would very much like to use these maps. Based on the shading, I am guessing something is wrong with how the function is processing land cover, perhaps related the crossing the date line in the map? Unsure. Any help would be appreciated! Below is the code I am using and a representative figure.
#make data compatible with package
#error estimates from Shaffer et al 2005
fgshear<-sheardata[,c(2,5:7)]
colnames(fgshear)<-c("id","date","lon","lat")
fgshear$lc<-as.character("GL")
fgshear<-fgshear %>% relocate(lc, .before = lon)
fgshear$lonerr<-1.68
fgshear$laterr<-1.95
#fit CRW SSM to one example bird
onebirdexample<-fgshear[fgshear$id == "3105004",]
onebirdexample$id<-as.character(onebirdexample$id)
fitwater<-fit_ssm(onebirdexample, model = "crw", time.step = 24, vmax = 12.5)
fitwater
#plot example
plot(fitwater, what = "predicted", type = 1, pages = 1)
plot(fitwater, what = "fitted", type = 2, pages = 1)
fmap(fitwater, what = "fitted")
The text was updated successfully, but these errors were encountered:
Yes, this is an issue with the default Mercator projected fitted and predicted locations. You can overcome this by specifying a different projection in your call to fmap(), eg.
library(foieGras)
set.seed(10)
fit <- sim(N=300,
start = list(c(-20000, 4000), ISOdatetime(2021,12,08,12,00,00,tz="UTC")),
model = "crw",
D=0.5) %>%
mutate(id = 1) %>%
select(id, date, lc, lon, lat) %>%
fit_ssm(., model = "crw", time.step=24)
fmap(fit, what = "p", crs = "+proj=stere +lon_0=180 +lat_0=30 +unit=km", ext.rng = c(3,3)) # extending to see land
For an unknown reason, large sections of the North American coastline are not mapping correctly using the fmap function. The locations of the fit_ssm output are mapped correctly, including dates and error ellipses, but much of the northern hemisphere is not. I have tried several different dependencies for the fmap function (e.g., rgeos, geos, ggmap) but nothing seems to fix it. I would very much like to use these maps. Based on the shading, I am guessing something is wrong with how the function is processing land cover, perhaps related the crossing the date line in the map? Unsure. Any help would be appreciated! Below is the code I am using and a representative figure.
library(dplyr)
library(foieGras)
library(lubridate)
library(ggmap)
library(ggplot2)
library(ggsn)
#read in raw data, organize
sheardata<-na.omit(read.csv("SOSH_GLS_filtered.csv"))
sheardata$Tag<-as.factor(sheardata$Tag)
sheardata$Band<-as.factor(sheardata$Band)
sheardata$TOPPID<-as.factor(sheardata$TOPPID)
sheardata$Date<-as.POSIXct(sheardata$Date, format = "%m/%d/%y")
sheardata$Date<-sheardata$Date + hours(12) + minutes(00) + seconds(00)
colnames(sheardata)<-c("Species","DepID","Band","GLSNum","Date","Long","Lat")
#make data compatible with package
#error estimates from Shaffer et al 2005
fgshear<-sheardata[,c(2,5:7)]
colnames(fgshear)<-c("id","date","lon","lat")
fgshear$lc<-as.character("GL")
fgshear<-fgshear %>% relocate(lc, .before = lon)
fgshear$lonerr<-1.68
fgshear$laterr<-1.95
#fit CRW SSM to one example bird
onebirdexample<-fgshear[fgshear$id == "3105004",]
onebirdexample$id<-as.character(onebirdexample$id)
fitwater<-fit_ssm(onebirdexample, model = "crw", time.step = 24, vmax = 12.5)
fitwater
#plot example
plot(fitwater, what = "predicted", type = 1, pages = 1)
plot(fitwater, what = "fitted", type = 2, pages = 1)
fmap(fitwater, what = "fitted")
The text was updated successfully, but these errors were encountered: