[GRASS-user] problems with r.mapcalc

Benjamin Ducke benducke at fastmail.fm
Mon Dec 8 13:47:13 PST 2014


Look closely at the output of r.info:
Your current region is not where your data is.

First change the region to the extent and
resolution of the input map(s):

g.region rast=NDVI_1_h11v11

... then run your r.mapcalc command.

Best,

Ben

On 08/12/14 22:23, Diana Brito wrote:
> Hi list, 
> 
> first, i'm new with grass 
> 
> Im trying to do some math calculations with r.mapcalc, but my result
> allways is nan. 
> 
> When I display the image I can see different values, not only nan.
> 
> Thanks
> 
> 
> 
> GRASS 7.1.svn (sequia):/opt/grass_trunk/bin.x86_64-unknown-linux-gnu >
> r.info <http://r.info> grass-user at lists.osgeo.org
> 
>  +----------------------------------------------------------------------------+
>  | Map:      NDVI_1_h11v11                  Date: Mon Dec  1 05:12:28
> 2014    |
>  | Mapset:   sequia                         Login of Creator: polzader  
>      |
>  | Location: sequia                                                    
>       |
>  | DataBase: /home/polzader/Documentos/grassdata_diana_bpr              
>      |
>  | Title:     ( NDVI_1_h11v11 )                                        
>       |
>  | Timestamp: none                                                      
>      |
>  |----------------------------------------------------------------------------|
>  |                                                                      
>      |
>  |   Type of Map:  raster               Number of Categories: 0        
>       |
>  |   Data Type:    DCELL                                                
>      |
>  |   Rows:         4409                                                
>       |
>  |   Columns:      7499                                                
>       |
>  |   Total Cells:  33063091                                            
>       |
>  |        Projection: Latitud - Longitud.                              
>       |
>  |            N: 19:54:02.16S    S: 30:01:58.200271S   Res:
> 0:00:08.273087    |
>  |            E: 63:35:44.521118W    W: 80:49:44.4W   Res:
> 0:00:08.273087     |
>  |   Range of data:    min = -2000  max = 9090                          
>      |
>  |                                                                      
>      |
>  |   Data Description:                                                  
>      |
>  |    generated by r.series                                            
>       |
>  |                                                                      
>      |
>  |   Comments:                                                          
>      |
>  |    r.series
> input="MOD13Q1.A2004001.h11v11.005.2007235231758.250m_16_da\   |
>  |  
> ys_NDVI,MOD13Q1.A2005001.h11v11.005.2007352072715.250m_16_days_NDVI,\   |
>  |  
>  MOD13Q1.A2006001.h11v11.005.2008064055525.250m_16_days_NDVI,MOD13Q1.\   |
>  |  
>  A2007001.h11v11.005.2007021105928.250m_16_days_NDVI,MOD13Q1.A2008001\   |
>  |  
>  .h11v11.005.2008019102106.250m_16_days_NDVI,MOD13Q1.A2009001.h11v11.\   |
>  |  
>  005.2009019230008.250m_16_days_NDVI,MOD13Q1.A2010001.h11v11.005.2010\   |
>  |  
>  027061330.250m_16_days_NDVI,MOD13Q1.A2011001.h11v11.005.201102405534\   |
>  |  
>  0.250m_16_days_NDVI,MOD13Q1.A2012001.h11v11.005.2012019103715.250m_1\   |
>  |  
>  6_days_NDVI,MOD13Q1.A2013001.h11v11.005.2013018034332.250m_16_days_N\   |
>  |  
>  DVI,MOD13Q1.A2014001.h11v11.005.2014018092301.250m_16_days_NDVI,MOD1\   |
>  |  
>  3Q1.A2004017.h11v11.005.2008224113415.250m_16_days_NDVI,MOD13Q1.A200\   |
>  |  
>  5017.h11v11.005.2007353093413.250m_16_days_NDVI,MOD13Q1.A2006017.h11\   |
>  |  
>  v11.005.2008278011906.250m_16_days_NDVI,MOD13Q1.A2007017.h11v11.005.\   |
>  |  
>  2007096165508.250m_16_days_NDVI,MOD13Q1.A2008017.h11v11.005.20080370\   |
>  |  
>  54317.250m_16_days_NDVI,MOD13Q1.A2009017.h11v11.005.2009035200807.25\   |
>  |  
>  0m_16_days_NDVI,MOD13Q1.A2010017.h11v11.005.2010036002816.250m_16_da\   |
>  |  
>  ys_NDVI,MOD13Q1.A2011017.h11v11.005.2011039201212.250m_16_days_NDVI,\   |
>  |  
>  MOD13Q1.A2012017.h11v11.005.2012046172118.250m_16_days_NDVI,MOD13Q1.\   |
>  |  
>  A2013017.h11v11.005.2013039191638.250m_16_days_NDVI,MOD13Q1.A2014017\   |
>  |    .h11v11.005.2014038143732.250m_16_days_NDVI"
> output="NDVI_1_h11v11" \   |
>  |    method="average"                                                  
>      |
>  |                                                                      
>      |
>  +----------------------------------------------------------------------------+
> 
> GRASS 7.1.svn (sequia):/opt/grass_trunk/bin.x86_64-unknown-linux-gnu >
> r.info <http://r.info> NDWI_1_h11v11
>  +----------------------------------------------------------------------------+
>  | Map:      NDWI_1_h11v11                  Date: Mon Dec  1 05:49:38
> 2014    |
>  | Mapset:   sequia                         Login of Creator: polzader  
>      |
>  | Location: sequia                                                    
>       |
>  | DataBase: /home/polzader/Documentos/grassdata_diana_bpr              
>      |
>  | Title:     ( NDWI_1_h11v11 )                                        
>       |
>  | Timestamp: none                                                      
>      |
>  |----------------------------------------------------------------------------|
>  |                                                                      
>      |
>  |   Type of Map:  raster               Number of Categories: 0        
>       |
>  |   Data Type:    DCELL                                                
>      |
>  |   Rows:         4409                                                
>       |
>  |   Columns:      7499                                                
>       |
>  |   Total Cells:  33063091                                            
>       |
>  |        Projection: Latitud - Longitud.                              
>       |
>  |            N: 19:54:02.16S    S: 30:01:58.200271S   Res:
> 0:00:08.273087    |
>  |            E: 63:35:44.521118W    W: 80:49:44.4W   Res:
> 0:00:08.273087     |
>  |   Range of data:    min = -9254.65838509317  max = 9247.07852234276  
>      |
>  |                                                                      
>      |
>  |   Data Description:                                                  
>      |
>  |    generated by r.mapcalc                                            
>      |
>  |                                                                      
>      |
>  |   Comments:                                                          
>      |
>  |    (NIR_reflectance_1_h11v11 - MIR_reflectance_1_h11v11) /          
>       |
>  |    (NIR_reflectance_1_h11v11 + MIR_reflectance_1_h11v11) * 10000    
>       |
>  |                                                                      
>      |
>  +----------------------------------------------------------------------------+
> 
> 
> r.mapcalc --o expression="bla=NDVI_1_h11v11 - NDWI_1_h11v11"
> GRASS 7.1.svn (sequia):/opt/grass_trunk/bin.x86_64-unknown-linux-gnu >
> r.info <http://r.info> bla
>  +----------------------------------------------------------------------------+
>  | Map:      bla                            Date: Mon Dec  8 18:04:41
> 2014    |
>  | Mapset:   sequia                         Login of Creator: polzader  
>      |
>  | Location: sequia                                                    
>       |
>  | DataBase: /home/polzader/Documentos/grassdata_diana_bpr              
>      |
>  | Title:     ( bla )                                                  
>       |
>  | Timestamp: none                                                      
>      |
>  |----------------------------------------------------------------------------|
>  |                                                                      
>      |
>  |   Type of Map:  raster               Number of Categories: 0        
>       |
>  |   Data Type:    DCELL                                                
>      |
>  |   Rows:         2861                                                
>       |
>  |   Columns:      9350                                                
>       |
>  |   Total Cells:  26750350                                            
>       |
>  |        Projection: Latitud - Longitud.                              
>       |
>  |            N: 49:42:30.96S    S: 60:04:18.329421S   Res:
> 0:00:13.039975    |
>  |            E: 46:24:51.430659W    W: 80:16:55.2W   Res:
> 0:00:13.039975     |
>  |   Range of data:    min = -nan  max = -nan                          
>       |
>  |                                                                      
>      |
>  |   Data Description:                                                  
>      |
>  |    generated by r.mapcalc                                            
>      |
>  |                                                                      
>      |
>  |   Comments:                                                          
>      |
>  |    NDVI_1_h11v11 - NDWI_1_h11v11                                    
>  |                                                                      
>      |
>  +----------------------------------------------------------------------------+
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> -- 
> Diana Marcela Brito Hoyos
> Biologa
> d.brito at javeriana.edu.co <mailto:d.brito at javeriana.edu.co>
> 
> 
> 
> 
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
> 



-- 
Dr. Benjamin Ducke
{*} Geospatial Consultant
{*} GIS Developer

Spatial technology for the masses, not the classes:
experience free and open source GIS at http://gvsigce.org


More information about the grass-user mailing list