[GRASS-user] r.hazard.flood does not respect region settings?
Margherita Di Leo
diregola at gmail.com
Mon Apr 21 07:33:19 PDT 2014
Hi,
sorry for late answer, I had overlooked this email
On Fri, Mar 7, 2014 at 7:30 AM, Hamish <hamish_b at yahoo.com> wrote:
> maning wrote:
>
> > I'm testing r.hazard.flood and noticed that it computes the flood and
> > mti layers on the full region of the elevation raster instead of the
> > pre-defined region settings.
> >
> > The relvant code I found from the r.hazard.flood is this:
> > # Detect cellsize of the DEM
> > info_region = grass.read_command('g.region', flags = 'p',
> > rast =
> > '%s' % (r_elevation))
> > dict_region = grass.parse_key_val(info_region, ':')
> > resolution = (float(dict_region['nsres']) +
> > float(dict_region['ewres']))/2
> > grass.message("Cellsize : %s " % resolution)
> >
> > Would it be possible to either respect the current region settings or
> > add a flag to choose between the dem region settings or current region
> > settings?
>
>
> if it needs to detect the original raster cell resolution (usually that's
> only needed to avoid aliasing artifacts in certain situations) it should
> use r.info to get the answer. I'm guessing due to the averaging of the ew
> and ns resolutions avoiding aliasing isn't the case.
>
> if a module wants to change the region (and almost none should ever do
> that except for g.region by itself) it should set up a temporary
> WIND_OVERRIDE first, in the case of python scripting there is an easy grass
> python function to make that and clean it up at the end. (otherwise
> parallel jobs get their regions messed up mid-run, and region changes
> without you expecting it will)
>
> I suspect grass.raster's raster_info() is the better way for
> r.hazard.flood to do what it's trying to do now. But also just querying the
> current g.region info without changing anything is probably even better, as
> that is what the other raster commands will expect to use. If the user
> should align perfectly with the input map first, it should be noted in the
> help page for them to do it manually before running the module.
>
Thanks for suggestion, applied in r59879
Cheers,
madi
--
Best regards,
Dr. Margherita DI LEO
Scientific / technical project officer
European Commission - DG JRC
Institute for Environment and Sustainability (IES)
Via Fermi, 2749
I-21027 Ispra (VA) - Italy - TP 261
Tel. +39 0332 78 3600
margherita.di-leo at jrc.ec.europa.eu
Disclaimer: The views expressed are purely those of the writer and may not
in any circumstance be regarded as stating an official position of the
European Commission.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20140421/31633587/attachment.html>
More information about the grass-user
mailing list