Historical weather similarity analysis method based on dynamic time warping method
By analyzing historical weather data using the dynamic time warping method, precipitation patterns and laws in different regions are identified, solving the accuracy problem of climate model similarity analysis in the existing technology, improving the assessment of the impact of climate change on agricultural production, and supporting a more scientific decision.
Patent Information
- Application Number
- CN202410749466.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-12
- Publication Date
- 2024-09-27
AI Technical Summary
Existing technology is difficult to effectively analyze the similarities and changes in climate patterns in different regions in historical weather data, making it difficult to make accurate decisions on environmental protection and agricultural production.
The historical weather similarity analysis method based on the dynamic time warping method is used to process the time series data of precipitation events by collecting and cleaning historical weather site data, and the dynamic time warping algorithm is used to time align and match the precipitation events at different sites, combined with The similarity measurement value establishes a similarity analysis model and identifies similar precipitation patterns and laws.
It improves the accuracy of the similarity relationship between historical weather data, provides more accurate climate model analysis results, and helps formulate scientific environmental protection and agricultural production strategies.
Smart Images

Figure CN118708983A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data analysis technology, and more specifically, to a historical weather similarity analysis method based on a dynamic time warping method. Background Art
[0002] As global climate change becomes increasingly significant, the analysis of historical weather data has become an extremely important task. This analysis aims to understand the similarities and changes in climate patterns in different regions, thereby providing an important basis for decision-making in areas such as environmental protection, agricultural production, and urban planning.
[0003] By analyzing historical weather data, we can reveal the similarities and differences between climate patterns in different regions, understand the impact of climate change on ecosystems and natural resources, and provide support for environmental protection. In addition, the analysis of historical weather data can also help predict the probability of extreme weather events and make disaster prevention preparations in advance. Especially in the field of agricultural production, the analysis of historical weather data can help farmers and agricultural experts better understand the impact of climate change on crop growth and yield. According to the analysis results of historical climate data, we can adjust agricultural production strategies, select crop varieties that are more suitable for local climate conditions, and reasonably arrange agricultural production plans to improve the yield and quality of agricultural products. Summary of the invention
[0004] In view of the technical problems existing in the prior art, the present invention provides a historical weather similarity analysis method based on a dynamic time warping method to solve the problems raised in the above background technology.
[0005] The technical solution of the present invention to solve the above technical problem is as follows: a historical weather similarity analysis method based on a dynamic time warping method, specifically comprising the following steps:
[0006] Step 101: collect historical weather station data, including precipitation data and other meteorological data, clean the collected precipitation data, filter and process the cleaned precipitation data to form time series data of precipitation events at a single station;
[0007] Step 102: Based on the processed single-station time series data, a dynamic time warping algorithm is used to time-align and match precipitation events at different stations to obtain similarity metrics between different historical weather patterns;
[0008] Step 103: Combine the dynamic time warping method and the similarity measurement value to establish a similarity analysis model, and identify similar precipitation patterns and laws by performing similarity analysis on historical precipitation data.
[0009] In a preferred embodiment, in step 101, historical weather station data, including precipitation data and other meteorological data, is collected, and the collected precipitation data is cleaned, and the cleaned precipitation data is screened and processed to form time series data of precipitation events at a single station. The specific steps are as follows:
[0010] Step A1, data collection: determine the range and time period of historical weather station data to be collected, and obtain historical weather data of the required stations by querying the public data sources of the National Meteorological Administration, including precipitation data of precipitation intensity, precipitation duration, precipitation distribution, and meteorological data.
[0011] Step A2, data cleaning: Check whether there are missing values in the data. For missing data, identify and process the missing values in the precipitation data through interpolation methods;
[0012] Step A3, data screening and processing: based on the cleaned precipitation data, screen and process the historical site precipitation data, define precipitation event standards, including precipitation amount, precipitation duration, and precipitation interval, and identify and record each precipitation event, including start time, end time, and precipitation amount information. Based on the precipitation event definition standards, screen the historical site precipitation data and form the time series data of the precipitation event of a single site;
[0013] The step of forming the time series data of precipitation events at a single station further comprises the following steps:
[0014] Step A301, arranging in chronological order: arranging the precipitation event data of a single station in chronological order;
[0015] Step A302, forming time series data: converting the sorted single-station precipitation event data into a time series data format, using the timestamp as the horizontal axis and the precipitation as the vertical axis to form the time series data of the single-station precipitation event. If there are missing values in the time series, interpolation processing is performed to fill in the missing values to ensure the integrity of the time series.
[0016] In a preferred embodiment, in step 102, based on the processed single-station time series data, a dynamic time warping algorithm is used to time-align and match precipitation events at different stations to obtain similarity metrics between different historical weather patterns. The specific steps are as follows:
[0017] Step B1: The time series data of each precipitation element X in the precipitation event of a single station is expressed as X = {x 1 ,x 2 ,...,x n}, where x n Represents the precipitation data value at the nth time point. The specific calculation formula is as follows:
[0018]
[0019] Among them, X month represents the monthly single-station precipitation data time series, m represents the number of days in the month, n m represents the number of data points on the mth day;
[0020] Step B2, dynamic time warping: initialize a two-dimensional matrix to store the matching costs between time series, calculate the distance between each point between two time series, and gradually fill the matrix according to the idea of dynamic programming to find the best matching path. According to the best matching path, align the time series and find the best matching path according to the matching cost matrix. This can quantify the degree of similarity between different time series, help evaluate the similarity between time series data, and discover the intrinsic connections and rules between them.
[0021] In a preferred embodiment, the step of aligning the time series in the step B2 dynamic time warping includes: extracting features from historical precipitation data, including precipitation distribution and precipitation duration, assuming that the time series of the two precipitation elements are P = {p 1 ,p 2 ,...,p e} and Q = {q 1 ,q 2 ,...,q f}, where e and f represent the lengths of the two time series respectively. By minimizing the distance between the two time series, the constructed time series are similarly matched and aligned. The specific calculation formula is as follows:
[0022]
[0023] Where DTW(i,j) represents the dynamic time warping distance between the i-th point and the j-th point, d(p i ,q i ) represents the similarity measure between the i-th point and the j-th point, DTW(i,j), DTW(i,j-1) and DTW(i-1,j-1) represent three alignment methods respectively.
[0024] In a preferred embodiment, in step 103, the dynamic time warping method and the similarity metric are combined to establish a similarity analysis model, and similar precipitation patterns and laws are identified by performing similarity analysis on historical precipitation data. The specific steps are as follows:
[0025] Step C1, similarity measurement: After dynamic time warping, the similarity measurement values between different historical weather patterns are calculated using the Euclidean distance method. The similarity measurement values reflect the similarity of precipitation patterns between different stations and form a similarity matrix. The specific calculation formula is as follows:
[0026]
[0027] Among them, d(P,Q) represents the Euclidean distance between the time series of two meteorological elements, p g and q g They represent the meteorological data values at the g-th time point of the two time series. The smaller the Euclidean distance value, the more similar the two time series are; the larger the distance value, the less similar the two time series are.
[0028] Step C2, establishing a similarity analysis model: Based on the similarity metric, a similarity analysis model is established, and a classifier method is used to identify similar patterns and laws in historical precipitation data, and precipitation events are classified into different weather patterns through the classifier.
[0029] In a preferred embodiment, in the step C2 of establishing a similarity analysis model, a classifier method is used to identify similar patterns and regularities in historical precipitation data, and precipitation events are classified into different weather patterns by a classifier, further comprising the following steps:
[0030] Step C201, feature extraction: extract features from historical precipitation data, including statistical features of the average, maximum, and minimum values of precipitation, as well as duration and frequency time features of precipitation events, and use them as inputs to the classifier;
[0031] Step C202, data marking: marking the historical precipitation data into different weather modes, and classifying them according to the precipitation amount and duration indicators, marking the events with large precipitation amount and long duration as heavy rain mode, and marking the events with small precipitation amount and short duration as light rain mode;
[0032] Step C203, model evaluation: use the labeled historical precipitation data to train the model, use the cross-validation technique to evaluate the trained model, and check the performance of the model on the training set and the test set;
[0033] Step C204, model application: Use the trained classifier to classify and predict future precipitation events, identify different weather patterns, formulate response measures based on the classification results, and respond to different types of precipitation events in advance.
[0034] The beneficial effects of the present invention are as follows: historical weather site data, including precipitation data and other meteorological data, are collected and cleaned; based on the cleaned precipitation data, the historical site precipitation data are screened and processed to form time series data of precipitation events at a single site; based on the processed single site time series data, a dynamic time warping algorithm is used to time align and match precipitation events at different sites to obtain similarity metrics between different historical weather patterns; the dynamic time warping method and the similarity metrics are combined to establish a similarity analysis model; similar precipitation patterns and laws are identified by performing similarity analysis on historical precipitation data; the historical weather similarity analysis method based on dynamic time warping better reflects the similarity relationship between historical weather data by processing the similarity metrics between different time series, thereby improving the accuracy of the similarity metrics. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 The present invention is a flow chart of the method. DETAILED DESCRIPTION
[0036] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.
[0037] In the description of this application, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of this application, "plurality" means two or more, unless otherwise clearly and specifically defined.
[0038] In the description of the present application, the term "for example" is used to mean "used as an example, illustration or description". Any embodiment described as "for example" in the present application is not necessarily to be construed as being more preferred or advantageous than other embodiments. The following description is given to enable any technician in the field to implement and use the present invention. In the following description, details are listed for the purpose of explanation. It should be understood that a person of ordinary skill in the art can recognize that the present invention can be implemented without using these specific details. In other examples, well-known structures and processes will not be elaborated in detail to avoid unnecessary details to obscure the description of the present invention. Therefore, the present invention is not intended to be limited to the embodiments shown, but is consistent with the widest scope consistent with the principles and features disclosed in the present application.
[0039] Example 1
[0040] This embodiment provides Figure 1 A historical weather similarity analysis method based on a dynamic time warping method is shown, which specifically includes the following steps:
[0041] Step 101: collect historical weather station data, including precipitation data and other meteorological data, clean the collected precipitation data, filter and process the cleaned precipitation data to form time series data of precipitation events at a single station;
[0042] Step 102: Based on the processed single-station time series data, a dynamic time warping algorithm is used to time-align and match precipitation events at different stations to obtain similarity metrics between different historical weather patterns;
[0043] Step 103: Combine the dynamic time warping method and the similarity measurement value to establish a similarity analysis model, and identify similar precipitation patterns and laws by performing similarity analysis on historical precipitation data.
[0044] Preferably, in step 101, historical weather station data, including precipitation data and other meteorological data, are collected, and the collected precipitation data are cleaned, and the cleaned precipitation data are screened and processed to form time series data of precipitation events at a single station. The specific steps are as follows:
[0045] Step A1, data collection: determine the range and time period of historical weather station data to be collected, and obtain historical weather data of the required stations by querying the public data sources of the National Meteorological Administration, including precipitation data of precipitation intensity, precipitation duration, precipitation distribution, and meteorological data.
[0046] Step A2, data cleaning: Check whether there are missing values in the data. For missing data, identify and process the missing values in the precipitation data through interpolation methods;
[0047] Step A3, data screening and processing: Based on the cleaned precipitation data, screen and process the historical site precipitation data, define the precipitation event standards, including precipitation amount, precipitation duration, and precipitation interval, and identify and record each precipitation event, including start time, end time, and precipitation amount information. According to the precipitation event definition standards, screen the historical site precipitation data and form the time series data of the precipitation event of a single station.
[0048] Preferably, the forming of the time series data of precipitation events at a single station further comprises the following steps:
[0049] Step A301, arranging in chronological order: arranging the precipitation event data of a single station in chronological order;
[0050] Step A302, forming time series data: converting the sorted single-station precipitation event data into a time series data format, using the timestamp as the horizontal axis and the precipitation as the vertical axis to form the time series data of the single-station precipitation event. If there are missing values in the time series, interpolation processing is performed to fill in the missing values to ensure the integrity of the time series.
[0051] Preferably, in step 102, based on the processed single-station time series data, a dynamic time warping algorithm is used to time-align and match precipitation events at different stations to obtain similarity metrics between different historical weather patterns. The specific steps are as follows:
[0052] Step B1: The time series data of each precipitation element X in the precipitation event of a single station is expressed as X = {x 1 ,x 2 ,...,x n}, where x n Represents the precipitation data value at the nth time point. The specific calculation formula is as follows:
[0053]
[0054] Among them, X month represents the monthly single-station precipitation data time series, m represents the number of days in the month, n m represents the number of data points on the mth day;
[0055] Step B2, dynamic time warping: initialize a two-dimensional matrix to store the matching costs between time series, calculate the distance between each point between two time series, and gradually fill the matrix according to the idea of dynamic programming to find the best matching path. According to the best matching path, align the time series and find the best matching path according to the matching cost matrix. This can quantify the degree of similarity between different time series, help evaluate the similarity between time series data, and discover the intrinsic connections and rules between them.
[0056] Preferably, in the step B2 of dynamic time warping, the step of aligning the time series includes: extracting features from historical precipitation data, including precipitation distribution and precipitation duration, assuming that the time series of the two precipitation elements are P = {p 1 ,p 2 ,...,p e} and Q = {q 1 ,q 2 ,...,q f}, where e and f represent the lengths of the two time series respectively. By minimizing the distance between the two time series, the constructed time series are similarly matched and aligned. The specific calculation formula is as follows:
[0057]
[0058] Where DTW(i,j) represents the dynamic time warping distance between the i-th point and the j-th point, d(p i ,q i ) represents the similarity measure between the i-th point and the j-th point, DTW(i,j), DTW(i,j-1) and DTW(i-1,j-1) represent three alignment methods respectively.
[0059] Preferably, in step 103, the dynamic time warping method and the similarity metric are combined to establish a similarity analysis model, and similar precipitation patterns and laws are identified by performing similarity analysis on historical precipitation data. The specific steps are as follows:
[0060] Step C1, similarity measurement: After dynamic time warping, the similarity measurement values between different historical weather patterns are calculated using the Euclidean distance method. The similarity measurement values reflect the similarity of precipitation patterns between different stations and form a similarity matrix. The specific calculation formula is as follows:
[0061]
[0062] Among them, d(P,Q) represents the Euclidean distance between the time series of two meteorological elements, p g and q g They represent the meteorological data values at the g-th time point of the two time series. The smaller the Euclidean distance value, the more similar the two time series are; the larger the distance value, the less similar the two time series are.
[0063] Step C2, establishing a similarity analysis model: Based on the similarity metric, a similarity analysis model is established, and a classifier method is used to identify similar patterns and laws in historical precipitation data, and precipitation events are classified into different weather patterns through the classifier.
[0064] Preferably, in the step C2 of establishing a similarity analysis model, a classifier method is used to identify similar patterns and regularities in historical precipitation data, and precipitation events are classified into different weather patterns by a classifier, further comprising the following steps:
[0065] Step C201, feature extraction: extract features from historical precipitation data, including statistical features of the average, maximum, and minimum values of precipitation, as well as duration and frequency time features of precipitation events, and use them as inputs to the classifier;
[0066] Step C202, data marking: marking the historical precipitation data into different weather modes, and classifying them according to the precipitation amount and duration indicators, marking the events with large precipitation amount and long duration as heavy rain mode, and marking the events with small precipitation amount and short duration as light rain mode;
[0067] Step C203, model evaluation: use the labeled historical precipitation data to train the model, use the cross-validation technique to evaluate the trained model, and check the performance of the model on the training set and the test set;
[0068] Step C204, model application: Use the trained classifier to classify and predict future precipitation events, identify different weather patterns, formulate response measures based on the classification results, and respond to different types of precipitation events in advance.
[0069] It should be noted that in the above embodiments, the description of each embodiment has its own emphasis, and for parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0070] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0071] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded computer, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0072] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0073] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0074] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0075] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A historical weather similarity analysis method based on dynamic time warping method, characterized in that: The specific steps include: Step 101: collect historical weather station data, including precipitation data and other meteorological data, clean the collected precipitation data, filter and process the cleaned precipitation data to form time series data of precipitation events at a single station; Step 102: Based on the processed single-station time series data, a dynamic time warping algorithm is used to time-align and match precipitation events at different stations to obtain similarity metrics between different historical weather patterns; Step 103: Combine the dynamic time warping method and the similarity measurement value to establish a similarity analysis model, and identify similar precipitation patterns and laws by performing similarity analysis on historical precipitation data.
2. The method for analyzing historical weather similarity based on dynamic time warping method according to claim 1, characterized in that: In step 101, historical weather station data, including precipitation data and other meteorological data, are collected, and the collected precipitation data is cleaned, and the cleaned precipitation data is screened and processed to form time series data of precipitation events at a single station. The specific steps are as follows: Step A1, data collection: determine the scope and time period of historical weather station data to be collected, and obtain historical weather data of the required stations by querying the public data sources of the National Meteorological Administration, including precipitation data of precipitation intensity, precipitation duration, precipitation distribution, and meteorological data. Step A2, data cleaning: Check whether there are missing values in the data. For missing data, identify and process the missing values in the precipitation data through interpolation methods; Step A3, data screening and processing: Based on the cleaned precipitation data, screen and process the historical site precipitation data, define the precipitation event standard, and identify and record each precipitation event. According to the precipitation event definition standard, screen the historical site precipitation data and form the time series data of the single site precipitation event.
3. The historical weather similarity analysis method based on dynamic time warping method according to claim 2 is characterized in that: The forming of the time series data of precipitation events at a single station further comprises the following steps: Step A301, arranging in chronological order: arranging the precipitation event data of a single station in chronological order; Step A302, forming time series data: converting the sorted single-station precipitation event data into a time series data format, using the timestamp as the horizontal axis and the precipitation as the vertical axis to form the time series data of the single-station precipitation event.
4. The historical weather similarity analysis method based on dynamic time warping method according to claim 1 is characterized in that: In step 102, based on the processed single-station time series data, a dynamic time warping algorithm is used to time-align and match precipitation events at different stations to obtain similarity metrics between different historical weather patterns. The specific steps are as follows: Step B1: The time series data of each precipitation element X in the precipitation event of a single station is expressed as X = {x1, x2, ..., x n }, where x n Represents the precipitation data value at the nth time point. The specific calculation formula is as follows: Among them, X month represents the monthly single-station precipitation data time series, m represents the number of days in the month, n m represents the number of data points on the mth day; Step B2, dynamic time warping: Initialize a two-dimensional matrix to store the matching cost between time series, calculate the distance between each point of the two time series, and gradually fill the matrix according to the idea of dynamic programming to find the best matching path. According to the best matching path, align the time series.
5. The method for analyzing historical weather similarity based on dynamic time warping method according to claim 4, characterized in that: In the step B2 of dynamic time warping, the step of aligning the time series includes: extracting features from historical precipitation data, including precipitation distribution and precipitation duration, assuming that the time series of the two precipitation elements are P = {p1, p2, ..., p e } and Q={q1,q2,...,q f }, where e and f represent the lengths of the two time series respectively. By minimizing the distance between the two time series, the constructed time series are similarly matched and aligned. The specific calculation formula is as follows: Where DTW(i,j) represents the dynamic time warping distance between the i-th point and the j-th point, d(p i ,q i ) represents the similarity measure between the i-th point and the j-th point, DTW(i,j), DTW(i,j-1) and DTW(i-1,j-1) represent three alignment methods respectively.
6. The method for analyzing historical weather similarity based on dynamic time warping method according to claim 1, characterized in that: In step 103, the dynamic time warping method and the similarity metric are combined to establish a similarity analysis model. By performing similarity analysis on historical precipitation data, similar precipitation patterns and laws are identified. The specific steps are as follows: Step C1, similarity measurement: After dynamic time warping, the Euclidean distance method is used to calculate the similarity measurement values between different historical weather patterns. The specific calculation formula is as follows: Among them, d(P,Q) represents the Euclidean distance between the time series of two meteorological elements, p g and q g They represent the meteorological data values at the g-th time point of the two time series respectively; Step C2, establishing a similarity analysis model: Based on the similarity metric, a similarity analysis model is established, and a classifier method is used to identify similar patterns and laws in historical precipitation data, and precipitation events are classified into different weather patterns through the classifier.
7. The method for analyzing historical weather similarity based on dynamic time warping method according to claim 6, characterized in that: In the step C2 of establishing a similarity analysis model, a classifier method is used to identify similar patterns and regularities in historical precipitation data, and precipitation events are classified into different weather patterns by the classifier, further comprising the following steps: Step C201, feature extraction: extract features from historical precipitation data, including statistical features of the average, maximum, and minimum values of precipitation, as well as duration and frequency time features of precipitation events, and use them as inputs to the classifier; Step C202, data labeling: labeling historical precipitation data into different weather patterns and classifying them according to the precipitation amount and duration indicators; Step C203, model evaluation: use the labeled historical precipitation data to train the model, use the cross-validation technique to evaluate the trained model, and check the performance of the model on the training set and the test set; Step C204, model application: Use the trained classifier to classify and predict future precipitation events, identify different weather patterns, formulate response measures based on the classification results, and respond to different types of precipitation events in advance.
Citation Information
Cited By
Weather history case-oriented similarity calculation method and visual viewing device
CN120256977A
A method for calculating similarity of weather history cases and a visual viewing device
CN120256977B
Method for determining unknown meteorological message
TWI934597B
