Re: [GRASS-user] r.import extent=region ignored

2017-04-06 Thread Anna Petrášová
Once this the ticket below is solved, it will be integrated to r.import:
https://trac.osgeo.org/grass/ticket/2055


Best,

Anna

On Thu, Apr 6, 2017 at 3:09 PM, Veronica Andreo  wrote:
> Correction: it is mentioned under 'known issues'... :)
>
> Vero
>
>
> El 6 abr. 2017 9:05 p. m., "Veronica Andreo" 
> escribió:
>
> Hello Thomas,
>
> If the map you are importing has the same projection than the location, then
> extent parameter is ignored. It is not a bug, but how the module works. It
> is written in the 'Notes' section, I think. The extent parameter works only
> when map and target location have different reference systems.
>
> Best,
> Vero
>
> El 6 abr. 2017 8:59 p. m., "Tomáš Brunclík"  escribió:
>
> Hello,
>
> Using GRASS 7.2.1svn r70842 (Linux 64bit from today's binary snapshot) and
> it seems the extent=region parameter of the r.import is just ignored. Tried
> from GUI, then from command line, first with multi band virtual raster, then
> with single JPEG2000 file (as in the example below), with and without the -n
> option. Is it a known bug, or does it work for someone, perhaps in some
> other version, or with other input formats? I tried to look in trac, but did
> not see anything. I am aware how I can clip the rasters after import, but it
> seemed one of the fine new features which would make the daily use a little
> more comfortable...
>
> Tomas Brunclik
>
>
> GRASS 7.2.1svn (utm33n):~ > r.import -o
> input=/home/tom/GISdata/DPZ/Chlorofyl-vzorkovani/2016-09-13_R122_S2A_samping_09-13/S2A_USER_PRD_MSIL2A_PDMC_20160915T151344_R122_V20160913T100022_20160913T100504.SAFE/GRANULE/S2A_USER_MSI_L2A_TL_SGS__20160913T170505_A006411_T33UWR_N02.04/IMG_DATA/R20m/S2A_USER_MSI_L2A_TL_SGS__20160913T170505_A006411_T33UWR_B04_20m.jp2
> output=20160913_R122.3b extent=region
> UPOZORNĚNÍ: Přeskakuje se kontrola kartografického zobrazení.
> Proceeding with import of 1 raster bands...
> Importing raster map <20160913_R122.3b>...
>  100%
> GRASS 7.2.1svn (utm33n):~ > g.region -p
> projection: 1 (UTM)
> zone:   33
> datum:  wgs84
> ellipsoid:  a=6378137 es=0.00669438
> north:  5569000
> south:  5543320
> west:   531260
> east:   570320
> nsres:  20
> ewres:  20
> rows:   1284
> cols:   1953
> cells:  2507652
> GRASS 7.2.1svn (utm33n):~ > r.info map=20160913_R122.3b
>
> ++
>  | Map:  20160913_R122.3b   Date: Thu Apr  6 20:27:43 2017
> |
>  | Mapset:   sentinel2test  Login of Creator: tom
> |
>  | Location: utm33n
> |
>  | DataBase: /home/tom/GISdata/grass
> |
>  | Title:
> |
>  | Timestamp: none
> |
>
> ||
>  |
> |
>  |   Type of Map:  raster   Number of Categories: 0
> |
>  |   Data Type:CELL
> |
>  |   Rows: 5490
> |
>  |   Columns:  5490
> |
>  |   Total Cells:  30140100
> |
>  |Projection: UTM (zone 33)
> |
>  |N:5600040S:5490240   Res:20
> |
>  |E: 609780W: 499980   Res:20
> |
>  |   Range of data:min = 1  max = 17010
> |
>  |
> |
>  |   Data Description:
> |
>  |generated by r.in.gdal
> |
>  |
> |
>  |   Comments:
> |
>  |r.in.gdal -o -k input="/home/tom/GISdata/DPZ/Chlorofyl-vzorkovani/20\
> |
>  |16-09-13_R122_S2A_samping_09-13/S2A_USER_PRD_MSIL2A_PDMC_20160915T15\
> |
>  |1344_R122_V20160913T100022_20160913T100504.SAFE/GRANULE/S2A_USER_MSI\
> |
>  |_L2A_TL_SGS__20160913T170505_A006411_T33UWR_N02.04/IMG_DATA/R20m/S2A\
> |
>  |_USER_MSI_L2A_TL_SGS__20160913T170505_A006411_T33UWR_B04_20m.jp2" ou\
> |
>  |tput="20160913_R122.3b" memory=300 offset=0 num_digits=0
> |
>  |
> |
>
> ++
>
> GRASS 7.2.1svn (utm33n):~ >
>
>
> ___
> grass-user mailing list
> grass-user@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/grass-user
>
>
>
>
> ___
> grass-user mailing list
> grass-user@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/grass-user
___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

Re: [GRASS-user] r.mask: no MASK created when using many categories

2017-04-06 Thread Anna Petrášová
On Thu, Apr 6, 2017 at 5:47 AM, Micha Silver  wrote:
> Interesting...
> I can duplicate the problem (but only up to 100 cats). Above that I get an
> error of "stack smashing":
>

I tried to fix it in r70847 (or at least allow longer sequences, the
arrays are still statically allocated). But in this case you can also
use "1 thru 106".

Anna

> GRASS 7.2.0 (ITM):~ > r.mask raster=farm_bas maskcats="`seq -s " " 1 100`"
> --o
> All subsequent raster operations will be limited to the MASK area. Removing
> or renaming raster map named 'MASK' will restore raster operations to
> normal.
> [Raster MASK present]
>
> GRASS 7.2.0 (ITM):~ > r.info -g MASK
> north=53
> south=51
> east=185000
> west=17
> nsres=4
> ewres=4
> rows=5000
> cols=3750
> cells=1875
> datatype=CELL
> ncats=0
> [Raster MASK present]
>
> But with 103 cats...
> GRASS 7.2.0 (ITM):~ > r.mask raster=farm_bas maskcats="`seq -s " " 1 103`"
> --o
> WARNING: MASK already exists and will be overwritten
> *** stack smashing detected ***: r.reclass terminated
> All subsequent raster operations will be limited to the MASK area. Removing
> or renaming raster map named 'MASK' will restore raster operations to
> normal.
> GRASS 7.2.0 (ITM):~ > r.info -g MASK
> ERROR: Raster map  not found
>
>
>
> On 04/06/2017 12:12 PM, Mira Kattwinkel wrote:
>
> Dear Anna, dear list
>
> I used the NC basic sample data set to replicate my case. Unfortunately, I
> get the same problem. Can anybody give me a hint? Thanks a lot!
>
> Here is what I did and the output:
>
> r.watershed elevation=elevation@PERMANENT threshold=500 basin=basins_new
> SECTION 1a (of 5): Initiating Memory.
> SECTION 1b (of 5): Determining Offmap Flow.
> SECTION 2: A* Search.
> SECTION 3a: Accumulating Surface Flow with MFD.
> SECTION 3b: Adjusting drainage directions.
> SECTION 4: Watershed determination.
> SECTION 5: Closing Maps.
>
> ## creating mask with 106 categories  works fine
> r.mask raster=basins_new@PERMANENT maskcats=1 2 3 4 5 6 7 8 9 10 11 12 13 14
> 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
> 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
> 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
> 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
> All subsequent raster operations will be limited to the MASK area. Removing
> or renaming raster map named 'MASK' will restore raster operations to
> normal.
>
> r.mapcalc expression=r106 = MASK
>
> r.mask -r
> Raster MASK removed
>
> ## creating mask with 107 categories seems to work without error but there
> is no MASK output
> r.mask raster=basins_new@PERMANENT maskcats=1 2 3 4 5 6 7 8 9 10 11 12 13 14
> 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
> 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
> 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
> 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
> All subsequent raster operations will be limited to the MASK area. Removing
> or renaming raster map named 'MASK' will restore raster operations to
> normal.
>
> r.mapcalc expression=m107 = MASK
> Invalid map 
> Parse error
> ERROR: parse error
>
> g.list type=raster
> basins
> basins_new
> elevation
> elevation_shade
> geology
> lakes
> landuse
> r106
> soils
>
>
>
> On 06/04/17 05:06, Anna Petrášová wrote:
>
> On Wed, Apr 5, 2017 at 8:22 AM, Mira Kattwinkel
>  wrote:
>
> Dear List,
>
> I am using r.mask to create a new raster map that only contains certain
> categories given in 'maskcats'. Then, I use r.mapcalc to save the map under
> a new name and (to be on the save side) delete the MASK with r.mask flag
> '-r'. I do this in a loop and it works fine until a case when the number of
> categories to combine is 213 (trail and error lead to 106 as the maximum
> number that works fine). Flag 'verbose' gives the message that a MASK was
> created, but none is there. The problem arises in both cases when I directly
> use Grass or through R using execGrass.
>
> I tried it on landsat raster from NC sample dataset and it worked.
> Perhaps you could try to replicate it with this sample dataset?
>
> Anna
>
> Is there a limit in the number of categories that can be passed to r.mask? I
> did not find any hint about that. Additionally, I wonder why there is no
> error message but in the contrary one that tells me that a MASK was created
> even when it failed.
>
> In case the details are important (or if anybody has a better idea how to
> achieve what I want): I have a raster map of subcatchemts belonging to
> stream segments created with r.stream.basins. For the endpoints of segments,
> I want to combine these subcatchments to a total catchment raster map
> containing all upstream catchments.
>
> Thanks a lot,
>
> Mira
>
>
> --
> Dr. Mira Kattwinkel
> Quantitative Landscape Ecology
> Institute for Environmental 

[GRASS-user] Convert vector map from line to boundary/area

2017-04-06 Thread Rich Shepard

  I have done something incorrectly trying to create a mask and need a
clue-stick to correct the situation. Here's what I did:

  1. Digitized a line to define an area on a base raster map; saved it as
anal_area_mask.

  2. v.to.rast in=bndy_conditions type=area out=anal_area_mask use=cat

  3. Removed existing mask: r.mask -r

  4. Created new mask: r.mask rast=anal_area_mask

  5. Selected a raster map in the Layer Manager window.

  6. No map displayed in the Map Display window; it's plain white.

  Did editing the digitized line to an area, and saving it as a line, affect
how it was converted to a raster map? Yep.

  If I change the vector map type from line to boundary or area it is not
visible.

  How do I convert this vector line to either a boundary or area (whichever
is appropriate) so it produces a raster mask?

Rich
___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

Re: [GRASS-user] Modifying vector map in map display window [RESOLVED]

2017-04-06 Thread Rich Shepard

On Thu, 6 Apr 2017, Rich Shepard wrote:


 What have I done incorrectly here?


  Apparently, did not left click on the starting vertex sufficient to
convert the solid black line to a dotted yellow line. When I did this I was
able to add the two line segments and a right click turned the new line to
solid black.

Rich
___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

[GRASS-user] Modifying vector map in map display window

2017-04-06 Thread Rich Shepard

  I have a line digitized in the map display window and I want to add two
segments so it bounds an area. I'll then convert that area to a raster MASK.

  Tried using the 'edit line/boundary' feature but it's not adding the
segments to the existing line. Putting the cursor on one end vertex and
issuing a left-click, I drag the line to a corner, left-click, continue
dragging to the second line end vertex, double left-click (which turns the
exiting line from black to dashed yellow), then right-click. The original
line remains.

  What have I done incorrectly here?

Rich
___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

Re: [GRASS-user] r.import extent=region ignored

2017-04-06 Thread Veronica Andreo
Correction: it is mentioned under 'known issues'... :)

