Solar stocks took a beating in the second half of 2015 and throughout 2016, but the sector has turned around in 2017. In fact, one exchange-traded fund (ETF) tracking the sector – the Guggenheim Solar ETF (TAN) – has generated impressive returns of over 30% year to date. Solar stocks soared in the past due in part to federal tax credits for home solar installation and other incentives to stimulate the industry, but they have been surprisingly resilient this year despite a presidential administration that does not prioritize renewable energy to the same extent as its predecessor.

The facts on the ground suggest that solar's fortunes may remain strong over the medium and long term. Consider that solar energy use is skyrocketing – nearly 40% of all new energy installations in 2016 were solar. The solar workforce has tripled since 2010, reaching some 270,000 workers currently, edging out the number employed in natural gas and nearly doubling the number employed by coal. Of course, there's continued uncertainty under the Trump administration, which may not pursue aggressive alternative energy policies. (See also: 2017: A Turning Point for the Solar Industry.)

That said, depending on your point of view, the sunny outlook for the industry may mean that the time is right to jump into solar. If you're considering solar exposure for your portfolio, here are the top picks for the remainder of 2017. Note: All figures are current as of Nov. 1, 2017.

First Solar, Inc. (FSLR)

After a somewhat disappointing 2016, when revenue was down nearly 20% from 2015, First Solar got off to a great start in 2017. After a great first quarter revenue report of $891 million, second quarter revenue came in at $623.3 million, well above consensus estimates of $556 million but down 33% from the same period in 2016. The results for the third quarter were even more impressive – First Solar reported third quarter revenue of $1.09 billion, representing year-over-year growth of 60% and crushing the consensus estimate of $824.2 million.

Currently, the stock is trading at about $57, up a whopping 75% for the year. The solid third quarter earnings report was enough to send the stock soaring by over 20% in the trading session on Oct. 27. First Solar has a market cap of $5.975 billion, and recent guidance suggests that it will have about $1.5 billion in net cash on the balance sheet by the end of 2017, a reassuring figure. (See also: Buy First Solar on Better Products: Deutsche Bank.)

SunPower Corporation (SPWR)

SunPower lost more than 70% of its value over the course of 2016, a figure that strikes fear in the heart of the average investor. Bankruptcy is a definite concern with some solar companies, but SunPower is majority owned (66%) by petroleum giant Total S.A. (TOT), which is propping it up with credit and even purchasing solar panels for its 5,000 gas stations. SunPower is plowing money into new technology from Congenra Solar to boost its solar panels' efficiency and move into utility-scale projects, which could be a game changer for the balance sheet.

SunPower has a market cap of $994.57 million, and it reported revenue last year of $2.56 billion, up 62%. However, income was down markedly – the company reported a loss of $471 million in 2016. The stock is currently trading at about $7 per share, well below its 12-month average price target of around $9 per share. Second quarter revenue of $341.5 million beat analysts' expectations but was down 15% from 2Q 2016, and the company is due to report third quarter results in early November. (For more, see: First Solar and SunPower: Effects of Solar Panel Tariffs.)

Vivint Solar, Inc. (VSLR)

Vivint is a residential solar company that provides both rooftop solar and storage solutions. The stock had a bang-up month in June, rallying over 80% after Goldman Sachs analysts upgraded the stock to Buy and nearly doubled their price target from $3.50 to $6.00 per share. However, Vivint shares subsequently gave up the majority of those gains. The stock is currently trading at $3.45 per share, up nearly 33% for the year.

The volatility experienced by the stock in recent months could give investors pause, but the company's recent move to a cash and loan sales model and its national footprint could make it an attractive acquisition target. Plus, Vivint Solar has some of the lowest solar installation costs in the country. Pending legislation in Nevada, which will allow solar owners to sell excess electricity to the utility companies at 95% of retail prices, could mean a huge revenue boost for Vivint if it restarts operations in the state.

First quarter 2017 revenue of $53 million was up over 200% over the same period last year, and 2016 total revenue of $135 million was up over 110% from 2015. The company turned profitable in the third quarter of 2017, generating a gross profit of $16.4 million for the period that ended Sept. 30. (For additional reading, check out: Sunny Times Ahead for the Solar Sector.)

Want to learn how to invest?

Get a free 10 week email series that will teach you how to start investing.

Delivered twice a week, straight to your inbox.