[GRASS-dev] gunittest test temporal dataset

Stefan Blumentrath Stefan.Blumentrath at gmx.de
Mon Mar 27 07:01:29 PDT 2023


Hi again,

 
Looking at my example I see that there is in fact a possibility to check existence of an STDS without t.list. See:
https://github.com/NVE/actinia_modules_nve/blob/036a4c85664a9015d5ca13ed6f40bdcc79bbfcb2/src/temporal/t.rast.reclass/t.rast.reclass.py#L294-L316
 
You could basically do:
 
import grass.temporal as tgis
# Initialize TGIS
tgis.init()
# Connect to TGIS DB
dbif = tgis.SQLDatabaseInterfaceConnection()
dbif.connect()

output_strds = tgis.factory.dataset_factory("strds", "MY_STRDS_NAME")
output_strds_exists = output_strds.is_in_db(dbif)
assertTrue(output_strds_exists)
 
Maybe worth considering to add a method for that in the unittest module!?!
 
Cheers,
Stefan
 
 

Gesendet: Montag, 27. März 2023 um 14:15 Uhr
Von: "Luca Delucchi" <lucadeluge at gmail.com>
An: "Stefan Blumentrath" <Stefan.Blumentrath at gmx.de>
Cc: "GRASS-dev" <grass-dev at lists.osgeo.org>
Betreff: Re: [GRASS-dev] gunittest test temporal dataset

 

Il lun 27 mar 2023, 13:21 Stefan Blumentrath <Stefan.Blumentrath at gmx.de[mailto:Stefan.Blumentrath at gmx.de]> ha scritto:

Hi Luca,
 
Hi Stefan,

 
Not that I am aware of. I use to parse output from t.list to check if a STDS exists...
 
Yes this was my idea too. Do you have an example?

 
Cheers
Stefan
 
 
Cheers
Luca

 


More information about the grass-dev mailing list