Skip to contents

Compute horizon height in degrees from a station location in UTM 33

Usage

compute_horizon(
  stn = NULL,
  dem = NULL,
  level = NULL,
  step = 10,
  f_plot_polygon = FALSE
)

Arguments

stn

A SpatVector or an array of two coordinates in UTM 33

dem

A SpatRaster of a digital elevation/surface model in UTM 33 (epsg:25833)

level

A height above the ground of the sensor in metres, level 0 is set to 2 metres

step

An interval in degrees at which the horizon will be computed, default is every 10 deg.

f_plot_polygon

A boolean setting boundary values to -20 deg to facilitate plotting as polygon

Value

A dataframe with `horizon_height` in degrees and `azimuth` angle in degrees at which the horizon is computed in degrees

Examples

# Load the station metadata including location and level
stn <- get_metadata_frost(stationid = 18700)

# Load a digital elevation model
dsm   <- download_dem_kartverket(stn, name = "dom", dx = 100, resx = 1)
#> [1] "Process: 18700 - 260966.8/6652718.0 - dom - 100/1 - path: data/dem"
#> [1] "Load demo file: data/dem/18700_dom_25833_d00100m_1.0m.tif"

# Compute the horizon
compute_horizon(stn, dsm)
#> Over-riding projection check
#> Importing raster map <elev>...
#>    0%   3%   6%   9%  12%  15%  18%  21%  24%  27%  30%  33%  36%  39%  42%  45%  48%  51%  54%  57%  60%  63%  66%  69%  72%  75%  78%  81%  84%  87%  90%  93%  96%  99% 100%
#> SpatRaster read into GRASS using r.in.gdal from memory
#>    azimuth horizon_height horizon_distance
#> 1        0       9.939936        54.147945
#> 2      350       2.306929        68.468971
#> 3      340       3.249575       104.120123
#> 4      330      20.886836        30.413813
#> 5      320      12.180172        20.000000
#> 6      310      32.785109        36.069378
#> 7      300       6.553074        41.048752
#> 8      290       9.113168        17.464249
#> 9      280      10.758612        51.419841
#> 10     270       9.838308        55.145263
#> 11     260       7.956049        49.254441
#> 12     250       6.645440        69.641941
#> 13     240      12.569229        65.741920
#> 14     230      14.440466        80.212219
#> 15     220      11.846928        50.209561
#> 16     210      22.669420        38.275318
#> 17     200      63.301882         1.000000
#> 18     190      63.301882         1.000000
#> 19     180      63.301882         1.000000
#> 20     170      63.301882         1.000000
#> 21     160      63.301882         1.000000
#> 22     150      63.301882         1.000000
#> 23     140       7.332311        15.811388
#> 24     130       7.923324         9.219544
#> 25     120      12.459800        15.811388
#> 26     110       9.732914        53.712196
#> 27     100      10.646912        58.694122
#> 28      90       9.109575        64.124878
#> 29      80       7.823404        75.425460
#> 30      70      21.361401        52.201533
#> 31      60      22.801016        62.169124
#> 32      50      18.286524        47.201695
#> 33      40      18.566975        46.690470
#> 34      30      18.431249        46.872167
#> 35      20      17.705236        48.332184
#> 36      10       9.871761        52.392748
compute_horizon(stn, dsm, step = 1, f_plot_polygon = TRUE)
#> Over-riding projection check
#> Importing raster map <elev>...
#>    0%   3%   6%   9%  12%  15%  18%  21%  24%  27%  30%  33%  36%  39%  42%  45%  48%  51%  54%  57%  60%  63%  66%  69%  72%  75%  78%  81%  84%  87%  90%  93%  96%  99% 100%
#> SpatRaster read into GRASS using r.in.gdal from memory
#>     azimuth horizon_height horizon_distance
#> 1       360     -20.000000         0.000000
#> 2       359       9.818483        54.083269
#> 3       358       8.980175        53.037722
#> 4       357       8.932049        54.009258
#> 5       356       3.649215        54.000000
#> 6       355       2.103104         3.000000
#> 7       354       2.103104         3.000000
#> 8       353       2.103104         3.000000
#> 9       352       2.103104         3.000000
#> 10      351       2.103104         3.000000
#> 11      350       2.306929        68.468971
#> 12      349       2.362784         4.123106
#> 13      348       2.787974        56.568542
#> 14      347       2.660042        57.706152
#> 15      346       2.362784         4.123106
#> 16      345       2.362784         4.123106
#> 17      344       2.711264       101.414989
#> 18      343       4.128500       102.839681
#> 19      342       4.115418       103.077641
#> 20      341       3.348565       103.580886
#> 21      340       3.249575       104.120123
#> 22      339       4.248157        29.410882
#> 23      338      12.396627        30.675723
#> 24      337      14.947356        28.792360
#> 25      336      17.024463        31.016125
#> 26      335      19.541723        30.083218
#> 27      334      19.752768        30.463092
#> 28      333      19.808159        29.546573
#> 29      332      20.007029        30.870698
#> 30      331      20.570215        29.966648
#> 31      330      20.886836        30.413813
#> 32      329      20.886836        30.413813
#> 33      328      20.886836        30.413813
#> 34      327      19.515686        29.529646
#> 35      326      18.541882        30.016662
#> 36      325      16.694693        31.384710
#> 37      324      12.455313        30.528675
#> 38      323       8.565076        19.416488
#> 39      322       8.565076        19.416488
#> 40      321      12.180172        20.000000
#> 41      320      12.180172        20.000000
#> 42      319      13.380166        19.209373
#> 43      318      13.380166        19.209373
#> 44      317      14.966405        19.849433
#> 45      316      14.966405        19.849433
#> 46      315      15.627119        20.518285
#> 47      314      15.627119        20.518285
#> 48      313      15.627119        20.518285
#> 49      312      23.089759        35.355339
#> 50      311      32.785109        36.069378
#> 51      310      32.785109        36.069378
#> 52      309      23.693429        36.796739
#> 53      308      15.124667        20.518285
#> 54      307      11.878021        19.849433
#> 55      306      11.878021        19.849433
#> 56      305       8.745321        18.439089
#> 57      304       6.424614        20.615528
#> 58      303       6.349063        42.201896
#> 59      302       6.789614        41.617304
#> 60      301       6.789614        41.617304
#> 61      300       6.553074        41.048752
#> 62      299       9.303251        17.492856
#> 63      298       9.303251        17.492856
#> 64      297      11.055700        18.357560
#> 65      296      11.055700        18.357560
#> 66      295      11.055700        18.357560
#> 67      294      11.641041        17.888544
#> 68      293      11.641041        17.888544
#> 69      292      11.641041        17.888544
#> 70      291      11.641041        17.888544
#> 71      290       9.113168        17.464249
#> 72      289       9.113168        17.464249
#> 73      288       6.270351        18.384776
#> 74      287       6.270351        18.384776
#> 75      286       5.954507        44.598206
#> 76      285       6.231283        43.324358
#> 77      284       6.018215        52.497619
#> 78      283       5.931825        46.840154
#> 79      282       8.284994        51.923020
#> 80      281      10.226637        51.662365
#> 81      280      10.758612        51.419841
#> 82      279      11.298909        51.195703
#> 83      278      11.363601        50.990195
#> 84      277      10.939793        51.971146
#> 85      276      10.341410        50.803543
#> 86      275       8.309175        50.635956
#> 87      274       8.182928        77.646635
#> 88      273       8.367777        77.524190
#> 89      272       8.359009        77.414469
#> 90      271       9.128993        54.147945
#> 91      270       9.838308        55.145263
#> 92      269       9.232735        55.081757
#> 93      268       8.693906        49.010203
#> 94      267       9.083959        55.009090
#> 95      266       7.158666        50.000000
#> 96      265       6.461135        49.010203
#> 97      264       7.432562        49.040799
#> 98      263       7.333528        47.095647
#> 99      262       7.926363        49.162994
#> 100     261       7.956049        49.254441
#> 101     260       7.956049        49.254441
#> 102     259       7.296334        74.545288
#> 103     258       7.619863        75.802375
#> 104     257       7.342130        79.075913
#> 105     256      10.536681        77.278716
#> 106     255      11.308860        77.466122
#> 107     254      11.227512        78.854296
#> 108     253      10.228151        77.129761
#> 109     252       9.513746        78.339007
#> 110     251       8.986791        49.729267
#> 111     250       6.645440        69.641941
#> 112     249       6.219118        37.643060
#> 113     248       5.863048        64.195015
#> 114     247       5.598576        64.513564
#> 115     246       6.440794        65.192024
#> 116     245       7.811516        63.324561
#> 117     244       9.168214        62.769419
#> 118     243       9.346933        63.158531
#> 119     242      10.963551        64.884513
#> 120     241      12.133326        65.306967
#> 121     240      12.569229        65.741920
#> 122     239      12.594533        66.189123
#> 123     238      12.186158        64.884513
#> 124     237      12.116923        65.368188
#> 125     236      11.468926        64.498062
#> 126     235      11.582319        66.887966
#> 127     234      12.867229        67.416615
#> 128     233      12.935784        67.955868
#> 129     232      12.286418        79.881162
#> 130     231      14.403619        79.630396
#> 131     230      14.440466        80.212219
#> 132     229      14.774570        45.607017
#> 133     228      15.460929        47.010637
#> 134     227      15.347007        46.227697
#> 135     226      15.725672        48.918299
#> 136     225      15.761065        49.578221
#> 137     224      15.761065        49.578221
#> 138     223      15.369207        48.104054
#> 139     222      14.680277        48.795492
#> 140     221      12.558885        49.497475
#> 141     220      11.846928        50.209561
#> 142     219      12.595025        33.970576
#> 143     218      16.123612        33.301652
#> 144     217      17.802674        34.058773
#> 145     216      20.115683        33.421550
#> 146     215      20.115683        33.421550
#> 147     214      20.987719        32.802439
#> 148     213      21.781483        33.600595
#> 149     212      21.781483        33.600595
#> 150     211      21.040083        33.015148
#> 151     210      22.669420        38.275318
#> 152     209      23.127839        37.735925
#> 153     208      23.433103        38.587563
#> 154     207      24.133368        38.078866
#> 155     206      63.301882         1.000000
#> 156     205      63.301882         1.000000
#> 157     204      63.301882         1.000000
#> 158     203      63.301882         1.000000
#> 159     202      63.301882         1.000000
#> 160     201      63.301882         1.000000
#> 161     200      63.301882         1.000000
#> 162     199      63.301882         1.000000
#> 163     198      63.301882         1.000000
#> 164     197      63.301882         1.000000
#> 165     196      63.301882         1.000000
#> 166     195      63.301882         1.000000
#> 167     194      63.301882         1.000000
#> 168     193      63.301882         1.000000
#> 169     192      63.301882         1.000000
#> 170     191      63.301882         1.000000
#> 171     190      63.301882         1.000000
#> 172     189      63.301882         1.000000
#> 173     188      63.301882         1.000000
#> 174     187      63.301882         1.000000
#> 175     186      63.301882         1.000000
#> 176     185      63.301882         1.000000
#> 177     184      63.301882         1.000000
#> 178     183      63.301882         1.000000
#> 179     182      63.301882         1.000000
#> 180     181      63.301882         1.000000
#> 181     180      63.301882         1.000000
#> 182     179      63.301882         1.000000
#> 183     178      63.301882         1.000000
#> 184     177      63.301882         1.000000
#> 185     176      63.301882         1.000000
#> 186     175      63.301882         1.000000
#> 187     174      63.301882         1.000000
#> 188     173      63.301882         1.000000
#> 189     172      63.301882         1.000000
#> 190     171      63.301882         1.000000
#> 191     170      63.301882         1.000000
#> 192     169      63.301882         1.000000
#> 193     168      63.301882         1.000000
#> 194     167      63.301882         1.000000
#> 195     166      63.301882         1.000000
#> 196     165      63.301882         1.000000
#> 197     164      63.301882         1.000000
#> 198     163      63.301882         1.000000
#> 199     162      63.301882         1.000000
#> 200     161      63.301882         1.000000
#> 201     160      63.301882         1.000000
#> 202     159      63.301882         1.000000
#> 203     158      63.301882         1.000000
#> 204     157      63.301882         1.000000
#> 205     156      63.301882         1.000000
#> 206     155      63.301882         1.000000
#> 207     154      63.301882         1.000000
#> 208     153      63.301882         1.000000
#> 209     152      63.301882         1.000000
#> 210     151      63.301882         1.000000
#> 211     150      63.301882         1.000000
#> 212     149      63.301882         1.000000
#> 213     148      63.301882         1.000000
#> 214     147      63.301882         1.000000
#> 215     146      10.646834        99.478641
#> 216     145      10.047831        15.264338
#> 217     144      10.047831        15.264338
#> 218     143      10.047831        15.264338
#> 219     142       9.352945       118.713942
#> 220     141       8.736032        18.027756
#> 221     140       7.332311        15.811388
#> 222     139       7.490012       126.210142
#> 223     138      11.092774         9.219544
#> 224     137      11.092774         9.219544
#> 225     136      11.092774         9.219544
#> 226     135      11.092774         9.219544
#> 227     134      11.092774         9.219544
#> 228     133      11.092774         9.219544
#> 229     132       7.365093       106.075445
#> 230     131       7.437130       107.480231
#> 231     130       7.923324         9.219544
#> 232     129       7.923324         9.219544
#> 233     128       8.881715        15.620499
#> 234     127      10.079754        14.212670
#> 235     126      10.079754        14.212670
#> 236     125      12.578786        15.000000
#> 237     124      12.578786        15.000000
#> 238     123      12.578786        15.000000
#> 239     122      12.578786        15.000000
#> 240     121      12.578786        15.000000
#> 241     120      12.459800        15.811388
#> 242     119      12.459800        15.811388
#> 243     118      12.442900        14.422205
#> 244     117      11.354036        13.892444
#> 245     116      11.354036        13.892444
#> 246     115      11.354036        13.892444
#> 247     114      11.354036        13.892444
#> 248     113      10.405815        14.764823
#> 249     112      11.354405        54.129474
#> 250     111      11.354405        54.129474
#> 251     110       9.732914        53.712196
#> 252     109       9.420969        55.154329
#> 253     108      10.792453        57.008771
#> 254     107       9.885861        56.648036
#> 255     106       9.169913        60.745370
#> 256     105      10.955915        55.973208
#> 257     104       9.646166        55.659680
#> 258     103      10.152053        57.280014
#> 259     102      10.896995        58.240879
#> 260     101      10.872508        57.974132
#> 261     100      10.646912        58.694122
#> 262      99      10.822515        58.463664
#> 263      98      11.070726        58.249464
#> 264      97      10.762614        58.051701
#> 265      96      10.265672        58.855756
#> 266      95       9.275388        62.801274
#> 267      94      10.731452        63.639610
#> 268      93      10.353822        64.498062
#> 269      92       9.220488        62.289646
#> 270      91       9.148837        65.192024
#> 271      90       9.109575        64.124878
#> 272      89       8.779123        67.067131
#> 273      88       8.821810        73.027392
#> 274      87       9.798953        70.007142
#> 275      86       9.642045        69.000000
#> 276      85       9.018525        73.027392
#> 277      84       9.523864        73.061618
#> 278      83       9.032578        72.111026
#> 279      82       8.316898        72.173402
#> 280      81       8.699577        75.325958
#> 281      80       7.823404        75.425460
#> 282      79       7.445471        75.663730
#> 283      78       6.967832        79.906195
#> 284      77       7.320845        79.075913
#> 285      76       6.539044        85.328776
#> 286      75       6.002198        54.129474
#> 287      74      16.484945        54.341513
#> 288      73      21.780999        53.366656
#> 289      72      21.482357        52.630789
#> 290      71      22.018406        51.923020
#> 291      70      21.361401        52.201533
#> 292      69      22.161387        51.244512
#> 293      68      23.750355        57.870545
#> 294      67      23.506184        58.189346
#> 295      66      24.801587        56.648036
#> 296      65      25.946738        54.781384
#> 297      64      27.437766        55.154329
#> 298      63      26.739598        56.462377
#> 299      62      25.316201        56.859476
#> 300      61      23.501764        57.271284
#> 301      60      22.801016        62.169124
#> 302      59      21.511611        63.953108
#> 303      58      18.779931        62.177166
#> 304      57      18.300963        64.007812
#> 305      56      17.787754        48.877398
#> 306      55      17.787754        48.877398
#> 307      54      17.926382        48.548944
#> 308      53      18.069458        47.707442
#> 309      52      17.984542        48.259714
#> 310      51      18.142710        48.010416
#> 311      50      18.286524        47.201695
#> 312      49      18.215487        47.801674
#> 313      48      18.370244        47.010637
#> 314      47      18.502649        46.227697
#> 315      46      18.558949        46.097722
#> 316      45      18.558949        46.097722
#> 317      44      18.412291        47.423623
#> 318      43      18.536228        46.690470
#> 319      42      18.432529        47.381431
#> 320      41      18.434721        47.381431
#> 321      40      18.566975        46.690470
#> 322      39      18.566975        46.690470
#> 323      38      18.567362        46.754679
#> 324      37      18.672524        46.097722
#> 325      36      18.531737        46.861498
#> 326      35      18.494164        47.010637
#> 327      34      18.583936        46.400431
#> 328      33      18.583936        46.400431
#> 329      32      18.505177        46.615448
#> 330      31      18.505177        46.615448
#> 331      30      18.431249        46.872167
#> 332      29      18.489577        46.324939
#> 333      28      18.368365        46.647615
#> 334      27      18.368365        46.647615
#> 335      26      18.282648        47.010637
#> 336      25      18.282648        47.010637
#> 337      24      17.953673        48.764741
#> 338      23      17.815072        49.193496
#> 339      22      17.838968        48.754487
#> 340      21      17.705236        48.332184
#> 341      20      17.705236        48.332184
#> 342      19      17.692340        48.846699
#> 343      18      17.515246        49.769469
#> 344      17      17.171053        50.328918
#> 345      16      15.861276        49.979996
#> 346      15       9.893121        51.865210
#> 347      14       9.745260        51.546096
#> 348      13       9.610513        52.201533
#> 349      12       9.577626        38.327536
#> 350      11       9.666357        52.630789
#> 351      10       9.871761        52.392748
#> 352       9      10.064807        52.172790
#> 353       8      10.268221        50.990195
#> 354       7      10.597030        48.836462
#> 355       6      10.637235        48.662100
#> 356       5      10.596047        49.648766
#> 357       4      10.460202        50.487622
#> 358       3      10.326412        50.358713
#> 359       2      10.131129        52.239832
#> 360       1      10.014721        52.153619
#> 361       0     -20.000000         0.000000