27 #include <grass/interpf.h> 32 static void do_history(
const char *
name,
int vect,
const char *input,
42 vect ?
"vector map" :
"site file",
61 double zmin,
double zmax,
62 double zminac,
double zmaxac,
63 double c1min,
double c1max,
64 double c2min,
double c2max,
65 double gmin,
double gmax,
69 int dtens,
int vect,
int n_points
73 int cf1 = -1, cf2 = -1, cf3 = -1, cf4 = -1, cf5 = -1, cf6 = -1;
81 const char *mapset =
NULL;
115 nrows = cellhd->
rows;
116 if (nrows != params->
nsizr) {
117 G_warning(
_(
"First change your rows number to nsizr! %d %d"),
118 nrows, params->
nsizr);
122 ncols = cellhd->
cols;
123 if (ncols != params->
nsizc) {
124 G_warning(
_(
"First change your cols number to nsizc %d %d"),
125 ncols, params->
nsizc);
131 for (i = 0; i < params->
nsizr; i++) {
147 for (i = 0; i < params->
nsizr; i++) {
158 for (i = 0; i < params->
nsizr; i++) {
169 for (i = 0; i < params->
nsizr; i++) {
180 for (i = 0; i < params->
nsizr; i++) {
191 for (i = 0; i < params->
nsizr; i++) {
216 zstep = (
FCELL) (zmaxac - zminac) / 5.;
217 for (i = 1; i <= 5; i++) {
218 data1 = (
FCELL) (zminac + (i - 1) * zstep);
219 data2 = (
FCELL) (zminac + i * zstep);
223 &data2, 0, 255, 0, &colors);
227 &data2, 255, 255, 0, &colors);
231 &data2, 255, 127, 0, &colors);
235 &data2, 191, 127, 63, &colors);
239 &data2, 200, 200, 200, &colors);
246 if (mapset ==
NULL) {
253 (
CELL) (zminac - 0.5), (
CELL) (zmaxac + 0.5));
258 if (!params->
deriv) {
289 dat1 = (
FCELL) - 5.0;
291 dat2 = (
FCELL) - 0.1;
293 &dat2, 0, 0, 255, &colors);
295 dat2 = (
FCELL) - 0.01;
297 &dat2, 0, 127, 255, &colors);
299 dat2 = (
FCELL) - 0.001;
301 &dat2, 0, 255, 255, &colors);
305 &dat2, 200, 255, 200, &colors);
307 dat2 = (
FCELL) 0.001;
309 &dat2, 255, 255, 0, &colors);
313 &dat2, 255, 127, 0, &colors);
317 &dat2, 255, 0, 0, &colors);
322 &dat2, 255, 0, 200, &colors);
327 if (mapset ==
NULL) {
334 do_history(params->
slope, vect, input, params);
338 if (!params->
deriv) {
358 dat1 = (
FCELL) - 5.0;
360 dat2 = (
FCELL) - 0.1;
362 &dat2, 0, 0, 255, &colors);
364 dat2 = (
FCELL) - 0.01;
366 &dat2, 0, 127, 255, &colors);
368 dat2 = (
FCELL) - 0.001;
370 &dat2, 0, 255, 255, &colors);
374 &dat2, 200, 255, 200, &colors);
376 dat2 = (
FCELL) 0.001;
378 &dat2, 255, 255, 0, &colors);
382 &dat2, 255, 127, 0, &colors);
386 &dat2, 255, 0, 0, &colors);
391 &dat2, 255, 0, 200, &colors);
396 if (mapset ==
NULL) {
403 do_history(params->
aspect, vect, input, params);
411 dat2 = (
FCELL) - 0.01;
413 &dat2, 0, 0, 255, &colors);
415 dat2 = (
FCELL) - 0.001;
417 &dat2, 0, 127, 255, &colors);
419 dat2 = (
FCELL) - 0.00001;
421 &dat2, 0, 255, 255, &colors);
425 &dat2, 200, 255, 200, &colors);
427 dat2 = (
FCELL) 0.00001;
429 &dat2, 255, 255, 0, &colors);
431 dat2 = (
FCELL) 0.001;
433 &dat2, 255, 127, 0, &colors);
437 &dat2, 255, 0, 0, &colors);
442 &dat2, 255, 0, 200, &colors);
446 if (mapset ==
NULL) {
453 (
CELL) (dat2 * MULT));
455 do_history(params->
pcurv, vect, input, params);
460 if (mapset ==
NULL) {
467 (
CELL) (dat2 * MULT));
469 do_history(params->
tcurv, vect, input, params);
474 if (mapset ==
NULL) {
481 (
CELL) (dat2 * MULT));
483 do_history(params->
mcurv, vect, input, params);
490 if (mapset ==
NULL) {
505 if (params->
rsm == -1)
507 &hist,
"giventension=%f, smoothing att=%d",
508 params->
fi * 1000. / dnorm, params->
smatt);
511 &hist,
"giventension=%f, smoothing=%f",
512 params->
fi * 1000. / dnorm, params->
rsm);
515 if (params->
rsm == -1)
517 &hist,
"tension=%f, smoothing att=%d",
518 params->
fi * 1000. / dnorm, params->
smatt);
521 &hist,
"tension=%f, smoothing=%f",
522 params->
fi, params->
rsm);
526 &hist,
"dnorm=%f, dmin=%f, zmult=%f",
538 &hist,
"segmax=%d, npmin=%d, rmsdevi=%f",
539 params->
kmax, params->
kmin, sqrt(ertot / n_points));
542 &hist,
"zmin_data=%f, zmax_data=%f", zmin, zmax);
544 &hist,
"zmin_int=%f, zmax_int=%f", zminac, zmaxac);
548 &hist,
"theta=%f, scalex=%f", params->
theta,
552 vect ?
"vector map" :
"site file",
void Rast_write_colors(const char *, const char *, struct Colors *)
Write map layer color table.
void Rast_write_history(const char *, struct History *)
Write raster history file.
void Rast_add_c_color_rule(const CELL *, int, int, int, const CELL *, int, int, int, struct Colors *)
Adds the integer color rule (CELL version)
2D/3D raster map header (used also for region)
int IL_output_2d(struct interp_params *params, struct Cell_head *cellhd, double zmin, double zmax, double zminac, double zmaxac, double c1min, double c1max, double c2min, double c2max, double gmin, double gmax, double ertot, char *input, double dnorm, int dtens, int vect, int n_points)
double amax1(double, double)
void Rast_free_history(struct History *)
void Rast_quantize_fp_map_range(const char *, const char *, DCELL, DCELL, CELL, CELL)
Write quant rules (f_quant) for floating-point raster map.
void Rast_set_window(struct Cell_head *)
Establishes 'window' as the current working window.
int G_write_raster_timestamp(const char *, const struct TimeStamp *)
Write timestamp of raster map.
void Rast_append_format_history(struct History *, const char *,...) __attribute__((format(printf
int Rast_open_new(const char *, RASTER_MAP_TYPE)
Opens a new raster map.
Raster history info (metadata)
Description of original data source (two lines)
void Rast_put_f_row(int, const FCELL *)
Writes the next row for fcell file (FCELL version)
void G_fseek(FILE *, off_t, int)
Change the file position of the stream.
FCELL * Rast_allocate_f_buf(void)
Allocates memory for a raster map of type FCELL.
void Rast_short_history(const char *, const char *, struct History *)
Initialize history structure.
double amin1(double, double)
int cols
Number of columns for 2D data.
int Rast_command_history(struct History *)
Save command line to raster history structure.
void Rast_add_f_color_rule(const FCELL *, int, int, int, const FCELL *, int, int, int, struct Colors *)
Adds the floating-point color rule (FCELL version)
const char * G_find_file(const char *, char *, const char *)
Searches for a file from the mapset search list or in a specified mapset.
void G_warning(const char *,...) __attribute__((format(printf
void Rast_format_history(struct History *, int, const char *,...) __attribute__((format(printf
int rows
Number of rows for 2D data.
void Rast_init_colors(struct Colors *)
Initialize color structure.
void Rast_close(int)
Close a raster map.