[GRASS-dev] g.parser and "#% type: double"

Given the following

--%<---
#%option
#% key: sea
#% key_desc: degrees
#% type: double
#% description: Aquisition's Sun Elevation Angle
#% options: 0.0 - 90.0
#% guisection: Metadata
#% required: yes
#%end
..
import grass.script as grass
..
def main()
     ..
     sea = options['sea']
     ..

if __name__ == "__main__":
     options, flags = grass.parser()
     sys.exit(main())
--->%--

Isn't supposed that sea is returned as a float? Is it really necessary to do

sea = float(options['sea'])

?

Grazie, Nikos

On Sat, Nov 15, 2014 at 4:19 PM, Nikos Alexandris
<nik@nikosalexandris.net> wrote:

Given the following

--%<---
#%option
#% key: sea
#% key_desc: degrees
#% type: double

... this defines what type is *accepted* as input.

#% description: Aquisition's Sun Elevation Angle
#% options: 0.0 - 90.0
#% guisection: Metadata
#% required: yes
#%end
..
import grass.script as grass
..
def main()
    ..
    sea = options['sea']
    ..

if __name__ == "__main__":
    options, flags = grass.parser()
    sys.exit(main())
--->%--

Isn't supposed that sea is returned as a float?

No, above is the definition for the accepted input type.

Is it really necessary to do

sea = float(options['sea'])

?

Yes.

Markus

Nikos Alexandris

Given the following..
#%option
#% key: sea

..

#% type: double

..

Markus Neteler wrote:

... this defines what type is *accepted* as input.

#% description: Aquisition's Sun Elevation Angle
#% options: 0.0 - 90.0
#% guisection: Metadata
#% required: yes
#%end
..
import grass.script as grass
..
def main()
    ..
    sea = options['sea']
    ..

if __name__ == "__main__":
    options, flags = grass.parser()
    sys.exit(main())
--->%--

Isn't supposed that sea is returned as a float?

No, above is the definition for the accepted input type.

Is it really necessary to do
sea = float(options['sea'])
?

Yes.

Grazie Markus.

Is it too much work to make this automatic? I am trying to think why should a user/scripter want something else than the type that the parameter (in CLI or wx-GUI) requests?

Nikos

Nikos