Ice Sheet System Model  4.18
Code documentation
Functions
Kriging.cpp File Reference

"c" core code for Kriging More...

#include "./Kriging.h"

Go to the source code of this file.

Functions

void KrigingUsage (void)
 
 WRAPPER (Kriging_python)
 

Detailed Description

"c" core code for Kriging

Definition in file Kriging.cpp.

Function Documentation

◆ KrigingUsage()

void KrigingUsage ( void  )

Definition at line 6 of file Kriging.cpp.

6  {/*{{{*/
7  int num=1;
8 #ifdef _MULTITHREADING_
9  num=_NUMTHREADS_;
10 #endif
11  _printf0_("\n");
12  _printf0_(" usage: predictions=" << __FUNCT__ << "(x,y,observations,x_interp,y_interp,'options');\n");
13  _printf0_(" available options:\n");
14  _printf0_(" -'model': Available variogram models 'gaussian' (default),'spherical','power','exponential'\n");
15  _printf0_(" -'nugget': nugget effect (default 0.2)\n");
16  _printf0_(" -'range': for gaussian, spherical and exponential models (default sqrt(3))\n");
17  _printf0_(" -'sill': for gaussian, spherical and exponential models (default 1)\n");
18  _printf0_(" -'slope': for power model (default 1)\n");
19  _printf0_(" -'power': for power model (default 1)\n");
20  _printf0_(" -'searchradius': search radius for each prediction (default is observations span)\n");
21  _printf0_(" -'boxlength': minimum length of quadtree boxes (useful to decrease the number of observations)\n");
22  _printf0_(" -'maxdata': minimum number of observations for a prediction (default is 50)\n");
23  _printf0_(" -'mindata': maximum number of observations for a prediction (default is 1)\n");
24  _printf0_(" -'maxtrimming': maximum trimming value (default is -1.e+21)\n");
25  _printf0_(" -'mintrimming': minimum trimming value (default is +1.e+21)\n");
26  _printf0_(" -'minspacing': minimum distance between observation (default is 0.01)\n");
27  _printf0_(" -'numthreads': number of threads, default is "<<num << "\n");
28  _printf0_("\n");
29 }/*}}}*/

◆ WRAPPER()

WRAPPER ( Kriging_python  )

Definition at line 30 of file Kriging.cpp.

30  {
31 
32  /*Outputs*/
33  double *x = NULL;
34  double *y = NULL;
35  double *observations = NULL;
36  double *x_interp = NULL;
37  double *y_interp = NULL;
38  double *predictions = NULL;
39  double *error = NULL;
40  Options *options = NULL;
41  int N_interp,M_interp,M,N,n_obs;
42 
43  /*Boot module: */
44  MODULEBOOT();
45 
46  /*checks on arguments on the matlab side: */
47  if (nrhs<NRHS || nlhs>NLHS){
48  KrigingUsage(); _error_("Kriging usage error");
49  }
50 
51  /*Fetch inputs: */
52  FetchData(&x,&n_obs,X);
53  FetchData(&y,&N,Y); if(n_obs!=N) _error_("x and y should have the same size");
54  FetchData(&observations,&N,OBSERVATIONS); if(n_obs!=N) _error_("x and observations should have the same size");
55  FetchData(&x_interp,&M_interp,&N_interp,XINTERP);
56  FetchData(&y_interp,&M,&N,YINTERP); if(N!=N_interp || M!=M_interp) _error_("x_interp and y_interp should have the same size");
57  FetchData(&options,NRHS,nrhs,prhs);
58 
59  /*Call x layer*/
60  Krigingx(&predictions,&error,x,y,observations,n_obs,x_interp,y_interp,M_interp*N_interp,options);
61 
62  /*Generate output Matlab Structures*/
63  if(nlhs>=1) WriteData(PREDICTIONS,predictions,M_interp,N_interp);
64  if(nlhs==2) WriteData(ERROR,error,M_interp,N_interp);
65 
66  /*Free ressources: */
67  xDelete<double>(x);
68  xDelete<double>(y);
69  xDelete<double>(observations);
70  xDelete<double>(x_interp);
71  xDelete<double>(y_interp);
72  xDelete<double>(predictions);
73  xDelete<double>(error);
74  delete options;
75 
76  /*end module: */
77  MODULEEND();
78 }
Options
Definition: Options.h:9
_printf0_
#define _printf0_(StreamArgs)
Definition: Print.h:29
WriteData
void WriteData(IssmPDouble **pmatrix, int *pnel, int *matrix, int M, int N)
Definition: WriteJavascriptData.cpp:16
NRHS
#define NRHS
Definition: BamgConvertMesh.h:52
KrigingUsage
void KrigingUsage(void)
Definition: Kriging.cpp:6
FetchData
void FetchData(char **pstring, char *stringin)
Definition: FetchJavascriptData.cpp:16
__FUNCT__
#define __FUNCT__
Definition: Chacox.h:43
NLHS
#define NLHS
Definition: BamgConvertMesh.h:50
Krigingx
int Krigingx(double **ppredictions, double **perror, double *obs_x, double *obs_y, double *obs_list, int obs_length, double *x_interp, double *y_interp, int n_interp, Options *options)
Definition: Krigingx.cpp:13
_error_
#define _error_(StreamArgs)
Definition: exceptions.h:49