Sky View Factor (SVF) assessment in a real-time system for thermal comfort conditions monitoring in the Moscow region

Comfort indices are used to assess the harm to human health caused by unfavorable thermal conditions. All calculated indices are based on both meteorological and physiological parameters. An algorithm is used which is based on a model RayMan for calculating two of the most common thermal indexes: PET and UTCI, which are based on a balance of human energy or models of human heat fluxes. The purpose of this research is to develop a real-time system of calculating comfort indices based on data of a web service for monitoring weather conditions in Moscow and the Moscow region. The technology is based on the use of specialized libraries of the Python language (pyautogui, pywinauto) to interact with the keys of a keyboard and a mouse, because it is necessary to write paths to files and make keystrokes in the model. The result is presented in a visually understandable form with a spatial distribution of the thermal stress in the form of points with signed index values at the locations of weather stations throughout Moscow and the surrounding areas. A test of sensitivity of the RayMan model to changes in a sky view factor (SVF) is also carried out. It is shown that the PET index is more sensitive to changes in SVF than UTCI. An assessment is made of the summer frequency of occurrence of cases with unfavorable levels of the thermal stress (taking into account SVF) at stations of the Roshydromet network in Moscow and the Moscow region. It is shown that during the controversial summer of 2019, the points where strong and extreme heat stresses most often occurred are located within the territories of Domodedovo and Sheremetyevo airports.


Introduction and motivation
High air temperatures and the specificity of the microclimate in cities have an impact on the ecosystems, the economy, as well as on the health and comfort of the population. In recent years, there have been numerous studies that show a strong correlation between human health and biometeorological indices. Heat stress in the summer months has led to an increase in cardiovascular diseases and mortality [1]. Humans do not have any sensor to measure meteorological parameters such as air temperature and humidity, but they can experience an integral effect through the temperature of their skin and blood in the thermoregulatory system for which the hypothalamus is responsible. Thus, human thermal perception is based on a huge number of parameters [2]. The most common metrics display information about thermal biometeorology are thermal comfort indices. They combine several factors to assess human thermal perception [3]. The thermal indices take into account many parameters, which can be divided into 2 groups: meteorological and physiological ones [4]. The physiological parameters mainly consist of information about the physiology of the human body. Examples of the meteorological parameters are air temperature, relative humidity, wind speed, and various fluxes of radiation [5].
In this work, we used two most common thermal indices, PET and UTCI. These indices use °C as a unit, facilitating interpretation by people with little knowledge of human biometeorology [6].
A routinely used measure of human thermal comfort is the physiological equivalent temperature (PET). The PET is defined as "the air temperature at which, under normal room conditions, the heat balance of the human body remains in balance with the internal organ and skin temperatures for the situation under consideration" [7]. The parameter is based on a simplification of the Munich energy balance model for individuals (MEMI, [8]).
The universal thermal climate index (UTCI) is defined as "the equivalent ambient temperature of a reference environment that provides the same physiological response of a reference face in a real environment" [9]. Unlike other indicators, the physiological parameters are not specified for the UTCI calculation. In addition to self-adapting thermal insulation of clothing, a constant walking speed of 4 km/h (1.11 m/s) and an internal heat dissipation of 135 W/m² are assumed [9]. The UTCI is calculated using a multi-segment thermoregulation model that includes a clothing model that automatically adapts to current conditions [10].
Moscow serves as an optimal testing site for studying the urban climate due to its size, level and uniform surrounding terrain, and compact and relatively symmetrical shapes. This was approved during urban climate and thermal comfort modeling studies [11], [12], [13], [14], [15]. A dense meteorological network provides on-site observations in and around the city.
To ensure the safety of the population, Moscow has always needed high-quality information services. From a meteorological point of view, such services are centers for operational forecasting and monitoring of weather conditions. However, Moscow (as well as many other cities) lacks spatial resolution studies of urban climate and public real-time monitoring services.
The development of a publicly accessible cartographic web service began in 2019, with joint efforts of the staff of the Department of Cartography and Geoinformatics and the Department of Meteorology and Climatology of the Geographical Faculty of Moscow State University and the Research Computing Center. The main goal of the service was to provide new approaches to the study and real time monitoring of the effect of the urban heat island and its spatial heterogeneity based on the use of regular and crowdsourced data.
The purpose of this work was to develop a block for modeling thermal comfort conditions in the above-described weather monitoring system in Moscow. The main task was RayMan automation. The first attempt to automatize RayMan-based calculation was made in [16].

