[GRASS-dev] [Temporal] Access a temporal dataset from another mapset

Hello all,

I have several STRDS of rainfall covering a whole country, in a
specific mapset dedicated to rainfall data.
I'd like to run some hydraulic simulations in different regions of the
country, that output several STRDS as results.
For the sake of organizing the data, every study area has its own mapset.
The hydraulic model calls the STRDS from the other mapset return an error:

[...]
  File "/home/jrodriguezri/.local/lib/python2.7/site-packages/itzi/gis.py",
line 138, in name_is_stds
    if tgis.SpaceTimeRasterDataset(name).is_in_db():
  File "/usr/lib/grass70/etc/python/grass/temporal/abstract_dataset.py",
line 370, in is_in_db
    return self.base.is_in_db(dbif)
  File "/usr/lib/grass70/etc/python/grass/temporal/base.py", line 314,
in is_in_db
    dbif.execute(sql, mapset=self.mapset)
  File "/usr/lib/grass70/etc/python/grass/temporal/core.py", line 956,
in execute
    "mapset <%(mapset)s>" % {"mapset": mapset}))
  File "/usr/lib/grass70/etc/python/grass/pygrass/messages/__init__.py",
line 269, in fatal
    raise FatalError(message)
grass.exceptions.FatalError: Unable to execute sql statement. There is
no temporal database connection defined for mapset <Lluvia>

I realize that if I try to open a strds from another mapset with
t.rst.list, I get a similar error:

ERROR: Unable to execute sql statement. There is no temporal database
connection defined for mapset

Searching for an open ticket about it, I encounter #2110 which seems
related, but it's quite old and it seems in the discussion that a
STRDS should behave like a map, which could be open from another
mapset.

Is it a normal behaviour, and if it's the case, what is the workaround?

Cheers,
Laurent

Hello Laurent,

AFAIK, you can access STRDS stored in other mapsets as long as those mapsets are in the search path (check with g.mapsets -p). If I’m in a certain mapset and I do:

t.rast.list some_strds@other_mapset

it lists the maps as expected… However, the error I get if I try to list maps in a STRDS that is in a mapset not in the search path, is different from yours. I get the following:

ERROR: Unable to execute sql statement. You have no permission to access
mapset <rrs_667>, or mapset <rrs_667> has no temporal database. Accessable
mapsets are: <clorofila,pruebas>

The error you get in both cases appears to be related to the database connection. I guess you run t.connect in those mapsets, right? What is the output of t.connect -p??

IIUC, the ticket you mention #2110 [0] is related to registering maps from one mapset in a STRDS of some other mapset, that is not allowed unless you change the database connection of each mapset to point to a single one (See Soeren’s explanation in ML: https://lists.osgeo.org/pipermail/grass-user/2016-April/074079.html). However, I don’t think that’s what you need, since, again IIUC, you would only need to access those STDRS in different mapsets but you would NOT need to register those same maps in a different STDRS in a different mapset, would you?

Also, what version of grass you use and under which system? (here, i have freshly compiled grass73 in Linux)

HTH,
Vero

[0] https://trac.osgeo.org/grass/ticket/2110

···

2016-08-05 18:38 GMT-03:00 Laurent C. <lrntct@gmail.com>:

Hello all,

I have several STRDS of rainfall covering a whole country, in a
specific mapset dedicated to rainfall data.
I’d like to run some hydraulic simulations in different regions of the
country, that output several STRDS as results.
For the sake of organizing the data, every study area has its own mapset.
The hydraulic model calls the STRDS from the other mapset return an error:

[...]
File "/home/jrodriguezri/.local/lib/python2.7/site-packages/itzi/gis.py",
line 138, in name_is_stds
if tgis.SpaceTimeRasterDataset(name).is_in_db():
File "/usr/lib/grass70/etc/python/grass/temporal/abstract_dataset.py",
line 370, in is_in_db
return self.base.is_in_db(dbif)
File "/usr/lib/grass70/etc/python/grass/temporal/base.py", line 314,
in is_in_db
dbif.execute(sql, mapset=self.mapset)
File "/usr/lib/grass70/etc/python/grass/temporal/core.py", line 956,
in execute
"mapset <%(mapset)s>" % {"mapset": mapset}))
File "/usr/lib/grass70/etc/python/grass/pygrass/messages/__init__.py",
line 269, in fatal
raise FatalError(message)
grass.exceptions.FatalError: Unable to execute sql statement. There is
no temporal database connection defined for mapset <Lluvia>

