27 #include <grass/interpf.h>
32 static void do_history(
const char *
name,
int vect,
const char *input,
42 vect ?
"vector map" :
"site file", input);
59 double zmin,
double zmax,
60 double zminac,
double zmaxac,
double c1min,
62 double c2min,
double c2max,
double gmin
UNUSED,
67 int dtens,
int vect,
int n_points)
70 int cf1 = -1, cf2 = -1, cf3 = -1, cf4 = -1, cf5 = -1, cf6 = -1;
78 const char *mapset =
NULL;
112 nrows = cellhd->
rows;
113 if (nrows != params->
nsizr) {
114 G_warning(
_(
"First change your rows number to nsizr! %d %d"), nrows,
119 ncols = cellhd->
cols;
120 if (ncols != params->
nsizc) {
121 G_warning(
_(
"First change your cols number to nsizc %d %d"), ncols,
128 for (i = 0; i < params->
nsizr; i++) {
131 (off_t)(params->
nsizr - 1 - i) * params->
nsizc *
135 (
size_t)params->
nsizc)
144 for (i = 0; i < params->
nsizr; i++) {
147 (off_t)(params->
nsizr - 1 - i) * params->
nsizc *
151 (
size_t)params->
nsizc)
160 for (i = 0; i < params->
nsizr; i++) {
163 (off_t)(params->
nsizr - 1 - i) * params->
nsizc *
167 (
size_t)params->
nsizc)
176 for (i = 0; i < params->
nsizr; i++) {
179 (off_t)(params->
nsizr - 1 - i) * params->
nsizc *
183 (
size_t)params->
nsizc)
192 for (i = 0; i < params->
nsizr; i++) {
195 (off_t)(params->
nsizr - 1 - i) * params->
nsizc *
199 (
size_t)params->
nsizc)
208 for (i = 0; i < params->
nsizr; i++) {
211 (off_t)(params->
nsizr - 1 - i) * params->
nsizc *
215 (
size_t)params->
nsizc)
237 zstep = (
FCELL)(zmaxac - zminac) / 5.;
238 for (i = 1; i <= 5; i++) {
239 data1 = (
FCELL)(zminac + (i - 1) * zstep);
240 data2 = (
FCELL)(zminac + i * zstep);
267 if (mapset ==
NULL) {
273 (
DCELL)zmaxac + 0.5, (
CELL)(zminac - 0.5),
274 (
CELL)(zmaxac + 0.5));
279 if (!params->
deriv) {
326 dat2 = (
FCELL)-0.001;
354 if (mapset ==
NULL) {
361 do_history(params->
slope, vect, input, params);
365 if (!params->
deriv) {
400 dat2 = (
FCELL)-0.001;
428 if (mapset ==
NULL) {
436 do_history(params->
aspect, vect, input, params);
448 dat2 = (
FCELL)-0.001;
452 dat2 = (
FCELL)-0.00001;
460 dat2 = (
FCELL)0.00001;
479 if (mapset ==
NULL) {
488 do_history(params->
pcurv, vect, input, params);
493 if (mapset ==
NULL) {
502 do_history(params->
tcurv, vect, input, params);
507 if (mapset ==
NULL) {
516 do_history(params->
mcurv, vect, input, params);
523 if (mapset ==
NULL) {
538 if (params->
rsm == -1)
540 &hist,
"giventension=%f, smoothing att=%d",
541 params->
fi * 1000. / dnorm, params->
smatt);
544 &hist,
"giventension=%f, smoothing=%f",
545 params->
fi * 1000. / dnorm, params->
rsm);
548 if (params->
rsm == -1)
550 &hist,
"tension=%f, smoothing att=%d",
551 params->
fi * 1000. / dnorm, params->
smatt);
554 params->
fi, params->
rsm);
570 sqrt(ertot / n_points));
582 vect ?
"vector map" :
"site file", input);
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
void G_warning(const char *,...) __attribute__((format(printf
int G_write_raster_timestamp(const char *, const struct TimeStamp *)
Write timestamp of raster map.
void G_fseek(FILE *, off_t, int)
Change the file position of the stream.
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_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
FCELL * Rast_allocate_f_buf(void)
Allocates memory for a raster map of type FCELL.
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.
int Rast_open_new(const char *, RASTER_MAP_TYPE)
Opens a new raster map.
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.
void Rast_set_window(struct Cell_head *)
Establishes 'window' as the current working window.
int Rast_command_history(struct History *)
Save command line to raster history structure.
void Rast_write_colors(const char *, const char *, struct Colors *)
Write map layer color table.
void Rast_free_history(struct History *)
#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)
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 UNUSED, double gmax UNUSED, double ertot, char *input, double dnorm, int dtens, int vect, int n_points)
@ HIST_DATSRC_1
Description of original data source (two lines)
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.
Raster history info (metadata)