[GRASS-SVN] r64374 - in grass-addons/grass7/raster: r.stream.basins r.stream.channel r.stream.distance r.stream.order r.stream.segment r.stream.snap r.stream.stats

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Jan 30 14:31:10 PST 2015


Author: mmetz
Date: 2015-01-30 14:31:10 -0800 (Fri, 30 Jan 2015)
New Revision: 64374

Modified:
   grass-addons/grass7/raster/r.stream.basins/basins_inputs.c
   grass-addons/grass7/raster/r.stream.basins/io.c
   grass-addons/grass7/raster/r.stream.channel/io.c
   grass-addons/grass7/raster/r.stream.channel/stream_topology.c
   grass-addons/grass7/raster/r.stream.channel/stream_write.c
   grass-addons/grass7/raster/r.stream.distance/distance_calc.c
   grass-addons/grass7/raster/r.stream.distance/io.c
   grass-addons/grass7/raster/r.stream.order/io.c
   grass-addons/grass7/raster/r.stream.segment/io.c
   grass-addons/grass7/raster/r.stream.snap/io.c
   grass-addons/grass7/raster/r.stream.stats/io.c
Log:
r-stream: fix NULL handling step 1

Modified: grass-addons/grass7/raster/r.stream.basins/basins_inputs.c
===================================================================
--- grass-addons/grass7/raster/r.stream.basins/basins_inputs.c	2015-01-30 18:32:32 UTC (rev 64373)
+++ grass-addons/grass7/raster/r.stream.basins/basins_inputs.c	2015-01-30 22:31:10 UTC (rev 64374)
@@ -210,7 +210,6 @@
     for (r = 0; r < nrows; ++r) {
 	G_percent(r, nrows, 4);
 	for (c = 0; c < ncols; ++c) {
-
 	    Segment_get(streams, &streams_cell, r, c);
 	    if (streams_cell > 0) {
 		if (outlets_num > 6 * (out_max - 1))

Modified: grass-addons/grass7/raster/r.stream.basins/io.c
===================================================================
--- grass-addons/grass7/raster/r.stream.basins/io.c	2015-01-30 18:32:32 UTC (rev 64373)
+++ grass-addons/grass7/raster/r.stream.basins/io.c	2015-01-30 22:31:10 UTC (rev 64374)
@@ -53,6 +53,7 @@
      * map pointer to map structure (created with create_map);
      * check_res: [1]: check res correspondence between region and map [0 no check];
      * check_data_type [CELL, FCELL, DCELL] check if reading map is of particular type, [-1] no check;
+     * nullval: value to use as NULL value
      */
 
     int r, c;
@@ -395,6 +396,7 @@
      * seg: pointer to map structure (created with create_map);
      * check_res: [1]: check res correspondence between region and map [0 no check];
      * check_data_type [CELL, FCELL, DCELL] check if reading map is of particular type, [-1] no check;
+     * nullval: value to use as NULL value
      */
 
     int input_fd;

Modified: grass-addons/grass7/raster/r.stream.channel/io.c
===================================================================
--- grass-addons/grass7/raster/r.stream.channel/io.c	2015-01-30 18:32:32 UTC (rev 64373)
+++ grass-addons/grass7/raster/r.stream.channel/io.c	2015-01-30 22:31:10 UTC (rev 64374)
@@ -53,6 +53,7 @@
      * map pointer to map structure (created with create_map);
      * check_res: [1]: check res correspondence between region and map [0 no check];
      * check_data_type [CELL, FCELL, DCELL] check if reading map is of particular type, [-1] no check;
+     * nullval: value to use as NULL value
      */
 
     int r, c;
@@ -395,6 +396,7 @@
      * seg: pointer to map structure (created with create_map);
      * check_res: [1]: check res correspondence between region and map [0 no check];
      * check_data_type [CELL, FCELL, DCELL] check if reading map is of particular type, [-1] no check;
+     * nullval: value to use as NULL value
      */
 
     int input_fd;

Modified: grass-addons/grass7/raster/r.stream.channel/stream_topology.c
===================================================================
--- grass-addons/grass7/raster/r.stream.channel/stream_topology.c	2015-01-30 18:32:32 UTC (rev 64373)
+++ grass-addons/grass7/raster/r.stream.channel/stream_topology.c	2015-01-30 22:31:10 UTC (rev 64374)
@@ -328,8 +328,8 @@
 
     for (i = 1; i < number_of_streams; ++i) {
 
-	SA[i].points = (unsigned long int *)
-	    G_malloc((SA[i].number_of_cells) * sizeof(unsigned long int));
+	SA[i].points = (long int *)
+	    G_malloc((SA[i].number_of_cells) * sizeof(long int));
 	SA[i].elevation = (float *)
 	    G_malloc((SA[i].number_of_cells) * sizeof(float));
 	SA[i].distance = (double *)
@@ -411,7 +411,7 @@
 {
     int i, j = 0;
     int next_r, next_c;
-    float elev_min = 9999;
+    FCELL elev_min = 9999;
 
     for (i = 1; i < 9; ++i) {
 	if (NOT_IN_REGION(i))

Modified: grass-addons/grass7/raster/r.stream.channel/stream_write.c
===================================================================
--- grass-addons/grass7/raster/r.stream.channel/stream_write.c	2015-01-30 18:32:32 UTC (rev 64373)
+++ grass-addons/grass7/raster/r.stream.channel/stream_write.c	2015-01-30 22:31:10 UTC (rev 64374)
@@ -135,8 +135,8 @@
 {
     int r, c;
     int i, j, k;
+    STREAM *SA;
     double output_cell;
-    STREAM *SA;
 
     SA = stream_attributes;
 
@@ -185,7 +185,7 @@
 {
     int r, c;
     int i, j;
-    double output_cell;
+    double result;
     STREAM *SA;
 
     SA = stream_attributes;
@@ -194,12 +194,12 @@
 
 	for (j = 1; j < SA[i].number_of_cells - 1; ++j) {
 	    /* what if any elevation is -99999 ? */
-	    output_cell = downstream ?
+	    result = downstream ?
 		SA[i].elevation[j - 1] - SA[i].elevation[j] :
 		SA[i].elevation[j] - SA[i].elevation[j + 1];
 	    r = (int)SA[i].points[j] / ncols;
 	    c = (int)SA[i].points[j] % ncols;
-	    Segment_put(output, &output_cell, r, c);
+	    Segment_put(output, &result, r, c);
 	}
     }
 
@@ -244,8 +244,8 @@
     int r, c;
     int i, j;
     double init;
+    STREAM *SA;
     double output_cell;
-    STREAM *SA;
 
     SA = stream_attributes;
 
@@ -317,9 +317,9 @@
     int r, c;
     int i, j;
     double init;
-    double output_cell;
     double cum_length;
     STREAM *SA;
+    double output_cell;
 
     SA = stream_attributes;
 
@@ -384,8 +384,8 @@
     int r, c;
     int i, j;
     double elev_diff;
+    STREAM *SA;
     double output_cell;
-    STREAM *SA;
 
     G_debug(3, "seg_calculate_local_gradient(): downstream=%d", downstream);
     SA = stream_attributes;
@@ -433,8 +433,8 @@
 {
     int r, c;
     int i, j;
+    STREAM *SA;
     double output_cell;
-    STREAM *SA;
 
     G_debug(3, "seg_calculate_local_distance(): downstream=%d", downstream);
     SA = stream_attributes;
@@ -490,9 +490,9 @@
 {
     int r, c;
     int i, j;
-    double output_cell;
     STREAM *SA;
     double first_derivative, second_derivative;
+    double output_cell;
 
     G_debug(3, "seg_calculate_curvature(): downstream=%d", downstream);
     SA = stream_attributes;

Modified: grass-addons/grass7/raster/r.stream.distance/distance_calc.c
===================================================================
--- grass-addons/grass7/raster/r.stream.distance/distance_calc.c	2015-01-30 18:32:32 UTC (rev 64373)
+++ grass-addons/grass7/raster/r.stream.distance/distance_calc.c	2015-01-30 22:31:10 UTC (rev 64374)
@@ -36,7 +36,7 @@
     POINT n_cell;
     double cur_dist = 0;
     double tmp_dist = 0;
-    double target_elev;		/* eleavation at stream or outlet */
+    double target_elev;		/* elevation at stream or outlet */
     double easting, northing;
     double cell_easting, cell_northing;
     struct Cell_head window;
@@ -52,6 +52,8 @@
 	target_elev = elevation[r][c];
 	elevation[r][c] = 0.;
     }
+    else
+	Rast_set_d_null_value(&target_elev, 1);
 
     while (tail != head) {
 	easting = window.west + (c + .5) * window.ew_res;

Modified: grass-addons/grass7/raster/r.stream.distance/io.c
===================================================================
--- grass-addons/grass7/raster/r.stream.distance/io.c	2015-01-30 18:32:32 UTC (rev 64373)
+++ grass-addons/grass7/raster/r.stream.distance/io.c	2015-01-30 22:31:10 UTC (rev 64374)
@@ -53,6 +53,7 @@
      * map pointer to map structure (created with create_map);
      * check_res: [1]: check res correspondence between region and map [0 no check];
      * check_data_type [CELL, FCELL, DCELL] check if reading map is of particular type, [-1] no check;
+     * nullval: value to use as NULL value
      */
 
     int r, c;
@@ -395,6 +396,7 @@
      * seg: pointer to map structure (created with create_map);
      * check_res: [1]: check res correspondence between region and map [0 no check];
      * check_data_type [CELL, FCELL, DCELL] check if reading map is of particular type, [-1] no check;
+     * nullval: value to use as NULL value
      */
 
     int input_fd;

Modified: grass-addons/grass7/raster/r.stream.order/io.c
===================================================================
--- grass-addons/grass7/raster/r.stream.order/io.c	2015-01-30 18:32:32 UTC (rev 64373)
+++ grass-addons/grass7/raster/r.stream.order/io.c	2015-01-30 22:31:10 UTC (rev 64374)
@@ -53,6 +53,7 @@
      * map pointer to map structure (created with create_map);
      * check_res: [1]: check res correspondence between region and map [0 no check];
      * check_data_type [CELL, FCELL, DCELL] check if reading map is of particular type, [-1] no check;
+     * nullval: value to use as NULL value
      */
 
     int r, c;
@@ -395,6 +396,7 @@
      * seg: pointer to map structure (created with create_map);
      * check_res: [1]: check res correspondence between region and map [0 no check];
      * check_data_type [CELL, FCELL, DCELL] check if reading map is of particular type, [-1] no check;
+     * nullval: value to use as NULL value
      */
 
     int input_fd;

Modified: grass-addons/grass7/raster/r.stream.segment/io.c
===================================================================
--- grass-addons/grass7/raster/r.stream.segment/io.c	2015-01-30 18:32:32 UTC (rev 64373)
+++ grass-addons/grass7/raster/r.stream.segment/io.c	2015-01-30 22:31:10 UTC (rev 64374)
@@ -53,6 +53,7 @@
      * map pointer to map structure (created with create_map);
      * check_res: [1]: check res correspondence between region and map [0 no check];
      * check_data_type [CELL, FCELL, DCELL] check if reading map is of particular type, [-1] no check;
+     * nullval: value to use as NULL value
      */
 
     int r, c;
@@ -395,6 +396,7 @@
      * seg: pointer to map structure (created with create_map);
      * check_res: [1]: check res correspondence between region and map [0 no check];
      * check_data_type [CELL, FCELL, DCELL] check if reading map is of particular type, [-1] no check;
+     * nullval: value to use as NULL value
      */
 
     int input_fd;

Modified: grass-addons/grass7/raster/r.stream.snap/io.c
===================================================================
--- grass-addons/grass7/raster/r.stream.snap/io.c	2015-01-30 18:32:32 UTC (rev 64373)
+++ grass-addons/grass7/raster/r.stream.snap/io.c	2015-01-30 22:31:10 UTC (rev 64374)
@@ -53,6 +53,7 @@
      * map pointer to map structure (created with create_map);
      * check_res: [1]: check res correspondence between region and map [0 no check];
      * check_data_type [CELL, FCELL, DCELL] check if reading map is of particular type, [-1] no check;
+     * nullval: value to use as NULL value
      */
 
     int r, c;
@@ -395,6 +396,7 @@
      * seg: pointer to map structure (created with create_map);
      * check_res: [1]: check res correspondence between region and map [0 no check];
      * check_data_type [CELL, FCELL, DCELL] check if reading map is of particular type, [-1] no check;
+     * nullval: value to use as NULL value
      */
 
     int input_fd;

Modified: grass-addons/grass7/raster/r.stream.stats/io.c
===================================================================
--- grass-addons/grass7/raster/r.stream.stats/io.c	2015-01-30 18:32:32 UTC (rev 64373)
+++ grass-addons/grass7/raster/r.stream.stats/io.c	2015-01-30 22:31:10 UTC (rev 64374)
@@ -53,6 +53,7 @@
      * map pointer to map structure (created with create_map);
      * check_res: [1]: check res correspondence between region and map [0 no check];
      * check_data_type [CELL, FCELL, DCELL] check if reading map is of particular type, [-1] no check;
+     * nullval: value to use as NULL value
      */
 
     int r, c;
@@ -395,6 +396,7 @@
      * seg: pointer to map structure (created with create_map);
      * check_res: [1]: check res correspondence between region and map [0 no check];
      * check_data_type [CELL, FCELL, DCELL] check if reading map is of particular type, [-1] no check;
+     * nullval: value to use as NULL value
      */
 
     int input_fd;



More information about the grass-commit mailing list