Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ssm projection #9

Closed
otoolem opened this issue May 13, 2019 · 1 comment
Closed

ssm projection #9

otoolem opened this issue May 13, 2019 · 1 comment

Comments

@otoolem
Copy link

otoolem commented May 13, 2019

Hi Ian

I want to use x.se and y.se, from the fit_ssm output to calculate the edge of the error ellipse around each data point.

grab output

out <- foieGras::fit_ssm(...)
ssm <- foieGras::grab(out, “predicted”, as_sf = FALSE)

track coordinates

ssm$lon # or ssm$x
ssm$lat # or ssm$y

find edges of ellipse

ssm$lon2 <- ssm$x+ssm$x.se
ssm$lat2 <- ssm$y+ssm$y.se
xy <- as.matrix(ssm[c('lon2', 'lat2')])
proj4string <- as.character(CRS('+init=EPSG:4326'))
ssm$lon2 <- project(xy, proj4string, inv=TRUE)[,1] # edge of ellipse along lon axis
ssm$lat2 <- project(xy, proj4string, inv=TRUE)[,2] # edge of ellipse along lat axis

However, the track data and coordinates of the 'ellipse boundaries' appear to have different projections.

ssm[,c('lon','lat','lon2','lat2')]
lon lat lon2 lat2
1 -26.01687 5.600394 75.76054 35587.20
2 -26.17290 5.237531 -55.06476 36493.35
3 -26.30081 4.958494 -10.90205 34711.58
4 -26.84735 4.559007 -136.02852 32288.30
5 -27.05270 4.411449 72.44271 32046.08
6 -27.31685 4.221786 -55.77494 30812.26
7 -27.58099 4.032076 -114.66851 28310.99
8 -27.87863 3.681396 43.44134 23356.09
9 -27.57547 3.946964 82.59072 27578.42
10 -26.80854 4.600780 121.77401 30990.43
11 -25.65469 5.361667 -146.98428 36572.13
12 -25.29457 5.653881 -74.58530 37407.11
13 -24.98268 5.881524 -81.03987 39731.08
14 -24.78388 6.113966 -20.48755 40574.67
15 -25.24602 6.174506 89.12844 41328.01
16 -25.69252 6.105850 -66.64888 40847.09
17 -25.80649 5.875334 -95.19035 40497.73
18 -25.91273 5.497413 111.19606 38681.79
19 -25.99331 5.248576 104.58948 36843.61
20 -26.32641 4.761293 147.82622 34288.65
21 -26.55639 4.434251 -84.89157 31936.47
22 -27.02737 3.970427 100.31919 29876.73
23 -27.49835 3.506338 -87.91668 27056.50
24 -27.96933 3.042016 -82.58127 23543.93
25 -28.07799 2.887690 -164.90769 22149.28
26 -27.53539 3.085527 -98.08894 23024.86
27 -27.31244 3.138100 -54.01810 22570.34
28 -27.35467 2.920236 166.46369 20728.95
29 -27.44570 2.669940 -101.61275 18425.00
30 -28.19315 2.157776 -163.50920 17065.89
31 -28.94061 1.645436 -50.06504 13281.10
32 -29.44954 1.324774 -54.04135 10655.61
33 -29.67303 1.185742 -102.63438 10013.83

Any help is greatly appreciated

Cheers

Malcolm

@otoolem otoolem closed this as completed May 13, 2019
@camrinbraun
Copy link

@otoolem what was the solution here? i'd also like to use the SE metrics as an error estimate around predicted locations. ideally, i'd get the SE metrics into lat/lon space.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants