Skip to content

Commit

Permalink
Leverage the project projection which handles units.
Browse files Browse the repository at this point in the history
  • Loading branch information
matteius committed Oct 3, 2024
1 parent 9d5f8a7 commit 93f9847
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion opensensor/collection_apis.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,12 @@ def sample_and_paginate_collection(

# Add UTC offset to timestamp field
for item in raw_data:
item["timestamp"] = item["timestamp"].replace(tzinfo=timezone.utc).isoformat()
if isinstance(item["timestamp"], datetime):
item["timestamp"] = item["timestamp"].replace(tzinfo=timezone.utc).isoformat()
elif isinstance(item["timestamp"], str):
item["timestamp"] = (
datetime.fromisoformat(item["timestamp"]).replace(tzinfo=timezone.utc).isoformat()
)

if response_model is VPD:
# If the response model is VPD, you already have VPD-related data from the pipeline.
Expand Down

0 comments on commit 93f9847

Please sign in to comment.