Transform a longitude or latitude interval into the equivalent in meters depending on latitude.

dlon(dx, lat, a = 6731000)

dlat(dy, a = 6731000)

dx(dlon, lat, a = 6731000)

dy(dlat, a = 6731000)

Arguments

dx, dy

interval in meters

lat

latitude, in degrees

a

radius of the Earth

dlon, dlat

interval in degrees

Examples

library(data.table) data(geopotential) geopotential <- geopotential[date == date[1]] # Geostrophic wind geopotential[, c("u", "v") := GeostrophicWind(gh, lon, lat)] # in meters/second
#> lon lat lev gh date u v #> 1: 0.0 -22.5 700 3163.839 1990-01-01 NA 1.08181190 #> 2: 2.5 -22.5 700 3162.516 1990-01-01 NA 0.55189199 #> 3: 5.0 -22.5 700 3162.226 1990-01-01 NA 0.06625043 #> 4: 7.5 -22.5 700 3162.323 1990-01-01 NA -0.29800162 #> 5: 10.0 -22.5 700 3163.097 1990-01-01 NA -0.75064329 #> --- #> 4028: 347.5 -90.0 700 2715.936 1990-01-01 NA 0.00000000 #> 4029: 350.0 -90.0 700 2715.936 1990-01-01 NA 0.00000000 #> 4030: 352.5 -90.0 700 2715.936 1990-01-01 NA 0.00000000 #> 4031: 355.0 -90.0 700 2715.936 1990-01-01 NA 0.00000000 #> 4032: 357.5 -90.0 700 2715.936 1990-01-01 NA 0.00000000
geopotential[, c("dlon", "dlat") := .(dlon(u, lat), dlat(v))] # in degrees/second
#> lon lat lev gh date u v dlon dlat #> 1: 0.0 -22.5 700 3163.839 1990-01-01 NA 1.08181190 NA 9.208625e-06 #> 2: 2.5 -22.5 700 3162.516 1990-01-01 NA 0.55189199 NA 4.697828e-06 #> 3: 5.0 -22.5 700 3162.226 1990-01-01 NA 0.06625043 NA 5.639385e-07 #> 4: 7.5 -22.5 700 3162.323 1990-01-01 NA -0.29800162 NA -2.536657e-06 #> 5: 10.0 -22.5 700 3163.097 1990-01-01 NA -0.75064329 NA -6.389644e-06 #> --- #> 4028: 347.5 -90.0 700 2715.936 1990-01-01 NA 0.00000000 NA 0.000000e+00 #> 4029: 350.0 -90.0 700 2715.936 1990-01-01 NA 0.00000000 NA 0.000000e+00 #> 4030: 352.5 -90.0 700 2715.936 1990-01-01 NA 0.00000000 NA 0.000000e+00 #> 4031: 355.0 -90.0 700 2715.936 1990-01-01 NA 0.00000000 NA 0.000000e+00 #> 4032: 357.5 -90.0 700 2715.936 1990-01-01 NA 0.00000000 NA 0.000000e+00
geopotential[, c("u2", "v2") := .(dx(dlon, lat), dy(dlat))] # again in degrees/second
#> lon lat lev gh date u v dlon dlat u2 #> 1: 0.0 -22.5 700 3163.839 1990-01-01 NA 1.08181190 NA 9.208625e-06 NA #> 2: 2.5 -22.5 700 3162.516 1990-01-01 NA 0.55189199 NA 4.697828e-06 NA #> 3: 5.0 -22.5 700 3162.226 1990-01-01 NA 0.06625043 NA 5.639385e-07 NA #> 4: 7.5 -22.5 700 3162.323 1990-01-01 NA -0.29800162 NA -2.536657e-06 NA #> 5: 10.0 -22.5 700 3163.097 1990-01-01 NA -0.75064329 NA -6.389644e-06 NA #> --- #> 4028: 347.5 -90.0 700 2715.936 1990-01-01 NA 0.00000000 NA 0.000000e+00 NA #> 4029: 350.0 -90.0 700 2715.936 1990-01-01 NA 0.00000000 NA 0.000000e+00 NA #> 4030: 352.5 -90.0 700 2715.936 1990-01-01 NA 0.00000000 NA 0.000000e+00 NA #> 4031: 355.0 -90.0 700 2715.936 1990-01-01 NA 0.00000000 NA 0.000000e+00 NA #> 4032: 357.5 -90.0 700 2715.936 1990-01-01 NA 0.00000000 NA 0.000000e+00 NA #> v2 #> 1: 1.08181190 #> 2: 0.55189199 #> 3: 0.06625043 #> 4: -0.29800162 #> 5: -0.75064329 #> --- #> 4028: 0.00000000 #> 4029: 0.00000000 #> 4030: 0.00000000 #> 4031: 0.00000000 #> 4032: 0.00000000