Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

r.slope.aspect with -n flag giving aspect of flat areas as -9998 #319

Closed
PedroVenancio opened this issue Jan 31, 2020 · 5 comments
Closed

Comments

@PedroVenancio
Copy link

r.slope.aspect with the "new" -n flag is giving aspect values of flat areas as -9998, instead of -9999, when the precision choosed is CELL, and the output data type is CELL.

I've tested with GRASS 7.6 (on Linux) and GRASS 7.8.2 (on Windows), both in the GUI and CLI.

(Tue Jan 28 11:19:40 2020)                                                      
r.slope.aspect -e -n --verbose elevation=SRTM_PT_25m@PERMANENT slope=SRTM_PT_25m_Slope_Deg_GRASS aspect=SRTM_PT_25m_Aspect_Std_GRASS precision=CELL
Percent complete...
Elevation products for mapset <PERMANENT> in <SRTM_PT_25m>
Min computed aspect 0.0000, max computed aspect 360.0000
Aspect raster map <SRTM_PT_25m_Aspect_Std_GRASS> complete
Min computed slope 0.0000, max computed slope 75.2970
Slope raster map <SRTM_PT_25m_Slope_Deg_GRASS> complete
(Tue Jan 28 11:20:24 2020) Comando terminado (43 sec)  
r.info map=SRTM_PT_25m_Aspect_Std_GRASS@PERMANENT                              
 +----------------------------------------------------------------------------+
 | Map:      SRTM_PT_25m_Aspect_Std_GRASS@  Date: Tue Jan 28 11:20:24 2020    |
 | Mapset:   PERMANENT                      Login of Creator: PedroVenancio   |
 | Location: SRTM_PT_25m                                                      |
 | DataBase: D:\ICNF\Modelos_Combustivel_2018\Landscape_File\grass78          |
 | Title:    Aspect counterclockwise in degrees from east                     |
 | Timestamp: none                                                            |
 |----------------------------------------------------------------------------|
 |                                                                            |
 |   Type of Map:  raster               Number of Categories: 360             |
 |   Data Type:    CELL                                                       |
 |   Rows:         23200                                                      |
 |   Columns:      11360                                                      |
 |   Total Cells:  263552000                                                  |
 |        Projection: ETRS89 / Portugal TM06                                  |
 |            N:     278000    S:    -302000   Res:    25                     |
 |            E:     164000    W:    -120000   Res:    25                     |
 |   Range of data:    min = -9998  max = 360                                 |
 |                                                                            |
 |   Data Source:                                                             |
 |    raster elevation file SRTM_PT_25m@PERMANENT                             |
 |                                                                            |
 |                                                                            |
 |   Data Description:                                                        |
 |    generated by r.slope.aspect                                             |
 |                                                                            |
 |   Comments:                                                                |
 |    aspect map elev = SRTM_PT_25m@PERMANENT                                 |
 |    zfactor = 1.00                                                          |
 |    min_slope = 0.000000                                                    |
 |                                                                            |
 |    r.slope.aspect --verbose -e -n elevation="SRTM_PT_25m@PERMANENT" slo\   |
 |    pe="SRTM_PT_25m_Slope_Deg_GRASS" aspect="SRTM_PT_25m_Aspect_Std_GRAS\   |
 |    S" format="degrees" precision="CELL" zscale=1.0 min_slope=0.0           |
 |                                                                            |
 +----------------------------------------------------------------------------+
(Tue Jan 28 11:26:09 2020) Comando terminado (0 sec) 

Using the default precision as FCELL, all goes ok:

