Skip to content

Commit

Permalink
Merge pull request #58 from ovro-lwa/wxmon
Browse files Browse the repository at this point in the history
Add get_rain function to influx.py
  • Loading branch information
caseyjlaw authored Feb 7, 2024
2 parents f01db67 + b0792ac commit 6648cba
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions mnc/influx.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,23 @@

def get_rfpower(utctime, dt):
""" Given utctime (e.g., '2023-07-25T10:00:00') and dt in seconds, return ARX RF power monitor points.
Returns time, ant_num, power_a, and power_b as a DataFrame.
"""

tu = int(MS_PER_SECOND*Time(utctime, format='isot').unix)
query = f'SELECT time, ant_num, "power_a" as pa, "power_b" as pb FROM "antmon" WHERE time >= {tu}ms and time < {tu+dt*MS_PER_SECOND}ms'
result = influx.query(query)['antmon']

return result


def get_rain(utctime, dt):
""" Given utctime (e.g., '2023-07-25T10:00:00') and dt in seconds, return rain monitor points from wxmon.
Returns time, rainrate, and rainhr as a DataFrame.
"""

tu = int(MS_PER_SECOND*Time(utctime, format='isot').unix)
query = f'SELECT time, rainrate, rainhr FROM "wxmon" WHERE time >= {tu}ms and time < {tu+dt*MS_PER_SECOND}ms'
result = influx.query(query)['wxmon']

return result

0 comments on commit 6648cba

Please sign in to comment.