Use Cases

Products

Developer

Blog

Blog

/

Developer

Querying weather conditions along the path of totality for the solar eclipse on April 8th

4.5.2024//Developer, Educational, API & Mapping, Tutorials

Blog post banner

Cam Schnackel

Technical Specialist

Solar eclipses are a rare and wonderful phenomena, with many avid sky-watchers eagerly anticipating their occurrence — a fact demonstrated by fully-booked hotels along the path of totality. If you're still making plans, you can check the cities getting the total eclipse here to locate one within driving distance of you.

If you're one of the many across North America getting ready to look up on April 8th as we plunge into momentary midday darkness, you've likely wondered what the weather might look like — maybe that's why you've found yourself here. No, we don't have an eclipse endpoint — but that doesn't mean we can't still help you find the best weather conditions near you during the time of eclipse totality. Read on to learn about building batch requests for weather conditions for multiple locations, along with a sample query I've built that you can modify to your needs.


The sample query had the following considerations:

  • I started by following the eclipse path and grabbed a few noteworthy cities that were relatively spread out to include. When building yours, you can include cities in the path of totality nearest to you to find out if the conditions there might be optimal for viewing.

  • Though the routing module may have returned similar responses, I opted to perform a batch request in order to return the conditions for each of these locations with one call. Note that each individual request you include within a single batch call counts as a separate API access against your account's limit.

  • I also wanted to ensure that each individual request would grab the forecast at the exact time that totality began, so I retrieved those timestamps and passed them into the for parameter. Again, when building your query, make sure you replace those timestamps with the timestamp for total eclipse for that city.

  • Finally, I filtered out the results so that only the data most relevant to an eclipse viewer would be included in the response:

    • periods.sky  - Percentage of clouds in the sky

    • periods.cloudsCoded - Coded version of cloud conditions (see weather codes)

    • periods.weather - Phrase of weather conditions

    • periods.pop - Probability of precipitation

    • periods.precipIN - The estimated precipitation in inches

    • periods.precipMM - The estimated precipitation in millimeters

Now that we've walked through our qualifications for a query that will return what we care about, let's look at our example.

The query:

The sample response:

Forecasted conditions for Austin, Dallas, Little Rock, Carbondale, Cleveland, Buffalo, Rochester, and Burlington as of Friday, April 5th at 3:56pm CDT.

There we have it — we hope this helps you find the best spot to view the eclipse near you. If you leverage the API to check weather conditions for cities near you, let us know - and send your solar eclipse photos to hello@xweather.com or tag us on LinkedIn, X, or Instagram! As always, happy coding — and happy viewing.

Cam Schnackel

Technical Specialist

Previous

Charged up: Xweather reveals the full extent of lightning risk for U.S. wind farms

=

Next

Returning to the Alps