# Forest Fire Risk Forecasting with the Aid of Case-Based Reasoning
## 3 Forecasting the Risk of Forest Wildfires Using a Case-Based Approach
### Results (Employed Works)
#### 3.3.1 Data Preprocessing  
The initial data in the form of 45,000 records describing information about thermal points includes records of daily (or with a break of up to three days) statistics about the  
Figure 4: The main stages and steps of our research.  
date and time of detection of the thermal point, its area, coordinates, and contours in the form of a polygon.  
This initial data were preprocessed, including:  
* Thermal points located within the boundaries of industrial zones, populated areas, and mining zones that are not forest fires were identified, with their subsequent exclusion from consideration. The remaining thermal points were later interpreted as forest fires.
* Grouped (aggregated) information about fires is gathered by combining data characterized by the location of the fire on intersecting polygons and the minimum time interval, with the determination of the duration, minimum, and maximum area of the detected fire.
* The initial events (ignitions) of a forest fire are highlighted with the determination of the date of detection, coordinates, and the fire polygon.
* Calculation of characteristics of each fire: 1. Area of each fire; 2. Municipal formation, forestry, forest area, forest quarter on whose territory a fire was detected; 3. Fire hazard class of the forest of the allocated territory; 4. Fire hazard class of the forest of the allocated territory according to weather conditions; 5. Forest-growing zone and forest-seed zoning area; 6. Weather conditions based on the data of the meteorological stations closest to the fire; 7. Data on the population density of municipalities affected by fires; 8. Distances from each fire to roads and railways as well as rivers and lakes and the nearest settlements; determination of the intervals of these indicators.
* Calculation of statistical indicators: 1. Number of fires and their areas in municipalities; 2. Number of fires and their areas in forest zones; 3. Number of fires and their areas in forest districts.  
To implement the processing, the GeoAnalytics software module [63] was developed in Python3 using the \"shapely\", \"pyproj\", and \"pandas\" libraries to work with geo objects in the WKT (well-known text) and WKB (well-known binary) formats.  
WKT is a text format for representing vector geometry and describing coordinate systems. To store the same information in the database, a binary equivalent format is used--WKB. The formats are part of the \"Simple Feature Access\" technology created to provide a common interface for the exchange of spatial data between various programs and services.  
In particular, the \"shapely\" library used the WKB and WKT methods to load data. Further, to obtain the area of the polygon in square kilometers, the polygon was converted to a geodetic projection using the \"pyproj\" library, and the \"Geod\" class with the \"WGS84\" parameter and the \"geometry_area_perimeter\" method was used. In turn, the \"pyproj\" library and the \"CRS\" and \"Transformer\" classes as well as the \"shapely\" library and the \"transform\" method were used to obtain the projection of polygons (geometric data/geometric figure in radians) into geodesic quantities (geometric figure in meters). To obtain the distances, the \"distance\" method was used.