I realize that if I try to open a strds from another mapset with
t.rst.list, I get a similar error:

ERROR: Unable to execute sql statement. There is no temporal database
connection defined for mapset

Searching for an open ticket about it, I encounter #2110 which seems
related, but it’s quite old and it seems in the discussion that a
STRDS should behave like a map, which could be open from another
mapset.

Is it a normal behaviour, and if it’s the case, what is the workaround?

Cheers,
Laurent


grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Hello Veronica,

Thanks for your answer. Here is my version, under Ubuntu 16.4:

$ g.version -b
GRASS 7.0.4 (2016)
./configure --build=x86_64-linux-gnu --prefix=/usr
'--includedir=${prefix}/include' '--mandir=${prefix}/share/man'
'--infodir=${prefix}/share/info' --sysconfdir=/etc
--localstatedir=/var --disable-silent-rules
'--libdir=${prefix}/lib/x86_64-linux-gnu'
'--libexecdir=${prefix}/lib/x86_64-linux-gnu'
--disable-maintainer-mode --disable-dependency-tracking
--prefix=/usr/lib --enable-largefile --enable-socket --enable-shared
--with-blas --with-cairo --with-cxx --with-freetype
--with-freetype-includes=/usr/include/freetype2 --with-gdal
--with-geos --with-lapack --with-liblas=/usr/bin/liblas-config
--with-motif --with-mysql --with-mysql-includes=/usr/include/mysql
--with-netcdf --with-nls --with-odbc --with-postgres
--with-postgres-includes=/usr/include/postgresql
--with-proj-share=/usr/share/proj --with-python --with-readline
--with-sqlite --with-wxwidgets=/usr/bin/wx-config --with-x

According to g.mapset -l, the mapsets are in the search path. If I
make the mapset current, I can access the STRDS in that mapset, but
not from another mapset. I have one temporal DB for each mapset.
Below are the commands:

$ g.mapset -p
hull
$ g.mapset -l
PERMANENT hull_rain hull
$ t.rast.list radar_rain_5min@hull_rain
ERROR: Unable to execute sql statement. There is no temporal database
connection defined for mapset <hull_rain>
$ g.mapset mapset=hull_rain
$ g.mapset -p
hull_rain
$ t.rast.list radar_rain_5min@hull_rain
name|mapset|start_time|end_time
radar_rain_5min_0000|hull_rain|2007-06-24 00:00:00|None
radar_rain_5min_0001|hull_rain|2007-06-24 00:05:00|None
[...]
radar_rain_5min_0575|hull_rain|2007-06-25 23:55:00|None
$ t.connect -p
driver:sqlite
database:$GISDBASE/$LOCATION_NAME/$MAPSET/tgis/sqlite.db

Thanks again for your help.

Cheers,
Laurent

2016-08-05 18:10 GMT-05:00 Veronica Andreo <veroandreo@gmail.com>:

Hello Laurent,

AFAIK, you can access STRDS stored in other mapsets as long as those mapsets
are in the search path (check with g.mapsets -p). If I'm in a certain mapset
and I do:

t.rast.list some_strds@other_mapset

it lists the maps as expected... However, the error I get if I try to list
maps in a STRDS that is in a mapset not in the search path, is different
from yours. I get the following:

ERROR: Unable to execute sql statement. You have no permission to access
mapset <rrs_667>, or mapset <rrs_667> has no temporal database. Accessable
mapsets are: <clorofila,pruebas>

The error you get in both cases appears to be related to the database
connection. I guess you run t.connect in those mapsets, right? What is the
output of t.connect -p??

