Skip to content

Commit 6c1e98d

Browse files
authored
check if time data is iterable, make list if not (#2064)
1 parent 8396dc5 commit 6c1e98d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pygeoapi/provider/xarray_.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,12 @@ def gen_covjson(self, metadata, data, fields):
345345

346346
if self.time_field is not None:
347347
cj['domain']['axes']['t'] = {
348-
'values': [str(v) for v in data[self.time_field].values]
348+
'values': [str(v) for v in (
349+
data[self.time_field].values
350+
if hasattr(data[self.time_field].values, '__iter__')
351+
else [data[self.time_field].values]
352+
)
353+
]
349354
}
350355
cj['domain']['referencing'].append({
351356
'coordinates': ['t'],

0 commit comments

Comments
 (0)