[GRASS-dev] Temporal GIS: best practice to access a map at a specific time?
lucadeluge at gmail.com
Wed Jul 29 12:31:18 PDT 2015
On 22 May 2015 at 22:54, Laurent C. <lrntct at gmail.com> wrote:
> Hi all,
I try to answer to your question
> I'm working on a python module which compute superficial flows using
> simplified shallow water equations. It already works quite well and export
> results as temporal data sets.
> But I'd like to add the possibility to work with temporal data sets as input
> (typically rainfall or other input flows).
> I've looked at the documentation of the temporal module, but I haven't
> figure out what would be the best way to access a strds at a specified time.
> There might be something with get_registered_maps, but I don't know how to
> select the map when the simulation time is between 'start-time' and
> 'end-time'. I don't know is SQL would be of any help here.
to get the registered maps for a period you can use t.rast.list using
the where option like "where=start-time>'2001-01-01 12:30:00' and
end-time<='2001-01-01 13:30:00' " or using the python function
tgis.list_maps_of_stds("strds", input, columns, order, where,
separator, method, header, granule)
> currently my program looks like this:
> load grass maps as numpy arrays
> while not sim_clock >= sim_duration:
> calculate time-step duration
> calculate flow and water depth
> write results
> register produced maps in space-time dataset
> I was thinking of checking at the beginning of the while loop if there is
> the current input map is still valid for the current time-step, and ielse
> loading the new one. Does this approach make sense and how could I do that?
If I understand well your question, yes it should
> Thanks for your time.
More information about the grass-dev