Vero

El 6 abr. 2017 9:05 p. m., "Veronica Andreo" 
escribió:

Hello Thomas,

If the map you are importing has the same projection than the location,
then extent parameter is ignored. It is not a bug, but how the module
works. It is written in the 'Notes' section, I think. The extent parameter
works only when map and target location have different reference systems.

Best,
Vero

El 6 abr. 2017 8:59 p. m., "Tomáš Brunclík"  escribió:

Hello,

Using GRASS 7.2.1svn r70842 (Linux 64bit from today's binary snapshot) and
it seems the extent=region parameter of the r.import is just ignored. Tried
from GUI, then from command line, first with multi band virtual raster,
then with single JPEG2000 file (as in the example below), with and without
the -n option. Is it a known bug, or does it work for someone, perhaps in
some other version, or with other input formats? I tried to look in trac,
but did not see anything. I am aware how I can clip the rasters after
import, but it seemed one of the fine new features which would make the
daily use a little more comfortable...

Tomas Brunclik


GRASS 7.2.1svn (utm33n):~ > r.import -o input=/home/tom/GISdata/DPZ/Ch
lorofyl-vzorkovani/2016-09-13_R122_S2A_samping_09-13/S2A_USE
R_PRD_MSIL2A_PDMC_20160915T151344_R122_V20160913T100022_2016
0913T100504.SAFE/GRANULE/S2A_USER_MSI_L2A_TL_SGS__20160913T
170505_A006411_T33UWR_N02.04/IMG_DATA/R20m/S2A_USER_MSI_
L2A_TL_SGS__20160913T170505_A006411_T33UWR_B04_20m.jp2
output=20160913_R122.3b extent=region
UPOZORNĚNÍ: Přeskakuje se kontrola kartografického zobrazení.
Proceeding with import of 1 raster bands...
Importing raster map <20160913_R122.3b>...
 100%
GRASS 7.2.1svn (utm33n):~ > g.region -p
projection: 1 (UTM)
zone:   33
datum:  wgs84
ellipsoid:  a=6378137 es=0.00669438
north:  5569000
south:  5543320
west:   531260
east:   570320
nsres:  20
ewres:  20
rows:   1284
cols:   1953
cells:  2507652
GRASS 7.2.1svn (utm33n):~ > r.info map=20160913_R122.3b
 +--
--+
 | Map:  20160913_R122.3b   Date: Thu Apr  6 20:27:43
2017|
 | Mapset:   sentinel2test  Login of Creator:
tom |
 | Location: utm33n
|
 | DataBase: /home/tom/GISdata/grass
|
 | Title:
|
 | Timestamp: none
|
 |--
--|
 |
|
 |   Type of Map:  raster   Number of Categories:
0   |
 |   Data Type:CELL
|
 |   Rows: 5490
|
 |   Columns:  5490
|
 |   Total Cells:  30140100
|
 |Projection: UTM (zone 33)
|
 |N:5600040S:5490240   Res:
20 |
 |E: 609780W: 499980   Res:
20 |
 |   Range of data:min = 1  max = 17010
|
 |
|
 |   Data Description:
|
 |generated by r.in.gdal
|
 |
|
 |   Comments:
|
 |r.in.gdal -o -k input="/home/tom/GISdata/DPZ/Chlorofyl-vzorkovani/20\
|
 |16-09-13_R122_S2A_samping_09-13/S2A_USER_PRD_MSIL2A_PDMC_20160915T15\
|
 |1344_R122_V20160913T100022_20160913T100504.SAFE/GRANULE/S2A_USER_MSI\
|
 |_L2A_TL_SGS__20160913T170505_A006411_T33UWR_N02.04/IMG_DATA/R20m/S2A\
|
 |_USER_MSI_L2A_TL_SGS__20160913T170505_A006411_T33UWR_B04_20m.jp2"
ou\   |
 |tput="20160913_R122.3b" memory=300 offset=0
num_digits=0|
 |
|
 +--
--+

GRASS 7.2.1svn (utm33n):~ >


___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user
___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

Re: [GRASS-user] r.import extent=region ignored

2017-04-06 Thread Veronica Andreo
Hello Thomas,

If the map you are importing has the same projection than the location,
then extent parameter is ignored. It is not a bug, but how the module
works. It is written in the 'Notes' section, I think. The extent parameter
works only when map and target location have different reference systems.

Best,
Vero

El 6 abr. 2017 8:59 p. m., "Tomáš Brunclík"  escribió:

Hello,

Using GRASS 7.2.1svn r70842 (Linux 64bit from today's binary snapshot) and
it seems the extent=region parameter of the r.import is just ignored. Tried
from GUI, then from command line, first with multi band virtual raster,
then with single JPEG2000 file (as in the example below), with and without
the -n option. Is it a known bug, or does it work for someone, perhaps in
some other version, or with other input formats? I tried to look in trac,
but did not see anything. I am aware how I can clip the rasters after
import, but it seemed one of the fine new features which would make the
daily use a little more comfortable...

Tomas Brunclik


GRASS 7.2.1svn (utm33n):~ > r.import -o input=/home/tom/GISdata/DPZ/
Chlorofyl-vzorkovani/2016-09-13_R122_S2A_samping_09-13/S2A_
USER_PRD_MSIL2A_PDMC_20160915T151344_R122_V20160913T100022_
20160913T100504.SAFE/GRANULE/S2A_USER_MSI_L2A_TL_SGS__
20160913T170505_A006411_T33UWR_N02.04/IMG_DATA/R20m/
S2A_USER_MSI_L2A_TL_SGS__20160913T170505_A006411_T33UWR_B04_20m.jp2
output=20160913_R122.3b extent=region
UPOZORNĚNÍ: Přeskakuje se kontrola kartografického zobrazení.
Proceeding with import of 1 raster bands...
Importing raster map <20160913_R122.3b>...
 100%
GRASS 7.2.1svn (utm33n):~ > g.region -p
projection: 1 (UTM)
zone:   33
datum:  wgs84
ellipsoid:  a=6378137 es=0.00669438
north:  5569000
south:  5543320
west:   531260
east:   570320
nsres:  20
ewres:  20
rows:   1284
cols:   1953
cells:  2507652
GRASS 7.2.1svn (utm33n):~ > r.info map=20160913_R122.3b
 +--
--+
 | Map:  20160913_R122.3b   Date: Thu Apr  6 20:27:43
2017|
 | Mapset:   sentinel2test  Login of Creator:
tom |
 | Location: utm33n
|
 | DataBase: /home/tom/GISdata/grass
|
 | Title:
|
 | Timestamp: none
|
 |--
--|
 |
|
 |   Type of Map:  raster   Number of Categories:
0   |
 |   Data Type:CELL
|
 |   Rows: 5490
|
 |   Columns:  5490
|
 |   Total Cells:  30140100
|
 |Projection: UTM (zone 33)
|
 |N:5600040S:5490240   Res:
20 |
 |E: 609780W: 499980   Res:
20 |
 |   Range of data:min = 1  max = 17010
|
 |
|
 |   Data Description:
|
 |generated by r.in.gdal
|
 |
|
 |   Comments:
|
 |r.in.gdal -o -k input="/home/tom/GISdata/DPZ/Chlorofyl-vzorkovani/20\
|
 |16-09-13_R122_S2A_samping_09-13/S2A_USER_PRD_MSIL2A_PDMC_20160915T15\
|
 |1344_R122_V20160913T100022_20160913T100504.SAFE/GRANULE/S2A_USER_MSI\
|
 |_L2A_TL_SGS__20160913T170505_A006411_T33UWR_N02.04/IMG_DATA/R20m/S2A\
|
 |_USER_MSI_L2A_TL_SGS__20160913T170505_A006411_T33UWR_B04_20m.jp2"
ou\   |
 |tput="20160913_R122.3b" memory=300 offset=0
num_digits=0|
 |
|
 +--
--+

GRASS 7.2.1svn (utm33n):~ >


___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user
___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

[GRASS-user] r.import extent=region ignored

2017-04-06 Thread Tomáš Brunclík

Hello,

Using GRASS 7.2.1svn r70842 (Linux 64bit from today's binary snapshot) 
and it seems the extent=region parameter of the r.import is just 
ignored. Tried from GUI, then from command line, first with multi band 
virtual raster, then with single JPEG2000 file (as in the example 
below), with and without the -n option. Is it a known bug, or does it 
work for someone, perhaps in some other version, or with other input 
formats? I tried to look in trac, but did not see anything. I am aware 
how I can clip the rasters after import, but it seemed one of the fine 
new features which would make the daily use a little more comfortable...


Tomas Brunclik


GRASS 7.2.1svn (utm33n):~ > r.import -o 
input=/home/tom/GISdata/DPZ/Chlorofyl-vzorkovani/2016-09-13_R122_S2A_samping_09-13/S2A_USER_PRD_MSIL2A_PDMC_20160915T151344_R122_V20160913T100022_20160913T100504.SAFE/GRANULE/S2A_USER_MSI_L2A_TL_SGS__20160913T170505_A006411_T33UWR_N02.04/IMG_DATA/R20m/S2A_USER_MSI_L2A_TL_SGS__20160913T170505_A006411_T33UWR_B04_20m.jp2 
output=20160913_R122.3b extent=region

UPOZORNĚNÍ: Přeskakuje se kontrola kartografického zobrazení.
Proceeding with import of 1 raster bands...
Importing raster map <20160913_R122.3b>...
 100%
GRASS 7.2.1svn (utm33n):~ > g.region -p
projection: 1 (UTM)
zone:   33
datum:  wgs84
ellipsoid:  a=6378137 es=0.00669438
north:  5569000
south:  5543320
west:   531260
east:   570320
nsres:  20
ewres:  20
rows:   1284
cols:   1953
cells:  2507652
GRASS 7.2.1svn (utm33n):~ > r.info map=20160913_R122.3b
 ++
 | Map:  20160913_R122.3b   Date: Thu Apr  6 20:27:43 
2017|
 | Mapset:   sentinel2test  Login of Creator: 
tom |

 | Location: utm33n |
 | DataBase: /home/tom/GISdata/grass |
 | Title: |
 | Timestamp: none |
 ||
 | |
 |   Type of Map:  raster   Number of Categories: 
0   |
 |   Data Type: 
CELL   |

 |   Rows: 5490   |
 |   Columns: 5490   |
 |   Total Cells: 
30140100   |
 |Projection: UTM (zone 
33)   |
 |N:5600040S:5490240   Res: 
20 |
 |E: 609780W: 499980   Res: 
20 |
 |   Range of data:min = 1  max = 
17010   |

 | |
 |   Data Description: |
 |generated by 
r.in.gdal  |

 | |
 | Comments: |
 |r.in.gdal -o -k 
input="/home/tom/GISdata/DPZ/Chlorofyl-vzorkovani/20\   |

 | 16-09-13_R122_S2A_samping_09-13/S2A_USER_PRD_MSIL2A_PDMC_20160915T15\ |
 | 1344_R122_V20160913T100022_20160913T100504.SAFE/GRANULE/S2A_USER_MSI\ |
 | _L2A_TL_SGS__20160913T170505_A006411_T33UWR_N02.04/IMG_DATA/R20m/S2A\ |
 | _USER_MSI_L2A_TL_SGS__20160913T170505_A006411_T33UWR_B04_20m.jp2" 
ou\   |
 |tput="20160913_R122.3b" memory=300 offset=0 
num_digits=0|

 | |
 ++

GRASS 7.2.1svn (utm33n):~ >

___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

Re: [GRASS-user] r.mask: no MASK created when using many categories

2017-04-06 Thread Micha Silver

  
  
Interesting...
I can duplicate the problem (but only up to 100 cats). Above that I
get an error of "stack smashing":

GRASS 7.2.0 (ITM):~ > r.mask raster=farm_bas maskcats="`seq
  -s " " 1 100`" --o
All subsequent raster operations will be limited to the
  MASK area. Removing
or renaming raster map named 'MASK' will restore raster
  operations to
normal.
[Raster MASK present]

GRASS 7.2.0 (ITM):~ > r.info -g MASK
north=53
south=51
east=185000
west=17
nsres=4
ewres=4
rows=5000
cols=3750
cells=1875
datatype=CELL
ncats=0
[Raster MASK present]

But with 103 cats...
GRASS 7.2.0 (ITM):~ > r.mask raster=farm_bas maskcats="`seq
  -s " " 1 103`" --o
WARNING: MASK already exists and will be overwritten
*** stack smashing detected ***: r.reclass terminated
All subsequent raster operations will be limited to the
  MASK area. Removing
or renaming raster map named 'MASK' will restore raster
  operations to
normal.
GRASS 7.2.0 (ITM):~ > r.info -g MASK
ERROR: Raster map  not found


On 04/06/2017 12:12 PM, Mira Kattwinkel
  wrote:

Dear Anna, dear list
  
  
  I used the NC basic sample data set to replicate my case.
  Unfortunately, I get the same problem. Can anybody give me a hint?
  Thanks a lot!
  
  
  Here is what I did and the output:
  
  
  r.watershed elevation=elevation@PERMANENT threshold=500
  basin=basins_new
  
  SECTION 1a (of 5): Initiating Memory.
  
  SECTION 1b (of 5): Determining Offmap Flow.
  
  SECTION 2: A* Search.
  
  SECTION 3a: Accumulating Surface Flow with MFD.
  
  SECTION 3b: Adjusting drainage directions.
  
  SECTION 4: Watershed determination.
  
  SECTION 5: Closing Maps.
  
  
  ## creating mask with 106 categories  works fine
  
  r.mask raster=basins_new@PERMANENT maskcats=1 2 3 4 5 6 7 8 9 10
  11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
  33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
  55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
  77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
  99 100 101 102 103 104 105 106
  
  All subsequent raster operations will be limited to the MASK area.
  Removing or renaming raster map named 'MASK' will restore raster
  operations to normal.
  
  
  r.mapcalc _expression_=r106 = MASK
  
  
  r.mask -r
  
  Raster MASK removed
  
  
  ## creating mask with 107 categories seems to work without error
  but there is no MASK output
  
  r.mask raster=basins_new@PERMANENT maskcats=1 2 3 4 5 6 7 8 9 10
  11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
  33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
  55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
  77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
  99 100 101 102 103 104 105 106 107
  
  All subsequent raster operations will be limited to the MASK area.
  Removing or renaming raster map named 'MASK' will restore raster
  operations to normal.
  
  
  r.mapcalc _expression_=m107 = MASK
  
  Invalid map 
  
  Parse error
  
  ERROR: parse error
  
  
  g.list type=raster
  
  basins
  
  basins_new
  
  elevation
  
  elevation_shade
  
  geology
  
  lakes
  
  landuse
  
  r106
  
  soils
  
  
  
  
  On 06/04/17 05:06, Anna Petrášová wrote:
  
  On Wed, Apr 5, 2017 at 8:22 AM, Mira
Kattwinkel

 wrote:

Dear List,
  
  
  I am using r.mask to create a new raster map that only
  contains certain
  
  categories given in 'maskcats'. Then, I use r.mapcalc to save
  the map under
  
  a new name and (to be on the save side) delete the MASK with
  r.mask flag
  
  '-r'. I do this in a loop and it works fine until a case when
  the number of
  
  categories to combine is 213 (trail and error lead to 106 as
  the maximum
  
  number that works fine). Flag 'verbose' gives the message that
  a MASK was
  
  created, but none is there. The problem arises in both cases
  when I directly
  
  use Grass or through R using execGrass.
  

I tried it on landsat raster from NC sample dataset and it
worked.

Perhaps you could try to replicate it with this sample dataset?

Re: [GRASS-user] Temporal framework: calculating annual 5-day extremes

2017-04-06 Thread Sören Gebbert
Hi,

2017-04-06 11:09 GMT+02:00 RichardCooper :
> I have a time series of rainfall data, and for each year I want to calculate
> the five-day period with maximum rainfall. So I would need to calculate the
> sum of day1 to day5, then day2 to day6, then day3 to day7 etc for the whole
> year, and then output the maximum grid cell 5-day values for each year into
> a single raster.

What you need is a temporal moving window with the size of 5 days to
compute for each day the 5 day aggregate of the future.
You can convert your time series into a voxel dataset (3d raster) and
use r3.mapcalc with the neighbor index operator map[x][y][z] (if i
remember correctly):

agg_map3d = map3d[0][0][0] + map3d[0][0][1] + ... map3d[0][0][4]

Or you use t.rast.algebra [1] and the temporal neighbor operator strds[t]:

agg_strds = prec_strds[0] + prec_strds[1] + ... prec_strds[4]

Best regards
Soeren

[1] https://grass.osgeo.org/grass73/manuals/t.rast.algebra.html

>
> To do this in t.rast.accumulate, I can see how to set a temporal cycle of 1
> year (cycle= "12 months"), but not sure how to specify such a rolling sum
> calculation of 5 days as described above. The default method is the 'mean'
> as indicated in r.series.accumulation? I'm not too sure how the accumulation
> is applied in the module.
>
> Best regards,
> Richard
>
>
>
> --
> View this message in context: 
> http://osgeo-org.1560.x6.nabble.com/Temporal-framework-calculating-annual-5-day-extremes-tp5316014p5316076.html
> Sent from the Grass - Users mailing list archive at Nabble.com.
> ___
> grass-user mailing list
> grass-user@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/grass-user
___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

Re: [GRASS-user] Temporal framework: calculating annual 5-day extremes

2017-04-06 Thread Mira Kattwinkel

Hi Richard

t.rast.aggregate might be the function you are looking for. It has the 
method 'max'.


For the cycling you might need to somehow loop over the data with 
different starting days.


Best, Mira


On 06/04/17 11:09, RichardCooper wrote:

I have a time series of rainfall data, and for each year I want to calculate
the five-day period with maximum rainfall. So I would need to calculate the
sum of day1 to day5, then day2 to day6, then day3 to day7 etc for the whole
year, and then output the maximum grid cell 5-day values for each year into
a single raster.

To do this in t.rast.accumulate, I can see how to set a temporal cycle of 1
year (cycle= "12 months"), but not sure how to specify such a rolling sum
calculation of 5 days as described above. The default method is the 'mean'
as indicated in r.series.accumulation? I'm not too sure how the accumulation
is applied in the module.

Best regards,
Richard



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Temporal-framework-calculating-annual-5-day-extremes-tp5316014p5316076.html
Sent from the Grass - Users mailing list archive at Nabble.com.
___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user


--
Dr. Mira Kattwinkel
Quantitative Landscape Ecology
Institute for Environmental Sciences
University of Koblenz-Landau
Fortstraße 7
76829 Landau
Germany
Phone: + 49 6341 280-31553
Office: Building I, Room 2.02

___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

Re: [GRASS-user] r.mask: no MASK created when using many categories

2017-04-06 Thread Mira Kattwinkel

Dear Anna, dear list

I used the NC basic sample data set to replicate my case. Unfortunately, 
I get the same problem. Can anybody give me a hint? Thanks a lot!


Here is what I did and the output:

r.watershed elevation=elevation@PERMANENT threshold=500 basin=basins_new
SECTION 1a (of 5): Initiating Memory.
SECTION 1b (of 5): Determining Offmap Flow.
SECTION 2: A* Search.
SECTION 3a: Accumulating Surface Flow with MFD.
SECTION 3b: Adjusting drainage directions.
SECTION 4: Watershed determination.
SECTION 5: Closing Maps.

## creating mask with 106 categories  works fine
r.mask raster=basins_new@PERMANENT maskcats=1 2 3 4 5 6 7 8 9 10 11 12 
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
All subsequent raster operations will be limited to the MASK area. 
Removing or renaming raster map named 'MASK' will restore raster 
operations to normal.


r.mapcalc expression=r106 = MASK

r.mask -r
Raster MASK removed

## creating mask with 107 categories seems to work without error but 
there is no MASK output
r.mask raster=basins_new@PERMANENT maskcats=1 2 3 4 5 6 7 8 9 10 11 12 
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
All subsequent raster operations will be limited to the MASK area. 
Removing or renaming raster map named 'MASK' will restore raster 
operations to normal.


r.mapcalc expression=m107 = MASK
Invalid map 
Parse error
ERROR: parse error

g.list type=raster
basins
basins_new
elevation
elevation_shade
geology
lakes
landuse
r106
soils



On 06/04/17 05:06, Anna Petrášová wrote:

On Wed, Apr 5, 2017 at 8:22 AM, Mira Kattwinkel
 wrote:

Dear List,

I am using r.mask to create a new raster map that only contains certain
categories given in 'maskcats'. Then, I use r.mapcalc to save the map under
a new name and (to be on the save side) delete the MASK with r.mask flag
'-r'. I do this in a loop and it works fine until a case when the number of
categories to combine is 213 (trail and error lead to 106 as the maximum
number that works fine). Flag 'verbose' gives the message that a MASK was
created, but none is there. The problem arises in both cases when I directly
use Grass or through R using execGrass.

I tried it on landsat raster from NC sample dataset and it worked.
Perhaps you could try to replicate it with this sample dataset?

Anna


Is there a limit in the number of categories that can be passed to r.mask? I
did not find any hint about that. Additionally, I wonder why there is no
error message but in the contrary one that tells me that a MASK was created
even when it failed.

In case the details are important (or if anybody has a better idea how to
achieve what I want): I have a raster map of subcatchemts belonging to
stream segments created with r.stream.basins. For the endpoints of segments,
I want to combine these subcatchments to a total catchment raster map
containing all upstream catchments.

Thanks a lot,

Mira


--
Dr. Mira Kattwinkel
Quantitative Landscape Ecology
Institute for Environmental Sciences
University of Koblenz-Landau
Fortstraße 7
76829 Landau
Germany
Phone: + 49 6341 280-31553
Office: Building I, Room 2.02

___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user


--
Dr. Mira Kattwinkel
Quantitative Landscape Ecology
Institute for Environmental Sciences
University of Koblenz-Landau
Fortstraße 7
76829 Landau
Germany
Phone: + 49 6341 280-31553
Office: Building I, Room 2.02

___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

Re: [GRASS-user] Temporal framework: calculating annual 5-day extremes

2017-04-06 Thread RichardCooper
I have a time series of rainfall data, and for each year I want to calculate
the five-day period with maximum rainfall. So I would need to calculate the
sum of day1 to day5, then day2 to day6, then day3 to day7 etc for the whole
year, and then output the maximum grid cell 5-day values for each year into
a single raster.

To do this in t.rast.accumulate, I can see how to set a temporal cycle of 1
year (cycle= "12 months"), but not sure how to specify such a rolling sum
calculation of 5 days as described above. The default method is the 'mean'
as indicated in r.series.accumulation? I'm not too sure how the accumulation
is applied in the module.

Best regards,
Richard



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Temporal-framework-calculating-annual-5-day-extremes-tp5316014p5316076.html
Sent from the Grass - Users mailing list archive at Nabble.com.
___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

Re: [GRASS-user] Temporal framework: calculating annual 5-day extremes

2017-04-06 Thread Sören Gebbert
Hi,
i am not sure if i understand the problem correctly. However, you can use
t.rast.accumulate [1] to create the rolling sum for an arbitrary interval
(5 days, one year?) and then use t.rast.aggregate
to compute the yearly maximum value time series based on the time series
output of t.rast.accumulate.

Or you can use t.rast.aggregate two time, first to compute the 5 day
aggregation (sum of all values in 5 day interval) and then use
t.rast.aggregate to compute the yearly maximums on the output of the first
operation.

Best regards
Soeren

[1] https://grass.osgeo.org/grass72/manuals/t.rast.accumulate.html

Am 06.04.2017 06:31 schrieb "RichardCooper" :

> Hi,
>
> I have a data set containing multiple years of daily raster layers and
> would
> like to aggregate and output annual raster layers of 5-day extremes
> (maxima).
>
> Essentially, for each grid cell, I need to calculate rolling 5-day sums of
> each year and then find the annual max of the latter sums, and output as a
> series of raster layers of annual 5-day extremes.
>
> However, I'm trying to work out the best way in GRASS of doing this.
> Overall
> t.rast.aggregate comes closest to the type of functionality needed. I've
> also looked at t.rast3d.mapcalc, but unsure if calculating a rolling sum is
> possible.
>
> I'd be grateful for any suggestions on how I might approach this.
>
> Thanks,
>
> Richard
>
>
>
> --
> View this message in context: http://osgeo-org.1560.x6.nabbl
> e.com/Temporal-framework-calculating-annual-5-day-extremes-tp5316014.html
> Sent from the Grass - Users mailing list archive at Nabble.com.
> ___
> grass-user mailing list
> grass-user@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/grass-user
___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

Re: [GRASS-user] Temporal framework: calculating annual 5-day extremes

2017-04-06 Thread Sitansu Pattnaik
r.series for the computation and g.mlist for selecting the rasters is how I
have used in the past.
Sitansu

On Thu, Apr 6, 2017 at 10:01 AM, RichardCooper 
wrote:

> Hi,
>
> I have a data set containing multiple years of daily raster layers and
> would
> like to aggregate and output annual raster layers of 5-day extremes
> (maxima).
>
> Essentially, for each grid cell, I need to calculate rolling 5-day sums of
> each year and then find the annual max of the latter sums, and output as a
> series of raster layers of annual 5-day extremes.
>
> However, I'm trying to work out the best way in GRASS of doing this.
> Overall
> t.rast.aggregate comes closest to the type of functionality needed. I've
> also looked at t.rast3d.mapcalc, but unsure if calculating a rolling sum is
> possible.
>
> I'd be grateful for any suggestions on how I might approach this.
>
> Thanks,
>
> Richard
>
>
>
> --
> View this message in context: http://osgeo-org.1560.x6.
> nabble.com/Temporal-framework-calculating-annual-5-day-
> extremes-tp5316014.html
> Sent from the Grass - Users mailing list archive at Nabble.com.
> ___
> grass-user mailing list
> grass-user@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/grass-user
___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user