[GRASS-user] Problem with r.basin in grass7

Andrea Timmermann timmermann at gmx.at
Tue Dec 16 12:19:38 PST 2014


Hi, thanks for the answers!!
 
I still have a problem, since my DEMs have a very high resolution. I tried to run r.basin using a lower resolution of the DEMs, but I do get an error.
 
I am using the NC database. First I run r.basin with the DEM at the original resolution. Then I adjusted the resolution of g.region, resampled my DEM, re-adjusted the g.region settings and finally re-run r.basin. Here are all my steps.
 
 
A) Run r.basin using the original DEM
A1) Set the region and checked r.info for the DEM
 
g.region -a raster=elev_ned_30m at PERMANENT align=elev_ned_30m at PERMANENT
 
g.region -p                                                                    
projection: 99 (Lambert Conformal Conic)
zone:       0
datum:      nad83
ellipsoid:  a=6378137 es=0.006694380022900787
north:      228500
south:      215000
west:       630000
east:       645000
nsres:      30
ewres:      30
rows:       450
cols:       500
cells:      225000
 
r.info map=elev_ned_30m at PERMANENT                                              
 +----------------------------------------------------------------------------+
 | Map:      elev_ned_30m at PERMANENT         Date: Tue Nov  7 00:35:18 2006    |
 | Mapset:   PERMANENT                      Login of Creator: helena          |
 | Location: nc_spm_08_grass7                                                 |
 | DataBase: C:\Users\Andrea\Documents\grassdata                            |
 | Title:    South-West Wake county: National Elevation Data 30m ( elev_ned30 |
 | Timestamp: none                                                            |
 |----------------------------------------------------------------------------|
 |                                                                            |
 |   Type of Map:  raster               Number of Categories: 255             |
 |   Data Type:    FCELL                                                      |
 |   Rows:         450                                                        |
 |   Columns:      500                                                        |
 |   Total Cells:  225000                                                     |
 |        Projection: Lambert Conformal Conic                                 |
 |            N:     228500    S:     215000   Res:    30                     |
 |            E:     645000    W:     630000   Res:    30                     |
 |   Range of data:    min = 55.1736  max = 156.3865                          |
 |                                                                            |
 |   Data Description:                                                        |
 |    generated by r.proj                                                     |
 |                                                                            |
 |   Comments:                                                                |
 |    r.proj input="ned1arcsec" location="northcarolina_latlong" mapset="h\   |
 |    elena" output="elev_ned30m" method="cubic" resolution=30                |
 |                                                                            |
 
 
A2) Run r.basin
 
r.basin --verbose --overwrite map=elev_ned_30m at PERMANENT prefix=a dir=C:\Users\Andrea\t20 threshold=40 coordinates=636654.791181,218824.126649  

I got the "DROP TABLE" error again, but since it is at the end and it still gives all the results I think I will just ignore it
 
“....
Reading raster map <a_elev_35_strahler>...
Reading raster map <a_elev_35_drainage_e>...
Reading raster map <r_elevation_crop>...
ERROR: Error while executing: 'DROP TABLE summary'
...
“
 
B) Run r.basin using a lower resolution DEM 
B1) I changed the resolution of the computational region
 
g.region res=35
 
g.region -p                                                                    
projection: 99 (Lambert Conformal Conic)
zone:       0
datum:      nad83
ellipsoid:  a=6378137 es=0.006694380022900787
north:      228500
south:      215000
west:       630000
east:       645000
nsres:      34.97409326
ewres:      34.96503497
rows:       386
cols:       429
cells:      165594
 
B2) Resampled my DEM and readjusted the computational region
 
r.resample --overwrite --verbose input=elev_ned_30m at PERMANENT output=elev_35
 
g.region -a --overwrite raster=elev_35 at user1 align=elev_35 at user1
 
g.region -p                                                                    
projection: 99 (Lambert Conformal Conic)
zone:       0
datum:      nad83
ellipsoid:  a=6378137 es=0.006694380022900787
north:      228500
south:      215000
west:       630000
east:       645000
nsres:      34.97409326
ewres:      34.96503497
rows:       386
cols:       429
cells:      165594
 
r.info map=elev_35                                                              
 +----------------------------------------------------------------------------+
 | Map:      elev_35                        Date: Tue Nov  7 00:35:18 2006    |
 | Mapset:   user1                          Login of Creator: helena          |
 | Location: nc_spm_08_grass7                                                 |
 | DataBase: C:\Users\Andrea\Documents\grassdata                            |
 | Title:    South-West Wake county: National Elevation Data 30m ( elev_ned30 |
 | Timestamp: none                                                            |
 |----------------------------------------------------------------------------|
 |                                                                            |
 |   Type of Map:  raster               Number of Categories: 0               |
 |   Data Type:    FCELL                                                      |
 |   Rows:         386                                                        |
 |   Columns:      429                                                        |
 |   Total Cells:  165594                                                     |
 |        Projection: Lambert Conformal Conic                                 |
 |            N:     228500    S:     215000   Res: 34.97409326               |
 |            E:     645000    W:     630000   Res: 34.96503497               |
 |   Range of data:    min = 55.77085  max = 156.3865                         |
 |                                                                            |
 |   Data Description:                                                        |
 |    generated by r.proj                                                     |
 |                                                                            |
 |   Comments:                                                                |
 |    r.proj input="ned1arcsec" location="northcarolina_latlong" mapset="h\   |
 |    elena" output="elev_ned30m" method="cubic" resolution=30                |
 |                                                                            |
 
B3) Run r.basin
 
