Changeset 14049
- Timestamp:
- 11/29/12 08:09:39 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/Container/Observations.cpp
r14048 r14049 426 426 /*FUNCTION Observations::InterpolationV4{{{*/ 427 427 void Observations::InterpolationV4(IssmPDouble *pprediction,IssmPDouble x_interp,IssmPDouble y_interp,IssmPDouble radius,int mindata,int maxdata){ 428 /* Reference: David T. Sandwell, Biharmonic spline interpolation of GEOS-3 429 * and SEASAT altimeter data, Geophysical Research Letters, 2, 139-142, 430 * 1987. Describes interpolation using value or gradient of value in any 431 * dimension.*/ 428 432 429 433 /*Intermediaries*/ … … 435 439 IssmPDouble *Green = NULL; 436 440 IssmPDouble *weights = NULL; 437 IssmPDouble * d= NULL;441 IssmPDouble *g = NULL; 438 442 439 443 /*Some checks*/ … … 455 459 /*Allocate intermediary matrix and vectors*/ 456 460 Green = xNew<IssmPDouble>(n_obs*n_obs); 457 d= xNew<IssmPDouble>(n_obs);461 g = xNew<IssmPDouble>(n_obs); 458 462 459 463 /*First: distance vector*/ 460 464 for(i=0;i<n_obs;i++){ 461 d[i] = sqrt( (x[i]-x_interp)*(x[i]-x_interp) + (y[i]-y_interp)*(y[i]-y_interp) ); 465 h = sqrt( (x[i]-x_interp)*(x[i]-x_interp) + (y[i]-y_interp)*(y[i]-y_interp) ); 466 if(h>0){ 467 g[i] = h*h*(log(h)-1.); 468 } 469 else{ 470 g[i] = 0.; 471 } 462 472 } 463 473 … … 483 493 #endif 484 494 485 /*ok now we can interpolate with these weights*/ 486 487 _error_("Not implemented yet"); 495 /*Interpolate*/ 496 prediction = 0; 497 for(i=0;i<n_obs;i++) prediction += weights[i]*g[i]; 498 488 499 } 489 500 … … 493 504 xDelete<IssmPDouble>(y); 494 505 xDelete<IssmPDouble>(obs); 506 xDelete<IssmPDouble>(Green); 507 xDelete<IssmPDouble>(g); 508 xDelete<IssmPDouble>(weights); 495 509 }/*}}}*/ 496 510 /*FUNCTION Observations::QuadtreeColoring{{{*/
Note:
See TracChangeset
for help on using the changeset viewer.