Skip to content

time series request rounds the request endDate resulting in omitting last value #289

@AliceBalfanz

Description

@AliceBalfanz

When we have a dataset, which last two values are e.g.

'2022-04-26T06:56:04.065999872', '2022-05-06T06:56:04.065999872'

the last value is rounded to 2022-05-06T06:56:04Z in xcube viewer. The last time stamp is displayed fine on the map, however due to rounding it is omitted in the time-series request.

https://bc-api.brockmann-consult.de/api/timeseries/bc-demo~cglops_lake_tanganjika_300m.zarr/turbidity_mean?aggMethods=median&startDate=2021-10-26T19:37:41Z&endDate=2022-05-06T06:56:04Z

POST https://bc-api.brockmann-consult.de/api/timeseries/bc-demo~cglops_lake_tanganjika_300m.zarr/turbidity_mean?aggMethods=median&startDate=2021-10-26T19:37:41Z&endDate=2022-05-06T06:56:04Z

e.g. for

{
  "type": "Feature",
  "geometry": {
    "type": "Point",
    "coordinates": [29.40474395710414, -4.981605714204804]
  },
  "properties": {
    "name": "Point 1"
  }
}

result [ {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, … ]
0 Object { median: 0.31508904695510864, time: "2021-11-06T06:56:04Z" }
1 Object { median: 0.5600425004959106, time: "2021-11-16T06:56:04Z" }
2 Object { median: 0.5560182332992554, time: "2021-11-26T06:56:04Z" }
3 Object { median: 0.3041113018989563, time: "2021-12-06T06:56:04Z" }
4 Object { median: 0.4342271685600281, time: "2021-12-16T06:56:04Z" }
5 Object { time: "2021-12-26T19:37:41Z", median: null }
6 Object { time: "2022-01-06T06:56:04Z", median: null }
7 Object { median: 0.5325384736061096, time: "2022-01-16T06:56:04Z" }
8 Object { median: 0.4660368859767914, time: "2022-01-26T19:37:41Z" }
9 Object { median: 0.8200605511665344, time: "2022-02-06T06:56:04Z" }
10 Object { median: 0.5204707980155945, time: "2022-02-16T06:56:04Z" }
11 Object { median: 0.7293128967285156, time: "2022-02-25T05:32:51Z" }
12 Object { median: 0.7425397634506226, time: "2022-03-06T06:56:04Z" }
13 Object { median: 0.5542619228363037, time: "2022-03-16T06:56:04Z" }
14 Object { median: 0.3124908208847046, time: "2022-03-26T19:37:41Z" }
15 Object { time: "2022-04-06T06:56:04Z", median: null }
16 Object { median: 0.368571937084198, time: "2022-04-16T06:56:04Z" }
17 Object { median: 0.19854414463043213, time: "2022-04-26T06:56:04Z" }

the response therefore omits the last time stamp with the value 2022-05-06T06:56:04.065999872 as it is just later than 2022-05-06T06:56:04.

This happens for all datasets, where the milliseconds are rounded down, and therefore the timeseries display in the viewer is incomplete.

To reproduce:
Use https://bc-viewer.brockmann-consult.de/?dataset=bc-demo~cglops_lake_tanganjika_300m.zarr

which is located in our bc-demo-cubes s3 bucket.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions