[GRASS-user] r.hazard.flood extension

Dear users
I am new with Grass. I am trying to use the r.hazard.flood extension but I get the following error:

Traceback (most recent call last):

File “/home/lara/.grass7/addons/scripts/r.hazard.flood”, line 145, in
sys.exit(main())
File “/home/lara/.grass7/addons/scripts/r.hazard.flood”, line 78, in main
resolution = (float(dict_region[‘nsres’]) + float(dict_region[‘ewres’]))/2
ValueError: invalid literal for float(): 0:00:00.17656

Any idea of what can be wrong? my dem file (named fmosaic) is type raster, FCELL, 5099 rows 7647 columns, resolution: 0:00:00.17656

I thougth it was probably a problem with the dem resolution (5 m) but I tried with another DEM with different resolution and get the same error warning.

Hope to solve this!

Lara

Hi Lara,

as far as I remember, it worked only in projected coordinate system.

Hope this helps,
Kind regards,

···

Margherita Di Leo

Thanks Margherita ! you were right!

Kind regards,

Lara

El vie., 24 de may. de 2019 a la(s) 10:48, Margherita Di Leo (diregola@gmail.com) escribió:

Hi Lara,

as far as I remember, it worked only in projected coordinate system.

Hope this helps,
Kind regards,

On Fri, May 24, 2019 at 3:41 PM Lara DC <dellaceca.lara@gmail.com> wrote:

Dear users
I am new with Grass. I am trying to use the r.hazard.flood extension but I get the following error:

Traceback (most recent call last):

File “/home/lara/.grass7/addons/scripts/r.hazard.flood”, line 145, in
sys.exit(main())
File “/home/lara/.grass7/addons/scripts/r.hazard.flood”, line 78, in main
resolution = (float(dict_region[‘nsres’]) + float(dict_region[‘ewres’]))/2
ValueError: invalid literal for float(): 0:00:00.17656

Any idea of what can be wrong? my dem file (named fmosaic) is type raster, FCELL, 5099 rows 7647 columns, resolution: 0:00:00.17656

I thougth it was probably a problem with the dem resolution (5 m) but I tried with another DEM with different resolution and get the same error warning.

Hope to solve this!

Lara


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

Margherita Di Leo

Hi,

pá 24. 5. 2019 v 15:48 odesílatel Margherita Di Leo <diregola@gmail.com> napsal:

as far as I remember, it worked only in projected coordinate system.

1) should be mentioned in manual at least

Traceback (most recent call last):
File "/home/lara/.grass7/addons/scripts/r.hazard.flood", line 145, in <module>
    sys.exit(main())
File "/home/lara/.grass7/addons/scripts/r.hazard.flood", line 78, in main
    resolution = (float(dict_region['nsres']) + float(dict_region['ewres']))/2
ValueError: invalid literal for float(): 0:00:00.17656

2) should faill more gracefully. LL location is not supported. Feel
free to open a ticket in trac.

Ma

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa

On Fri, May 24, 2019 at 6:36 PM Martin Landa <landa.martin@gmail.com> wrote:

Hi,

pá 24. 5. 2019 v 15:48 odesílatel Margherita Di Leo <diregola@gmail.com> napsal:
> as far as I remember, it worked only in projected coordinate system.

1) should be mentioned in manual at least

+1 - TODO

>> Traceback (most recent call last):
>> File "/home/lara/.grass7/addons/scripts/r.hazard.flood", line 145, in <module>
>> sys.exit(main())
>> File "/home/lara/.grass7/addons/scripts/r.hazard.flood", line 78, in main
>> resolution = (float(dict_region['nsres']) + float(dict_region['ewres']))/2
>> ValueError: invalid literal for float(): 0:00:00.17656

2) should faill more gracefully. LL location is not supported.

https://github.com/OSGeo/grass-addons/pull/4

Markus

Hi,

pá 24. 5. 2019 v 15:48 odesílatel Margherita Di Leo <diregola@gmail.com> napsal:

as far as I remember, it worked only in projected coordinate system.

  1. should be mentioned in manual at least

+1 - TODO

Done

Traceback (most recent call last):
File “/home/lara/.grass7/addons/scripts/r.hazard.flood”, line 145, in
sys.exit(main())
File “/home/lara/.grass7/addons/scripts/r.hazard.flood”, line 78, in main
resolution = (float(dict_region[‘nsres’]) + float(dict_region[‘ewres’]))/2
ValueError: invalid literal for float(): 0:00:00.17656

  1. should faill more gracefully. LL location is not supported.

https://github.com/OSGeo/grass-addons/pull/4

Thank you Markus.

Cheers,

···

Margherita Di Leo

On Fri, Jun 7, 2019 at 10:44 AM Margherita Di Leo <diregola@gmail.com> wrote:

On Fri, Jun 7, 2019 at 12:16 AM Markus Neteler <neteler@osgeo.org> wrote:

On Fri, May 24, 2019 at 6:36 PM Martin Landa <landa.martin@gmail.com> wrote:

Hi,

pá 24. 5. 2019 v 15:48 odesílatel Margherita Di Leo <diregola@gmail.com> napsal:

as far as I remember, it worked only in projected coordinate system.

  1. should be mentioned in manual at least

+1 - TODO

Done

Traceback (most recent call last):
File “/home/lara/.grass7/addons/scripts/r.hazard.flood”, line 145, in
sys.exit(main())
File “/home/lara/.grass7/addons/scripts/r.hazard.flood”, line 78, in main
resolution = (float(dict_region[‘nsres’]) + float(dict_region[‘ewres’]))/2
ValueError: invalid literal for float(): 0:00:00.17656

  1. should faill more gracefully. LL location is not supported.

https://github.com/OSGeo/grass-addons/pull/4

A simple solution would be
dict_region = grass.region()
instead of
info_region = grass.read_command(‘g.region’, flags = ‘p’)
dict_region = grass.parse_key_val(info_region, ‘:’)

but that does not solve the problem of resolution being in degrees. For ll, you would need to get the resolution for each raster row separately, or estimate with
r.mapcalc “ll_resolution = sqrt(area())”

which probably doesn’t make sense for higher latitudes.

Markus M