USA Travel Planner

This is an application to assist in travel planning in the USA to natural scenic outdoor destinations based on average monthly climate data.   As a land based traveler by RV, I struggle with determining what location to visit in what month based on comfortable day and night temperatures.   The objective of this project is to make that travel planning easier.  

Functional Requirements

  • Travel and outdoor scenic destination visitation during daylight hours.
  • Nighttime is for sleeping, rest, and eating.
  • User specified minimum temperature (typically for overnight), and maximum temperature (late afternoon) thresholds.   Default will be min 40 °F and max 80 °F.
  • For a user specified month, display markers on a map color coded bright green if both the min and max temperature criteria is met, otherwise white with black outline.  

 

Data Requirements

  • A list of popular outdoor natural scenic destinations.
  • Positional data (latitude/longitude) coordinates for each location in decimal degrees.
  • Elevation
  • Sunrise & sunset times (local time reference and UTC).
  • Average monthly low/high climate data for each destination.
  • Average monthly rainfall amount for each destination.
  • Destination popularity score.

 

Data Sources

Need API that returns statistical weather data (temperature avg or median min/max) by month for a specified location based on historical data.   I am developing an app that solves the problem of providing travelers with the choice of what months to visit a US National Parks and other locations based on comfortable temperatures of a specified threshold such as min >40 °F and max < °F.   It is currently a difficult manual process to perform this type of trip planning.  

A list of parks can be obtained from the National Park Service (NPS) API.   Historical monthly min/max temperatures and precipitation is available from either NOAA Climate Data Online API or the Visual Crossing Weather API.   Conversion of location from city names or zip code to latitude/longitdue is available from OpenWeather API.  

National Park Service (NPS) API

NPS primary endpoint docs.   Data of interest includes activities, park names, geographic park boundaries specified by state code, address.   | GitHub NPS | GitHub Py & PHP API examples | datasets | Find a Station

NOAA Climate Data Online API

NOAA Climate Data Online has current and historical data available.   It is limited to five requests per second and 10,000 requests per day.   An extensive amount of data is available, but the API is challenging to use.   Annual and Monthly data are limited to a ten year range.   Monthly climate normals (temperature, precipitation, ..) are supposed to be computed for the 30 year period from 1981 to 2010 for U.S. stations, although I found the historical range to be more limited (but sufficient) for my data needs.  

The process that I used to acquire monthly statistical data for temperature min/max and precipitation is as follows, given a latitude and longitude for a location of interest:

  • Get the elevation in meters for the latitude/longitude coordinates.
  • Get the FIPS codes for the latitude/longitude coordinates.   Three sets of FIPS codes were obtained with varying levels of detail in terms of the geographic area covered.
  • Determine a set of Data Set IDs that would include the monthly temperatuere min/max and precipitation statistics.
  • Query NOAA Climate Data Online API and identify a set of Station IDs based on the FIPS codes (full, county, state).   This function processed many stations, scoring them based on differences in elevation and GPS position from the target location, and then returning the best station match.   A temperature change in 5 °F was considered significant by the scoring.   A latitude change of 3.8 degrees toward the equator will increase the temperature 5 °F.   An elevation difference of 282 m will change the temperature 5 ° F.   The start and end date for the dataset is also provided in the results and is needed in the next step to query for the specific climate data.
  • Query NOAA Climate Data Online API to get the monthly climate data based on Station ID, Dataset ID, Data Type ID, and a date range relevent to the data sets.   .

Google Maps API for Elevation

The Google Maps API for Elevation is a robust API service that returns the elevation in meters for the specified latitude and longitude.   It is a bit complicated to configure an account and acquire the API Key.   The service is free provided you keep your usage below the recurring $200 monthly credit, about 40,000 requests/month.  

FIPS Codes

FIPS codes are numbers which uniquely identify geographic areas.   The longer the number, the more detailed the location identification.   FIPS codes are typically made available as 'full fips', 'state fips', and 'county fips'.   The FIPS codes are critical for extracting data from the NOAA Climate Data Online API.   The FCC API service is more robust than the geeocodio API. The geocodio API provides FIPS codes with better location accuracy than the FCC.

FCC

The Federal Communications Commission (FCC) has a free API that returns FIPS codes at the full, county, and state level for a latitude and longitude.  

geocodio

geocodio has a free API that returns FIPS codes at the full, county, and state level for a latitude and longitude.   The API also provides extensive census data.   The FiPS codes obtained with geocodio in general have better accuracy than those returned by the FCC API.  

Nominatim

Nominatim offers a free Geocoding service based on OpenStreetMap API that includes detail reverse geocoding.  

 

Other Weather API Services

The following online API services were reviewed in terms of their suitability for providing historical climate data for this project.  

Visual Crossing Weather API

Visual Crossing Weather API has historical weather data available through a free account, but it is severely limited to the point of being useless.   (see FAQ).   So you must commit to at least a $35/mo subscription to do any meaningful trial.   Their latest product is Timeline Weather API The legacy endpoint for forecast and history queries is still available.   This API is considerably easier to use than NOAA Climate Data Online.  

