DrylandEcology / rSFSTEP2

R program that interfaces with the STEPWAT2 C code and runs in parallel for multiple sites, climate scenarios, disturbance regimes, and time periods
0 stars 1 forks source link

Raw daily output is inserted into SQLite output database instead of aggregated daily output #232

Closed kpalmqui closed 4 years ago

kpalmqui commented 4 years ago

Previously, we inserted aggregrated daily output from SOILWAT2 into the SQLite output databases. This represents the mean and SD of each variable on each DOY across all years. This significantly reduces the size of the SQLite databases, while still providing information on ecohydrological responses on a daily basis.

In the streamline_output branch, this code was accidentally deleted and now the raw daily SOILWAT2 output is being inserted. This has increased the size of a single site output database from ~400 MB to ~6 GB.

This issue will reinstate the code the aggregates the daily SOILWAT2 variables.

https://github.com/DrylandEcology/rSFSTEP2/commit/a7393a46589037765e69a4914031fe3bdaf81644accidentally removed this code from OutputDatabase.R.

#calculate aggregated daily mean and sd - need to get the columns after data - site, GCM, Rgrp_treatment, species, soilType, dist_freq, graz_freq, intensity, RCP, YEARS
    length=length(total_sw2_daily_slyrs[2,])-10

total_sw2_daily_slyrs_aggregated=aggregate(total_sw2_daily_slyrs[,c(3:length)],by=list(total_sw2_daily_slyrs$Day,total_sw2_daily_slyrs$site,total_sw2_daily_slyrs$GCM,total_sw2_daily_slyrs$Rgrp_treatment,total_sw2_daily_slyrs$species, total_sw2_daily_slyrs$soilType,total_sw2_daily_slyrs$dist_freq,total_sw2_daily_slyrs$graz_freq,total_sw2_daily_slyrs$intensity,total_sw2_daily_slyrs$RCP,total_sw2_daily_slyrs$YEARS),mean)
    names(total_sw2_daily_slyrs_aggregated)[1:11]=c("Day","site","GCM","Rgrp_treatment","species","soilType","dist_freq","graz_freq","intensity","RCP","YEARS")

    length=length(total_sw2_daily[2,])-10

total_sw2_daily_aggregated=aggregate(total_sw2_daily[,c(3:length)],by=list(total_sw2_daily$Day,total_sw2_daily$site,total_sw2_daily$GCM,total_sw2_daily$Rgrp_treatment,total_sw2_daily$species, total_sw2_daily$soilType,total_sw2_daily$dist_freq,total_sw2_daily$graz_freq,total_sw2_daily$intensity,total_sw2_daily$RCP,total_sw2_daily$YEARS),mean)
    names(total_sw2_daily_aggregated)[1:11]=c("Day","site","GCM","Rgrp_treatment","species","soilType","dist_freq","graz_freq","intensity","RCP","YEARS")
kpalmqui commented 4 years ago

Closed by 00c3579