forked from ProcessNetwork/ProcessNetwork_Software
-
Notifications
You must be signed in to change notification settings - Fork 2
/
config_runscript_Bondville.m
107 lines (91 loc) · 9.11 KB
/
config_runscript_Bondville.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
% Setup file to run the ProcessNetwork software, and a couple plotting
% options
%% Create the options structure
clear
close all
clc
clear global processLog
global processLog
% File specification and variable designation
opts.files = {'Bondville2003InputData\2003_1_USBo1_L4_30min.txt';... % cell column of strings listing files to process, including path
'Bondville2003InputData\2003_2_USBo1_L4_30min.txt';...
'Bondville2003InputData\2003_3_USBo1_L4_30min.txt';...
'Bondville2003InputData\2003_4_USBo1_L4_30min.txt';...
'Bondville2003InputData\2003_5_USBo1_L4_30min.txt';...
'Bondville2003InputData\2003_6_USBo1_L4_30min.txt';...
'Bondville2003InputData\2003_7_USBo1_L4_30min.txt';...
'Bondville2003InputData\2003_8_USBo1_L4_30min.txt';...
'Bondville2003InputData\2003_9_USBo1_L4_30min.txt';...
'Bondville2003InputData\2003_10_USBo1_L4_30min.txt';...
'Bondville2003InputData\2003_11_USBo1_L4_30min.txt';...
'Bondville2003InputData\2003_12_USBo1_L4_30min.txt'};
opts.varNames = {'Incoming shortwave radiation','Air Temp','Vapor pressure deficit','Soil temperature (surface layer)','Precipitation','soil water content (surface layer)','sensible heat flux','latent heat flux','gross ecosystem respiration','net ecosystem exchange','gross ecosystem production'}; % cell row of strings listing the variable names (no latex symbols here) (default = V1,V2,V3,etc.)
opts.varSymbols = {'\itR_g','\theta_a','VPD','\theta_s','\itP','\theta','\gamma_H','\gamma_{LE}','GER','NEE','GEP'}; % cell row of strings listing the variable symbols for plotting (latex okay here) (default = same as varNames)
opts.varUnits = {'W m^{-2}','\circC','KPa','\circC','mm','m^{3} m^{-3}','W m^{-2}','W m^{-2}','\mumol CO_2 m^{-2} s^{-1}','\mumol CO_2 m^{-2} s^{-1}','\mumol CO_2 m^{-2} s^{-1}'}; % (optional) cell row of strings listing the variable symbols for plotting (latex okay here)
% Preprocessing options
opts.NoDataCode = -9999; % Numerical value representing no data (default = NaN)
opts.trimTheData = 1; % Remove entire rows of data with at least 1 missing value? 0 = no, 1 = yes (default)
opts.transformation = 1; % 0 = apply no transformation (default), 1 = apply anomaly filter, 2 = apply maximal overlap wavelet transform (requires no data gaps)
opts.anomalyPeriodInData = 48; % Anomaly filter only: set to the length in time steps of the period of the data (default = 48)
opts.anomalyMovingAveragePeriodNumber = 5; % Anomaly filter only: the moving window used for anomaly generation, in # of periods (default = 5)
opts.waveN = 1; % Wavelet transform only: vector of dyadic (2^n) scales to decompose (default = 1)
opts.waveName = 'la8'; % Wavelet transform only: string indicating mother wavelet to use (default = 'la8', options are 'haar','d4','la8','la16')
opts.waveDorS = 1; % Wavelet transform only: 1 (default) = output detail added at this scale (will be summed over scales in waveN), 2 = output smooth approximation at the scale in waveN (waveN must be single-valued)
opts.binType = 2; % 0 = don't do classification (or data are already classified), 1 = classify using locally bounded bins (default), 2 = classify using globally bounded bins
opts.binPctlRange = [0 100]; % [min max] percentile range to determine total bin range for each variable. Default is entire data range ([0 100])
opts.nBins = 11; % Number of bins to classify each signal (default = 11). This can be a single value to be applied to all variables, or a row vector of integers correspoding with each column in the input data
opts.SurrogateMethod = 2; % 0 = Do not do statistical testing, regardless of whether input files contain Surrogates. 1 = Use the Surrogates contained in the loaded files. 2 = create and test new surrogates via random shuffle of input data (default); 3 = create and test new surrogates via IAAFT method (requires no data gaps)
opts.nTests = 100; % Number of surrogates to create and/or test (default = 100)
% Entropy computation options
opts.doEntropy = 1; % run entropy calculations? 0 = no (default), 1 = yes
opts.lagVect = 0:36; % lags (in units of time steps) to evaluate (default = 0:10). Note: 0 will always be included, whether it is entered here or not.
opts.SurrogateTestEachLag = 0; % Test surrogates at each lag? 0 = no, test last lag only (default), 1 = yes
opts.oneTailZ = 1.66; % one-tail z-score for 95% significance given number of tests, 1.66 for 100, 1.68 for 50, 1.71 for 25
opts.parallelWorkers = 2; % parallel CPU matlab toolbox flag; if 0 or 1 no parallelization is used (default), if a positive integer will attempt to open this number of workers using parallel toolbox
opts.closeParallelPool = 1; % close parallel pool after finishing? 0 = no, 1 = yes (default)
% Saving options
opts.savePreProcessed = 0; % save preprocessed data? 0 = no (default), 1 = yes
opts.preProcessedSuffix = '_preprocessed'; % string indicating the suffix to add onto the end of each file name when saving preprocessed data
opts.saveProcessNetwork = 1; % save R structure output and process log from ProcessNetwork computations? 0 = no, 1 = yes (default)
opts.outFileProcessNetwork = 'Results_Bondville'; % file name of saved ProcessNetwork output. Default file will be named with date and time of processing run
opts.outDirectory = 'Bondville2003InputData\'; % directory to save output. (default is current directory)
%% Run the script
tic
[R,opts] = ProcessNetwork(opts);
toc
%% Do coupling lag plot
clear popts
popts.testStatistic = 'TR'; % String indicating the name of the test statistic within the R. output structure to plot
popts.SigThresh = 'SigThreshTR'; % (optional) string inficating the name of the statistical significance threshold for the test statistic
popts.vars = {'precipitation';'latent heat flux'}; % cell array of strings (matching R.varNames) or indices within R.varNames indicating the variables in the coupling 1st is FROM variable, 2nd is TO variable (default is [1 2])
popts.fi = 7; % file index (4th dimension of output) (default is 1)
popts.laglim = [0 36]; % [min max] of lags to show (default is entire range)
popts.fignum = 1; % figure number to plot within (default is 1)
popts.subplot = [1 1 1]; % Following the matlab format [nrows ncols n], indicate the subplot to plot within (default is [1 1 1]
popts.clearplot = 1; % 1 = clear the current plot before plotting, 0 = plot over whatever is already in the plot (default)
popts.plotProperties = {'color',[0 0 0],'linewidth',2}; % (optional) following the Name, Value linespec syntax, enclose desired linespec properties for the testStatistic in curly brackets
popts.sigThreshPlotProperties = {'color',[0 0 0],'linewidth',1}; % (optional) following the Name, Value linespec syntax, enclose desired linespec properties for sigThresh in curly brackets
popts.saveFig = 0; % 1 = save the figure, 2 = don't save (default)
popts.figName = 'couplingPlot'; % file name for saving figure. Default includes the testStatistic and variables in the coupling
popts.saveFormat = 'png'; % format to save the figure in. See MATLAB help for saveas function for allowable formats
popts.outDirectory = opts.outDirectory; % relative or absolute directory to save figure in (default is current directory)
% Plot it!
[H] = couplingLagPlot(R,popts);
%% Do multi-coupling synchrony plot
clear popts
popts.testStatistic = 'TR'; % String indicating the name of the test statistic within the R. output structure to plot
popts.SigThresh = 'SigThreshTR'; % (optional) string inficating the name of the statistical significance threshold for the test statistic
popts.ToVar = 11; % The 'TO' variable in the set of couplings to plot. Can be a string or index matching one of the names in R.varNames
% popts.FromVars = [1:8 10:11]; % The 'FROM' variables in the set of couplings to plot. Can be a cell array of strings or vector of indices matching names in R.varNames
popts.fi = 8; % file index (4th dimension of output) (default is 1)
popts.laglim = [0 36]; % [min max] of lags to evaluate (default is entire range)
popts.claglim = [0 36]; % [min max] range of lags to form the color range in plotting the lag of max testStatistic (default is entire range observed in the data)
popts.fignum = 2; % figure number to plot within (default is 1)
popts.subplot = [1 1 1]; % Following the matlab format [nrows ncols n], indicate the subplot to plot within (default is [1 1 1]
popts.clearplot = 1; % 1 = clear the current plot before plotting, 0 = plot over whatever is already in the plot (default)
popts.saveFig = 1; % 1 = save the figure, 2 = don't save (default)
popts.figName = 'multicouplingPlot'; % file name for saving figure. Default includes the testStatistic and variables in the coupling
popts.saveFormat = 'png'; % format to save the figure in. See MATLAB help for saveas function for allowable formats
popts.outDirectory = opts.outDirectory; % relative or absolute directory to save figure in (default is current directory)
% Plot it!
[H] = multiCouplingSynchronyPlot(R,popts);