GRASS GIS 7 Programmer's Manual  7.0.4(2016)-r00000
wr_cellhd.c
Go to the documentation of this file.
1 
17 #include <stdio.h>
18 #include <grass/gis.h>
19 
20 
30 void G__write_Cell_head(FILE * fd,
31  const struct Cell_head *cellhd, int is_cellhd)
32 {
33  char buf[1024];
34  int fmt;
35 
36  fmt = cellhd->proj;
37 
38  fprintf(fd, "proj: %d\n", cellhd->proj);
39  fprintf(fd, "zone: %d\n", cellhd->zone);
40 
41  G_format_northing(cellhd->north, buf, fmt);
42  fprintf(fd, "north: %s\n", buf);
43 
44  G_format_northing(cellhd->south, buf, fmt);
45  fprintf(fd, "south: %s\n", buf);
46 
47  G_format_easting(cellhd->east, buf, fmt);
48  fprintf(fd, "east: %s\n", buf);
49 
50  G_format_easting(cellhd->west, buf, fmt);
51  fprintf(fd, "west: %s\n", buf);
52 
53  fprintf(fd, "cols: %d\n", cellhd->cols);
54  fprintf(fd, "rows: %d\n", cellhd->rows);
55 
56  G_format_resolution(cellhd->ew_res, buf, fmt);
57  fprintf(fd, "e-w resol: %s\n", buf);
58 
59  G_format_resolution(cellhd->ns_res, buf, fmt);
60  fprintf(fd, "n-s resol: %s\n", buf);
61 
62  if (is_cellhd) {
63  fprintf(fd, "format: %d\n", cellhd->format);
64  fprintf(fd, "compressed: %d\n", cellhd->compressed);
65  }
66 }
67 
68 
78 void G__write_Cell_head3(FILE * fd,
79  const struct Cell_head *cellhd, int is_cellhd)
80 {
81  char buf[1024];
82  int fmt;
83 
84  fmt = cellhd->proj;
85 
86  G__write_Cell_head(fd, cellhd, is_cellhd);
87 
88  fprintf(fd, "top: %.15f\n", cellhd->top);
89  fprintf(fd, "bottom: %.15f\n", cellhd->bottom);
90 
91  fprintf(fd, "cols3: %d\n", cellhd->cols3);
92  fprintf(fd, "rows3: %d\n", cellhd->rows3);
93  fprintf(fd, "depths: %d\n", cellhd->depths);
94 
95  G_format_resolution(cellhd->ew_res3, buf, fmt);
96  fprintf(fd, "e-w resol3: %s\n", buf);
97 
98  G_format_resolution(cellhd->ns_res3, buf, fmt);
99  fprintf(fd, "n-s resol3: %s\n", buf);
100 
101  G_format_resolution(cellhd->tb_res, buf, -1);
102  fprintf(fd, "t-b resol: %s\n", buf);
103 }
void G_format_easting(double east, char *buf, int projection)
Easting to ASCII.
Definition: wind_format.c:49
void G_format_resolution(double res, char *buf, int projection)
Resolution to ASCII.
Definition: wind_format.c:69
void G_format_northing(double north, char *buf, int projection)
Northing to ASCII.
Definition: wind_format.c:29
void G__write_Cell_head(FILE *fd, const struct Cell_head *cellhd, int is_cellhd)
Write cell header or window.
Definition: wr_cellhd.c:30
void G__write_Cell_head3(FILE *fd, const struct Cell_head *cellhd, int is_cellhd)
Write 3D cell header or window.
Definition: wr_cellhd.c:78