[GRASS-dev] problem initializing temporal gis

Hi everybody,

if I run python inside a GRASS session and after try to connect to the
database I obtain an error

import grass.temporal as tgis
dbif = tgis.SQLDatabaseInterfaceConnection()

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/lucadelu/compilati/grass_trunk/dist.x86_64-unknown-linux-gnu/etc/python/grass/temporal/core.py",
line 786, in __init__
    self.msgr.debug(1, "SQLDatabaseInterfaceConnection constructor")
AttributeError: 'NoneType' object has no attribute 'debug'

If I run the same code in a script I didn't obtain any error, some
advice to solve the problem?

--
ciao
Luca

http://gis.cri.fmach.it/delucchi/
www.lucadelu.org

Hi Luca,
please call

tgis.init()

before any temporal operation is performed.

Best regards
Soeren

2014-06-24 10:51 GMT+02:00 Luca Delucchi <lucadeluge@gmail.com>:

Hi everybody,

if I run python inside a GRASS session and after try to connect to the
database I obtain an error

import grass.temporal as tgis
dbif = tgis.SQLDatabaseInterfaceConnection()

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/lucadelu/compilati/grass_trunk/dist.x86_64-unknown-linux-gnu/etc/python/grass/temporal/core.py",
line 786, in __init__
    self.msgr.debug(1, "SQLDatabaseInterfaceConnection constructor")
AttributeError: 'NoneType' object has no attribute 'debug'

If I run the same code in a script I didn't obtain any error, some
advice to solve the problem?

--
ciao
Luca

http://gis.cri.fmach.it/delucchi/
www.lucadelu.org
_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

On 24 June 2014 13:05, Sören Gebbert <soerengebbert@googlemail.com> wrote:

Hi Luca,
please call

tgis.init()

before any temporal operation is performed.

thanks it fix the problem.

Is any information about the unit of values of temporal dataset (as
millimeter for precipitation or Celsius for temperature) ?

Best regards
Soeren

--
ciao
Luca

http://gis.cri.fmach.it/delucchi/
www.lucadelu.org

Hi Luca,
there is no dedicated field for unit specification. You can use the
description, or maybe better, the semantic field in the base
information object:

{{{

import grass.temporal as tgis
tgis.init()
stds = tgis.SpaceTimeRasterDataset("a@PERMANENT")
stds.base.set_semantic_type("unit:degree celsius")
stds.base.get_semantic_type()

'unit:degree celsius'
}}}

Best regards
Soeren

2014-06-24 16:32 GMT+02:00 Luca Delucchi <lucadeluge@gmail.com>:

On 24 June 2014 13:05, Sören Gebbert <soerengebbert@googlemail.com> wrote:

Hi Luca,
please call

tgis.init()

before any temporal operation is performed.

thanks it fix the problem.

Is any information about the unit of values of temporal dataset (as
millimeter for precipitation or Celsius for temperature) ?

Best regards
Soeren

--
ciao
Luca

http://gis.cri.fmach.it/delucchi/
www.lucadelu.org

On 24 June 2014 17:10, Sören Gebbert <soerengebbert@googlemail.com> wrote:

Hi Luca,

Hi Soeren,

there is no dedicated field for unit specification. You can use the
description, or maybe better, the semantic field in the base
information object:

{{{

import grass.temporal as tgis
tgis.init()
stds = tgis.SpaceTimeRasterDataset("a@PERMANENT")
stds.base.set_semantic_type("unit:degree celsius")
stds.base.get_semantic_type()

'unit:degree celsius'
}}}

ok thanks,
do you think could be possible to add a field for unit in future?

Best regards
Soeren

--
ciao
Luca

http://gis.cri.fmach.it/delucchi/
www.lucadelu.org

Hi Luca,

2014-06-27 15:08 GMT+02:00 Luca Delucchi <lucadeluge@gmail.com>:

On 24 June 2014 17:10, Sören Gebbert <soerengebbert@googlemail.com> wrote:

Hi Luca,

Hi Soeren,

there is no dedicated field for unit specification. You can use the
description, or maybe better, the semantic field in the base
information object:

{{{

import grass.temporal as tgis
tgis.init()
stds = tgis.SpaceTimeRasterDataset("a@PERMANENT")
stds.base.set_semantic_type("unit:degree celsius")
stds.base.get_semantic_type()

'unit:degree celsius'
}}}

ok thanks,
do you think could be possible to add a field for unit in future?

Yes, it is possible to add any amount of fields in the future. Older
databases must then be updated to support the new fields, otherwise
the updated framework will not work with them.

However, a specific unit field that can be set by the user will
conflict with the unit field of raster and voxel maps. IMHO the unit
of a space time raster dataset should be derived from the units of the
registered raster maps. Well i did not implemented this, since from my
experience are units used very seldom for maps. So the correct
implementation would add a units fields to raster and 3d raster map
tables and to STRDS and STR3DS tables. The STDS SQL code must be
updated to aggregate the unit information. But what to do if map layer
have different units? Or if only a subset of the registered maps have
units?

So maybe the semantic type option is sufficient right now?

Best regards
Soeren

Best regards
Soeren

--
ciao
Luca

http://gis.cri.fmach.it/delucchi/
www.lucadelu.org

On 28 June 2014 12:32, Sören Gebbert <soerengebbert@googlemail.com> wrote:

Hi Luca,

Hi Soeren,

Yes, it is possible to add any amount of fields in the future. Older
databases must then be updated to support the new fields, otherwise
the updated framework will not work with them.

ok, so maybe it is better to collect idea and change only few times,
do you think I should open a ticket?

However, a specific unit field that can be set by the user will
conflict with the unit field of raster and voxel maps. IMHO the unit
of a space time raster dataset should be derived from the units of the
registered raster maps. Well i did not implemented this, since from my
experience are units used very seldom for maps. So the correct
implementation would add a units fields to raster and 3d raster map
tables and to STRDS and STR3DS tables. The STDS SQL code must be
updated to aggregate the unit information. But what to do if map layer
have different units? Or if only a subset of the registered maps have
units?

In r.support there is units field, could we use this?
Can you do some example of map layer with different units?

So maybe the semantic type option is sufficient right now?

But it accept only min, max, sum, mean value?

Best regards
Soeren

--
ciao
Luca

http://gis.cri.fmach.it/delucchi/
www.lucadelu.org