(Tue Jan 28 11:33:08 2020)                                                      
r.slope.aspect -e -n --verbose elevation=SRTM_PT_25m@PERMANENT slope=SRTM_PT_25m_Slope_Deg_GRASS_2 aspect=SRTM_PT_25m_Aspect_Std_GRASS_2
Percent complete...
Elevation products for mapset <PERMANENT> in <SRTM_PT_25m>
Min computed aspect 0.0000, max computed aspect 359.8096
Aspect raster map <SRTM_PT_25m_Aspect_Std_GRASS_2> complete
Min computed slope 0.0000, max computed slope 75.2970
Slope raster map <SRTM_PT_25m_Slope_Deg_GRASS_2> complete
(Tue Jan 28 11:34:01 2020) Comando terminado (53 sec)
(Tue Jan 28 11:34:27 2020)                                                      
r.info map=SRTM_PT_25m_Aspect_Std_GRASS_2@PERMANENT                            
 +----------------------------------------------------------------------------+
 | Map:      SRTM_PT_25m_Aspect_Std_GRASS_  Date: Tue Jan 28 11:34:01 2020    |
 | Mapset:   PERMANENT                      Login of Creator: PedroVenancio   |
 | Location: SRTM_PT_25m                                                      |
 | DataBase: D:\ICNF\Modelos_Combustivel_2018\Landscape_File\grass78          |
 | Title:    Aspect counterclockwise in degrees from east                     |
 | Timestamp: none                                                            |
 |----------------------------------------------------------------------------|
 |                                                                            |
 |   Type of Map:  raster               Number of Categories: 360             |
 |   Data Type:    FCELL                                                      |
 |   Rows:         23200                                                      |
 |   Columns:      11360                                                      |
 |   Total Cells:  263552000                                                  |
 |        Projection: ETRS89 / Portugal TM06                                  |
 |            N:     278000    S:    -302000   Res:    25                     |
 |            E:     164000    W:    -120000   Res:    25                     |
 |   Range of data:    min = -9999  max = 359.8097                            |
 |                                                                            |
 |   Data Source:                                                             |
 |    raster elevation file SRTM_PT_25m@PERMANENT                             |
 |                                                                            |
 |                                                                            |
 |   Data Description:                                                        |
 |    generated by r.slope.aspect                                             |
 |                                                                            |
 |   Comments:                                                                |
 |    aspect map elev = SRTM_PT_25m@PERMANENT                                 |
 |    zfactor = 1.00                                                          |
 |    min_slope = 0.000000                                                    |
 |                                                                            |
 |    r.slope.aspect --verbose -e -n elevation="SRTM_PT_25m@PERMANENT" slo\   |
 |    pe="SRTM_PT_25m_Slope_Deg_GRASS_2" aspect="SRTM_PT_25m_Aspect_Std_GR\   |
 |    ASS_2" format="degrees" precision="FCELL" zscale=1.0 min_slope=0.0      |
 |                                                                            |
 +----------------------------------------------------------------------------+
(Tue Jan 28 11:34:28 2020) Comando terminado (0 sec)  

The elevation map I'm using is this one:
https://www.fc.up.pt/pessoas/jagoncal/srtm/SRTM_PT_25m.tif

As CELL is a 32 bit integer with a range from -2,147,483,647 to +2,147,483,647, -9999 should be fine to conform inside it.

Another issue I see is in r.info, that is showing the title as

| Title: Aspect counterclockwise in degrees from east

which is not correct in this case, as the -n flag was used.

Should I fill another ticket for this issue?

Thanks!

@metzm
Copy link
Contributor

metzm commented Jan 31, 2020

Fixed in master f449ea5 and relbr78 fdd079c

@metzm
Copy link
Contributor

metzm commented Feb 1, 2020

Sorry, I missed PR #320, please ignore (the removed) PR #321.

@PedroVenancio
Copy link
Author

Hi @metzm

It's fixed now! Thank you very much!

The #320 part will be fixed after the merge.

-e and -n flags are now used also in QGIS Processing Framework: qgis/QGIS#34087

@petrasovaa
Copy link
Contributor

Done, merged to 78 as well.

@PedroVenancio
Copy link
Author

Awesome @petrasovaa ! Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants