Skip to content

Commit 3a2a4ef

Browse files
authored
Merge pull request #8 from LimnoTech/xarray-time-fix
Flexibility on length of timesteps
2 parents 76589b7 + 52bf19d commit 3a2a4ef

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)