Historical forecast example for July at Reading PA USA with min/max temperatures and precipitation is shown below.   The 'normal' option causes an array with the min, mean, max for each element to be returned.   So for the month of July, the monthly maximum temperature could be between 65.9 and 91.1 °F.  


https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/timeline/19506/20210701/20210731?unitGroup=us&key=YOUR_API_KEY&include=stats&elements=tempmax,tempmin

{
	"queryCost": 1,
	"latitude": 40.453886,
	"longitude": -76.12911,
	"resolvedAddress": "19506, USA",
	"address": "19506",
	"timezone": "America/New_York",
	"tzoffset": -4.0,
	"days": [
		{
			"tempmax": 83.0,
			"tempmin": 63.9,
			"precip": 0.071,
			"normal": {
				"tempmax": [
					65.9,
					83.0,
					91.1
				],
				"tempmin": [
					51.9,
					63.9,
					72.1
				],
				"precip": [
					0.0,
					0.1,
					0.7
				]
			}
		}
	]
}

 

stormglass.io has a free subscription that permits up to 10 requests per day and returns all weather data, just don't use it for commercial projects.   Historical data is available between specified dates for up to 10 days from start (so must query 3x or more to get a month of data).   High and low tide data is available for a specified coordination location.  

Meteomatics has statistical historical weather data but their API is only free for 14 days.   Subscription prices are very expensive.  

Weatherbit returns 30 year historical climate normals for temperature and precipitation in monthly intervals, but requires an expensive $180/mo subscription.   The free subscription includes 7 day daily forecasts and current weather for non-commerical use.  

The U.S. Climate Resilience Toolkit has location (station, average monthly climate projection data for years 2010 to 2040 and beyond that includes the weighted values for the mean, min, max temperatures for download as CSV.  

OpenWeather (openweathermap.org) They have an older v2.5 API still active that provide extensive current weather information with up to 1,000 API calls per day for free, but the monthly statistical data by location is only available at a premium price.   The new One Call API 3.0 (1,000 API calls per day for free) only provides current weather for free, or historical daily data for $0.0015 per call (no historical monthly).   They also have a free Geocoding API to convert city names and zip codes to latitude/longitude coordinates.  

Meteum only offers a free 7 day trial.   They claim to have historical weather data for up to 10 years by location for $7/location.  

National Weather Service (NWS) API only provides forecasts, alerts, and observations through their API.   Monthly min/max/avg monthly climate data is available on their website, but not in a form that is easy to scrape.  

AccuWeather offers a free tier with up to 50 calls/day that includes data for current conditions and the last 20 hours.   Historical data isn't available at any subscription level.  

weather api has a free tier with current, future, and 7 day past weather data.  

Tomorrow.io API pricing is not transparent, so I didn't even bother to look any further.  

Weatherstack only offers current weather data for free.   Historical weather data starts at $10/mo 'Standard' subscription for up to 50k calls/mo.   Aggregated historical data is available for 24 hour intervals over multiple days (not convenient for my application).   I dropped consideration of this API service for my project because I could not try the historical weather API for free.  

Weather2020 pricing not transparent and no free tier readily available.  

AerisWeather pricing starts at $300/mo.   The only trial is free for 30 days.  

DTN (Meteogroup) is only accessible by contacting a DTN Sales Representative, so I just passed them by.   They also control ClearAG (DTN).  

Open-Elevation

Open-Elevation has a free API that returns an elevation in meters for the supplied latitude and longitude.   I started using this API service initially for my project (and I it it a lot), but after experiencing periods of no availability, I switch to using Google Maps API for Elevation

 

Data Storage Structure

For this project, we have both metadata and data that needs to be stored for each location (National Park).   An end use application may want to query this data to identify what park locations in what months meet the temperature and precipitation thresholds.   The metadata looks something like:


fullname, parkID, parkCode, latitude, longitude, elevation_m, state, zip, street

Ex:
'Acadia National Park', '6DA17C86-088E-4B4D-B862-7C1BD5CF236B', 'acad', Decimal('44.409286'), Decimal('-68.247501'), Decimal('22.0'), 'ME', '04609', '25 Visitor Center Road'
}

The temperature and precipitation data for one park looks like this:


Month    Tmin[F] Tmax[F] PRCP[in]
Jan      20.5    35.2    3.58
Feb      22.6    37.7    3.02
Mar      28.0    45.5    4.45
Apr      37.8    55.9    4.39
May      46.5    64.1    5.02
Jun      55.6    71.9    4.81
Jul      59.0    74.8    5.04
Aug      57.6    72.9    3.81
Sep      51.5    67.1    6.35
Oct      40.8    57.8    4.69
Nov      33.5    48.1    4.9
Dec      23.2    38.2    4.13

The results from a query will likely return a set of park locations for a specified month that meet the climate criteria.  


Name			Latitude	Longitude	Tmin[F]		Tmax[F]		PRCP[in]
Shenandoah NP	38.5288		-78.4383	46.5		64.1		5.02
..

 

Related Links

Weather Data and Forecasts from Open Weather API (Python & Pandas)