Skip to content

Commit 820e85f

Browse files
committed
add earth curvature and refraction correction to cartesian_to_polar()
1 parent 791af7b commit 820e85f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

R/project_as_ppi.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,8 @@ proj_to_wgs <- function(x, y, proj4string) {
195195
return(res)
196196
}
197197

198-
cartesian_to_polar <- function(coords, elev = 0) {
199-
range <- sqrt(coords[, 1]^2 + coords[, 2]^2) / cos(elev)
198+
cartesian_to_polar <- function(coords, elev = 0, k = 4/3, lat = 35, re = 6378, rp = 6357) {
199+
range <- beam_range(sqrt(coords[, 1]^2 + coords[, 2]^2),elev,k=k, lat=lat, re=re, rp=rp)
200200
azim <- (0.5 * pi - atan2(coords[, 2], coords[, 1])) %% (2 * pi)
201201
data.frame(range = range, azim = azim * 180 / pi)
202202
}

0 commit comments

Comments
 (0)