Opened 6 years ago

Last modified 5 years ago

#3828 new enhancement

pygrass.gis.Region.from_* should raise a ValueError if the specified map does not exist.

Reported by: pmav99 Owned by: grass-dev@…
Priority: normal Milestone: 7.8.3
Component: PyGRASS Version: svn-trunk
Keywords: Cc:
CPU: Unspecified Platform: Unspecified

Description

I think it would be better if

pygrass.gis.Region.from_rast(raster_name)
pygrass.gis.Region.from_vect(vector_name)

would raise a ValueError if the specified map name cannot be found. With the current implementation, the region remains unchanged and you have no clue about that: https://grass.osgeo.org/grass77/manuals/libpython/_modules/pygrass/gis/region.html#Region.from_rast

Note, it might make sense to raise the Exception from within get_mapset_raster() but that function is used in more places and I haven't checked if this will break anything.

Change History (2)

comment:1 by neteler, 6 years ago

A patch would be appreciated.

comment:2 by neteler, 5 years ago

Milestone: 7.8.3
Note: See TracTickets for help on using tickets.