Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature overhaul aggregation code (part1) #268

Open
wants to merge 65 commits into
base: master
Choose a base branch
from

Conversation

dschlaep
Copy link
Member

@dschlaep dschlaep commented Feb 8, 2018

  • introduced generalized aggregation functions
  • possibility to output aggregated values for each year

dschlaep added 30 commits September 9, 2016 08:38
- this branch will be addressing issue #18
- setting option ‘agg_funs’ allows to choose which functions will be
applied to aggregate output across years (and/or to output for each
year)
- setting option ‘agg_years’ contains sequences of years over which
will be aggregated


Former-commit-id: d3124f4
Former-commit-id: 8ba1d5a
- Meta: meta-data of output DB
- aggregation_functions
- aggregation_timewindows


Former-commit-id: 54ede9e
Former-commit-id: 05038c0
Former-commit-id: b5e46d5
Former-commit-id: ea0e901
- argument ‘i_labels’ was overwritten inside function
- making some kinds of debugging annoying
- renamed to ‘i_label’


Former-commit-id: 9aad337
Former-commit-id: fdaadce
- call dbW_setConnection() and dbW_disconnectConnection() when setting
up workers


Former-commit-id: 5917d5f
Former-commit-id: 3f5d3bb
 function ‘get.DoyMostFrequentSuccesses’ didn’t work correctly when
quantiles interpolated
—> type 3 (even order statistic) instead of type 7


Former-commit-id: 406c234
Former-commit-id: e3907b3
- commit 4863b65 [formerly 65ea3ce] [formerly ef0b55941bf5b0b314466a7cff8c040a17c88430 [formerly ec75e0d7130c8102bcc0f3604771568f650949ec]] introduced bug
- i.e., under parallelization with ‘snow’, the code attempted the
workers to connect to the weather DB before the variable
‘dbWeatherDataFile’ was exported to the workers


Former-commit-id: f2ba430
Former-commit-id: f818449
- This function generates the aggregation function which will be
applied to the annual response variables.


Former-commit-id: e438fd6
Former-commit-id: d6e8b8f
…n to choose from

Former-commit-id: 916b8d1
Former-commit-id: 823b184
Three types of estimator are defined
- yearly
- central (tendency): mean, median, and 50%-quantile
- variation: sd, mad, quantiles (except the 50%)


Former-commit-id: 69e9023
Former-commit-id: 303122d
- If 'return_ids', then the function returns a data.frame object with
two columns ‘aggfun_id’ and 'x'. The column ‘aggfun_id’ contains the
values of the identifier 'id' and the column 'x' contains the returned
value(s) of the aggregating functions applied to the input argument 'x'.
- If 'return_ids' is FALSE, then the function returns what would be
otherwise be the column 'x' as numeric vector.


Former-commit-id: 0de3fe4
Former-commit-id: add38f1
- if only quantiles were selected, the previous code added an entry
‘quantile’ without probability value attached to it


Former-commit-id: dd3a4e9
Former-commit-id: 3fa6ae4
…ment 'omit_yearly'

If ‘omit_yearly’ is TRUE, then the output of the ‘yearly’ aggregation
function is not returned.


Former-commit-id: aeabb02
Former-commit-id: 3be1bec
…regation_function'

Former-commit-id: f81c701
Former-commit-id: 901ddea
- progress: up to aggregation 23 = ‘dailyC4_TempVar’

- Adjusting field names of output DB
- Applying ‘agg_fun’ or ‘agg_fun_circular’ to the requested aggregations
- Some aggregations are not across years, but across different units,
e.g., ‘yearlyDryWetPeriods’ and ‘monthlySPEIEvents’; ‘agg_fun’ gained a
new argument ‘omit_yearly’ and ‘resAgg' is filled except for the not
‘is_yearly’ columns

other changes:
- replaced any(is.na(.)) with anyNA(.) and thus R v3.1.0 is required
- re-coded the aggregation ‘dailySnowpack2’ for clarity and speed


