r.hazard.flood extension

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

r.hazard.flood extension

Lara DC
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 <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  

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
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: r.hazard.flood extension

margherita
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 <[hidden email]> 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 <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  

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
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user


--
Margherita Di Leo

_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: r.hazard.flood extension

Lara DC
Thanks Margherita ! you were right!

Kind regards, 

Lara

El vie., 24 de may. de 2019 a la(s) 10:48, Margherita Di Leo ([hidden email]) 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 <[hidden email]> 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 <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  

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
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user


--
Margherita Di Leo

_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: r.hazard.flood extension

Martin Landa
In reply to this post by margherita
Hi,

pá 24. 5. 2019 v 15:48 odesílatel Margherita Di Leo <[hidden email]> 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
_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: r.hazard.flood extension

Markus Neteler
On Fri, May 24, 2019 at 6:36 PM Martin Landa <[hidden email]> wrote:
>
> Hi,
>
> pá 24. 5. 2019 v 15:48 odesílatel Margherita Di Leo <[hidden email]> 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
_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: r.hazard.flood extension

margherita


On Fri, Jun 7, 2019 at 12:16 AM Markus Neteler <[hidden email]> wrote:
On Fri, May 24, 2019 at 6:36 PM Martin Landa <[hidden email]> wrote:
>
> Hi,
>
> pá 24. 5. 2019 v 15:48 odesílatel Margherita Di Leo <[hidden email]> 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 <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

Thank you Markus.

Cheers,


--
Margherita Di Leo

_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: r.hazard.flood extension

Markus Metz-3


On Fri, Jun 7, 2019 at 10:44 AM Margherita Di Leo <[hidden email]> wrote:

>
>
>
> On Fri, Jun 7, 2019 at 12:16 AM Markus Neteler <[hidden email]> wrote:
>>
>> On Fri, May 24, 2019 at 6:36 PM Martin Landa <[hidden email]> wrote:
>> >
>> > Hi,
>> >
>> > pá 24. 5. 2019 v 15:48 odesílatel Margherita Di Leo <[hidden email]> 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 <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
>
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


_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user