[GRASS-user] problems with r.mapcalc

Paulo van Breugel p.vanbreugel at gmail.com
Mon Dec 8 13:47:58 PST 2014


Not sure that will give you a solution, but an r.mapcalc expression in
grass 7.1 should look like:

r.mapcalc --overwrite expression="bla = NDVI_1_h11v11 - NDWI_1_h11v11"

In other words 1) the --o flag in grass 6.4 was changed to --overwrite in
grass 7 and higher, and 2) there should be a space before the first *=*
sign.

Check out: http://grass.osgeo.org/grass71/manuals/r.mapcalc.html

Paulo


On Mon, Dec 8, 2014 at 10:23 PM, Diana Brito <dianisbrito2 at gmail.com> 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 NDVI_1_h11v11
>
>
>  +----------------------------------------------------------------------------+
>  | 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 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 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
>
>
>
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20141208/68ec9f3e/attachment-0001.html>


More information about the grass-user mailing list