context("Objects")
bgrid <- ugrid(pollat = 37.483, pollon = -166.6,
startlat_tot = -0.882, startlon_tot = -0.882,
ie_tot = 195, je_tot = 195,
dlat = 0.009, dlon = 0.009,
ke_uhl = 13,
hhl_uhl = c(0, 5, 10, 15, 20, 25, 30, 35, 40, 50, 60, 80, 100, 140),
n_uclass = 1,
n_udir = 4, angle_udir = c(-45., 0., 45., 90.))
test_that("ugrid", {
expect_equal(bgrid, berlin_grid)
expect_is(bgrid, "ugrid")
})
brlat <- rotated_latitude(bgrid)
brlon <- rotated_longitude(bgrid)
brlat_test <-
c(-0.882, -0.873, -0.864, -0.855, -0.846, -0.837, -0.828, -0.819,
-0.81, -0.801, -0.792, -0.783, -0.774, -0.765, -0.756, -0.747,
-0.738, -0.729, -0.72, -0.711, -0.702, -0.693, -0.684, -0.675,
-0.666, -0.657, -0.648, -0.639, -0.63, -0.621, -0.612, -0.603,
-0.594, -0.585, -0.576, -0.567, -0.558, -0.549, -0.54, -0.531,
-0.522, -0.513, -0.504, -0.495, -0.486, -0.477, -0.468, -0.459,
-0.45, -0.441, -0.432, -0.423, -0.414, -0.405, -0.396, -0.387,
-0.378, -0.369, -0.36, -0.351, -0.342, -0.333, -0.324, -0.315,
-0.306, -0.297, -0.288, -0.279, -0.27, -0.261, -0.252, -0.243,
-0.234, -0.225, -0.216, -0.207, -0.198, -0.189, -0.18, -0.171,
-0.162, -0.153, -0.144, -0.135, -0.126, -0.117, -0.108, -0.099,
-0.09, -0.081, -0.072, -0.063, -0.054, -0.045, -0.036, -0.027,
-0.018, -0.009, 0, 0.009, 0.018, 0.027, 0.036, 0.045, 0.054,
0.063, 0.072, 0.081, 0.09, 0.099, 0.108, 0.117, 0.126, 0.135,
0.144, 0.153, 0.162, 0.171, 0.18, 0.189, 0.198, 0.207, 0.216,
0.225, 0.234, 0.243, 0.252, 0.261, 0.27, 0.279, 0.288, 0.297,
0.306, 0.315, 0.324, 0.333, 0.342, 0.351, 0.36, 0.369, 0.378,
0.387, 0.396, 0.405, 0.414, 0.423, 0.432, 0.441, 0.45, 0.459,
0.468, 0.477, 0.486, 0.495, 0.504, 0.513, 0.522, 0.531, 0.54,
0.549, 0.558, 0.567, 0.576, 0.585, 0.594, 0.603, 0.612, 0.621,
0.63, 0.639, 0.648, 0.657, 0.666, 0.675, 0.684, 0.693, 0.702,
0.711, 0.72, 0.729, 0.738, 0.747, 0.756, 0.765, 0.774, 0.783,
0.792, 0.801, 0.81, 0.819, 0.828, 0.837, 0.846, 0.855, 0.864)
brlon_test <-
c(-0.882, -0.873, -0.864, -0.855, -0.846, -0.837, -0.828, -0.819,
-0.81, -0.801, -0.792, -0.783, -0.774, -0.765, -0.756, -0.747,
-0.738, -0.729, -0.72, -0.711, -0.702, -0.693, -0.684, -0.675,
-0.666, -0.657, -0.648, -0.639, -0.63, -0.621, -0.612, -0.603,
-0.594, -0.585, -0.576, -0.567, -0.558, -0.549, -0.54, -0.531,
-0.522, -0.513, -0.504, -0.495, -0.486, -0.477, -0.468, -0.459,
-0.45, -0.441, -0.432, -0.423, -0.414, -0.405, -0.396, -0.387,
-0.378, -0.369, -0.36, -0.351, -0.342, -0.333, -0.324, -0.315,
-0.306, -0.297, -0.288, -0.279, -0.27, -0.261, -0.252, -0.243,
-0.234, -0.225, -0.216, -0.207, -0.198, -0.189, -0.18, -0.171,
-0.162, -0.153, -0.144, -0.135, -0.126, -0.117, -0.108, -0.099,
-0.09, -0.081, -0.072, -0.063, -0.054, -0.045, -0.036, -0.027,
-0.018, -0.009, 0, 0.009, 0.018, 0.027, 0.036, 0.045, 0.054,
0.063, 0.072, 0.081, 0.09, 0.099, 0.108, 0.117, 0.126, 0.135,
0.144, 0.153, 0.162, 0.171, 0.18, 0.189, 0.198, 0.207, 0.216,
0.225, 0.234, 0.243, 0.252, 0.261, 0.27, 0.279, 0.288, 0.297,
0.306, 0.315, 0.324, 0.333, 0.342, 0.351, 0.36, 0.369, 0.378,
0.387, 0.396, 0.405, 0.414, 0.423, 0.432, 0.441, 0.45, 0.459,
0.468, 0.477, 0.486, 0.495, 0.504, 0.513, 0.522, 0.531, 0.54,
0.549, 0.558, 0.567, 0.576, 0.585, 0.594, 0.603, 0.612, 0.621,
0.63, 0.639, 0.648, 0.657, 0.666, 0.675, 0.684, 0.693, 0.702,
0.711, 0.72, 0.729, 0.738, 0.747, 0.756, 0.765, 0.774, 0.783,
0.792, 0.801, 0.81, 0.819, 0.828, 0.837, 0.846, 0.855, 0.864)
test_that("rotated longitude and latitude", {
expect_equal(brlat, brlat_test)
expect_equal(brlon, brlon_test)
})
blat <- latitude(bgrid)
blon <- longitude(bgrid)
test_that("geographical longitude and latitude", {
expect_equal(dim(blat), c(bgrid$ie_tot, bgrid$je_tot))
expect_equal(dim(blon), c(bgrid$ie_tot, bgrid$je_tot))
expect_lt(max(blat), 53.4)
expect_gt(min(blat), 51.6)
expect_lt(max(blon), 14.9)
expect_gt(min(blon), 11.9)
})
ucp <- upar(bgrid, fr_urb = berlin_fr_urb,
fr_uclass = berlin_fr_uclass, fr_udir = berlin_fr_udir,
fr_roof = berlin_fr_roof, w_street = berlin_w_street,
w_build = berlin_w_build)
test_that("upar", {
expect_length(ucp, 7)
expect_is(ucp, "upar")
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.