[GRASS-dev] Re: [GRASS GIS] #1161: g.region and r.info decimal issue when using grass python libs

Isaac Ullah isaac.ullah at asu.edu
Sun Oct 3 21:38:44 EDT 2010


Okay, this all is starting to make sense. I was not aware of the "funnyness"
in Python when it comes to decimals. Although it would be quite possible for
the scripter to turn everything into strings before doing comparisons, I
wonder if the best solution is to add a "string" option to those python
grass libs that return output as dictionaries/lists. If one does not invoke
this new option, dictionary/list items are "numbers" in whatever precision
they come out as, but if one does invoke it, dictionary/list items are
strings. In any case, this behavior should be added as a note in the grass
python scripts description pages.

Cheers,

Isaac Ullah

On Sun, Oct 3, 2010 at 6:18 PM, GRASS GIS <trac at osgeo.org> wrote:

> #1161: g.region and r.info decimal issue when using grass python libs
>
> -------------------------+--------------------------------------------------
>  Reporter:  isaacullah  |       Owner:  grass-dev@…
>      Type:  defect      |      Status:  closed
>  Priority:  normal      |   Milestone:  6.4.1
>  Component:  Python      |     Version:  6.4.0
> Resolution:  invalid     |    Keywords:  g.region, precision
>  Platform:  All         |         Cpu:  All
>
> -------------------------+--------------------------------------------------
> Changes (by hamish):
>
>  * keywords:  => g.region, precision
>
>
> Comment:
>
>  Replying to [comment:8 hamish]:
>  > I guess what I find weird is that g.region will never report
>  > with precision > .15g, which is exactly representable
>
>  well, no, as in the "5.1" example. but reproducible anyhow..
>
>  > & will never saturate the double-prec bitspace, and so the python
>  > repr() example above is perhaps using %.16f internally?
>
>  anyway, if it matters python's "print" gives it back to you in the form
>  you were expecting,
>
>  {{{
>  >>> n = 4293588.60267
>  >>> n
>  4293588.6026699999
>  >>> print n
>  4293588.60267
>  }}}
>
>
>  Hamish
>
>  ps- do you mind if I move LandDyn/ in addons svn to raster/LandDyn?
>
> --
> Ticket URL: <https://trac.osgeo.org/grass/ticket/1161#comment:10>
> GRASS GIS <http://grass.osgeo.org>
>
>


-- 
Isaac I Ullah, M.A.

Archaeology PhD Candidate,
ASU School of Evolution and Social Change

Research Assistant,
Mediterranean Landscape Dynamics Project
***************************************************
isaac.ullah at asu.edu
ullah at archaeologist.com

http://www.public.asu.edu/~iullah
***************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-dev/attachments/20101003/56b2f287/attachment.html


More information about the grass-dev mailing list