# A tibble: 4,038,747 × 7
STATION DATE LATITUDE LONGITUDE ELEVATION NAME TEMP
<chr> <date> <dbl> <dbl> <dbl> <chr> <dbl>
1 01001099999 2023-01-01 70.9 -8.67 9 JAN MAYE… 18.1
2 01001099999 2023-01-02 70.9 -8.67 9 JAN MAYE… 25.8
3 01001099999 2023-01-03 70.9 -8.67 9 JAN MAYE… 35.8
4 01001099999 2023-01-04 70.9 -8.67 9 JAN MAYE… 37
5 01001099999 2023-01-05 70.9 -8.67 9 JAN MAYE… 35.4
6 01001099999 2023-01-06 70.9 -8.67 9 JAN MAYE… 32.7
7 01001099999 2023-01-07 70.9 -8.67 9 JAN MAYE… 34.7
8 01001099999 2023-01-08 70.9 -8.67 9 JAN MAYE… 35.2
9 01001099999 2023-01-09 70.9 -8.67 9 JAN MAYE… 34
10 01001099999 2023-01-10 70.9 -8.67 9 JAN MAYE… 31.6
# ℹ 4,038,737 more rows
data quality
summary(dat0)
STATION DATE LATITUDE LONGITUDE
Length:4038747 Min. :2023-01-01 Min. :-90.00 Min. :-179.983
Class :character 1st Qu.:2023-04-01 1st Qu.: 23.84 1st Qu.: -82.454
Mode :character Median :2023-07-02 Median : 40.08 Median : 8.517
Mean :2023-07-01 Mean : 31.66 Mean : -1.280
3rd Qu.:2023-10-02 3rd Qu.: 49.22 3rd Qu.: 64.230
Max. :2023-12-31 Max. : 83.65 Max. : 179.500
NA's :13408 NA's :13408
ELEVATION NAME TEMP
Min. :-999.9 Length:4038747 Min. :-114.30
1st Qu.: 31.0 Class :character 1st Qu.: 42.70
Median : 155.1 Mode :character Median : 59.70
Mean : 361.8 Mean : 56.49
3rd Qu.: 446.2 3rd Qu.: 74.10
Max. :4701.0 Max. : 110.00
NA's :13770
functions for insolation and maximum sun elevation
From Jean Meeus’ book “Astronomical Algorithms” good approximations for solar irradiation per day and maximum sun elevation can be computed - see code for details.
# sun declinationdeclination <-function(J2000T) asin(sin(epsilon(J2000T)) *sin(lambda(J2000T)))# irradiation in kWh per m^2 per dayinsolation <-function(J2000T, latitude) { rho <-rho(J2000T) h0 <-h0(J2000T, latitude) x <-sin(epsilon(J2000T)) *sin(lambda(J2000T))10.4033856721* rho*rho * (h0*sin(latitude)*x +cos(latitude)*cos(asin(x))*sin(h0))}
add sun parameters to dataframe
With astronomical functions in place I can compute for each observation the daily sun irradiation energy per m^2 and the sine of maximum sun elevation.