Skip to content

t.vect.list: Added support for JSON, YAML and CSV#7051

Open
gulshan-123 wants to merge 10 commits intoOSGeo:mainfrom
gulshan-123:json_in_t_vect_lists
Open

t.vect.list: Added support for JSON, YAML and CSV#7051
gulshan-123 wants to merge 10 commits intoOSGeo:mainfrom
gulshan-123:json_in_t_vect_lists

Conversation

@gulshan-123
Copy link
Contributor

@gulshan-123 gulshan-123 commented Feb 7, 2026

The tests and idea are taken from t.rast.list.
I have added the tests too.

plain

name|layer|mapset|start_time|end_time
precipitation_1|None|PERMANENT|2001-01-01 00:00:00|2001-02-01 00:00:00
precipitation_2|None|PERMANENT|2001-02-01 00:00:00|2001-03-01 00:00:00
precipitation_3|None|PERMANENT|2001-03-01 00:00:00|2001-04-01 00:00:00
precipitation_4|None|PERMANENT|2001-04-01 00:00:00|2001-05-01 00:00:00
precipitation_5|None|PERMANENT|2001-05-01 00:00:00|2001-06-01 00:00:00
precipitation_6|None|PERMANENT|2001-06-01 00:00:00|2001-07-01 00:00:00

json

{'data': [{'end_time': '2001-02-01 00:00:00',
           'layer': None,
           'mapset': 'PERMANENT',
           'name': 'precipitation_1',
           'start_time': '2001-01-01 00:00:00'},
          {'end_time': '2001-03-01 00:00:00',
           'layer': None,
           'mapset': 'PERMANENT',
           'name': 'precipitation_2',
           'start_time': '2001-02-01 00:00:00'},
          {'end_time': '2001-04-01 00:00:00',
           'layer': None,
           'mapset': 'PERMANENT',
           'name': 'precipitation_3',
           'start_time': '2001-03-01 00:00:00'},
          {'end_time': '2001-05-01 00:00:00',
           'layer': None,
           'mapset': 'PERMANENT',
           'name': 'precipitation_4',
           'start_time': '2001-04-01 00:00:00'},
          {'end_time': '2001-06-01 00:00:00',
           'layer': None,
           'mapset': 'PERMANENT',
           'name': 'precipitation_5',
           'start_time': '2001-05-01 00:00:00'},
          {'end_time': '2001-07-01 00:00:00',
           'layer': None,
           'mapset': 'PERMANENT',
           'name': 'precipitation_6',
           'start_time': '2001-06-01 00:00:00'}],
 'metadata': {'column_names': ['name',
                               'layer',
                               'mapset',
                               'start_time',
                               'end_time']}}

yaml

data:
  - end_time: 2001-02-01 00:00:00
    layer: null
    mapset: PERMANENT
    name: precipitation_1
    start_time: 2001-01-01 00:00:00
  - end_time: 2001-03-01 00:00:00
    layer: null
    mapset: PERMANENT
    name: precipitation_2
    start_time: 2001-02-01 00:00:00
  - end_time: 2001-04-01 00:00:00
    layer: null
    mapset: PERMANENT
    name: precipitation_3
    start_time: 2001-03-01 00:00:00
  - end_time: 2001-05-01 00:00:00
    layer: null
    mapset: PERMANENT
    name: precipitation_4
    start_time: 2001-04-01 00:00:00
  - end_time: 2001-06-01 00:00:00
    layer: null
    mapset: PERMANENT
    name: precipitation_5
    start_time: 2001-05-01 00:00:00
  - end_time: 2001-07-01 00:00:00
    layer: null
    mapset: PERMANENT
    name: precipitation_6
    start_time: 2001-06-01 00:00:00
metadata:
  column_names:
    - name
    - layer
    - mapset
    - start_time
    - end_time

CSV

"name","start_time"
"precipitation_1","2001-01-01 00:00:00"
"precipitation_2","2001-02-01 00:00:00"
"precipitation_3","2001-03-01 00:00:00"
"precipitation_4","2001-04-01 00:00:00"
"precipitation_5","2001-05-01 00:00:00"
"precipitation_6","2001-06-01 00:00:00"

@github-actions github-actions bot added temporal Related to temporal data processing Python Related code is in Python module tests Related to Test Suite labels Feb 7, 2026
@gulshan-123
Copy link
Contributor Author

gulshan-123 commented Feb 7, 2026

One thing I am sorry about :( and the motivation for this PR:

#7004 , While testing more rigorously, I found this: Currently, #7004 refactored the code to use format parameter in both t.vect.list and t.rast.list, which is not currently supported in t.vect.list. Format parameter is only supported in t.rast.list.

We missed this during review as there is no any tests related to vector time datasets in pytest of timeseriesmap_test.py , only raster dataset was being used.

Thus, my next step will be to add tests corresponding to vector space time datasets too in the pytest, so that similar error do not occur in future in timeseriesmap.

Thank You

@wenzeslaus
Copy link
Member

While we use the data-metadata split in v.db.select, is that something we want to use here where the columns are fixed? Did you use it in the other temporal tool?

@gulshan-123
Copy link
Contributor Author

Did you use it in the other temporal tool?

Yes. we are using the similar data metadata split in t.rast.list.

For t.rast.list:

{'data': [{'end_time': '2001-02-01 00:00:00',
           'mapset': 'PERMANENT',
           'name': 'precipitation_1',
           'start_time': '2001-01-01 00:00:00'},
          {'end_time': '2001-03-01 00:00:00',
           'mapset': 'PERMANENT',
           'name': 'precipitation_2',
           'start_time': '2001-02-01 00:00:00'},
          {'end_time': '2001-04-01 00:00:00',
           'mapset': 'PERMANENT',
           'name': 'precipitation_3',
           'start_time': '2001-03-01 00:00:00'},
          {'end_time': '2001-05-01 00:00:00',
           'mapset': 'PERMANENT',
           'name': 'precipitation_4',
           'start_time': '2001-04-01 00:00:00'},
          {'end_time': '2001-06-01 00:00:00',
           'mapset': 'PERMANENT',
           'name': 'precipitation_5',
           'start_time': '2001-05-01 00:00:00'},
          {'end_time': '2001-07-01 00:00:00',
           'mapset': 'PERMANENT',
           'name': 'precipitation_6',
           'start_time': '2001-06-01 00:00:00'}],
 'metadata': {'column_names': ['name', 'mapset', 'start_time', 'end_time']}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module Python Related code is in Python temporal Related to temporal data processing tests Related to Test Suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants