Getting daily rainfall for the last week

I’m just starting to work with the API and I’m trying to get the last 7 days of daily rainfall from my Tempest. I’ve got an API request that’s working, but it doesn’t quite get what I want. This is it:

url = “https://swd.weatherflow.com/swd/rest/observations/device/[my device]?time_start=1677628800&time_end=1678147200&format=csv&token=[my token]”

This request returns all the data from between the two timestamps. But, what I want is the daily rainfall for the past 7 days. Can anyone help me fine-tune this request? Thanks in advance for any constructive suggestions!

If you’re exporting it to a CSV, I assume you’re intending on using it in a spreadsheet? If so, add a column after the timestamp, then preform the math on the timestamp to convert the epoch to date, =(epoch/86400) + date(1970, 1, 1).

That will give you date values, you can then filter by date, then add the precip columns.

If that isn’t your use case, can you provide more detail as to what, exactly, you are trying to accomplish?

In any regard, you have the data, it’s just a matter of putting it together into a format that is useful to you

Thanks for the reply. I actually just got all of this working. I decided to stick with the approach of using epoch times. What I do is calculate the epoch time for yesterday at 11:59 PM and the epoch time for 7 days earlier at 12 midnight. I use those to create my API request. The response is filtered down to give me the total rainfall for each of the previous 7 days. I save that data to a text file.

1 Like