IIUC, the ticket you mention #2110 [0] is related to registering maps from
one mapset in a STRDS of some other mapset, that is not allowed unless you
change the database connection of each mapset to point to a single one (See
Soeren's explanation in ML:
https://lists.osgeo.org/pipermail/grass-user/2016-April/074079.html).
However, I don't think that's what you need, since, again IIUC, you would
only need to access those STDRS in different mapsets but you would NOT need
to register those same maps in a different STDRS in a different mapset,
would you?

Also, what version of grass you use and under which system? (here, i have
freshly compiled grass73 in Linux)

HTH,
Vero

[0] https://trac.osgeo.org/grass/ticket/2110

2016-08-05 18:38 GMT-03:00 Laurent C. <lrntct@gmail.com>:

Hello all,

I have several STRDS of rainfall covering a whole country, in a
specific mapset dedicated to rainfall data.
I'd like to run some hydraulic simulations in different regions of the
country, that output several STRDS as results.
For the sake of organizing the data, every study area has its own mapset.
The hydraulic model calls the STRDS from the other mapset return an error:

[...]
  File
"/home/jrodriguezri/.local/lib/python2.7/site-packages/itzi/gis.py",
line 138, in name_is_stds
    if tgis.SpaceTimeRasterDataset(name).is_in_db():
  File "/usr/lib/grass70/etc/python/grass/temporal/abstract_dataset.py",
line 370, in is_in_db
    return self.base.is_in_db(dbif)
  File "/usr/lib/grass70/etc/python/grass/temporal/base.py", line 314,
in is_in_db
    dbif.execute(sql, mapset=self.mapset)
  File "/usr/lib/grass70/etc/python/grass/temporal/core.py", line 956,
in execute
    "mapset <%(mapset)s>" % {"mapset": mapset}))
  File "/usr/lib/grass70/etc/python/grass/pygrass/messages/__init__.py",
line 269, in fatal
    raise FatalError(message)
grass.exceptions.FatalError: Unable to execute sql statement. There is
no temporal database connection defined for mapset <Lluvia>

I realize that if I try to open a strds from another mapset with
t.rst.list, I get a similar error:

ERROR: Unable to execute sql statement. There is no temporal database
connection defined for mapset

Searching for an open ticket about it, I encounter #2110 which seems
related, but it's quite old and it seems in the discussion that a
STRDS should behave like a map, which could be open from another
mapset.

Is it a normal behaviour, and if it's the case, what is the workaround?

Cheers,
Laurent
_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Hello Laurent,

···

2016-08-08 12:13 GMT-03:00 Laurent C. <lrntct@gmail.com>:

Hello Veronica,

Thanks for your answer. Here is my version, under Ubuntu 16.4:

$ g.version -b
GRASS 7.0.4 (2016)

grass 7.0.4 should be fine, the change was introduced last year…

According to g.mapset -l, the mapsets are in the search path.

g.mapset -l
will only list available mapsets, but that does not mean they are accesible

If I
make the mapset current, I can access the STRDS in that mapset, but
not from another mapset. I have one temporal DB for each mapset.
Below are the commands:

$ g.mapset -p
hull

here you are just printing the current mapset

$ g.mapset -l
PERMANENT hull_rain hull

and here listing the available mapsets

You need to do:

g.mapsets -p mapset=hull_rain,PERMANENT operation=add

to indeed add the mapset to the search path and make it accessible from other mapset

That should be it :slight_smile:
Let me know

Best,
Vero

2016-08-08 10:24 GMT-05:00 Veronica Andreo <veroandreo@gmail.com>:

Hello Laurent,

2016-08-08 12:13 GMT-03:00 Laurent C. <lrntct@gmail.com>:

Hello Veronica,

Thanks for your answer. Here is my version, under Ubuntu 16.4:

$ g.version -b
GRASS 7.0.4 (2016)

grass 7.0.4 should be fine, the change was introduced last year...

According to g.mapset -l, the mapsets are in the search path.

g.mapset -l
will only list available mapsets, but that does not mean they are accesible

If I
make the mapset current, I can access the STRDS in that mapset, but
not from another mapset. I have one temporal DB for each mapset.
Below are the commands:

$ g.mapset -p
hull

here you are just printing the current mapset

$ g.mapset -l
PERMANENT hull_rain hull

and here listing the available mapsets

You need to do:

g.mapsets -p mapset=hull_rain,PERMANENT operation=add

to indeed add the mapset to the search path and make it accessible from
other mapset

Ok, I did not see it was g.mapsetS, I did not know this command.
It works now. Thanks a lot Veronica!
And sorry for the noise on dev list.

Regards,
Laurent