geco-bern / rsofun

Implements the Simulating Optimal FUNctioning framework for site-scale simulations of ecosystem processes, including model calibration. It contains Fortran 90 modules for the P-model, SPLASH, and BiomeE models.
https://geco-bern.github.io/rsofun/
GNU General Public License v3.0
25 stars 29 forks source link

Nested BiomeE output #268

Open fabern opened 5 days ago

fabern commented 5 days ago

BiomeE output is by default a data.frame with a single nested column containing outputs for output_daily_tile output_annual_tile and output_annual_cohorts .

This could be made more tidy by using unnest_wider(), which unnests them to three separate, (still nested) columns.

rsofun::biomee_gs_leuning_output |> unnest_wider(data)
# # A tibble: 1 × 4
#   sitename output_daily_tile output_annual_tile output_annual_cohorts
#   <chr>    <list>            <list>             <list>               
# 1 CH-Lae   <df [365 × 35]>   <df [251 × 59]>    <df [10 × 35]>       

rsofun::biomee_p_model_output |> unnest_wider(data) 
# # A tibble: 1 × 4
#   sitename output_daily_tile output_annual_tile output_annual_cohorts
#   <chr>    <list>            <list>             <list>               
# 1 CH-Lae   <df [365 × 35]>   <df [251 × 59]>    <df [5 × 35]>        

Should we either:

If we opt for b) we could then further:

rsofun::p_model_output |> rename(output_daily_tile = data) # This is breaking for p-model
# # A tibble: 1 × 3
#   sitename site_info        output_daily_tile
#   <chr>    <list>           <list>           
# 1 FR-Pue   <tibble [1 × 4]> <df [2,190 × 21]>

What do you think about these breaking changes, @marcadella @stineb?