Ejemplo n.º 1
0
static void ev2map(VARIOGRAM *v) {
	GRIDMAP *m1 = NULL, *m2 = NULL;
	unsigned int row, col, i;
	SAMPLE_VGM *ev;

	if (v->fname == NULL)
		return;
	ev = v->ev;
	m1 = map_dup(v->fname, ev->map);
	if (v->fname2 != NULL)
		m2 = map_dup(v->fname2, ev->map);
	for (row = i = 0; row < m1->rows; row++) {
		for (col = 0; col < m1->cols; col++) {
			if (ev->nh[i] > 0)
				map_put_cell(m1, row, col, ev->gamma[i]);
			if (m2 != NULL)
				map_put_cell(m2, row, col, 1.0 * ev->nh[i]);
			i++;
		}
	}
	m1->write(m1);
	if (m2 != NULL)
		m2->write(m2);
	return;
}
Ejemplo n.º 2
0
static void write_output(double *est, PRED_AT w, DPOINT *here,
		 unsigned int row, unsigned int col) {
	int i;

	switch (w) {
		case AT_POINTS:
			write_points(o_filename, val_data, here, est,
				get_mode() != STRATIFY ? get_n_outfile() : 2);
			break;
		case AT_GRIDMAP:
			for (i = 0; i < get_n_outfile(); i++)
				if (outmap[i] && !is_mv_double(&(est[i])))
					map_put_cell(outmap[i], row, col, est[i]);
			break;
	}
} /* write_output() */
Ejemplo n.º 3
0
void ossfim2map(double **table, const char *name, double s, double S,
	double b, double B, int dx, int dy) {
	
	GRIDMAP *m;
	TICKS x, y;
	char str[100];
	int i, j;
	extern int nice_legend;
	double bs;
	
	m = new_map();
	m->filename = name;
	m->rows = dy + 1;
	m->cols = dx + 1;
	m->cellsizex = m->cellsizey = 1.0;
	m->x_ul = m->y_ul = 1.0;
	alloc_mv_grid(m);
	for (i = 0; i <= dx; i++) /* row */
		for (j = 0; j <= dy; j++) /* col */
			map_put_cell(m, dy - j, i, table[i][j]); /* flips */

	/* fill ticks */
	x.every = y.every = 1;
	x.n = dx + 1;
	y.n = dy + 1;
	x.entries = (char **) emalloc(x.n * sizeof(char *));
	for (i = 0; i <= dx; i++) { /* sample spacings: */
		sprintf(str, "%3g", s + i * (S - s) / dx);
		x.entries[i] = string_dup((char *) str);
	}
	y.entries = (char **) emalloc(y.n * sizeof(char *));
	for (i = 0; i <= dy; i++) { /* sample spacings: */
		bs = b + i * (B - b) / dy;
		sprintf(str, "%g x %g", bs, bs);
		y.entries[dy - i] = string_dup((char *) str);
	}
	nice_legend = 1;
	one_map2gd(m, name, &y, &x, 1);
	return;
}