r.basin --verbose --overwrite map=elev_35 prefix=a coordinates=636654.791181,218824.126649 dir=C:\Users\Andrea\F threshold=40
 
Get this error:
“....
Updating attributes...
r.to.vect complete.
All in RAM calculation...
ERROR: Region resolution and raster map <a_elev_35_strahler> resolution differs. Run 'g.region rast=a_elev_35_strahler' to set proper region resolution.
“
 
Checked a_elev_35_strahler, which is the same as in g.region -p                                                 
 
r.info map=a_elev_35_strahler                                                  
 +----------------------------------------------------------------------------+
 | Map:      a_elev_35_strahler             Date: Tue Dec 16 20:13:24 2014    |
 | Mapset:   user1                          Login of Creator: Andrea        |
 | Location: nc_spm_08_grass7                                                 |
 | DataBase: C:\Users\Andrea\Documents\grassdata                            |
 | Title:     ( a_elev_35_strahler )                                          |
 | Timestamp: none                                                            |
 |----------------------------------------------------------------------------|
 |                                                                            |
 |   Type of Map:  raster               Number of Categories: 0               |
 |   Data Type:    CELL                                                       |
 |   Rows:         386                                                        |
 |   Columns:      429                                                        |
 |   Total Cells:  165594                                                     |
 |        Projection: Lambert Conformal Conic                                 |
 |            N:     228500    S:     215000   Res: 34.97409326               |
 |            E:     645000    W:     630000   Res: 34.96503497               |
 |   Range of data:    min = 1  max = 3                                       |
 |                                                                            |
 |   Data Description:                                                        |
 |    generated by r.stream.order                                             |
 |                                                                            |
 |   Comments:                                                                |
 |    r.stream.order stream_rast="a_elev_35_stream_e" direction="a_elev_35\   |
 |    _drainage_e" strahler="a_elev_35_strahler" horton="a_elev_35_horton"\   |
 |     shreve="a_elev_35_shreve" hack="a_elev_35_hack" memory=300             |
 |                                                                            |
 
Tried anyways what the error message suggested:
 
g.region rast=a_elev_35_strahler
 
g.region -p                                                                     
projection: 99 (Lambert Conformal Conic)
zone:       0
datum:      nad83
ellipsoid:  a=6378137 es=0.006694380022900787
north:      228500
south:      215000
west:       630000
east:       645000
nsres:      34.97409326
ewres:      34.96503497
rows:       386
cols:       429
cells:      165594
 

And rerun r.basin:
 
r.basin --verbose --overwrite map=elev_35 prefix=a coordinates=636654.791181,218824.126649 dir=C:\Users\Andrea\F threshold=40
 
“
...
ERROR: Region resolution and raster map <a_elev_35_strahler> resolution differs. Run 'g.region rast=a_elev_35_strahler' to set proper region resolution.
“

Thanks!


Gesendet: Montag, 15. Dezember 2014 um 22:42 Uhr
Von: "Helmut Kudrnovsky" <hellik at web.de>
An: grass-user at lists.osgeo.org
Betreff: Re: [GRASS-user] Problem with r.basin in grass7
> I run the r.basin command and it finished !!!!

great!

>I do get 2 blocks of warnings ... Are they important ?
>
>Here they are:
>"
>....
>Reading raster map <t_elev_ned_30m_strahler>...
>Reading raster map <t_elev_ned_30m_drainage_e>...
>Reading raster map <r_elevation_crop>...
>WARNING: Width for column x set to 255 (was not specified by OGR), some
strings may be truncated!
>WARNING: Width for column y set to 255 (was not specified by OGR), some
strings may be truncated!

these warnings come from the underlying involved ogr/gdal library and can't
be suppressed. these can be ignored.

>WARNING: 'windows/original' was found in more mapsets (also found in
<PERMANENT>)
>WARNING: Using <original at landsat>

the original region is stored in the beginning of a r.basin run and restored
in the finish of the r.basin run. your multiple "original" seems to be a
left over of earlier r.basin runs (?). you can remove these by g.remove
type=region ....

by r63549
(http://lists.osgeo.org/pipermail/grass-commit/2014-December/034459.html)
I've added it to the r.basin script to do it autmatically.




-----
best regards
Helmut
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Problem-with-r-basin-in-grass7-tp5169155p5177945.html[http://osgeo-org.1560.x6.nabble.com/Problem-with-r-basin-in-grass7-tp5169155p5177945.html]
Sent from the Grass - Users mailing list archive at Nabble.com.
_______________________________________________
grass-user mailing list
grass-user at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user[http://lists.osgeo.org/mailman/listinfo/grass-user]


More information about the grass-user mailing list