# Forecast API limit to one day

**URL:** <https://community.tempest.earth/t/forecast-api-limit-to-one-day/19710>\
**Category:** Developers\
**Tags:** tempest\
**Created:** [January 9, 2023, 3:37am UTC](https://community.tempest.earth/t/forecast-api-limit-to-one-day/19710 "2023-01-09T03:37:46Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mabeatty1978](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tempest.earth/mabeatty1978/32/15139_2.png) [@mabeatty1978](https://community.tempest.earth/u/mabeatty1978)\
**Post date:** [January 9, 2023, 3:37am UTC](https://community.tempest.earth/t/forecast-api-limit-to-one-day/19710/1 "2023-01-09T03:37:46Z")

</div>

I’m working on a project using the forecast API to get the current day’s sunrise/sunset epoch. I’m running this program on a raspberry pi pico. The API call for the forecast returns more data than the pico’s memory can handle. Is there a way to limit the response for a specific day? If not, I would like to make a feature request to add an additional parameter to the call to only return 1 specific day, for example “day=0” returns only today’s forecast?

---

<div class="post-metadata">

**Author:** ![iladyman](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tempest.earth/iladyman/32/2305_2.png) [@iladyman](https://community.tempest.earth/u/iladyman)\
**Post date:** [January 9, 2023, 11:39am UTC](https://community.tempest.earth/t/forecast-api-limit-to-one-day/19710/2 "2023-01-09T11:39:56Z")

</div>

I am not sure what your project is and why you want to get the sunrise/sunset epoch using the Weatherflow forecast API. I have a project running on a raspberry pi taking sunrise and sunset photographs and what I use to calculate the times is [ephem · PyPI](https://pypi.org/project/ephem/)  
cheers Ian 🙂

---

<div class="post-metadata">

**Author:** ![peter4](https://avatars.discourse-cdn.com/v4/letter/p/cc9497/32.png) [@peter4](https://community.tempest.earth/u/peter4)\
**Post date:** [January 9, 2023, 2:55pm UTC](https://community.tempest.earth/t/forecast-api-limit-to-one-day/19710/3 "2023-01-09T14:55:37Z")

</div>

If not ephem, which looks pretty cool, there are plenty of sunrise/sunset algorithms available that merely need latitude, longitude, and timezone info (UTC offset on the date in question). For more than a year I’ve been using some Javascript snagged from Github that’s seemed to line up well with the Weatherflow-provided times. It’s maybe 20 or 30 lines of code total (and of course relies on some basic trigonometric functions).

---

<div class="post-metadata">

**Author:** ![rleeden](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tempest.earth/rleeden/32/13174_2.png) [@rleeden](https://community.tempest.earth/u/rleeden)\
**Post date:** [January 10, 2023, 11:49am UTC](https://community.tempest.earth/t/forecast-api-limit-to-one-day/19710/4 "2023-01-10T11:49:37Z")

</div>

Or there are several free APIs out there that provide sunrise/sunset data for given latitude/longitude locations - e.g: [https://sunrise-sunset.org/api](https://sunrise-sunset.org/api)

---

<div class="post-metadata">

**Author:** ![wweems](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tempest.earth/wweems/32/15156_2.png) [@wweems](https://community.tempest.earth/u/wweems)\
**Post date:** [January 27, 2023, 6:16pm UTC](https://community.tempest.earth/t/forecast-api-limit-to-one-day/19710/5 "2023-01-27T18:16:07Z")

</div>

there are streaming json parsers that can help there too. I ran into the very same problem with a little arduino esp32. You wont be able to parse the entire json response into memory ever, but what you can do is if you know the structure, use a streaming json parser, and have it pull out the data you care about when you need it.

---

<div class="post-metadata">

**Author:** ![idaband](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tempest.earth/idaband/32/8292_2.png) [@idaband](https://community.tempest.earth/u/idaband)\
**Post date:** [January 30, 2023, 4:23pm UTC](https://community.tempest.earth/t/forecast-api-limit-to-one-day/19710/6 "2023-01-30T16:23:17Z")

</div>

> [@iladyman](#):
>
> I use to calculate the times is [ephem · PyPI](https://pypi.org/project/ephem/)

not sure that will run on micro pi.

other options…make a service on another pi to wrap these request to make them “smaller”