Former-commit-id: d1ae370
Former-commit-id: 08cd78b
- this branch will be addressing issue #18
- setting option ‘agg_funs’ allows to choose which functions will be
applied to aggregate output across years (and/or to output for each
year)
- setting option ‘agg_years’ contains sequences of years over which
will be aggregated


Former-commit-id: 63ff132
Former-commit-id: 132ecc4
- Meta: meta-data of output DB
- aggregation_functions
- aggregation_timewindows


Former-commit-id: 44659f3
Former-commit-id: 1da7e06
Former-commit-id: beebf33
Former-commit-id: bde84d0
- This function generates the aggregation function which will be
applied to the annual response variables.


Former-commit-id: 166edd2
Former-commit-id: 408ec99
…n to choose from

Former-commit-id: 830b156
Former-commit-id: 635fc84
Three types of estimator are defined
- yearly
- central (tendency): mean, median, and 50%-quantile
- variation: sd, mad, quantiles (except the 50%)


Former-commit-id: 3d8abb8
Former-commit-id: 6260e07
- If 'return_ids', then the function returns a data.frame object with
two columns ‘aggfun_id’ and 'x'. The column ‘aggfun_id’ contains the
values of the identifier 'id' and the column 'x' contains the returned
value(s) of the aggregating functions applied to the input argument 'x'.
- If 'return_ids' is FALSE, then the function returns what would be
otherwise be the column 'x' as numeric vector.


Former-commit-id: d8dedcb
Former-commit-id: 5b3448b
dschlaep and others added 27 commits September 16, 2016 09:14
- progress: up to aggregation 27.2 = ‘dailySoilWaterPulseVsStorage’


Former-commit-id: fbe3e71
Former-commit-id: 3bc7a17
- progress: up to aggregation 34 = ‘dailyRechargeExtremes’


Former-commit-id: 0557b7b
Former-commit-id: bffaf5b
- progress: up to aggregation 35b =
‘dailyNRCS_Chambers2014_ResilienceResistance’


Former-commit-id: 2c7f452
Former-commit-id: db91270
…eralized_agg_funs

Former-commit-id: 90e2a5a
Former-commit-id: f893de1
…alized_agg_funs

Former-commit-id: 49c71a5
Former-commit-id: 5f94d34
Working on implementing 'agg_fun' aggregations (part 7)


Former-commit-id: a1f6a24
Former-commit-id: 21cc475
- element ‘agg_years’ added to description ‘sim_time’
- elements ‘agg_funs’ and ‘agg_fun_options’ added to description
‘req_out’
- elements ‘define_period_min_cont_days’ and ‘SPEI_tscales_months’
added to description ‘opt_agg’

- new functions ‘degree_days’, ‘soil_status’,
‘dailyRegeneration_bySWPSnow_ThisYear_YN’, and ‘season_diff_NS’

- function ‘sw_dailyC4_TempVar’ gains argument ‘return_yearly’

- new R file ‘SWSF_OutputAggregation.R’ with functions
‘create_aggregation_function’ and ‘setup_aggregations’

- outputDB gains new tables ‘Meta’, ‘aggregating_functions’, and
‘aggregating_timewindows’

- function ‘init_rSFSW2_project’ calls ‘setup_aggregations’ to prepare
aggregation functions and store in variable ‘SFSW2_prj_meta’

- code for new aggregation functions and aggregation windows updated in
‘do_OneSite’, ‘dbOutput_create_Design’,
‘dbOutput_create_OverallAggregationTable’,
‘dbOutput_create_DailyAggregationTable’, and ‘make_dbOutput’ (which now
checks outputDB version number)

- new elements in package-level environment ‘SFSW2_glovars’:
"v_dbOutput”, "minVersion_dbOutput"
- branch is now installable as package
# Conflicts:
#	R/Miscellaneous_Functions.R
#	R/OutputDatabase.R
#	R/Simulation_Run.R
#	demo/SFSW2_project_descriptions.R
@dschlaep dschlaep added this to the OverhaulAggregationCode milestone Feb 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants