METHOD get_default_method(void) { int i, Xset, Vgm_set; /* * no no prediction locations or no data: */ if (get_n_vars() == 0) return NSP; if (valdata->id < 0 && gl_xvalid == 0 && data_area == NULL) { return UIF; } /* * check on X variables */ for (i = Xset = 0; i < get_n_vars(); i++) if (!(data[i]->n_X == 1 && data[i]->colX[0] == 0)) Xset++; /* * check on variograms */ for (i = 0, Vgm_set = 0; i < get_n_vars(); i++) if (vgm[LTI(i,i)] != NULL && (vgm[LTI(i,i)]->n_models > 0 || vgm[LTI(i,i)]->table != NULL)) /* was: ->id >= 0*/ Vgm_set++; if (!(Vgm_set == 0 || Vgm_set == get_n_vars())) ErrMsg(ER_SYNTAX, "set either all or no variograms"); if (Vgm_set > 0) { if (get_n_beta_set() > 0) return SKR; else return (Xset > 0 ? UKR : OKR); } else return (Xset > 0 ? LSLM : IDW); }
int decide_on_coincide(void) { int i, j; if (get_n_vars() <= 1) return 0; if (get_mode() == STRATIFY) return 0; /* data may coincide, but prediction locations won't */ for (i = 1; i < get_n_vars(); i++) { if (data[i]->n_list != data[0]->n_list || data[i]->colnx != data[0]->colnx || data[i]->colny != data[0]->colny || data[i]->colnz != data[0]->colnz || data[i]->sel_min != data[0]->sel_min || data[i]->sel_max != data[0]->sel_max || data[i]->force != data[0]->force || data[i]->sel_rad != data[0]->sel_rad) return 0; /* don't check filename: 'file.dat' and './file.dat' */ /* * Consider the data file * 1 2 NA 3 * 2 3 4 NA * with x=1, y=2, v=3 (for var 1), v=4 (for var 2). * This is only distinguishable by doing it the ``hard way'': */ for (j = 0; j < data[0]->n_list; j++) { if (data[0]->list[j]->x != data[i]->list[j]->x || data[0]->list[j]->y != data[i]->list[j]->y || data[0]->list[j]->z != data[i]->list[j]->z) return 0; } } if (DEBUG_DUMP) printlog("(identical search conditions found for all variables)\n"); return 1; }
void setup_valdata_X(DATA *d) { /* * fills '0'-X columns (intercept) at the right place * e.g. data(a): .. X=1&2;data(b): .. X=3&4; data(): .. X=1&2&3&4; * this leads to "0 1 2 3 4" for colX, but should be "0 1 2 0 3 4"; */ int i = 0, j = 0, n_d, n_all; /* * # positive X's in all variables should equal # positive X's in this */ for (i = 0, n_all = 0; i < get_n_vars(); i++) for (j = 0; j < data[i]->n_X; j++) if (data[i]->colX[j] > 0) n_all++; for (i = 0, n_d = 0; i < d->n_X; i++) if (d->colX[i] > 0) n_d++; if (n_all != n_d) { pr_warning( "nr of X's in data: (%d) should match X's in other data(...) (%d)", n_d, n_all); ErrMsg(ER_IMPOSVAL, "X column definition mismatch"); } /* * now correct for 0's */ for (i = 0, n_all = 0; i < get_n_vars(); i++) n_all += data[i]->n_X; if (n_all == d->n_X) return; /* we're done */ n_d = d->n_X; d->n_X = n_all; d->colX = (int *) realloc(d->colX, d->n_X * sizeof(int)); /* fill backwards */ for (i = get_n_vars() - 1; i >= 0; i--) { for (j = data[i]->n_X - 1; j >= 0; j--) { n_all--; /* position of current X in d */ if (data[i]->colX[j] <= 0) /* intercept, x, xy, x2, etc. */ d->colX[n_all] = data[i]->colX[j]; else { n_d--; if (n_d < 0) ErrMsg(ER_IMPOSVAL, "setup_X(): n_d < 0"); if (d->colX[n_d] == 0) ErrMsg(ER_IMPOSVAL, "setup_X(): zero error"); d->colX[n_all] = d->colX[n_d]; } if (n_all < 0) ErrMsg(ER_IMPOSVAL, "setup_X(): n_all < 0"); } } return; }
unsigned int *get_n_sim_locs_table(unsigned int *size) { unsigned int i, j, *table; if (get_mode() == STRATIFY) { if (val_data->id > -1) { *size = val_data->maxstratum - val_data->minstratum + 2; table = (unsigned int *) emalloc(*size * sizeof(int)); for (i = 0; i < *size; i++) table[i] = 0; for (i = 0; i < val_data->n_list; i++) table[val_data->list[i]->u.stratum]++; } else { *size = (int) STRATUM(masks[0]->cellmax) - (int) STRATUM(masks[0]->cellmin) + 1; table = (unsigned int *) emalloc(*size * sizeof(int)); for (i = 0; i < *size; i++) table[i] = 0; for (i = 0; i < masks[0]->rows; i++) { for (j = 0; j < masks[0]->cols; j++) { if (!map_cell_is_mv(masks[0], i, j)) table[(int) STRATUM(map_get_cell(masks[0], i, j))]++; } } } } else { *size = (int) get_n_vars(); table = (unsigned int *) emalloc(*size * sizeof(int)); for (i = 0; i < *size; i++) table[i] = n_pred_locs; } return table; }
int get_n_beta_set(void) { int i, nbeta; for (i = nbeta = 0; i < get_n_vars(); i++) if (data[i]->beta != NULL) nbeta++; return nbeta; }
void set_mode(void) { int i, j, check_failed = 0; if (method == NSP) return; /* * simple, univariate: */ if (get_n_vars() <= 1) { mode = SIMPLE; return; } /* * (get_n_vars() > 1): * multivariable prediction if all cross variograms set parameters merge */ for (i = check_failed = 0; i < get_n_vars(); i++) for (j = 0; j < i; j++) if (vgm[LTI(i,j)] == NULL || vgm[LTI(i,j)]->id < 0) check_failed = 1; if (check_failed == 0) { mode = MULTIVARIABLE; return; } if (n_variograms_set() == 0) { for (i = 0; i < get_n_vars(); i++) if (data[i]->n_merge > 0) { mode = MULTIVARIABLE; return; } } /* * stratify? ONLY if: * 0. get_n_vars() > 1; no cross variograms set ==>> has been checked. * 1. no pred(): or var(): except for first variable; * 2. No masks and valdata->what_is_u == U_ISSTRATUM * 3. mask is a valid strata map, n categories > 1 */ mode = (valdata->what_is_u == U_ISSTRATUM) ? STRATIFY : SIMPLE; return; }
const char *name_identifier(int i) { static const char *cp_val = "data()", *cp_area = "area"; switch (i) { case ID_OF_VALDATA: return cp_val; case ID_OF_AREA: return cp_area; default: if (i >= get_n_vars() || i < 0) { pr_warning("i = %d", i); ErrMsg(ER_RANGE, "name_identifier(i): i outside range"); } return ids[i]; } }
static void exit_predictions(PRED_AT what) { int i; if (gl_nsim > 1 && gl_lhs) lhs(get_gstat_data(), get_n_vars(), get_mode() == STRATIFY); switch (what) { case AT_POINTS: write_points(NULL, NULL, NULL, NULL, 0); if (gl_nsim > 1) save_simulations_to_ascii(o_filename); break; case AT_GRIDMAP: if (gl_nsim > 1) { if (DEBUG_DUMP) printlog("\nWriting results to files..."); save_simulations_to_maps(masks[0]); if (DEBUG_DUMP) printlog("done"); } else { for (i = 0; i < get_n_outfile(); i++) { if (get_outfile_namei(i)) { map_sign(outmap[i], what_is_outfile(i)); (outmap[i])->write(outmap[i]); map_free(outmap[i]); } } } for (i = 0; i < get_n_masks(); i++) map_free(masks[i]); efree(masks); efree(outmap); break; } print_orvc(); efree(est); } /* exit_predictions() */
int main(int argc, char *argv[]) { #else int gstat_main(int argc, char *argv[]) { #endif DATA **data = NULL, *valdata = NULL; /* * initialise some global variables: */ atexit(close_gstat_log_file); init_userio(1); init_global_variables(); argv0 = argv[0]; /* * register command line arguments on command_line: */ command_line = store_argv(argc, argv); parse_gstatrc(); /* * INPUT: command line options; */ parse_options(argc, argv); /* exits on -e options */ /* * start with program heading: */ printlog("%s: %s version %s\n", GSTAT_NAME, GSTAT_OS, VERSION); printlog("%s\n", GSTAT_CR); gstat_start(); /* * INPUT: Parse command files: */ if (optind == argc) { /* there's no command file name left */ if (get_method() != UIF) { /* -i or -m command line option */ /* no arguments */ printlog("Updates, manuals and source code: %s\n", GSTAT_HOME); printlog("%s\n", USAGE); ErrMsg(ER_NOCMD, ""); } else { start_ui(); exit(0); } } else { /* we have a command file to be read */ for ( ; optind < argc; optind++) { command_file_name = argv[optind]; parse_file(command_file_name); if (logfile_name != NULL) set_gstat_log_file(efopen(logfile_name, "w")); /* * get global variables locally: */ data = get_gstat_data(); valdata = get_dataval(); set_seed(gl_seed); /* * check variable settings and next * INPUT: read data values from file: */ read_all_data(data, valdata, get_n_vars()); if (get_method() == NSP) /* Still no answer to this: choose default */ set_method(get_default_method()); set_mode(); check_global_variables(); setup_meschach_error_handler(); if (DEBUG_DUMP) dump_all(); if (get_method() != NSP) printlog("[%s]\n", method_string(get_method())); if (check_only) set_method(NSP); /* * start calculations && OUTPUT routines: */ switch (get_method()) { case UIF: start_ui(); break; case NSP: break; case COV: case SEM: do_variogram(get_n_vars(), get_method()); break; case POLY: setup_poly_method(); /*FALLTHROUGH*/ default: if (gl_xvalid) /* validation/cross validation */ cross_valid(data); else predict_all(data); /* or prediction: */ break; } /* switch get_method() */ remove_all(); /* free all data etc. */ init_global_variables(); /* re-init for next round */ } } if (DEBUG_DUMP) atexit(print_file_record); if (get_method() != UIF) elapsed(); /* * file closing & data freeing time: */ if (plotfile != NULL) efclose(plotfile); exit(0); } /* end of main() */
void predict_all(DATA **data) { int i = 0, random_path = 0; DPOINT *here = NULL, *where = NULL; PRED_AT at_what; unsigned int row, col; n_done = 0; val_data = get_dataval(); if (val_data->id > -1) { at_what = AT_POINTS; n_pred_locs = val_data->n_list; if (val_data->colns) strata_min = val_data->minstratum; } else if (get_n_masks() > 0) { at_what = AT_GRIDMAP; here = (DPOINT *) emalloc(sizeof(DPOINT)); here->u.stratum = -2; /* only NON-MV cells */ if (max_block_dimension(0) > 0.0) SET_BLOCK(here); else SET_POINT(here); } else /* what else ? */ return; if (at_what == AT_GRIDMAP && get_n_outfile() == 0) { pr_warning("no output maps defined"); return; } init_predictions(at_what); if (at_what == AT_GRIDMAP && !data[0]->dummy) { if (data[0]->maxX < masks[0]->x_ul || data[0]->minX > (masks[0]->x_ul + masks[0]->cols * masks[0]->cellsizex) || data[0]->minY > masks[0]->y_ul || data[0]->maxY < (masks[0]->y_ul - masks[0]->rows * masks[0]->cellsizey)) { pr_warning("ALL data are outside the map boundaries"); printlog("data x[%g,%g], y[%g,%g]; map x[%g,%g], y[%g,%g]\n", data[0]->minX, data[0]->maxX, data[0]->minY, data[0]->maxY, masks[0]->x_ul, masks[0]->x_ul + masks[0]->cols * masks[0]->cellsizex, masks[0]->y_ul - masks[0]->rows * masks[0]->cellsizey, masks[0]->y_ul ); } else if (map_xy2rowcol(masks[0], data[0]->minX, data[0]->minY, &row, &col) || map_xy2rowcol(masks[0], data[0]->maxX, data[0]->minY, &row, &col) || map_xy2rowcol(masks[0], data[0]->minX, data[0]->maxY, &row, &col) || map_xy2rowcol(masks[0], data[0]->maxX, data[0]->maxY, &row, &col)) pr_warning("at least some data are outside the map boundaries"); /* this is not a sufficient test! */ } if (gl_rp) /* Yes, by default */ random_path = is_simulation(get_method()); row = col = 0; while ((where = next_location(here, at_what, random_path, &row, &col, data)) != NULL) { for (i = 0; i < get_n_outfile(); i++) set_mv_double(&(est[i])); /* initialize estimates */ if (where->u.stratum >= 0) { if (get_mode() != STRATIFY) { for (i = 0; i < get_n_vars(); i++) select_at(data[i], where); } else if (where->u.stratum < get_n_vars()) select_at(data[where->u.stratum], where); get_est(data, get_method(), where, est); } /* printf("%g %g\n", est[0], est[1]); */ write_output(est, at_what, where, row, col); } exit_predictions(at_what); if (here != NULL) efree(here); print_progress(100, 100); }
static double *get_maskX(DATA **data, DPOINT *p, unsigned int row, unsigned int col) { static double *d = NULL; static int totX = 0, *posMask = NULL; int i, j, k, l; static DATA *bl = NULL; static GRIDMAP **local_masks = NULL; if (data == NULL) { if (d != NULL) { efree(d); d = NULL; efree(posMask); posMask = NULL; local_masks = NULL; totX = 0; } return NULL; } if (d == NULL) { /* first time calling */ for (i = 0, totX = 0; i < get_n_vars(); i++) totX += data[i]->n_X; posMask = (int *) emalloc(totX * sizeof(int)); d = (double *) emalloc(totX * sizeof(double)); for (i = 0, k = 0; i < get_n_vars(); i++) { for (j = 0; j < data[i]->n_X; j++) { if (data[i]->colX[j] > 0) posMask[k] = 1; if (data[i]->colX[j] == 0) posMask[k] = 0; if (data[i]->colX[j] < -1) posMask[k] = -1; k++; } } if (get_mode() == STRATIFY) { if (get_n_masks() > 1) local_masks = masks + 1; /* skip the first (= strata) map */ } else local_masks = masks; } bl = block_discr(bl, get_block_p(), p); /* bl is a single point-list with p if IS_POINT(p) */ for (i = 0, k = 0; i < get_n_vars(); i++) { for (j = 0; j < data[i]->n_X; j++) { if (data[i]->colX[j] < -1) { /* do eventual block averaging here: */ for (l = 0, d[k] = 0.0; l < bl->n_list; l++) d[k] += bl->list[l]->u.weight * calc_polynomial(bl->list[l], data[i]->colX[j]); } k++; } } for (i = 0, j = 0; i < totX; i++) { switch(posMask[i]) { case -1: /* is done above */ break; case 1: if (map_cell_is_mv(local_masks[j], row, col)) ErrMsg(ER_IMPOSVAL, "missing value in one of the mask maps"); d[i] = map_get_cell(local_masks[j], row, col); j++; break; case 0: d[i] = (double) 1.0; break; default: ErrMsg(ER_IMPOSVAL, "get_maskX()"); break; } } return d; }
static void init_predictions(PRED_AT w) { int i; DPOINT *bp; DATA **d = NULL; #ifdef WITH_SPIRAL DATA_GRIDMAP *grid; #endif est = (double *) emalloc(get_n_outfile() * sizeof(double)); bp = get_block_p(); d = get_gstat_data(); switch (w) { case AT_POINTS: if (o_filename == NULL) ErrMsg(ER_VARNOTSET, "please specify output file"); write_points(o_filename, val_data, NULL, NULL, get_n_outfile()); if (bp->x == -1.0) { /* set default */ bp->x = bp->y = 1.0; pr_warning("default block size set to: dx=1, dy=1"); } break; case AT_GRIDMAP: /* open mask files: */ get_maskX(NULL, NULL, 0, 0); /* re-initializes static arrays */ masks = (GRIDMAP **) emalloc(get_n_masks() * sizeof(GRIDMAP *)); for (i = 0; i < get_n_masks(); i++) masks[i] = check_open(get_mask_name(i), i); /* read as float */ if (n_pred_locs > 0) strata_min = floor(masks[0]->cellmin); outmap = (GRIDMAP **) emalloc(get_n_outfile() * sizeof(GRIDMAP *)); printlog("initializing maps "); for (i = 0; i < get_n_outfile(); i++) { if (get_outfile_namei(i) != NULL) { printlog("."); /* creating maps ..... */ if (get_method() == ISI) masks[0]->celltype = CT_UINT8; outmap[i] = map_dup(get_outfile_namei(i), masks[0]); } else outmap[i] = NULL; } printlog("\n"); if (bp->x == -1.0) { /* set default to map cellsize */ bp->x = masks[0]->cellsizex; bp->y = masks[0]->cellsizey; pr_warning("default block size set to dx=%g, dy=%g", bp->x, bp->y); } for (i = 0; i < get_n_vars(); i++) { if (d[i]->dummy) { d[i]->minX = masks[0]->x_ul + 0.5 * masks[0]->cellsizex; d[i]->maxX = masks[0]->x_ul + masks[0]->cellsizex * (masks[0]->cols - 0.5); d[i]->maxY = masks[0]->y_ul - 0.5 * masks[0]->cellsizey; d[i]->minY = masks[0]->y_ul - masks[0]->cellsizey * (masks[0]->rows - 0.5); d[i]->minZ = d[i]->maxZ = 0.0; } if (d[i]->togrid) datagrid_rebuild(d[i], 1); } break; } if (gl_nsim > 1) init_simulations(d); if (is_simulation(get_method()) && get_n_beta_set() != get_n_vars()) setup_beta(d, get_n_vars(), gl_nsim); } /* init_predictions() */
void check_global_variables(void) { /* * Purpose : check internal variable consistency, add some parameters * Created by : Edzer J. Pebesma * Date : april 13, 1992 * Prerequisites : none * Returns : - * Side effects : none * also check Cauchy-Schwartz unequality on cross/variograms. */ int i, j, nposX, n_merge = 0; METHOD m; VARIOGRAM *v_tmp; /* UK: check if n_masks equals total nr of unbiasedness cond. */ if (gl_nblockdiscr < 2) ErrMsg(ER_RANGE, "nblockdiscr must be >= 2"); if (method == UKR || method == LSLM) { nposX = 0; for (i = 0; i < get_n_vars(); i++) for (j = 0; j < data[i]->n_X; j++) { if (data[i]->colX[j] > 0) nposX++; } } if (method == SPREAD) { for (i = 0; i < get_n_vars(); i++) if (data[i]->sel_rad == DBL_MAX) data[i]->sel_rad *= 0.99; /* force distance calculation */ } if (get_n_beta_set() != 0 && get_n_beta_set() != get_n_vars()) ErrMsg(ER_SYNTAX, "set sk_mean or beta either for all or for no variables"); if (!(method == ISI || method == GSI)) { if (gl_nsim > 1) ErrMsg(ER_IMPOSVAL, "nsim only allowed for simulation"); } if (method == ISI && max_block_dimension(0) > 0.0) ErrMsg(ER_IMPOSVAL, "indicator simulation only for points"); /* * check if both block and area are set */ if (data_area != NULL && (block.x > 0.0 || block.y > 0.0 || block.z > 0.0)) ErrMsg(ER_IMPOSVAL, "both block and area set: choose one"); /* * check for equality of coordinate dimensions: */ for (i = 1; i < get_n_vars(); i++) { if ((data[i]->mode & V_BIT_SET) != (data[0]->mode & V_BIT_SET)) { message("data(%s) and data(%s):\n", name_identifier(0), name_identifier(i)); ErrMsg(ER_IMPOSVAL, "data have different coordinate dimensions"); } } if (valdata->id > 0 && data[0]->dummy == 0 && ((data[0]->mode | (V_BIT_SET | S_BIT_SET)) != (valdata->mode | (V_BIT_SET | S_BIT_SET)))) { message("data() and data(%s):\n", name_identifier(0)); ErrMsg(ER_IMPOSVAL, "data have different coordinate dimensions"); for (i = 0; i < get_n_vars(); i++) { if (data[i]->dummy) { data[i]->mode = (valdata->mode | V_BIT_SET); data[i]->minX = valdata->minX; data[i]->minY = valdata->minY; data[i]->minZ = valdata->minZ; data[i]->maxX = valdata->maxX; data[i]->maxY = valdata->maxY; data[i]->maxZ = valdata->maxZ; set_norm_fns(data[i]); } } } for (i = 0; i < get_n_vars(); i++) { if (data[i]->fname == NULL && !data[i]->dummy) { message("file name for data(%s) not set\n", name_identifier(i)); ErrMsg(ER_NULL, " "); } if (data[i]->id < 0) { message("data(%s) not set\n", name_identifier(i)); ErrMsg(ER_NULL, " "); } if (data[i]->beta && data[i]->beta->size != data[i]->n_X) { pr_warning("beta dimension (%d) should equal n_X (%d)", data[i]->beta->size, data[i]->n_X); ErrMsg(ER_IMPOSVAL, "sizes of beta and X don't match"); } if (data[i]->sel_rad == DBL_MAX && data[i]->oct_max > 0) ErrMsg(ER_IMPOSVAL, "define maximum search radius (rad) for octant search"); if (data[i]->vdist && data[i]->sel_rad == DBL_MAX) ErrMsg(ER_IMPOSVAL, "when using vdist, radius should be set"); if (! data[i]->dummy && ! (data[i]->mode & V_BIT_SET)) { message("no v attribute set for data(%s)\n", name_identifier(data[i]->id)); ErrMsg(ER_NULL, " "); } if (method != SEM && method != COV) { /* check neighbourhood settings */ if (data[i]->sel_rad < 0.0 || data[i]->sel_min < 0 || data[i]->sel_max < 0 || (data[i]->sel_min > data[i]->sel_max)) { message( "invalid neighbourhood selection: radius %g max %d min %d\n", data[i]->sel_rad, data[i]->sel_max, data[i]->sel_min); ErrMsg(ER_IMPOSVAL, " "); } } if (data[i]->id > -1 && (method == OKR || method == SKR || is_simulation(method) || method == UKR)) { if (vgm[LTI(i,i)] == NULL || vgm[LTI(i,i)]->id < 0) { message("variogram(%s) not set\n", name_identifier(i)); ErrMsg(ER_VARNOTSET, "variogram()"); } } n_merge += data[i]->n_merge; } if (n_merge && get_mode() != MULTIVARIABLE) ErrMsg(ER_IMPOSVAL, "merge only works in multivariable mode"); if (mode == SIMPLE && get_method() != UIF) { /* check if it's clean: */ for (i = 0; i < get_n_vars(); i++) for (j = 0; j < i; j++) if (vgm[LTI(i,j)] != NULL && vgm[LTI(i,j)]->id > 0) { message("variogram(%s, %s) %s\n", name_identifier(i), name_identifier(j), "can only be set for ck, cs, uk, sk, ok, sem or cov"); ErrMsg(ER_IMPOSVAL, "variogram()"); } } if ((m = get_default_method()) != get_method()) { if (m == UKR && (get_method() == OKR || get_method() == SKR)) ErrMsg(ER_IMPOSVAL, "\nremove X=... settings for ordinary or simple kriging"); if (m == OKR && get_method() == SKR) ErrMsg(ER_IMPOSVAL, "method: something's terribly wrong!"); if (m == OKR && get_method() == UKR) { message("I would recommend:\n"); message("Do not specify uk if ok is all you'll get\n"); } } if (mode == MULTIVARIABLE && get_method() != UIF && get_method() != SEM && get_method() != COV && n_variograms_set() > 0) check_variography((const VARIOGRAM **) vgm, get_n_vars()); v_tmp = init_variogram(NULL); free_variogram(v_tmp); }
int get_n_outputs(void) { return get_n_vars() + get_n_vgms(); }
int get_n_vgms(void) { int n; n = get_n_vars(); return (n * (n + 1))/2; }
const char *method_string(METHOD i) { #define MSTR_SIZE 100 static char mstr[MSTR_SIZE]; char *str, *co, *un, *gsum = ""; if ((i == ISI || i == GSI) && gl_n_uk == DEF_n_uk && get_n_beta_set() != get_n_vars()) gsum = " with unknown means"; str = (get_mode() == STRATIFY ? "stratified " : ""); un = (get_n_vars() > 0 && data[0]->dummy ? "un" : ""); co = (get_mode() == MULTIVARIABLE ? "co" : ""); switch (i) { case NSP: snprintf(mstr, MSTR_SIZE, "exit"); break; case TEST: snprintf(mstr, MSTR_SIZE, "Test Option"); break; case UIF: snprintf(mstr, MSTR_SIZE, "starting interactive mode"); break; case SEM: snprintf(mstr, MSTR_SIZE, "calculating sample variogram"); break; case COV: snprintf(mstr, MSTR_SIZE, "calculating sample covariogram"); break; case SPREAD: snprintf(mstr, MSTR_SIZE, "spread value (distance to nearest observation) on output"); break; case IDW: snprintf(mstr, MSTR_SIZE, "%sinverse distance weighted interpolation", str); break; case MED: if (gl_quantile == 0.5) snprintf(mstr, MSTR_SIZE, "%smedian estimation", str); else snprintf(mstr, MSTR_SIZE, "%s%g-quantile estimation", str, gl_quantile); break; case NRS: snprintf(mstr, MSTR_SIZE, "(%s:) neighbourhood size on first output variable", str); break; case LSLM: if (n_variograms_set()) snprintf(mstr, MSTR_SIZE, "%sgeneralized least squares trend estimation", str); else snprintf(mstr, MSTR_SIZE, "%sordinary or weighted least squares prediction", str); break; case OKR: snprintf(mstr, MSTR_SIZE, "using %sordinary %skriging", str, co); break; case SKR: snprintf(mstr, MSTR_SIZE, "using %ssimple %skriging", str, co); break; case UKR: snprintf(mstr, MSTR_SIZE, "using %suniversal %skriging", str, co); break; case GSI: snprintf(mstr, MSTR_SIZE, "using %s%sconditional Gaussian %ssimulation%s", str, un, co, gsum); break; case ISI: snprintf(mstr, MSTR_SIZE, "using %s%sconditional indicator %ssimulation", str, un, co); break; case DIV: snprintf(mstr, MSTR_SIZE, "within-neighbourhood diversity and modus"); break; case SKEW: snprintf(mstr, MSTR_SIZE, "skewness and kurtosis"); break; case LSEM: snprintf(mstr, MSTR_SIZE, "local semivariance or locally fitted semivariogram parameters"); break; } return mstr; }