Map from Google - Catalonia

In Catalonia, an autonomous community located in north-eastern Spain, the climate is Alpine (cold mountain climate) in the Pyrenees, on the border with France, it's oceanic (cool and wet) in the small area of the Garonne valley, to the north of the Pyrenees, and it's Mediterranean along the coast, while in inland areas (see Lleida) it gets a little more continental and drier than the real Mediterranean climate.
The rains exceed 1,000 millimetres (40 inches) per year in the Pyrenean area, where some rains and thunderstorms occur also in summer, they remain above 700 mm (27.5 in) in the Girona province, they hover around 600 mm (23.5 in) in the coast of Barcelona and 500 mm (20 in) in the coast of Tarragona, while they fall below 400 mm (16 in) in the central and southern inland areas (see Lleida), which are therefore definitely arid.
Then there are some mountain ranges parallel to the coast (the Catalan Mediterranean System), whose climate gets colder with increasing altitude. In the Montseny Massif, the highest point is Turó de l'Home (1,707 metres or 5,600 feet). The mountain of Montserrat goes up to 1,236 metres (4,055 feet), but the monastery is at 700 metres (2,300 feet). In the valleys between those mountain ranges, in winter fog can form, while during cold spells from Eastern Europe it can snow at hill altitudes.

Monastery of Montserrat

In the far north, along the border with France, we find the chain of the Pyrenees; the highest peak of Catalonia is Pica d'Estats, 3,143 metres (10,312 feet) high, on the border with France. In the area at the foot of the Pyrenees, at the same altitude, the climate is cooler than in the south-central region; in addition, this area is exposed to outbreaks of cold air, with strong winds, in winter. In the high mountains, in winter heavy snowfalls occur. Summer is cool, with possible afternoon thunderstorms, but given the location, some Atlantic fronts can pass even in this season.
In the Pyrenean valleys, in winter cold spells can occur, with night frosts, while when the weather is stable, cold and foggy periods may occur; in summer the temperatures are pleasantly warm during the day, but sometimes days with scorching heat are possible, even though the air is dry and the nights remain cool.

On the coast of Catalonia the climate is Mediterranean, with mild and relatively rainy winters, and hot and sunny summers, in which the air is humid, but sea breezes blow.
The northernmost part of the coast, in the province of Girona, is called Costa Brava. There are towns like Portbou, Colera, Llançà, Cadaqués, Roses, Sant Pere Pescador, L'Escala, Estartit, Begur, Palafrugell, Palamós, Platja d'Aro, Sant Feliu de Guixols, Tossa de Mar, Lloret de Mar and Blanes. Due to its northern location, the climate is quite cold in winter, the rains have two maxima in spring and autumn, and some occasional disturbances may pass even in summer.
Here are the average temperatures of Girona, the chief town, located at 25 km (15 miles) from the coast.
Average temperatures - Girona
GironaJanFebMarAprMayJunJulAugSepOctNovDec
GironaJFMAMJJASOND
Min (°C)124610141717141152
Max (°C)131417192227303026221714
Min (°F)343639435057636357524136
Max (°F)555763667281868679726357

In Girona, 720 mm (28.5 in) of rain per year fall, with a minimum in July and a maximum in October.
Here is the average precipitation.
Average precipitation - Girona
GironaJanFebMarAprMayJunJulAugSepOctNovDecYear
GironaJFMAMJJASONDY
Prec. (mm)605050657060304570907055720
Prec. (in)2.4222.62.82.41.21.82.83.52.82.228.3
Days55577535765566

The temperature of the sea is lower in the northernmost part of the Costa Brava than in the south-central, because beyond the French border the Gulf of Lions receives cold Atlantic air masses for many months a year, which are able to cool down the sea. In Colera, the water temperature does not go over 21 °C (70 °F) in July and 22 °C (72 °F) in August.
Further south, in the Gulf of Roses, the sea is never very warm, however it reaches 23 °C (73 °F) in August, while it is still only at 21 °C (70 °F), so definitely cool, in July. Here the temperature of the sea at Figueres.
Sea temperature - Figueres
FigueresJanFebMarAprMayJunJulAugSepOctNovDec
FigueresJFMAMJJASOND
Sea (°C)131313141619212321181614
Sea (°F)555555576166707370646157

Continuing to the south, the sea temperature increases slightly, but remains cool enough up to Palamós and Sant Feliu de Guíxols.
The sea gets warmer in the southernmost part of the Costa Brava (see Tossa de Mar, Lloret de Mar, Blanes). Here is the temperature of the sea at Blanes.
Sea temperature - Blanes
BlanesJanFebMarAprMayJunJulAugSepOctNovDec
BlanesJFMAMJJASOND
Sea (°C)131313141720232523201715
Sea (°F)555555576368737773686359

Tossa de Mar, Costa Brava

