@@ -87,24 +87,26 @@ public static void main(String[] args) throws IOException {
87
87
List <PlotCurveCharacterstics > chars = new ArrayList <>();
88
88
89
89
int prevIndex = 0 ;
90
+ double prevLastSlip = 0d ;
90
91
for (double startTime =firstEventTime ; startTime +windowSize <lastEventTime ; startTime +=windowSize ) {
91
92
double endTime = startTime + windowSize ;
92
93
DiscretizedFunc subFunc = new ArbitrarilyDiscretizedFunc ();
93
- double slipAtStart = 0d ;
94
+ double slipAtStart = prevLastSlip ;
94
95
for (int i =prevIndex ; i <cumulativeSlipFunc .size (); i ++) {
95
96
double time = cumulativeSlipFunc .getX (i );
96
97
if (time < startTime )
97
98
continue ;
98
99
if (time > endTime )
99
100
break ;
100
101
prevIndex = i ;
101
- if ( slipAtStart == 0 && startTime > firstEventTime )
102
- slipAtStart = cumulativeSlipFunc . getY ( i - 1 ) ;
103
- double slip = cumulativeSlipFunc . getY ( i ) - slipAtStart ;
102
+ double slip = cumulativeSlipFunc . getY ( i );
103
+ prevLastSlip = slip ;
104
+ double relSlip = slip - slipAtStart ;
104
105
double relTime = time - startTime ;
105
106
Preconditions .checkState (relTime >= 0d );
106
- subFunc .set (relTime , slip );
107
+ subFunc .set (relTime , relSlip );
107
108
}
109
+ subFunc .set (0d , slipAtStart );
108
110
funcs .add (subFunc );
109
111
chars .add (new PlotCurveCharacterstics (PlotLineType .SOLID , 1f , Color .GRAY ));
110
112
}
@@ -116,7 +118,7 @@ public static void main(String[] args) throws IOException {
116
118
funcs .add (oneToOne );
117
119
chars .add (new PlotCurveCharacterstics (PlotLineType .DASHED , 1f , Color .BLACK ));
118
120
119
- PlotSpec spec = new PlotSpec (funcs , chars , middle .getParentSectionName (), "Windowed Time (years)" , "Cumulative Slip (mm/yr )" );
121
+ PlotSpec spec = new PlotSpec (funcs , chars , middle .getParentSectionName (), "Windowed Time (years)" , "Cumulative Slip (m )" );
120
122
121
123
HeadlessGraphPanel gp = PlotUtils .initHeadless ();
122
124
0 commit comments