@@ -54,33 +54,45 @@ void G_adjust_Cell_head(struct Cell_head *cellhd, int row_flag, int col_flag)
5454
5555 if (!row_flag ) {
5656 if (cellhd -> ns_res <= 0 )
57- G_fatal_error (_ ("Illegal n-s resolution value <%lf>" ), cellhd -> ns_res );
57+ G_fatal_error (_ ("Illegal n-s resolution value: %g" ),
58+ cellhd -> ns_res );
5859 }
5960 else {
6061 if (cellhd -> rows <= 0 )
61- G_fatal_error (_ ("Illegal row value" ));
62+ G_fatal_error (_ ("Illegal number of rows: %d"
63+ " (resolution is %g)" ),
64+ cellhd -> rows , cellhd -> ns_res );
6265 }
6366 if (!col_flag ) {
6467 if (cellhd -> ew_res <= 0 )
65- G_fatal_error (_ ("Illegal e-w resolution value" ));
68+ G_fatal_error (_ ("Illegal e-w resolution value: %g" ),
69+ cellhd -> ew_res );
6670 }
6771 else {
6872 if (cellhd -> cols <= 0 )
69- G_fatal_error (_ ("Illegal col value" ));
73+ G_fatal_error (_ ("Illegal number of columns: %d"
74+ " (resolution is %g)" ),
75+ cellhd -> cols , cellhd -> ew_res );
7076 }
7177
7278 /* check the edge values */
7379 if (cellhd -> north <= cellhd -> south ) {
7480 if (cellhd -> proj == PROJECTION_LL )
75- G_fatal_error (_ ("North must be north of South" ));
81+ G_fatal_error (_ ("North must be north of South,"
82+ " but %g (north) <= %g (south" ),
83+ cellhd -> north , cellhd -> south );
7684 else
77- G_fatal_error (_ ("North must be larger than South" ));
85+ G_fatal_error (_ ("North must be larger than South,"
86+ " but %g (north) <= %g (south" ),
87+ cellhd -> north , cellhd -> south );
7888 }
7989
8090 ll_wrap (cellhd );
8191
8292 if (cellhd -> east <= cellhd -> west )
83- G_fatal_error (_ ("East must be larger than West" ));
93+ G_fatal_error (_ ("East must be larger than West,"
94+ " but %g (east) <= %g (west)" ),
95+ cellhd -> east , cellhd -> west );
8496
8597 /* compute rows and columns, if not set */
8698 if (!row_flag ) {
@@ -98,8 +110,11 @@ void G_adjust_Cell_head(struct Cell_head *cellhd, int row_flag, int col_flag)
98110 cellhd -> cols = 1 ;
99111 }
100112
101- if (cellhd -> cols < 0 || cellhd -> rows < 0 ) {
102- G_fatal_error (_ ("Invalid coordinates" ));
113+ if (cellhd -> cols < 0 ) {
114+ G_fatal_error (_ ("Invalid coordinates: negative number of columns" ));
115+ }
116+ if (cellhd -> rows < 0 ) {
117+ G_fatal_error (_ ("Invalid coordinates: negative number of rows" ));
103118 }
104119
105120 /* (re)compute the resolutions */
@@ -154,52 +169,73 @@ void G_adjust_Cell_head3(struct Cell_head *cellhd, int row_flag,
154169
155170 if (!row_flag ) {
156171 if (cellhd -> ns_res <= 0 )
157- G_fatal_error (_ ("Illegal n-s resolution value" ));
172+ G_fatal_error (_ ("Illegal n-s resolution value: %g" ),
173+ cellhd -> ns_res );
158174 if (cellhd -> ns_res3 <= 0 )
159- G_fatal_error (_ ("Illegal n-s3 resolution value" ));
175+ G_fatal_error (_ ("Illegal n-s resolution value for 3D: %g" ),
176+ cellhd -> ns_res3 );
160177 }
161178 else {
162179 if (cellhd -> rows <= 0 )
163- G_fatal_error (_ ("Illegal row value" ));
180+ G_fatal_error (_ ("Illegal number of rows: %d"
181+ " (resolution is %g)" ),
182+ cellhd -> rows , cellhd -> ns_res );
164183 if (cellhd -> rows3 <= 0 )
165- G_fatal_error (_ ("Illegal row3 value" ));
184+ G_fatal_error (_ ("Illegal number of rows for 3D: %d"
185+ " (resolution is %g)" ),
186+ cellhd -> rows3 , cellhd -> ns_res3 );
166187 }
167188 if (!col_flag ) {
168189 if (cellhd -> ew_res <= 0 )
169- G_fatal_error (_ ("Illegal e-w resolution value" ));
190+ G_fatal_error (_ ("Illegal e-w resolution value: %g" ),
191+ cellhd -> ew_res );
170192 if (cellhd -> ew_res3 <= 0 )
171- G_fatal_error (_ ("Illegal e-w3 resolution value" ));
193+ G_fatal_error (_ ("Illegal e-w resolution value for 3D: %g" ),
194+ cellhd -> ew_res3 );
172195 }
173196 else {
174197 if (cellhd -> cols <= 0 )
175- G_fatal_error (_ ("Illegal col value" ));
198+ G_fatal_error (_ ("Illegal number of columns: %d"
199+ " (resolution is %g)" ),
200+ cellhd -> cols , cellhd -> ew_res );
176201 if (cellhd -> cols3 <= 0 )
177- G_fatal_error (_ ("Illegal col3 value" ));
202+ G_fatal_error (_ ("Illegal number of columns for 3D: %d"
203+ " (resolution is %g)" ),
204+ cellhd -> cols3 , cellhd -> ew_res3 );
178205 }
179206 if (!depth_flag ) {
180207 if (cellhd -> tb_res <= 0 )
181- G_fatal_error (_ ("Illegal t-b3 resolution value" ));
208+ G_fatal_error (_ ("Illegal t-b resolution value: %g" ),
209+ cellhd -> tb_res );
182210 }
183211 else {
184212 if (cellhd -> depths <= 0 )
185- G_fatal_error (_ ("Illegal depths value" ) );
213+ G_fatal_error (_ ("Illegal depths value: %d" ), cellhd -> depths );
186214 }
187215
188216 /* check the edge values */
189217 if (cellhd -> north <= cellhd -> south ) {
190218 if (cellhd -> proj == PROJECTION_LL )
191- G_fatal_error (_ ("North must be north of South" ));
219+ G_fatal_error (_ ("North must be north of South,"
220+ " but %g (north) <= %g (south" ),
221+ cellhd -> north , cellhd -> south );
192222 else
193- G_fatal_error (_ ("North must be larger than South" ));
223+ G_fatal_error (_ ("North must be larger than South,"
224+ " but %g (north) <= %g (south" ),
225+ cellhd -> north , cellhd -> south );
194226 }
195227
196228 ll_wrap (cellhd );
197229
198230 if (cellhd -> east <= cellhd -> west )
199- G_fatal_error (_ ("East must be larger than West" ));
231+ G_fatal_error (_ ("East must be larger than West,"
232+ " but %g (east) <= %g (west)" ),
233+ cellhd -> east , cellhd -> west );
200234
201235 if (cellhd -> top <= cellhd -> bottom )
202- G_fatal_error (_ ("Top must be larger than Bottom" ));
236+ G_fatal_error (_ ("Top must be larger than Bottom,"
237+ " but %g (top) <= %g (bottom)" ),
238+ cellhd -> top , cellhd -> bottom );
203239
204240 /* compute rows and columns, if not set */
205241 if (!row_flag ) {
@@ -237,9 +273,14 @@ void G_adjust_Cell_head3(struct Cell_head *cellhd, int row_flag,
237273 cellhd -> depths = 1 ;
238274 }
239275
240- if (cellhd -> cols < 0 || cellhd -> rows < 0 || cellhd -> cols3 < 0 ||
241- cellhd -> rows3 < 0 || cellhd -> depths < 0 ) {
242- G_fatal_error (_ ("Invalid coordinates" ));
276+ if (cellhd -> cols < 0 || cellhd -> cols3 < 0 ) {
277+ G_fatal_error (_ ("Invalid coordinates: negative number of columns" ));
278+ }
279+ if (cellhd -> rows < 0 || cellhd -> rows3 < 0 ) {
280+ G_fatal_error (_ ("Invalid coordinates: negative number of rows" ));
281+ }
282+ if (cellhd -> depths < 0 ) {
283+ G_fatal_error (_ ("Invalid coordinates: negative number of depths" ));
243284 }
244285
245286 /* (re)compute the resolutions */
0 commit comments