Scottsdale is one of the top 10 cities for recreation in the United States, according to a recent WalletHub study.

The study compared the 100 largest U.S. cities across 47 key metrics grouped in four categories that evaluated the quality of parks, the number of entertainment facilities per capita, the cost of leisure activities and weather conditions, to determine which prioritize recreation the most.

Most Arizona cities fared fairly well in the study. Two cities besides Scottsdale fell into the top 15 spots, and only two cities in the state were in the bottom half of the list.

Here’s how Arizona cities ranked in the study and why, as well as a roundup of the top cities for recreation in the U.S.

Top 10 cities for recreation in the US

Here are the best 10 cities for recreation in the nation, according to WalletHub.

Why Scottsdale is a top city for recreation

Scottsdale ranked seventh in the ranking, standing out mostly for its weather and quality of parks.

The city placed third nationally in the weather category, and tied for first with Anchorage, Arkansas, and Fremont, California, for the amount of park space compared with city size.

Scottsdale also performed above the median for the categories of affordability of leisure activities and number of entertainment facilities in proportion to the population.

The study focused on the availability of neighborhood parks, which are “are one of the most beneficial types of recreation a city can offer,” according to the report. However, indoor activities that don’t require good weather — an especially important opportunity during the summer months in metro Phoenix — were also considered.

Having a high share of movie theaters, music venues and coffee shops significantly contributed to each city’s score. Most Arizona cities performed well in these categories.

What are the best and worst Arizona cities for recreation?

Phoenix, the state capital, also ranked high in the study, take spot No. 12 in the nation and No. 2 in the state. Phoenix performed best in the weather and entertainment facilities categories.

Also in the top 15, Tucson stood out for its good weather and affordable prices for recreation activities, but it fell far below the median for the quality of park category.

Glendale was still above water at spot No. 30, and Chandler barely made it to the top half at spot No. 49.

On the bottom half of the list, Mesa and Gilbert performed poorly in the quality of parks and recreational facilities categories.

Here’s a breakdown of how Arizona cities performed in WalletHub’s ranking.

How the ranking was created

To find out which U.S. cities are the best and worst for recreation, WalletHub studied the 100 most populous cities in the country.

The study focused on four main categories: entertainment and recreational facilities, leisure activity costs, park quality, and weather. To measure these categories, WalletHub used 47 different factors, including the number of attractions, how many parks or bike trails there are, and how affordable it is to go bowling or get a massage. Some of these factors were given more weight than others based on how important they were to the overall recreational experience.

Each city was scored on a scale from 0 to 100 for every factor, with higher scores meaning better recreation options. For some of the measurements that depend on population size, like how many sports venues or swimming pools a city has per person.

After scoring all the cities on each factor, WalletHub calculated an overall average score for each city. Those scores were then used to rank the cities from best to worst for recreation.

This article originally appeared on Arizona Republic: Why this Arizona city is a top spot for recreation in the US