geco-bern / FluxDataKit

LEMONTREE flux data kit
https://geco-bern.github.io/FluxDataKit
2 stars 11 forks source link

`flux_data_kit_site-info` object #22

Closed stineb closed 1 year ago

stineb commented 2 years ago

The object flux_data_kit_site-info comes in a shape that doesn't look as expected:

`flux_data_kit_site-info` %>% 
  as_tibble()

# A tibble: 306 × 1
   sitename.lat.lon.elv.date_start.date_end.product.koeppen_code.year_end.year_start.koeppen_code_beck.whc.igbp_land_use.data_path              
   <fct>                                                                                                                                        
 1 SE-Nor,60.0865,17.479504,45,2014-01-01,2020-12-31,icos,Dfb,2020,2014,Dfb,295.938995361328,Evergreen Needleleaf Forest,data-raw/flux_data/    
 2 BE-Bra,51.30761,4.51984,16,1996-01-01,2020-12-31,icos,Cfb,2020,1996,Cfb,425.602996826172,Mixed Forest,data-raw/flux_data/                    
 3 BE-Lcr,51.11218,3.85043,6.25,2019-01-01,2020-12-31,icos,Cfb,2020,2019,Cfb,321.834991455078,Croplands,data-raw/flux_data/                     
 4 BE-Lon,50.55162,4.746234,170,2004-01-01,2020-12-31,icos,Cfb,2020,2004,Cfb,441.085998535156,Croplands,data-raw/flux_data/                     
 5 BE-Maa,50.97987,5.631851,87,2016-01-01,2020-12-31,icos,Cfb,2020,2016,Cfb,314.752014160156,Savannas,data-raw/flux_data/                       
 6 BE-Vie,50.304962,5.998099,490,1996-01-01,2020-12-31,icos,Dfb,2020,1996,Dfb,395.394012451172,Mixed Forest,data-raw/flux_data/                 
 7 DE-Geb,51.09973,10.91463,161.5,2001-01-01,2020-12-31,icos,Dfb,2020,2001,Dfb,358.447998046875,Croplands,data-raw/flux_data/                   
 8 DE-Gri,50.95004,13.51259,385,2004-01-01,2020-12-31,icos,Dfb,2020,2004,Dfb,392.226013183594,Savannas,data-raw/flux_data/                      
 9 DE-Hai,51.079407,10.452089,438.7,2000-01-01,2020-12-31,icos,Dfb,2020,2000,Dfb,358.447998046875,Deciduous Broadleaf Forest,data-raw/flux_data/
10 DE-HoH,52.08656,11.22235,193,2015-01-01,2020-12-31,icos,Dfb,2020,2015,Dfb,392.226013183594,Mixed Forest,data-raw/flux_data/                  
# … with 296 more rows
# ℹ Use `print(n = ...)` to see more rows

Should be separated into multiple columns. Suggestion: the object could be named fdk_sites.

khufkens commented 2 years ago
read.table("data/flux_data_kit_site-info.csv", header = TRUE, sep = ",") |> head()
readRDS("flux_data_kit_site-info.rds") |> head()

returns:

  sitename      lat       lon    elv date_start   date_end product koeppen_code year_end year_start koeppen_code_beck     whc               igbp_land_use          data_path
1   SE-Nor 60.08650 17.479504  45.00 2014-01-01 2020-12-31    icos          Dfb     2020       2014               Dfb 295.939 Evergreen Needleleaf Forest data-raw/flux_data
2   BE-Bra 51.30761  4.519840  16.00 1996-01-01 2020-12-31    icos          Cfb     2020       1996               Cfb 425.603                Mixed Forest data-raw/flux_data
3   BE-Lcr 51.11218  3.850430   6.25 2019-01-01 2020-12-31    icos          Cfb     2020       2019               Cfb 321.835                   Croplands data-raw/flux_data
4   BE-Lon 50.55162  4.746234 170.00 2004-01-01 2020-12-31    icos          Cfb     2020       2004               Cfb 441.086                   Croplands data-raw/flux_data

or

read.table("data/flux_data_kit_site-info.csv", header = TRUE, sep = ",") |> dplyr::as_tibble()

reads

# A tibble: 306 × 14
   sitename   lat   lon    elv date_start date_end   product koeppen_code year_end year_start koeppen_code_beck   whc igbp_land_use               data_path          
   <chr>    <dbl> <dbl>  <dbl> <chr>      <chr>      <chr>   <chr>           <int>      <int> <chr>             <dbl> <chr>                       <chr>              
 1 SE-Nor    60.1 17.5   45    2014-01-01 2020-12-31 icos    Dfb              2020       2014 Dfb                296. Evergreen Needleleaf Forest data-raw/flux_data/
 2 BE-Bra    51.3  4.52  16    1996-01-01 2020-12-31 icos    Cfb              2020       1996 Cfb                426. Mixed Forest                data-raw/flux_data/
 3 BE-Lcr    51.1  3.85   6.25 2019-01-01 2020-12-31 icos    Cfb              2020       2019 Cfb                322. Croplands                   data-raw/flux_data/

not reproducible, closing

stineb commented 2 years ago
library(FluxDataKit)
`flux_data_kit_site-info`

returns:

                                   sitename.lat.lon.elv.date_start.date_end.product.koeppen_code.year_end.year_start.koeppen_code_beck.whc.igbp_land_use.data_path
1                        SE-Nor,60.0865,17.479504,45,2014-01-01,2020-12-31,icos,Dfb,2020,2014,Dfb,295.938995361328,Evergreen Needleleaf Forest,data-raw/flux_data/
2                                        BE-Bra,51.30761,4.51984,16,1996-01-01,2020-12-31,icos,Cfb,2020,1996,Cfb,425.602996826172,Mixed Forest,data-raw/flux_data/
3                                         BE-Lcr,51.11218,3.85043,6.25,2019-01-01,2020-12-31,icos,Cfb,2020,2019,Cfb,321.834991455078,Croplands,data-raw/flux_data/
...

It would be nice to make a data frame object fdk_siteinfo available through the package (like ingestr:siteinfo_fluxnet2015, which I use a ton!).

khufkens commented 2 years ago

This is not how it is supposed to be used. Although I ignore the data directory in .RBuildIgnore, LazyData: true overrides this it seems. Fixed as per: https://github.com/computationales/FluxDataKit/commit/ef561529430dcdc61b9e1692d119ab3305563d83

stineb commented 1 year ago

Could the object flux_data_kit_site-info be made available upon loading the package? I'm using the equivalent ingestr::siteinfo_fluxnet2015 all the time.

khufkens commented 1 year ago

Integrated as fdk_site_info will be updated on a release basis. Not my way of doing things but so is most of the package.