Hands-on exercise: LCZ and air temperature analysis with QGIS¶
This tutorial will focus on the use of Copernicus data for assessing local differences in air temperature according to land-use features within highly urbanized areas.
Through a computer exercise, you will analyse the case of Milan (Italy) using air temperature data from the Copernicus Climate Change Service (C3S) and the Local Climate Zones (LCZ) map of the city, derived from Sentinel-2 imagery.
You will learn how to access and download C3S data and how to process them in QGIS to obtain a quantitative insight into the LCZ influence on air temperature. The question you are going to answer with this exercise is “Can we observe and quantify differences in the average air temperature within different LCZ of a city?”
Important
Basic knowledge of QGIS and raster data analysis is required. Before starting, you have to install QGIS 3.10 (or higher) on your machine and create a personal account to access C3S data.
Copernicus Climate Change Service¶
The Copernicus Climate Change Service (C3S) “has been designed to respond to environmental and societal challenges associated with climate change”.
The C3S aims at combining expertise from across Europe by providing key indicators on climate change drivers and impacts to support the European climate change policy. The C3S leverages a systematical use of in-situ and satellite-based observations, combined with climate models, to generate these indicators. The C3S web portal further open access to climate datasets, information and news [1].
Climate Data Store¶
The Climate Data Store (CDS) is one of the component of the C3S web portal and provides access to the geophysical information needed to analyse the Climate Change Indicators in a consistent, scientific manner. Users can register for free to obtain access to the CDS and its Toolbox.
The CDS provides:
- estimates of essential climate variables, climate indicators, and relevant information
- near-real time climate monitoring facility
- access to multi-model seasonal forecasts
- climate projections at global and regional scales
- access to research computing facilities
- data processing and visualisation tools
Note
In the hands-on exercise, you will download air temperature data from the CDS for the city of Milan and you will learn how to manipulate them in QGIS.
[1] | Thépaut, J. N., Dee, D., Engelen, R., & Pinty, B. (2018). The Copernicus Programme and its Climate Change Service. In: IEEE International Geoscience and Remote Sensing Symposium 2018, 1591-1593. |
Local Climate Zones¶
Local Climate Zones (LCZ) is a particular land-use classification framework to describes urban surfaces structure and cover with consistency and comparability across cities, supporting applications in studies of urban heat waves, sustainable urbanization and urban energy balance [2]. The LCZ classification scheme [3] and instructions are accessible through the World Urban Database and Access Portal Tools (WUDAPT) project web portal.
Note
In the hands-on exercise, you will use an already available LCZ map of Milan. The analytical procedure to derive LCZ maps from optical satellite imagery is out of scope for this tutorial.
[2] | Stewart, I. D., & Oke, T. R. (2012). Local climate zones for urban temperature studies. Bulletin of the American Meteorological Society, 93(12), 1879-1900. |
[3] | Bechtel, B., Alexander, P. J., Böhner, J., Ching, J., Conrad, O., Feddema, J., … & Stewart, I. (2015). Mapping local climate zones for a worldwide database of the form and function of cities. ISPRS International Journal of Geo-Information, 4(1), 199-219. |
Hands-on Exercise with QGIS¶
Now that you are aware of all the necessay background information, it is time to do work with the Milan case study. To asses differences in the average air temperature within different LCZ, you will perform the following steps:
- download in your home folder the raw air temperature data from the C3S CDS in netCDF format and the LCZ map for Milan.
- open and manipulate the netCDF in QGIS to obtain an analysis-ready raster layer containg the average air temperature for a given time period.
- open the LCZ map in QGIS and perform raster layer zonal statistics to compute the average air temperature within each LCZ class
- plot and compare the averages using statistical graphs
Materials¶
Data specification and software tools that you will use for the analysis are reported below.
LCZ map¶
The LCZ raster map of Milan you will use in the exercise has been derived by [4] and [5] from a Sentinel-2 image acquired in summer 2016. The map includes the subset of LCZ characterizing the Milan area. Some of the contiguous classes have been aggregated (as shown in the table below) with the purpose of obtaining zones with marked differences in the urban land-use features thus easing their comparison in terms of air temperature. In practice, contiguous LCZ classes may be more easily confused during the classification procedure and, in turn, differences in their contributions to air temperature may be biased or difficult to distinguish.
Raster Value | Description |
1 | Compact midrise |
2 | Compact low-rise, Open midrise, Open low-rise, Large low-rise |
3 | Scattered trees |
4 | Low plants |
5 | Water |
The LCZ map of Milan (s2_lcz_milan.tif) (reference system: WGS84/UTM32N | EPSG:32632) in GeoTIFF format together with its predfined QGIS Style File (s2_lcz_milan.qml) can be download here.
Tip
Keep in the same folder both the raster map and its predefined QGIS style file to allow QGIS to automatically style the map when imported in a project.
Air temperature data¶
Air temperature data at a city level are included in the Climate variables for cities in Europe from 2008 to 2017 of the C3S CDS, which contains air temperature, specific humidity, relative humidity and wind speed for 100 European cities for the current climate. The variables are provided as netCDF files with an hourly temporal resolution on a 100m x 100 m spatial grid (reference system: ETRS89/LAEA Europe | EPSG: 3035).

