23 #include <grass/interpf.h>
28 static void do_history(
const char *
name,
const char *input,
48 double zminac,
double zmaxac,
49 double c1min,
double c1max,
double c2min,
double c2max,
double gmin
UNUSED,
50 double gmax
UNUSED,
double ertot,
54 char *smooth,
int n_points)
61 int cf1 = 0, cf2 = 0, cf3 = 0, cf4 = 0, cf5 = 0,
67 struct Colors colors, colors2;
68 double value1, value2;
81 _(
"Temporarily changing the region to desired resolution..."));
106 if (nrows != params->
nsizr) {
107 G_warning(
_(
"First change your rows number(%d) to %d"), nrows,
113 if (ncols != params->
nsizc) {
114 G_warning(
_(
"First change your columns number(%d) to %d"), ncols,
121 for (i = 0; i < params->
nsizr; i++) {
124 (off_t)(params->
nsizr - 1 - i) * params->
nsizc *
128 (
size_t)params->
nsizc)
137 for (i = 0; i < params->
nsizr; i++) {
140 (off_t)(params->
nsizr - 1 - i) * params->
nsizc *
144 (
size_t)params->
nsizc)
153 for (i = 0; i < params->
nsizr; i++) {
156 (off_t)(params->
nsizr - 1 - i) * params->
nsizc *
160 (
size_t)params->
nsizc)
169 for (i = 0; i < params->
nsizr; i++) {
172 (off_t)(params->
nsizr - 1 - i) * params->
nsizc *
176 (
size_t)params->
nsizc)
185 for (i = 0; i < params->
nsizr; i++) {
188 (off_t)(params->
nsizr - 1 - i) * params->
nsizc *
192 (
size_t)params->
nsizc)
201 for (i = 0; i < params->
nsizr; i++) {
204 (off_t)(params->
nsizr - 1 - i) * params->
nsizc *
208 (
size_t)params->
nsizc)
234 G_warning(
_(
"Raster map <%s> not found"), input);
249 for (; rule; rule = rule->
prev) {
250 value1 = rule->low.value * params->
zmult;
253 &value1, rule->low.red, rule->low.grn, rule->low.blu,
265 for (; rule; rule = rule->
prev) {
266 value1 = rule->low.value * params->
zmult;
269 rule->low.blu, &value2,
284 zmaxac + 0.5, (
CELL)(zminac - 0.5),
285 (
CELL)(zmaxac + 0.5));
288 G_warning(
_(
"No color table for input raster map -- will not "
289 "create color table"));
293 if (cond1 & (!params->
deriv)) {
328 do_history(params->
slope, input, params);
361 do_history(params->
aspect, input, params);
373 dat2 = (
FCELL)-0.001;
377 dat2 = (
FCELL)-0.00001;
385 dat2 = (
FCELL)0.00001;
408 fprintf(stderr,
"color map written\n");
413 do_history(params->
pcurv, input, params);
428 do_history(params->
tcurv, input, params);
443 do_history(params->
mcurv, input, params);
458 params->
fi * 1000. / (*dnorm), smooth);
461 params->
fi * 1000. / (*dnorm));
467 sqrt(ertot / n_points));
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 void void void G_fatal_error(const char *,...) __attribute__((format(printf
void G_warning(const char *,...) __attribute__((format(printf
void G_fseek(FILE *, off_t, int)
Change the file position of the stream.
void void G_verbose_message(const char *,...) __attribute__((format(printf
const char * G_mapset(void)
Get current mapset name.
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 Rast_set_output_window(struct Cell_head *)
Establishes 'window' as the current working window for output.
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)
int Rast_read_colors(const char *, const char *, struct Colors *)
Read color table of raster map.
void Rast_close(int)
Close a raster map.
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_append_format_history(struct History *, const char *,...) __attribute__((format(printf
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)
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)
void Rast_put_f_row(int, const FCELL *)
Writes the next row for fcell file (FCELL version)
void Rast_write_history(const char *, struct History *)
Write raster history file.
void Rast_format_history(struct History *, int, const char *,...) __attribute__((format(printf
void Rast_init_colors(struct Colors *)
Initialize color structure.
void Rast_short_history(const char *, const char *, struct History *)
Initialize history structure.
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_write_colors(const char *, const char *, struct Colors *)
Write map layer color table.
int Rast_open_fp_new(const char *)
Opens new fcell file in a database.
void Rast_free_history(struct History *)
FCELL * Rast_allocate_f_output_buf(void)
#define UNUSED
A macro for an attribute, if attached to a variable, indicating that the variable is not used.
double amin1(double, double)
double amax1(double, double)
@ HIST_DATSRC_1
Description of original data source (two lines)
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 UNUSED, double gmax UNUSED, double ertot, char *input, double *dnorm, struct Cell_head *outhd, struct Cell_head *winhd, char *smooth, int n_points)
2D/3D raster map header (used also for region)
int rows
Number of rows for 2D data.
int cols
Number of columns for 2D data.
struct _Color_Info_ fixed
struct _Color_Info_ modular
Raster history info (metadata)
struct _Color_Rule_ * rules
struct _Color_Rule_ * prev
struct _Color_Rule_ * next
struct _Color_Value_ low high