@@ -157,6 +157,7 @@ vec2 gridpp::R_optimal_interpolation_ensi_lr(const gridpp::Points& bpoints,
157
157
throw std::invalid_argument (" Background RIGTH and points size mismatch" );
158
158
159
159
float hmax = 7 * dh;
160
+ float default_min_std = 0.0013 ;
160
161
/*
161
162
BarnesStructure structure = BarnesStructure( dh, dz, dw, hmax)t;
162
163
if(which_structfun == 0) {
@@ -228,7 +229,7 @@ vec2 gridpp::R_optimal_interpolation_ensi_lr(const gridpp::Points& bpoints,
228
229
if (nValidEns == 0 )
229
230
return background_l;
230
231
231
- // gZ_R(nY, nValidEns): used to compute ensemble-based background correlations i) between yth gridpoint and observations ii) among observationsCompute Y
232
+ // gZ_R(nY, nValidEns): used to compute ensemble-based background correlations i) between yth gridpoint and observations ii) among observations
232
233
vec2 gZ_R = gridpp::init_vec2 (nY, nValidEns); // useful to compute dynamical correlations
233
234
for (int i = 0 ; i < nS; i++) {
234
235
vec pbackgroundValid_R (nValidEns);
@@ -243,7 +244,7 @@ vec2 gridpp::R_optimal_interpolation_ensi_lr(const gridpp::Points& bpoints,
243
244
gZ_R [i][e] = 0 ;
244
245
}
245
246
else {
246
- if (std == 0 ) {
247
+ if (std <= default_min_std ) {
247
248
for (int e = 0 ; e < nValidEns; e++)
248
249
gZ_R [i][e] = 0 ;
249
250
}
@@ -267,11 +268,13 @@ vec2 gridpp::R_optimal_interpolation_ensi_lr(const gridpp::Points& bpoints,
267
268
/* float localizationRadius = structure.localization_distance(p1); */
268
269
float localizationRadius = 0 ;
269
270
if (which_structfun == 0 ) {
270
- BarnesStructure structure = BarnesStructure ( dh, dz, dw, hmax);
271
+ /* BarnesStructure structure = BarnesStructure( dh, dz, dw, hmax);*/
272
+ BarnesStructure structure = BarnesStructure ( dh, dz, dw);
271
273
localizationRadius = structure.localization_distance (p1);
272
274
}
273
275
else if (which_structfun == 1 ) {
274
- MixAStructure structure = MixAStructure ( dh, dz, dw, hmax);
276
+ /* MixAStructure structure = MixAStructure( dh, dz, dw, hmax); */
277
+ MixAStructure structure = MixAStructure ( dh, dz, dw);
275
278
localizationRadius = structure.localization_distance (p1);
276
279
}
277
280
@@ -295,11 +298,13 @@ vec2 gridpp::R_optimal_interpolation_ensi_lr(const gridpp::Points& bpoints,
295
298
}
296
299
vec rhos (lLocIndices0.size ());
297
300
if (which_structfun == 0 ) {
298
- BarnesStructure structure = BarnesStructure ( dh, dz, dw, hmax);
301
+ /* BarnesStructure structure = BarnesStructure( dh, dz, dw, hmax); */
302
+ BarnesStructure structure = BarnesStructure ( dh, dz, dw);
299
303
rhos = structure.corr_background (p1, p2);
300
304
}
301
305
else if (which_structfun == 1 ) {
302
- MixAStructure structure = MixAStructure ( dh, dz, dw, hmax);
306
+ /* MixAStructure structure = MixAStructure( dh, dz, dw, hmax); */
307
+ MixAStructure structure = MixAStructure ( dh, dz, dw);
303
308
rhos = structure.corr_background (p1, p2);
304
309
}
305
310
/* vec rhos = structure.corr_background(p1, p2); */
@@ -358,7 +363,7 @@ vec2 gridpp::R_optimal_interpolation_ensi_lr(const gridpp::Points& bpoints,
358
363
}
359
364
float mean = gridpp::calc_statistic (backgroundValid_L, gridpp::Mean);
360
365
float std = gridpp::calc_statistic (backgroundValid_L, gridpp::Std);
361
- if (gridpp::is_valid (mean) && gridpp::is_valid (std) && std != 0 ) {
366
+ if (gridpp::is_valid (mean) && gridpp::is_valid (std) && std > default_min_std ) {
362
367
for (int e = 0 ; e < nValidEns; e++)
363
368
lX_L (0 ,e) = 1 / sqrt (nValidEns-1 ) * (backgroundValid_L[e] - mean) / std;
364
369
}
@@ -393,11 +398,13 @@ vec2 gridpp::R_optimal_interpolation_ensi_lr(const gridpp::Points& bpoints,
393
398
}
394
399
vec corr (lS);
395
400
if (which_structfun == 0 ) {
396
- BarnesStructure structure = BarnesStructure ( dh, dz, dw, hmax);
401
+ /* BarnesStructure structure = BarnesStructure( dh, dz, dw, hmax); */
402
+ BarnesStructure structure = BarnesStructure ( dh, dz, dw);
397
403
corr = structure.corr_background (p1, p2);
398
404
}
399
405
else if (which_structfun == 1 ) {
400
- MixAStructure structure = MixAStructure ( dh, dz, dw, hmax);
406
+ /* MixAStructure structure = MixAStructure( dh, dz, dw, hmax); */
407
+ MixAStructure structure = MixAStructure ( dh, dz, dw);
401
408
corr = structure.corr_background (p1, p2);
402
409
}
403
410
/* vec corr = structure.corr(p1, p2); */
@@ -429,13 +436,15 @@ vec2 gridpp::R_optimal_interpolation_ensi_lr(const gridpp::Points& bpoints,
429
436
increment = maxInc;
430
437
}
431
438
else if (maxInc < 0 && increment > 0 ) {
432
- increment = maxInc;
439
+ /* increment = maxInc; */
440
+ increment = 0 ;
433
441
}
434
442
else if (minInc < 0 && increment < minInc) {
435
443
increment = minInc;
436
444
}
437
445
else if (minInc > 0 && increment < 0 ) {
438
- increment = minInc;
446
+ /* increment = minInc; */
447
+ increment = 0 ;
439
448
}
440
449
dx[e] = increment;
441
450
}
@@ -491,6 +500,7 @@ vec2 gridpp::R_optimal_interpolation_ensi_staticcorr_lr(const gridpp::Points& bp
491
500
throw std::invalid_argument (" Background rigth and points size mismatch" );
492
501
493
502
float hmax = 7 * dh;
503
+ float default_min_std = 0.0013 ;
494
504
495
505
int nS = points.size ();
496
506
if (nS == 0 )
@@ -560,11 +570,13 @@ vec2 gridpp::R_optimal_interpolation_ensi_staticcorr_lr(const gridpp::Points& bp
560
570
/* float localizationRadius = structure.localization_distance(p1); */
561
571
float localizationRadius = 0 ;
562
572
if (which_structfun == 0 ) {
563
- BarnesStructure structure = BarnesStructure ( dh, dz, dw, hmax);
573
+ /* BarnesStructure structure = BarnesStructure( dh, dz, dw, hmax); */
574
+ BarnesStructure structure = BarnesStructure ( dh, dz, dw);
564
575
localizationRadius = structure.localization_distance (p1);
565
576
}
566
577
else if (which_structfun == 1 ) {
567
- MixAStructure structure = MixAStructure ( dh, dz, dw, hmax);
578
+ /* MixAStructure structure = MixAStructure( dh, dz, dw, hmax); */
579
+ MixAStructure structure = MixAStructure ( dh, dz, dw);
568
580
localizationRadius = structure.localization_distance (p1);
569
581
}
570
582
@@ -588,11 +600,13 @@ vec2 gridpp::R_optimal_interpolation_ensi_staticcorr_lr(const gridpp::Points& bp
588
600
}
589
601
vec rhos (lLocIndices0.size ());
590
602
if (which_structfun == 0 ) {
591
- BarnesStructure structure = BarnesStructure ( dh, dz, dw, hmax);
603
+ /* BarnesStructure structure = BarnesStructure( dh, dz, dw, hmax); */
604
+ BarnesStructure structure = BarnesStructure ( dh, dz, dw);
592
605
rhos = structure.corr_background (p1, p2);
593
606
}
594
607
else if (which_structfun == 1 ) {
595
- MixAStructure structure = MixAStructure ( dh, dz, dw, hmax);
608
+ /* MixAStructure structure = MixAStructure( dh, dz, dw, hmax); */
609
+ MixAStructure structure = MixAStructure ( dh, dz, dw);
596
610
rhos = structure.corr_background (p1, p2);
597
611
}
598
612
for (int i = 0 ; i < lLocIndices0.size (); i++) {
@@ -669,11 +683,13 @@ vec2 gridpp::R_optimal_interpolation_ensi_staticcorr_lr(const gridpp::Points& bp
669
683
}
670
684
vec corr (lS);
671
685
if (which_structfun == 0 ) {
672
- BarnesStructure structure = BarnesStructure ( dh, dz, dw, hmax);
686
+ /* BarnesStructure structure = BarnesStructure( dh, dz, dw, hmax); */
687
+ BarnesStructure structure = BarnesStructure ( dh, dz, dw);
673
688
corr = structure.corr_background (p1, p2);
674
689
}
675
690
else if (which_structfun == 1 ) {
676
- MixAStructure structure = MixAStructure ( dh, dz, dw, hmax);
691
+ /* MixAStructure structure = MixAStructure( dh, dz, dw, hmax); */
692
+ MixAStructure structure = MixAStructure ( dh, dz, dw);
677
693
corr = structure.corr_background (p1, p2);
678
694
}
679
695
/* vec corr = structure.corr(p1, p2); */
@@ -699,13 +715,15 @@ vec2 gridpp::R_optimal_interpolation_ensi_staticcorr_lr(const gridpp::Points& bp
699
715
increment = maxInc;
700
716
}
701
717
else if (maxInc < 0 && increment > 0 ) {
702
- increment = maxInc;
718
+ /* increment = maxInc; */
719
+ increment = 0 ;
703
720
}
704
721
else if (minInc < 0 && increment < minInc) {
705
722
increment = minInc;
706
723
}
707
724
else if (minInc > 0 && increment < 0 ) {
708
- increment = minInc;
725
+ /* increment = minInc; */
726
+ increment = 0 ;
709
727
}
710
728
dx[e] = increment;
711
729
}
0 commit comments