Skip to content

Commit 1cbf0f4

Browse files
committed
Use the same project projection
1 parent a60cd29 commit 1cbf0f4

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

opensensor/collection_apis.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ def get_vpd_pipeline(
191191
match_clause = get_initial_match_clause(
192192
device_ids, device_name, start_date, end_date, resolution
193193
)
194+
project_projection = _get_project_projection(VPD)
194195

195196
# We ensure both temperature and humidity exist for the calculation of VPD
196197
match_clause["temp"] = {"$exists": True}
@@ -241,14 +242,7 @@ def get_vpd_pipeline(
241242
"vpd": {"$multiply": ["$satvp", {"$subtract": [1, {"$divide": ["$rh", 100]}]}]}
242243
}
243244
},
244-
{
245-
"$project": {
246-
"_id": False,
247-
"timestamp": 1,
248-
"vpd": 1,
249-
"unit": "kPa", # assuming kPa as the unit for VPD
250-
}
251-
},
245+
{"$project": project_projection},
252246
{"$sort": {"timestamp": 1}},
253247
]
254248
return pipeline

0 commit comments

Comments
 (0)