Materials and methods
In recent years, many numerical models have been developed and applied in meteorology. However, in the field of urban biometeorology currently there are only a few models: RayMan [17], SkyHelios [18], and ENVI-Met [19]. RayMan was developed first, and the rest of the models are based on its human heat balance equations. The main advantage of RayMan is uninterrupted operation, which is why this model was used in this work.
RayMan is a microscale model developed at the Department of Environmental Meteorology, the former Department of Meteorology and Climatology, University of Freiburg, Albert-Ludwig, and used for calculating radiation fluxes in simple and complex environments [17]. This allows one to perform calculations of the average radiation temperature, which is an important input parameter when calculating thermal biometeorological indicators, such as UTCI and PET.
One of the main features of RayMan is the definition of the sky view factor (SVF). It is generated in the program from a Fish eye image, a free user drawing of a horizon constraint, a topographic raster, or an obstacle dataset [17]. The sky view factor (SVF) is the fraction of an obstructed sky visible from a specific point [20]. It is dimensionless and ranges from 0 to 1, where 0 means completely covered by terrain or obstacles sky, and 1 means open sky. The SVF is an important parameter in calculating the indices, since the values of radiation fluxes are weighted on it. The SVF can be calculated taking into account the aspect ratio.

Sensitivity test
To assess the influence of the sky view factor on the values of the simulated indices, a sensitivity test was performed. Specially created fish-eye images with an idealized building pattern were used as SVF data (Figure 1a). A total of 9 images were created for the following SVF values: 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9. 1. They are shown in Figure 1. The cells of the images are either black, which defines the closed part of the sky, or white, which defines the open part of the sky.
To assess the sensitivity, a fixed set of input data on meteorological parameters for one period was used (air temperature = 25°С, humidity = 30%, wind speed = 2 m/s, cloudiness = 4 octants). The SVF ranged from 1 to 0.2. After calculation of the indices, graphs of the dependences of the PET and UTCI on the sky view factor were constructed. Linear trends have been added to the charts to reveal the greatest sensitivity. The trend line equation can be used to determine the magnitude of the change in the bioclimatic parameter when the SVF deviates by 0.1 (Figure 1b).  The PET index turned out to be more sensitive to changes in the SVF (the coefficient in the regression equation = -0.53), followed by the UTCI (the coefficient in the regression equation = -0.38). The highest sensitivity of the PET index is provided by its best sensitivity to prolonged exposure to direct radiation. In the process of UTCI calculation, different thermal insulation due to clothing and perspiration is used, and so they show lower values.

Results
Developing Real-Time Monitoring of Thermal Comfort Conditions Technology The main drawback of the RayMan model is the code, which is closed from the common user. The documentation and the program itself do not contain information about the systems of equations used to model the energy balance of human heat. Therefore, to calculate the comfort indices it is necessary to directly interact with the program: open it, register the paths for the location of the files, mark the format of the data used, and run the model. This factor served as a basis for the development of this technology. Currently, there are two ways to work around this situation: 1) using an autoclicker [16] and 2) using specialized libraries of programming languages.
In this work, it was decided to use the second method, since it is more stable and requires less time to run. In addition, another convenience was the ability to provide a single common environment for all necessary modules.

Reading data and formatting
To extract the initial data, an open object-relational database management system PostgreSQL was used, deployed on a local machine. This DBMS is based on the SQL (Structured Query Language) programming language, which is used to compose queries to retrieve, store, update, and delete databases and their parts from the DBMS. Essentially, the SQL is about interacting with them.
It took several steps to obtain raw data. First, you need to download the complete database (the socalled "backup") from the server, where it is stored in full and is constantly replenished. Then, after installing the PostgreSQL system on your personal computer, you should restore the downloaded backup in the pgAdmin4 program. After restoring the database, you can open the tables for preview and verification. The next step is carried out with the help of specialized libraries of the Python language: sqlalchemy and pandas. The functionality of the first library allows you to connect to the PostgreSQL DBMS, and the functionality of the second one allows you to make a SQL query to download the entire database.
After receiving tables with all the necessary information, the dataframe is formatted. Work with tables is carried out using the pandas library. This step is necessary to convert the initial table to the format accepted by the RayMan model.

Calculation of comfort indices
To calculate the thermal comfort indices, the file obtained in the previous step is loaded into the RayMan model. There is a library for the interaction with programs (os) in the functionality of the Python language. It is required to access the RayMan program. Then you need to use the keyboard to navigate the working windows and write the path to the location of the files used. This item is implemented by the pyautogui and pywinauto libraries. They are designed specifically for work with keyboard keys and mouse movements.
In this module, a window is opened for entering initial information and working with it: prescribing the path to the file, putting punches in front of the listed types of information (list of meteorological elements, coordinates of place, date and time). In the window for work with SVF, a search is also carried out for previously prepared idealized "fish-eye" images with the sky view factor value corresponding to the calculated one for a particular meteorological station. After the description of the input information in the main window, checkmarks are put in front of the thermal comfort indices that will be simulated, and the button to start the calculations is pressed.
Since the program takes 3 seconds to start and about 1 second is needed to navigate through various windows, the script contains wait commands (the time library is responsible for them).

