This is a TEMPORARY FIX for the artefactcorrection step for 13 CRFs with faulty …
…events for a few crops.
Showing
1 changed file
with
5 additions
and
4 deletions
@@ -278,7 +278,8 @@ for i0=1:size(t,1) | @@ -278,7 +278,8 @@ for i0=1:size(t,1) | ||
278 | indexint=[4*StartInterpolation:4*EndInterpolation]; | 278 | indexint=[4*StartInterpolation:4*EndInterpolation]; |
279 | GoodEvent=[]; | 279 | GoodEvent=[]; |
280 | for i1=1:length(ev) | 280 | for i1=1:length(ev) |
281 | - if strcmp(EventType,strvcat(ev(i1).type)) | 281 | + disp(ev(i1)) |
282 | + if strcmp(EventType,strvcat(ev(i1).type)) && ev(i1).time > timeonset(D) | ||
282 | GoodEvent=[GoodEvent i1]; | 283 | GoodEvent=[GoodEvent i1]; |
283 | ind=indsample(D,ev(i1).time); | 284 | ind=indsample(D,ev(i1).time); |
284 | ind1=[ind+4*StartInterpolation]; | 285 | ind1=[ind+4*StartInterpolation]; |
@@ -388,7 +389,7 @@ for i0=1:size(t,1) | @@ -388,7 +389,7 @@ for i0=1:size(t,1) | ||
388 | n=0; | 389 | n=0; |
389 | for i1=1:length(ev) | 390 | for i1=1:length(ev) |
390 | % if ~isempty(intersect(EventType,ev(i1).value)) | 391 | % if ~isempty(intersect(EventType,ev(i1).value)) |
391 | - if strcmp(EventType,ev(i1).type) | 392 | + if strcmp(EventType,ev(i1).type) && ev(i1).time > timeonset(D) |
392 | n=n+1; | 393 | n=n+1; |
393 | ind=indsample(D,ev(i1).time); | 394 | ind=indsample(D,ev(i1).time); |
394 | ind1=[ind1 ind+StartInterpolation(i2,n)]; | 395 | ind1=[ind1 ind+StartInterpolation(i2,n)]; |
@@ -414,7 +415,7 @@ for i0=1:size(t,1) | @@ -414,7 +415,7 @@ for i0=1:size(t,1) | ||
414 | PeakMax=0.003; %Could be defined as argument | 415 | PeakMax=0.003; %Could be defined as argument |
415 | Artefact=[]; | 416 | Artefact=[]; |
416 | for i1=1:length(ev) | 417 | for i1=1:length(ev) |
417 | - if strcmp(EventType,strvcat(ev(i1).type)) | 418 | + if strcmp(EventType,strvcat(ev(i1).type)) && ev(i1).time > timeonset(D) |
418 | T2=indsample(D,S.StartInterpolation+ev(i1).time); | 419 | T2=indsample(D,S.StartInterpolation+ev(i1).time); |
419 | T3=indsample(D,S.EndInterpolation+ev(i1).time); | 420 | T3=indsample(D,S.EndInterpolation+ev(i1).time); |
420 | T4=indsample(D,PeakMin+ev(i1).time); | 421 | T4=indsample(D,PeakMin+ev(i1).time); |
@@ -460,7 +461,7 @@ for i0=1:size(t,1) | @@ -460,7 +461,7 @@ for i0=1:size(t,1) | ||
460 | %Apply correction | 461 | %Apply correction |
461 | n=0; | 462 | n=0; |
462 | for i1=1:length(ev) | 463 | for i1=1:length(ev) |
463 | - if strcmp(EventType,strvcat(ev(i1).type)) | 464 | + if strcmp(EventType,strvcat(ev(i1).type)) && ev(i1).time > timeonset(D) |
464 | T2=indsample(D,S.StartInterpolation+ev(i1).time); | 465 | T2=indsample(D,S.StartInterpolation+ev(i1).time); |
465 | T3=indsample(D,S.EndInterpolation+ev(i1).time); | 466 | T3=indsample(D,S.EndInterpolation+ev(i1).time); |
466 | if ~isnan(T3) | 467 | if ~isnan(T3) |
-
Please register or login to post a comment