Climate variables for cities in Europe from 2008 to 2017 (https://cds.climate.copernicus.eu/cdsapp#!/dataset/sis-urban-climate-cities)
After register and login to the C3S CDS web portal, you have to download Milan data by specifying the variable of interest together with a time period (year and month). The selected data can be then downloaded as a .zip or .tar file. For this exercise you have to specify the following options before the download:
- Variable = Air temperature
- City = Milan
- Year = 2016
- Month = July
- Format = Zip file (.zip)
The netCDF file is structured as a multidimensional spatial grid where each layer includes air temperature observations over Milan area at each time step (hour) in July 2016.
Note
The original name of the downloaded file should be “tas_Milan_UrbClim_2016_07_v1.0.nc”
Software tools¶
To perform the exercise you will use QGIS . However, advance raster processing functionalities are not directly available within the QGIS core algorithms. To that end, you will use third-party algorithms from GRASS GIS
which are integrated into the QGIS Processing Toolbox
and they can be run directly from the QGIS interface.
Tip
GRASS GIS Loading
If you don’t see GRASS in the Processing Toolbox, verify in: Settings –> Options –> Processing –> Providers if GRASS provider is activated. GRASS system paths should be already set up if using macOS or Windows.
Data Processing¶
netCDF preprocessing¶
- Open a new QGIS project and import as a raster layer (Layer –> Add Layer –> Add Raster Layer) the air temperature netCDF (tas_Milan_UrbClim_2016_07_v1.0.nc). The layer is imported as a multiband raster in which each band contains the hourly observation of air temperature over Milan (n. of bands = 744). In the following steps, you will manipulate the raster file obtained from the netCDF by projecting it to WGS84/UTM32N | EPSG:32632 and computing the averages of all bands.
- Do Right Click on the layer name in the QGIS Layer Panel and then: Export –> Save As… to save the layer in GeoTIFF format by assigning its native reference system (ETRS89/LAEA Europe | EPSG: 3035).

- Accept the default coordinates conversion procedure suggested by QGIS by clicking Ok.

- Create a second copy of the raster layer to assign the same projected reference system of the LCZ map (WGS84/UTM32N | EPSG:32632) by following the procedure explained in the previous step.

Tip
In case of issues with the presented procedure, you can directly download the projected raster layer from the above step.
Now, you have obtained a multiband raster layer projected to the same reference system of the LCZ map. The last step consists of computing the average air temperature in July 2016 at each pixel of the grid.
- From the QGIS menu, open: Processing –> Toolbox and search for the GRASS GIS algorithm r.series which allows making each output cell value a function (e.g. the average) of the values assigned to the corresponding cells in the input list of raster bands or layers.
- Run the algorithm on the projected multiband raster layer by specifying Average in the Aggregate operation tab to obtain the single-band raster of the average air temperature [K] for Milan in July 2016.
Warning
If you use QGIS on Windows, you have to set also the raster values range. In the r.series panel, open: Advanced Parameters –> Ignore values outside this range (lo,hi), set e.g. Min = -1000 and Max = 1000.
Tip
Name the output file as “air_t_milan_average”. The period (“.”) in the original name of the netCDF file may not be accepted by GRASS GIS as part of the output file name. In case of issues with the presented procedure, you can directly download the average air temperature raster.

Raster zonal statistics¶
To assess differences in the average air temperature within different LCZ, you need to compute raster statistics by class using the single band raster of the average air temperature for Milan in July 2016 and the LCZ map.
- Open a new QGIS project and import the requested raster maps (air_t_milan_average.tif and s2_lcz_milan.tif).
- From the QGIS menu, open: Processing –> Toolbox and search for the QGIS algorithm Raster layer zonal statistics which allows you computing statistics for a raster layer’s values, categorized by zones defined in another raster layer. Specify as Input layer the average air temperature raster and as Zones layer the LCZ map. Save the output as a Shapefile or GeoPackage table.

Note
The output file contains the summary statistics by LCZ class computed for the average air temperature raster. No geometries are included in the output.”
- Open, explore and comment the output table by focusing on the columns zone (i.e. LCZ class) and mean (i.e. average air temperature).

Results¶
It is possible now to plot the resulting table using e.g. the Data Plotly QGIS plugin. From the QGIS menu, open: Plugin –> Manage and Install Plugins, search for Data Plotly plugin and install it.
The difference of average air temperature in each LCZ class can be appreciated e.g. by plotting the columns zone (X-axis) and mean (Y-axis) using a Scatter Plot.
Can we observe and quantify differences in the average air temperature within different LCZ of a city?
The answer is “Yes, we can measure these differences that are around 2 Kelvin degrees between heavily urbanized areas (1 = Compact midrise) and vegetated areas (4 = Low plants) for this case study”
[4] | Loftian, M. (2016). Urban climate modeling: case study of Milan city. Politecnico di Milano (M.Sc. dissertation). |
[5] | Oxoli, D., Ronchetti, G., Minghini, M., Molinari, M. E., Lotfian, M., Sona, G., & Brovelli, M. A. (2018). Measuring urban land cover influence on air temperature through multiple geo-data—The case of Milan, Italy. ISPRS International Journal of Geo-Information, 7(11), 421. |