Exemplo n.º 1
0
static void write_ascii_header(FILE *out_file, DATA *data, int n_outfl) {
	char *lf = "\n";
	int i = 0;

	if (data->mode & X_BIT_SET) i++; 		/* xcoord */
	if (data->mode & Y_BIT_SET) i++; 		/* ycoord */
	if (data->mode & Z_BIT_SET) i++; 		/* zcoord */
	if (data->colnvalue > 0) i++;	/* obs */
    if (data->point_ids) i++;
    
	if (get_mode() == STRATIFY)
		i+= 3;
	else
		i+= n_outfl; 					/* est[0], .. , est[n_outfl-1]  */
	if (data->type.type == DATA_EAS) {
		fprintf(out_file, "prediction results from file: %s variable: %s\n",
			data->fname, data->variable); 
		fprintf(out_file, "%d\n", i);
	} else {
		fprintf(out_file, "#");
		lf = " ";
	}
	if (data->mode & X_BIT_SET) fprintf(out_file, "%s%s", NULS(data->x_coord), lf);
	if (data->mode & Y_BIT_SET) fprintf(out_file, "%s%s", NULS(data->y_coord), lf);
	if (data->mode & Z_BIT_SET) fprintf(out_file, "%s%s", NULS(data->z_coord), lf);
	if (data->mode & S_BIT_SET) fprintf(out_file, "%s%s", NULS(data->s_coord), lf);
	if (data->colnvalue > 0) fprintf(out_file, "%s%s", NULS(data->variable), lf);
	if (get_mode() == STRATIFY)
		fprintf(out_file, "predictions%svariances%s", lf, lf);
	else
		for (i = 0; i < n_outfl; i++)
			fprintf(out_file, "%s%s", what_is_outfile(i), lf);

    if (data->point_ids)
        fprintf(out_file, "%s%s",data->id_name,lf);

    if (data->type.type != DATA_EAS) fprintf(out_file, "\n");
    
}
Exemplo n.º 2
0
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() */