Check whether sufficient sites have net radiation data.
filnam <- "~/rsofun/data/df_fluxnet.rds"
if (!file.exists(filnam)){
df_fluxnet <-
suppressWarnings(
suppressMessages(
ingestr::ingest(
siteinfo = ingestr::siteinfo_fluxnet2015,
source = "fluxnet",
getvars = list(netrad = "NETRAD"),
dir = "~/data/FLUXNET-2015_Tier1/20191024/DD/",
timescale = "d"
)
)
)
saveRDS(df_fluxnet, file = filnam)
} else {
df_fluxnet <- readRDS(filnam)
}
Missing data across all sites.
df_fluxnet |>
tidyr::unnest(data) |>
select(netrad) |>
visdat::vis_miss(warn_large_data = FALSE, cluster = FALSE)
#> Adding missing grouping variables: `sitename`
#> Warning: `gather_()` was deprecated in tidyr 1.2.0.
#> ℹ Please use `gather()` instead.
#> ℹ The deprecated feature was likely used in the visdat package.
#> Please report the issue at <]8;;https://github.com/ropensci/visdat/issueshttps://github.com/ropensci/visdat/issues]8;;>.
Get fraction of missing data per site.
calc_f_missing <- function(df, varnam){
vec <- df |>
pull(!!varnam)
(sum(is.na(vec)) / nrow(df))
}
df_missing <- df_fluxnet |>
mutate(f_missing = purrr::map_dbl(data, ~calc_f_missing(., "netrad")))
Distribution of missing data.
df_missing |>
ggplot(aes(x = f_missing, y = ..count..)) +
geom_histogram()
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Available sites with maximum 10% missing.
df_missing |>
select(-data) |>
filter(f_missing <= 0.1) |>
arrange(desc(f_missing)) |>
left_join(
ingestr::siteinfo_fluxnet2015,
by = "sitename"
) |>
knitr::kable()
| sitename | f_missing | lon | lat | elv | year_start | year_end | classid | c4 | whc | koeppen_code | igbp_land_use | plant_functional_type |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| AU-Wom | 0.0949772 | 144.0944 | -37.4222 | 705.0 | 2010 | 2012 | EBF | FALSE | 189.57100 | Cfb | Evergreen Broadleaf Forest | Evergreen Broadleaf Trees |
| US-ARM | 0.0865753 | -97.4888 | 36.6058 | 314.0 | 2003 | 2012 | CRO | FALSE | 331.86008 | Cfa | Croplands | Cereal crop |
| US-Ne1 | 0.0817703 | -96.4766 | 41.1651 | 361.0 | 2001 | 2013 | CRO | TRUE | 344.28632 | Dfa | Croplands | Broadleaf crop |
| US-Ne3 | 0.0802950 | -96.4397 | 41.1797 | 363.0 | 2001 | 2013 | CRO | TRUE | 342.51697 | Dfa | Croplands | Broadleaf crop |
| US-Whs | 0.0794521 | -110.0522 | 31.7438 | 1370.0 | 2007 | 2014 | OSH | FALSE | 233.38818 | BSk | Open Shrublands | Shrub |
| US-Ne2 | 0.0788198 | -96.4701 | 41.1649 | 362.0 | 2001 | 2013 | CRO | TRUE | 346.08804 | Dfa | Croplands | Broadleaf crop |
| BE-Lon | 0.0784558 | 4.7461 | 50.5516 | 167.0 | 2004 | 2014 | CRO | FALSE | 383.65109 | Cfb | Croplands | Cereal crop |
| CA-Qfo | 0.0698630 | -74.3421 | 49.6925 | 382.0 | 2003 | 2010 | ENF | FALSE | 176.82556 | Dfc | Evergreen Needleleaf Forest | Evergreen Needleleaf Trees |
| US-KS2 | 0.0698630 | -80.6715 | 28.6086 | 3.0 | 2003 | 2006 | CSH | FALSE | 205.27802 | Cfa | Woody Savannas | Shrub |
| IT-MBo | 0.0674969 | 11.0458 | 46.0147 | 1550.0 | 2003 | 2013 | GRA | FALSE | 264.44385 | Dfb | Grasslands | Grass |
| CN-HaM | 0.0657534 | 101.1800 | 37.3700 | 3932.0 | 2002 | 2004 | GRA | FALSE | 222.66310 | NA | NA | NA |
| US-SRG | 0.0626223 | -110.8277 | 31.7894 | 1291.0 | 2008 | 2014 | GRA | FALSE | 154.87320 | BSk | Grasslands | Shrub |
| FR-Gri | 0.0605479 | 1.9519 | 48.8442 | 125.0 | 2004 | 2013 | CRO | TRUE | 314.90735 | Cfb | Croplands | Cereal crop |
| US-MMS | 0.0594178 | -86.4131 | 39.3232 | 275.0 | 1999 | 2014 | DBF | FALSE | 343.01581 | Cfa | Deciduous Broadleaf Forest | Deciduous Broadleaf Trees |
| US-Ton | 0.0585127 | -120.9660 | 38.4316 | 177.0 | 2001 | 2014 | WSA | FALSE | 304.46140 | Csa | Woody Savannas | Shrub |
| NL-Loo | 0.0561644 | 5.7436 | 52.1666 | 25.0 | 1996 | 2013 | ENF | FALSE | 71.05942 | Cfb | Evergreen Needleleaf Forest | Evergreen Needleleaf Trees |
| AU-Tum | 0.0551859 | 148.1517 | -35.6566 | 932.0 | 2001 | 2014 | EBF | FALSE | 248.48276 | Cfb | Evergreen Broadleaf Forest | Evergreen Broadleaf Trees |
| US-NR1 | 0.0547945 | -105.5464 | 40.0329 | 3050.0 | 1998 | 2014 | ENF | FALSE | 170.75986 | Dfc | Evergreen Needleleaf Forest | Evergreen Needleleaf Trees |
| FR-LBr | 0.0537408 | -0.7693 | 44.7171 | 61.0 | 1996 | 2008 | ENF | FALSE | 269.57657 | Cfb | Cropland/Natural Vegetation Mosaic | Shrub |
| US-Me2 | 0.0522655 | -121.5574 | 44.4523 | 1253.0 | 2002 | 2014 | ENF | FALSE | 244.58331 | Csb | Evergreen Needleleaf Forest | Evergreen Needleleaf Trees |
| IT-Lav | 0.0481735 | 11.2813 | 45.9562 | 1353.0 | 2003 | 2014 | ENF | FALSE | 249.79709 | Cfb | Evergreen Needleleaf Forest | Evergreen Needleleaf Trees |
| DE-Obe | 0.0414873 | 13.7196 | 50.7836 | 735.0 | 2008 | 2014 | ENF | FALSE | 246.86536 | Cfb | Evergreen Needleleaf Forest | Evergreen Needleleaf Trees |
| FR-Pue | 0.0361644 | 3.5958 | 43.7414 | 270.0 | 2000 | 2014 | EBF | FALSE | 239.64929 | Csa | Mixed Forests | Evergreen Needleleaf Trees |
| FI-Lom | 0.0347032 | 24.2092 | 67.9972 | 274.0 | 2007 | 2009 | WET | FALSE | 222.68436 | Dfc | Woody Savannas | Grass |
| US-Wkg | 0.0338730 | -109.9419 | 31.7365 | 1531.0 | 2004 | 2014 | GRA | FALSE | 209.49074 | BSk | Grasslands | Grass |
| US-UMB | 0.0325114 | -84.7138 | 45.5598 | 234.0 | 2000 | 2014 | DBF | FALSE | 174.07025 | Dfb | Deciduous Broadleaf Forest | Deciduous Broadleaf Trees |
| AU-DaS | 0.0324853 | 131.3881 | -14.1593 | 98.0 | 2008 | 2014 | SAV | FALSE | 249.25092 | Aw | Savannas | Grass |
| AT-Neu | 0.0229141 | 11.3175 | 47.1167 | 970.0 | 2002 | 2012 | GRA | FALSE | 270.08563 | Dfc | Mixed Forests | Evergreen Broadleaf Trees |
| US-SRM | 0.0204234 | -110.8661 | 31.8214 | 1120.0 | 2004 | 2014 | WSA | FALSE | 201.24539 | BSk | Open Shrublands | Shrub |
| FR-Fon | 0.0189041 | 2.7801 | 48.4764 | 103.0 | 2005 | 2014 | DBF | FALSE | 335.19290 | Cfb | Deciduous Broadleaf Forest | Deciduous Broadleaf Trees |
| DE-Tha | 0.0184571 | 13.5669 | 50.9636 | 380.0 | 1996 | 2014 | ENF | FALSE | 295.66315 | Cfb | Evergreen Needleleaf Forest | Evergreen Needleleaf Trees |
| DE-Hai | 0.0179136 | 10.4530 | 51.0792 | 430.0 | 2000 | 2012 | DBF | FALSE | 282.66736 | Cfb | Mixed Forests | Deciduous Broadleaf Trees |
| DE-Gri | 0.0174346 | 13.5125 | 50.9495 | 385.0 | 2004 | 2014 | GRA | FALSE | 338.52594 | Cfb | Mixed Forests | Deciduous Broadleaf Trees |
| GF-Guy | 0.0141968 | -52.9249 | 5.2788 | 48.0 | 2004 | 2014 | EBF | FALSE | 230.85413 | Af | Evergreen Broadleaf Forest | Evergreen Broadleaf Trees |
| AU-Rob | 0.0082192 | 145.6301 | -17.1175 | 772.0 | 2014 | 2014 | EBF | FALSE | 265.16736 | Csb | NA | NA |
| DE-Geb | 0.0043053 | 10.9143 | 51.1001 | 161.5 | 2001 | 2014 | CRO | FALSE | 332.97009 | Cfb | Croplands | Cereal crop |
| CN-Cha | 0.0000000 | 128.0958 | 42.4025 | 754.0 | 2003 | 2005 | MF | FALSE | 320.64484 | Dwb | Mixed Forests | Deciduous Broadleaf Trees |
| CN-Dan | 0.0000000 | 91.0664 | 30.4978 | 4751.0 | 2004 | 2005 | GRA | FALSE | 229.43036 | ET | Grasslands | Grass |
| CN-Din | 0.0000000 | 112.5361 | 23.1733 | 261.0 | 2003 | 2005 | EBF | FALSE | 274.25833 | Cfa | Evergreen Broadleaf Forest | Evergreen Broadleaf Trees |
| CN-Ha2 | 0.0000000 | 101.3269 | 37.6086 | 3217.0 | 2003 | 2005 | WET | FALSE | 308.49081 | ET | Grasslands | Grass |
| CN-Qia | 0.0000000 | 115.0581 | 26.7414 | 64.0 | 2003 | 2005 | ENF | FALSE | 303.67596 | Cfa | Woody Savannas | Shrub |
| IT-Isp | 0.0000000 | 8.6336 | 45.8126 | 210.0 | 2013 | 2014 | DBF | FALSE | 320.68103 | Cfb | Woody Savannas | Deciduous Broadleaf Trees |
| IT-SR2 | 0.0000000 | 10.2910 | 43.7320 | 12.0 | 2013 | 2014 | ENF | FALSE | 286.22598 | Csa | Mixed Forests | Evergreen Needleleaf Trees |
Table of missing data
df_missing |>
select(sitename, f_missing) |>
knitr::kable()
| sitename | f_missing |
|---|---|
| AR-SLu | 0.5908676 |
| AR-Vir | 0.4363014 |
| AT-Neu | 0.0229141 |
| AU-Ade | 0.4922374 |
| AU-ASM | 0.1712329 |
| AU-Cpr | 0.1457534 |
| AU-Cum | 0.2666667 |
| AU-DaP | 0.1749511 |
| AU-DaS | 0.0324853 |
| AU-Dry | 0.2986301 |
| AU-Emr | 0.1771689 |
| AU-Fog | 0.1753425 |
| AU-Gin | 0.2979452 |
| AU-GWW | 0.4246575 |
| AU-How | 0.4448141 |
| AU-Lox | 0.5986301 |
| AU-RDF | 0.4410959 |
| AU-Rig | 0.1315068 |
| AU-Rob | 0.0082192 |
| AU-Stp | 0.1776908 |
| AU-TTE | 0.2712329 |
| AU-Tum | 0.0551859 |
| AU-Wac | 0.2116438 |
| AU-Whr | 0.2321918 |
| AU-Wom | 0.0949772 |
| AU-Ync | 0.2767123 |
| BE-Bra | 0.1900505 |
| BE-Lon | 0.0784558 |
| BE-Vie | 0.1093006 |
| BR-Sa3 | 0.4208219 |
| CA-Man | 0.1663927 |
| CA-NS1 | 0.3747945 |
| CA-NS2 | 0.2668493 |
| CA-NS3 | 0.2394521 |
| CA-NS4 | 0.2705479 |
| CA-NS5 | 0.2032877 |
| CA-NS6 | 0.2043836 |
| CA-NS7 | 0.1993151 |
| CA-Qfo | 0.0698630 |
| CA-SF1 | 0.1650685 |
| CA-SF2 | 0.3764384 |
| CA-SF3 | 0.2447489 |
| CH-Cha | 0.3016438 |
| CH-Dav | 0.1885845 |
| CH-Fru | 0.3010959 |
| CH-Lae | 1.0000000 |
| CH-Oe1 | 0.2046967 |
| CH-Oe2 | 1.0000000 |
| CN-Cha | 0.0000000 |
| CN-Cng | 0.2260274 |
| CN-Dan | 0.0000000 |
| CN-Din | 0.0000000 |
| CN-Du2 | 0.1223744 |
| CN-Ha2 | 0.0000000 |
| CN-HaM | 0.0657534 |
| CN-Qia | 0.0000000 |
| CN-Sw2 | 0.6347032 |
| CZ-BK1 | 0.5194521 |
| CZ-BK2 | 0.6785388 |
| CZ-wet | 0.1296804 |
| DE-Akm | 0.2465753 |
| DE-Geb | 0.0043053 |
| DE-Gri | 0.0174346 |
| DE-Hai | 0.0179136 |
| DE-Kli | 0.2587796 |
| DE-Lkb | 0.2120548 |
| DE-Obe | 0.0414873 |
| DE-RuR | 0.1328767 |
| DE-RuS | 0.3534247 |
| DE-Seh | 0.1801370 |
| DE-SfN | 0.1963470 |
| DE-Spw | 0.1523288 |
| DE-Tha | 0.0184571 |
| DK-Fou | 0.1835616 |
| DK-NuF | 0.6348337 |
| DK-Sor | 0.5159337 |
| DK-ZaF | 0.9500000 |
| DK-ZaH | 0.7391781 |
| ES-LgS | 0.2803653 |
| ES-Ln2 | 1.0000000 |
| FI-Hyy | 0.2092286 |
| FI-Jok | 0.1931507 |
| FI-Lom | 0.0347032 |
| FI-Sod | 0.3590998 |
| FR-Fon | 0.0189041 |
| FR-Gri | 0.0605479 |
| FR-LBr | 0.0537408 |
| FR-Pue | 0.0361644 |
| GF-Guy | 0.0141968 |
| IT-BCi | 0.2747198 |
| IT-CA1 | 0.6616438 |
| IT-CA2 | 0.6705479 |
| IT-CA3 | 0.3815068 |
| IT-Col | 0.3387167 |
| IT-Cp2 | 0.4337900 |
| IT-Cpz | 0.2421496 |
| IT-Isp | 0.0000000 |
| IT-La2 | 0.5287671 |
| IT-Lav | 0.0481735 |
| IT-MBo | 0.0674969 |
| IT-Noe | 0.1599004 |
| IT-PT1 | 0.1178082 |
| IT-Ren | 0.1398973 |
| IT-Ro1 | 0.3226788 |
| IT-Ro2 | 0.2931507 |
| IT-SR2 | 0.0000000 |
| IT-SRo | 0.4620352 |
| IT-Tor | 0.1792564 |
| JP-MBF | 1.0000000 |
| JP-SMF | 1.0000000 |
| NL-Hor | 0.1260274 |
| NL-Loo | 0.0561644 |
| NO-Adv | 0.6815068 |
| NO-Blv | 1.0000000 |
| RU-Che | 0.6486301 |
| RU-Cok | 0.6641553 |
| RU-Fyo | 0.1182917 |
| RU-Ha1 | 0.4520548 |
| SD-Dem | 0.1654795 |
| SN-Dhr | 0.2390411 |
| US-AR1 | 0.1157534 |
| US-AR2 | 0.2232877 |
| US-ARb | 0.1767123 |
| US-ARc | 0.1739726 |
| US-ARM | 0.0865753 |
| US-Blo | 0.2313823 |
| US-Cop | 0.4160470 |
| US-GBT | 0.2106164 |
| US-GLE | 0.1185554 |
| US-Ha1 | 0.3346202 |
| US-KS2 | 0.0698630 |
| US-Los | 0.4213699 |
| US-Me1 | 0.5465753 |
| US-Me2 | 0.0522655 |
| US-Me6 | 0.1616438 |
| US-MMS | 0.0594178 |
| US-Myb | 0.2482192 |
| US-Ne1 | 0.0817703 |
| US-Ne2 | 0.0788198 |
| US-Ne3 | 0.0802950 |
| US-NR1 | 0.0547945 |
| US-ORv | 0.1205479 |
| US-PFa | 1.0000000 |
| US-Prr | 0.2609589 |
| US-SRG | 0.0626223 |
| US-SRM | 0.0204234 |
| US-Syv | 0.3982387 |
| US-Ton | 0.0585127 |
| US-Tw1 | 0.1771689 |
| US-Tw2 | 0.5876712 |
| US-Tw3 | 0.2726027 |
| US-Tw4 | 0.4589041 |
| US-Twt | 0.1908676 |
| US-UMB | 0.0325114 |
| US-UMd | 0.1191781 |
| US-Var | 0.1693151 |
| US-WCr | 0.3688356 |
| US-Whs | 0.0794521 |
| US-Wi0 | 0.4821918 |
| US-Wi3 | 0.5388128 |
| US-Wi4 | 0.5780822 |
| US-Wi6 | 0.7013699 |
| US-Wi9 | 0.6013699 |
| US-Wkg | 0.0338730 |
| ZA-Kru | 0.5155666 |
| ZM-Mon | 0.8126027 |