[GRASS-SVN] r42540 - grass-addons/raster/r.convergence

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Jun 13 05:14:21 EDT 2010


Author: jarekj71
Date: 2010-06-10 06:56:53 +0000 (Thu, 10 Jun 2010)
New Revision: 42540

Modified:
   grass-addons/raster/r.convergence/main.c
   grass-addons/raster/r.convergence/memory.c
   grass-addons/raster/r.convergence/slope_aspect.c
Log:
add raster resolution checking

Modified: grass-addons/raster/r.convergence/main.c
===================================================================
--- grass-addons/raster/r.convergence/main.c	2010-06-10 06:54:00 UTC (rev 42539)
+++ grass-addons/raster/r.convergence/main.c	2010-06-10 06:56:53 UTC (rev 42540)
@@ -93,6 +93,7 @@
 	G_check_input_output_name(map_dem->answer, map_output->answer, GR_FATAL_EXIT);
 	nrows = G_window_rows();
 	ncols = G_window_cols();
+	G_get_window(&window);
 	radius=window_size/2;
 
 

Modified: grass-addons/raster/r.convergence/memory.c
===================================================================
--- grass-addons/raster/r.convergence/memory.c	2010-06-10 06:54:00 UTC (rev 42539)
+++ grass-addons/raster/r.convergence/memory.c	2010-06-10 06:56:53 UTC (rev 42540)
@@ -22,6 +22,11 @@
 	
 		rast->raster_type = G_get_raster_map_type(rast->fd);
 
+
+    if (window.ew_res < cellhd.ew_res || window.ns_res < cellhd.ns_res)
+	G_fatal_error(_("Region resolution shoudn't be lesser than map %s resolution. Run g.region rast=%s to set proper resolution"),
+		      rast->elevname, rast->elevname);
+
 		tmp_buf=G_allocate_raster_buf(rast->raster_type);
 		rast->elev = (FCELL**) G_malloc((window_size+1) * sizeof(FCELL*));
 	

Modified: grass-addons/raster/r.convergence/slope_aspect.c
===================================================================
--- grass-addons/raster/r.convergence/slope_aspect.c	2010-06-10 06:54:00 UTC (rev 42539)
+++ grass-addons/raster/r.convergence/slope_aspect.c	2010-06-10 06:56:53 UTC (rev 42540)
@@ -6,8 +6,7 @@
 		
 			if(once) {
 		
-		G_get_window(&window);
-		north = G_row_to_northing(0.5, &window);
+	north = G_row_to_northing(0.5, &window);
     middle = G_row_to_northing(1.5, &window);
     south = G_row_to_northing(2.5, &window);
     east = G_col_to_easting(2.5, &window);



More information about the grass-commit mailing list