[GRASS-user] r.clip ... not clipping

On Wed, 15 Aug 2018, Vaclav Petras wrote:

See r.clip module in addons for equivalent of v.clip:
https://grass.osgeo.org/grass74/manuals/addons/r.clip.html

Vaclav,

   r.clip is not working for me. I have a 13G DEM that I need to cut down to
a more reasonable size. I set the region to a vector map of the county
boundary then run

r.clip in=dem_west out=dem_left

About 29 minutes later I see that the output file is the same size and
coverage as the input file. Doesn't matter if I use the '-r' option to
r.clip.

   What am I missing?

Rich

On Thu, 16 Aug 2018, Rich Shepard wrote:

r.clip is not working for me. I have a 13G DEM that I need to cut down to
a more reasonable size. I set the region to a vector map of the county
boundary then run

r.clip in=dem_west out=dem_left

Vaclav,

   Does the attached screenshot correctly show results of the above command?
Reading the manual page I thought that all cells outside the red boundary
would be eliminated.

Rich

(attachments)

screenshot.png

Rich Shepard wrote

On Wed, 15 Aug 2018, Vaclav Petras wrote:

See r.clip module in addons for equivalent of v.clip:
https://grass.osgeo.org/grass74/manuals/addons/r.clip.html

Vaclav,

   r.clip is not working for me. I have a 13G DEM that I need to cut down
to
a more reasonable size. I set the region to a vector map of the county
boundary then run

r.clip in=dem_west out=dem_left

About 29 minutes later I see that the output file is the same size and
coverage as the input file. Doesn't matter if I use the '-r' option to
r.clip.

   What am I missing?

when you're not sure if a command/module is working as expected, it's always
good to try the example with the NC sample data set mentioned in the
manuals.

th manual's example works here, see screenshot:
raster_clip.jpg
<http://osgeo-org.1560.x6.nabble.com/file/t193444/raster_clip.jpg&gt;

without the commands you used (g.region, r.clip, etc), it's hard to find out
what is missing.

-----
best regards
Helmut
--
Sent from: http://osgeo-org.1560.x6.nabble.com/Grass-Users-f3884509.html

* Helmut Kudrnovsky <hellik@web.de> [2018-08-17 00:18:01 -0700]:

Rich Shepard wrote

On Wed, 15 Aug 2018, Vaclav Petras wrote:

See r.clip module in addons for equivalent of v.clip:
https://grass.osgeo.org/grass74/manuals/addons/r.clip.html

Vaclav,

   r.clip is not working for me. I have a 13G DEM that I need to cut down
to
a more reasonable size. I set the region to a vector map of the county
boundary then run

r.clip in=dem_west out=dem_left

About 29 minutes later I see that the output file is the same size and
coverage as the input file. Doesn't matter if I use the '-r' option to
r.clip.

   What am I missing?

when you're not sure if a command/module is working as expected, it's always
good to try the example with the NC sample data set mentioned in the
manuals.

th manual's example works here, see screenshot:
raster_clip.jpg
<http://osgeo-org.1560.x6.nabble.com/file/t193444/raster_clip.jpg&gt;

without the commands you used (g.region, r.clip, etc), it's hard to find out
what is missing.

@Rich,

compare `r.info -g dem_west` with `g.region -g`, after you have set the
region to the desired extent, of course. They should be different. And,
then, `r.info -g dem_left` should match the current extent (`g.region
-g`).

Nikos

On Thu, 16 Aug 2018, Rich Shepard wrote:

Does the attached screenshot correctly show results of the above command?
Reading the manual page I thought that all cells outside the red boundary
would be eliminated.

   Mea culpa! Yes, r.clip works as it should; it was my expectation based on
r.mask that resulted in my confusion.

   r.clip clips to a rectangular region. When I set the region on an
irregular polygon border for a vector file I was thinking in terms of v.clip
where the input file is clipped to the irregular polygon boundary of the
clipping file. r.clip ignores the polygon boundary since the region covers
the rectangle in which the polygon is located. So, while I know I can mask a
raster to the boundary of an irregular polygon I cannot clip the raster
grids to that same boundary.

   Perhaps some time in the future the r.clip behavior can parallel that of
r.mask so a named vector map would be the clipping boundary.

Regards,

Rich