23 #include <grass/interpf.h> 28 static void do_history(
const char *
name,
const char *input,
46 double zminac,
double zmaxac,
47 double c1min,
double c1max,
double c2min,
double c2max,
double gmin,
double gmax,
double ertot,
51 char *smooth,
int n_points)
59 int cf1 = 0, cf2 = 0, cf3 = 0, cf4 = 0, cf5 = 0, cf6 = 0;
64 struct Colors colors, colors2;
65 double value1, value2;
102 if (nrows != params->
nsizr) {
103 G_warning(
_(
"First change your rows number(%d) to %d"),
104 nrows, params->
nsizr);
109 if (ncols != params->
nsizc) {
110 G_warning(
_(
"First change your columns number(%d) to %d"),
111 ncols, params->
nsizr);
117 for (i = 0; i < params->
nsizr; i++) {
128 for (i = 0; i < params->
nsizr; i++) {
144 for (i = 0; i < params->
nsizr; i++) {
155 for (i = 0; i < params->
nsizr; i++) {
166 for (i = 0; i < params->
nsizr; i++) {
177 for (i = 0; i < params->
nsizr; i++) {
205 G_warning(
_(
"Raster map <%s> not found"), input);
220 for (; rule; rule = rule->
prev) {
221 value1 = rule->low.value * params->
zmult;
225 rule->low.blu, &value2,
239 for (; rule; rule = rule->
prev) {
240 value1 = rule->low.value * params->
zmult;
243 rule->low.grn, rule->low.blu,
259 zminac - 0.5, zmaxac + 0.5,
260 (
CELL) (zminac - 0.5),
261 (
CELL) (zmaxac + 0.5));
264 G_warning(
_(
"No color table for input raster map -- will not create color table"));
268 if (cond1 & (!params->
deriv)) {
302 do_history(params->
slope, input, params);
333 do_history(params->
aspect, input, params);
341 dat2 = (
FCELL) - 0.01;
344 &dat2, 0, 0, 255, &colors);
346 dat2 = (
FCELL) - 0.001;
348 &dat2, 0, 127, 255, &colors);
350 dat2 = (
FCELL) - 0.00001;
352 &dat2, 0, 255, 255, &colors);
356 &dat2, 200, 255, 200, &colors);
358 dat2 = (
FCELL) 0.00001;
360 &dat2, 255, 255, 0, &colors);
362 dat2 = (
FCELL) 0.001;
364 &dat2, 255, 127, 0, &colors);
368 &dat2, 255, 0, 0, &colors);
372 &dat2, 155, 0, 20, &colors);
382 fprintf(stderr,
"color map written\n");
387 (
CELL) (dat2 * MULT));
388 do_history(params->
pcurv, input, params);
401 (
CELL) (dat2 * MULT));
403 do_history(params->
tcurv, input, params);
417 (
CELL) (dat2 * MULT));
419 do_history(params->
mcurv, input, params);
434 &hist,
"tension=%f, smoothing=%s",
435 params->
fi * 1000. / (*dnorm), smooth);
438 &hist,
"tension=%f", params->
fi * 1000. / (*dnorm));
441 &hist,
"dnorm=%f, zmult=%f", *dnorm, params->
zmult);
443 &hist,
"KMAX=%d, KMIN=%d, errtotal=%f", params->
kmax,
444 params->
kmin, sqrt(ertot / n_points));
446 &hist,
"zmin_data=%f, zmax_data=%f", zmin, zmax);
448 &hist,
"zmin_int=%f, zmax_int=%f", zminac, zmaxac);
struct _Color_Info_ fixed
const char * G_find_file2(const char *, const char *, const char *)
Searches for a file from the mapset search list or in a specified mapset. (look but don't touch) ...
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)
struct _Color_Value_ low high
struct _Color_Rule_ * next
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.
int IL_resample_output_2d(struct interp_params *params, 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, struct Cell_head *outhd, struct Cell_head *winhd, char *smooth, int n_points)
FCELL * Rast_allocate_f_output_buf(void)
void Rast_set_output_window(struct Cell_head *)
Establishes 'window' as the current working window for output.
void Rast_append_format_history(struct History *, const char *,...) __attribute__((format(printf
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.
int Rast_open_fp_new(const char *)
Opens new fcell file in a database.
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.
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.
const char * G_mapset(void)
Get current mapset name.
int Rast_read_colors(const char *, const char *, struct Colors *)
Read color table of raster map.
void G_warning(const char *,...) __attribute__((format(printf
int Rast_add_modular_d_color_rule(const DCELL *, int, int, int, const DCELL *, int, int, int, struct Colors *)
Add modular floating-point color rule (DCELL version)
void Rast_add_d_color_rule(const DCELL *, int, int, int, const DCELL *, int, int, int, struct Colors *)
Adds the floating-point color rule (DCELL version)
struct _Color_Info_ modular
void Rast_format_history(struct History *, int, const char *,...) __attribute__((format(printf
void void G_verbose_message(const char *,...) __attribute__((format(printf
int rows
Number of rows for 2D data.
void Rast_init_colors(struct Colors *)
Initialize color structure.
struct _Color_Rule_ * prev
void Rast_close(int)
Close a raster map.
struct _Color_Rule_ * rules