Visualization
Visualization was also carried out by means of the Python programming language. The presentation of the final image was provided by the convenient folium library. With folium, the data that was previously manipulated in Python can be easily visualized on an interactive map in the Leaflet library. Folium allows you to link data to the map for visualization of both areal phenomena in the form of cartograms and point in the format of markers on the map. In addition, folium can work with both vector and raster data.
Leaflet is a JavaScript programming language library designed to display interactive maps on websites. It supports many formats of geographic information systems and various browsers (Chrome, Opera, Firefox, and others). Leaflet allows you to not only visualize data, but also interact with them (for example, drag and drop a marker or click on it). The library is based on the open source spatial database "OpenStreetMaps".
For an example of visualization, an image of distribution of the UTCI comfort index values over the territory of Moscow and adjacent regions is presented below (Figure 3b). The position of the meteorological stations from which the information was taken is presented ( Figure 3a). The values are represented by points at the locations corresponding to the positions of the meteorological stations. The points are colored in a visually readable color scale corresponding to the gradation of the level of heat/cold stress exerted on the human body. When hovering over an item, the station name or ID is displayed, and when pressed, the index value in degrees is displayed. The map charts are legend and scaled to improve readability.
At the moment, the development of an experimental technology for calculating comfort indices is based on a database copied from the server and deployed on a local computer in order to debug bugs. The rendering was also performed in different ways from the methods implemented in the web service. In the future, it is planned to integrate the created block into a common working system.

Technology approbation and discussion
Evaluation of the repeatability of thermal stress levels for different stations taking into account SVF For some meteorological stations of the Roshydromet network with the known aspect ratio, the PET comfort index was calculated taking into account the SVF parameter. Since information from these weather stations has been pumped into the cartographic database since July 27, 2019, it was decided to evaluate the indices for all dates of August 2019; this is the only summer month in the database so far. After the indices were simulated, all values corresponding to strong and extreme heat stress levels were selected. Then the percentage of the number of cases at each of the stations was estimated in relation to the total number of periods when the data of the gradation of thermal stress were observed. The result is shown in a pie chart (Figure 4). Two leaders stand out on the pie chart: the weather stations at Sheremetyevo (29% of all cases) and Domodedovo (13% of all cases). They are followed by the Mikhnevo and Strogino stations. All these meteorological stations are located in open spaces (SVF = 0.9 -1) and, accordingly, practically no shading is observed there. A large amount of short-wave radiation is received, and the values of the comfort indices are higher. The smallest values are typical for the center of Moscow (Balchug, 1%), since there is much more development there and SVF = 0.6. This is an interesting result, which shows that in the conditions of a rather ambiguous summer of 2019 (average by climatic standards, August followed a cool and rainy July), the openness of the horizon on hot days and the proximity to the territory of the megalopolis (the diffusion effect of the urban heat island) most strongly affect thermal stress.

Conclusions
Thus, for the entire territory of the Moscow Region, a system for tracking thermal comfort conditions has been created for the first time. This is part of a large project to develop a cartographic web service for monitoring meteorological parameters carried out by the efforts of departments of climatology and cartography. The product of the service is visualized on an interactive map of meteorological characteristics. Thus, any person using the web service can be informed about weather conditions in Moscow and the surrounding regions in real time. The user also has access to the archived data of meteorological elements stored on the site (the information provided from February 12, 2020). The web service is a free product. The result is presented in a visually understandable format and does not require additional knowledge to extract information or interpret it. This is the main result of this work.
The web service can provide all necessary information for both ordinary people and the authorities who ensure the work of city planners when assessing the thermal comfort of the area in various development options. In the future, it is planned to further develop and strengthen the web service, as well as the accumulation of archived weather data.
A test was carried out for the sensitivity of thermal comfort indices to changes in the sky view factor. It has been shown that PET is more sensitive to variations in SVF (on average, the index changes by 0.53°С when SVF changes by 0.1), then UTCI (the index changes by 0.38°С when SVF changes by 0.1).
The SVF values were calculated for meteorological stations with known aspect ratio. Taking into account SVF, the index values for August 2019 were calculated. The frequency of occurrence of cases with severe and extreme heat stress were assessed. All stations in the Moscow region were ranked