In the rest of the coast of Catalonia, in the provinces of Barcelona and Tarragona, the sea temperature is similar to that of Blanes, or becomes, albeit slightly, even higher.
To the south of Costa Brava, in the province of Barcelona we find the Costa de Barcelona, which includes towns like Sitges, Vilanova i la Geltru, Arenys de Mar, Malgrat de Mar, Santa Susanna, Calella, Castelldefels, Badalona, Mataro, Sant Pol de Mar and Canet de Mar.
Here are the average temperatures of Barcelona.
Average temperatures - Barcelona
BarcelonaJanFebMarAprMayJunJulAugSepOctNovDec
BarcelonaJFMAMJJASOND
Min (°C)557913172020171496
Max (°C)141416182125282926221714
Min (°F)414145485563686863574843
Max (°F)575761647077828479726357

In Barcelona, precipitation amounts to 620 mm (24.5 in) per year, with an evident maximum in autumn, due to the prevailing southern currents. In winter the rains are not abundant: just 40 mm (1.6 in) of rain per month fall from December to February.
Here is the average precipitation.
Average precipitation - Barcelona
BarcelonaJanFebMarAprMayJunJulAugSepOctNovDecYear
BarcelonaJFMAMJJASONDY
Prec. (mm)4040354055302065851006540620
Prec. (in)1.61.61.41.62.21.20.82.63.33.92.61.624.4
Days44555425575556

In Barcelona the sea is warm enough for swimming from July to September, with a peak in August, of 25 °C (77 °F). In June, the sea is still cool, around 20 °C (68 °F).
Here are the average sea temperatures.
Sea temperature - Barcelona
BarcelonaJanFebMarAprMayJunJulAugSepOctNovDec
BarcelonaJFMAMJJASOND
Sea (°C)131313141720232523201715
Sea (°F)555555576368737773686359

Further south, in the province of Tarragona, we find the Costa Dorada, which includes towns such as L'Espluga de Francoli, Salou, Tarragona, Valls, Mont-Roig del Camp, Montblanc, Prades, Altafulla and Calafell. Here the climate is Mediterranean, similar to that of the Barcelona coast, though a bit drier.
Here are the average temperatures of the airport of Reus, near Tarragona.
Average temperatures - Reus
ReusJanFebMarAprMayJunJulAugSepOctNovDec
ReusJFMAMJJASOND
Min (°C)457912161920171385
Max (°C)141517192226292926221815
Min (°F)394145485461666863554641
Max (°F)575963667279848479726459

In Reus, 500 mm (20 in) of rain per year fall; even here you can notice the autumn peak, while in winter it rains little.
Here is the average precipitation.
Average precipitation - Reus
ReusJanFebMarAprMayJunJulAugSepOctNovDecYear
ReusJFMAMJJASONDY
Prec. (mm)303030355525154075755535500
Prec. (in)1.21.21.21.42.210.61.6332.21.419.7
Days44455324564450

Even in the Costa Dorada the sea is warm enough for swimming from July to September, with a maximum in August of 25 °C (77 °F), while in June it is still cool, around 20 °C (68 °F). Here, for example, the temperature of the sea at Tarragona.
Sea temperature - Tarragona
TarragonaJanFebMarAprMayJunJulAugSepOctNovDec
TarragonaJFMAMJJASOND
Sea (°C)131313141720232523201715
Sea (°F)555555576368737773686359

Port of Tarragona from above

In the interior of Catalonia, in the Catalan Central Depression, which is actually a plain area, formed by the Ebro River and its tributaries, the climate becomes slightly more continental and more arid.
In Lleida, the capital of the only landlocked province, the average of January is 5 °C (41 °F), that of July and August is 25 °C (77 °F). In winter, nights are often cold, with possible slight frosts. In summer, very hot days are frequent, with peaks around 40 °C (104 °F), but the air is dry, and at night temperatures drop by a lot.
Here are the average temperatures.
Average temperatures - Lleida
LleidaJanFebMarAprMayJunJulAugSepOctNovDec
LleidaJFMAMJJASOND
Min (°C)124711151717141042
Max (°C)101418212530333228221510
Min (°F)343639455259636357503936
Max (°F)505764707786919082725950

In Lleida, just 340 mm (13.5 in) of rain per year fall. You can notice the considerably low rainfall amount in winter.
Here is the average precipitation.
Average precipitation - Lleida
LleidaJanFebMarAprMayJunJulAugSepOctNovDecYear
LleidaJFMAMJJASONDY
Prec. (mm)251520404025102040453025340
Prec. (in)10.60.81.61.610.40.81.61.81.2113.4
Days43456422454446

The amount of sunshine in Catalonia is very good in summer on the coast and in the inland south-central areas: in Girona the hours of sunshine per day go to 4 in December to 9 in July, in Barcelona and Tarragona from 4.5 hours in December to 10 in July, in Tortosa from 5 hours in December to 10.5 in July. Lleida, lying in the interior, in winter experiences more often fogs and low clouds, so the hours of sunshine per day in December are only 3, while in July it even gets to 11.5 hours.

When to go

The best time to visit the Pyrenees and the valleys at the foot of the mountains is summer, being the warmest (or mildest) and sunniest of the year.
The summer, from mid-June to August, is also the best time for a beach holiday in Catalonia.
In low-lying inland areas (see Lleida), being the summer hot, you may prefer spring and autumn, especially in May, and from mid-September to mid-October, although the rains are more frequent.
Those who can stand the heat can choose July and August even for this area, but should be ready to stroll around the cities in hot weather.