Weather forecasting method and device for target area, storage medium and electronic device
By integrating and segmenting meteorological elements within the target area, and combining the architecture of encoders and alignment networks, the problem of poor forecasting results caused by large amounts of meteorological data with different dimensions is solved, thus achieving high accuracy and efficiency in high-resolution weather forecasting.
Patent Information
- Application Number
- CN202411244019.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-05
- Publication Date
- 2026-03-17
AI Technical Summary
In existing technologies, meteorological data is too large in volume and different meteorological elements have different dimensions, making it impossible to process them uniformly, resulting in poor weather forecasting.
By integrating multiple meteorological elements within the target area to form a three-dimensional feature matrix, and then dividing it along the latitude and longitude dimensions to obtain meteorological element blocks of the same size, these blocks are processed using a meteorological forecasting model. By combining an encoder, alignment network, and decoder architecture, high-resolution meteorological forecasting is achieved.
This improves the accuracy of weather forecasts, enabling the model to learn information and relationships of all meteorological elements at all altitude levels, reducing computational load and achieving high-resolution weather forecasts.
Smart Images

Figure CN121679749A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of computers, in particular to a target area weather forecast method and device, storage medium and electronic device. BACKGROUND
[0002] With the transformation of global energy structure, renewable energy, especially new energy such as solar energy and wind energy, has gradually become an important part of the global energy system. However, the output of these new energies is greatly affected by weather conditions, so high-precision weather forecasts are needed to optimize new energy power generation plans and scheduling.
[0003] Although high-performance computing is developing rapidly, the traditional numerical calculation-based new energy high-resolution weather forecast method is still restricted by computing time and economic cost in the actual application of the energy industry. With the development of artificial intelligence, weather forecasting based on artificial intelligence has gradually attracted the attention of researchers. However, current weather forecasting based on artificial intelligence still mainly focuses on coarse resolution, and there are still few studies on high-resolution weather forecasting for new energy.
[0004] Meteorological data and image data have certain similarities, however, the difference between high-resolution meteorological data and images is that the input data dimension of high-resolution meteorological data is wider, equivalent to tens or even hundreds of times of a single image, which causes the computational load of the model to increase exponentially; on the other hand, due to the different dimensions of different meteorological elements of meteorological data, it cannot be directly input into the model for processing. These factors result in the inability to accurately complete the weather forecasting in the new energy field.
[0005] In view of the problem in the related art that the data volume of meteorological data is too large, and different meteorological elements have different dimensions and cannot be uniformly processed, resulting in poor weather forecasting effect, no effective solution has been proposed so far.
[0006] Therefore, it is necessary to improve the related art to overcome the defects in the related art. SUMMARY
[0007] The embodiments of the present application provide a target area weather forecast method and device, storage medium and electronic device to at least solve the problem in the related art that the data volume of meteorological data is too large, and different meteorological elements have different dimensions and cannot be uniformly processed, resulting in poor weather forecasting effect.
[0008] According to an aspect of an embodiment of the present application, a weather forecasting method for a target area is provided. The method includes: integrating a plurality of weather elements at different spatial positions in the target area to obtain a first weather element matrix, wherein the plurality of weather elements include a plurality of categories, and the first weather element matrix is a three-dimensional feature matrix; performing segmentation processing on the first weather element matrix in the latitude and longitude dimension from a first latitude and longitude coordinate to obtain a plurality of first weather element blocks, wherein the plurality of first weather element blocks have the same size, and the height of the plurality of first weather element blocks and the height of the first weather element matrix are both a first height; and processing the plurality of first weather element blocks by using a weather forecasting model to obtain a weather forecasting result for the target area.
[0009] In an example embodiment, performing segmentation processing on the first weather element matrix in the latitude and longitude dimension from a first latitude and longitude coordinate to obtain a plurality of first weather element blocks includes: determining size information of each first weather element block; and segmenting the first weather element matrix according to the size information from the first latitude and longitude coordinate to obtain m complete weather element blocks and n incomplete weather element blocks, wherein m is a positive integer, and n is an integer.
[0010] In an example embodiment, processing the plurality of first weather element blocks by using a weather forecasting model to obtain a weather forecasting result for the target area includes: encoding the plurality of first weather element blocks by using an encoder to obtain a plurality of first encoded blocks, wherein the latitude and longitude coordinates of the plurality of first encoded blocks are the same as the latitude and longitude coordinates of the plurality of first weather element blocks, the height of the plurality of first encoded blocks is a second height, and the second height is less than the first height; processing the plurality of first encoded blocks by using an alignment network to obtain a first feature map corresponding to the first weather element matrix; and decoding the first feature map by using a decoder to obtain the weather forecasting result.
[0011] In an example embodiment, processing the plurality of first encoding blocks by the alignment network to obtain the first feature map corresponding to the first meteorological element matrix comprises: performing multi-head self-attention operation on the plurality of first encoding blocks to obtain a first operation result; performing multi-layer perception operation on the first operation result to obtain a second feature map, wherein the multi-layer perception operation is configured to perform nonlinear transformation on the first operation result, and the second feature map comprises a second meteorological element matrix and meteorological element features corresponding to the second meteorological element matrix, and the second meteorological element matrix corresponds to the plurality of first meteorological element blocks; performing transformation region self-attention operation on the second feature map to obtain a second operation result; and performing multi-layer perception operation on the second operation result to obtain the first feature map.
[0012] In an example embodiment, performing transformation region self-attention operation on the second feature map to obtain a second operation result comprises: performing segmentation processing on the second feature map in the latitude and longitude dimension from a second latitude and longitude coordinate to obtain a plurality of second encoding blocks; and performing multi-head self-attention operation on the plurality of second encoding blocks to obtain the second operation result.
[0013] In an example embodiment, performing multi-head self-attention operation on the plurality of first encoding blocks to obtain a first operation result comprises: performing region feature value calculation on the plurality of first encoding blocks by formula AttRi=Softmax((Regioni*W+b)×(Regioni*W+b)) / (region_size×region_size)(Regioni*W+b) to obtain a plurality of region feature values, wherein AttRi is a region feature value corresponding to an i-th first encoding block, Regioni is meteorological element features corresponding to the i-th first encoding block, W and b are network parameters of the alignment network and are configured to transform the meteorological element features from three-dimensional features to two-dimensional features, Softmax is configured to calculate self-attention weights corresponding to the first encoding blocks, and i is a positive integer; and processing the plurality of region feature values by formula MultiHeadAttR=Concat(AttR1, AttR2,..., AttRn)*W to obtain the first operation result, wherein MultiHeadAttR is the first operation result, and Concat is a concatenation function. i i i T i i i n
[0014] According to another aspect of the embodiments of the present application, a weather forecasting device for a target area is also provided, comprising: a unification module configured to unify a plurality of weather elements at different spatial positions in the target area to obtain a first weather element matrix, wherein the plurality of weather elements comprises a plurality of categories, and the first weather element matrix is a three-dimensional feature matrix; a segmentation module configured to segment the first weather element matrix in the latitude and longitude dimensions starting from a first latitude and longitude coordinate to obtain a plurality of first weather element blocks, wherein the plurality of first weather element blocks are of the same size, and the height of the plurality of first weather element blocks and the height of the first weather element matrix are both a first height; and a processing module configured to process the plurality of first weather element blocks by using a weather forecasting model to obtain a weather forecasting result for the target area.
[0015] According to still another aspect of the embodiments of the present application, a computer readable storage medium is also provided, which stores a computer program, wherein the computer program is configured to execute the weather forecasting method for a target area when running.
[0016] According to still another aspect of the embodiments of the present application, an electronic device is also provided, which comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the weather forecasting method for a target area by using the computer program.
[0017] According to still another aspect of the embodiments of the present application, a computer program product is also provided, which comprises a computer program, and the computer program is executed by a processor to implement the steps of the method described in the embodiments of the present application.
[0018] According to the present application, first, weather elements at different spatial positions in a target area are mixed and spliced to obtain a first weather element matrix, wherein the weather elements comprise a plurality of categories, and the first weather element matrix is a three-dimensional feature matrix; then, the first weather element matrix is segmented in the latitude and longitude dimensions to obtain a plurality of first weather element blocks, wherein the first weather element blocks are of the same size, and the height of the plurality of first weather element blocks and the height of the first weather element matrix are both a first height; finally, the first weather element blocks are processed by using a weather forecasting model to obtain a weather forecasting result for the target area; by using the above scheme, the weather elements are mixed and spliced, so that the model can learn the information and correlation of all weather elements at all height layers, and a Transformer architecture in the visual field is improved to obtain a weather forecasting model capable of predicting high-resolution weather elements, so that the weather forecasting result obtained by processing is more accurate; thereby solving the problem in the related art that the amount of weather data is too large, and the dimensions of different weather elements are different and cannot be uniformly processed, resulting in poor weather forecasting effect. Attached Figure Description
[0019] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0020] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1 This is a hardware structure block diagram of a computer terminal for a weather forecasting method for a target area according to an embodiment of this application;
[0022] Figure 2 This is a flowchart of a weather forecasting method for a target area according to an embodiment of this application;
[0023] Figure 3 This is a schematic diagram of a region segmentation process according to an embodiment of this application;
[0024] Figure 4 This is a flowchart illustrating a high-resolution weather forecasting method according to an embodiment of this application;
[0025] Figure 5 This is a schematic diagram of the architecture of a high-resolution weather forecasting model according to an embodiment of this application;
[0026] Figure 6 This is a structural block diagram of a weather forecasting device for a target area according to an embodiment of this application. Detailed Implementation
[0027] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0028] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0029] The methods and embodiments provided in this application can be executed on a computer terminal or similar computing device. Taking running on a computer terminal as an example, Figure 1 This is a hardware structure block diagram of a computer terminal for a weather forecasting method for a target area according to an embodiment of this application. For example... Figure 1 As shown, a computer terminal may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor (MCU) or a field-programmable gate array (FPGA)) and a memory 104 for storing data are also shown. The computer terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the computer terminal described above. For example, the computer terminal may also include components that are more complex than those described above. Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0030] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the weather forecasting method for the target area in this embodiment. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, thereby implementing the above-described method. The memory 104 may include high-speed random access memory and non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to a computer terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0031] The computer terminal uses a wireless network provided by a communications provider. In one example, transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, transmission device 106 may be a Radio Frequency (RF) module used for wireless communication with the Internet.
[0032] The following explains the technical terms used in this application:
[0033] CNN: Convolutional Neural Networks;
[0034] MLP: Multilayer Perceptron.
[0035] This embodiment provides a weather forecasting method for a target area. Figure 2 This is a flowchart of a weather forecasting method for a target area according to an embodiment of this application, such as... Figure 2 As shown, the process includes the following steps S202-S206:
[0036] Step S202: Integrate multiple meteorological elements at different spatial locations in the target area to obtain a first meteorological element matrix, wherein the multiple meteorological elements include multiple categories, and the first meteorological element matrix is a three-dimensional feature matrix;
[0037] It should be noted that multiple meteorological elements can include: U-wind, V-wind, temperature, humidity, air pressure, etc.
[0038] Step S204: The first meteorological element matrix is segmented starting from the first latitude and longitude coordinates in the latitude and longitude dimension to obtain multiple first meteorological element blocks, wherein the multiple first meteorological element blocks are of the same size and the height of the multiple first meteorological element blocks and the height of the first meteorological element matrix are both the first height;
[0039] It should be noted that the above segmentation of the first meteorological element matrix in the latitude and longitude dimensions can be understood as not segmenting the height dimension of the matrix, but only segmenting the longitude and latitude of the matrix to complete the segmentation process.
[0040] Step S206: Process the multiple first meteorological element blocks using a meteorological forecasting model to obtain the meteorological forecast results for the target area.
[0041] It should be noted that the above weather forecast results can be understood as the prediction of multiple meteorological elements in the target area at the second moment by processing multiple meteorological elements at the first moment and then using a weather forecast model to predict and analyze the data. That is, the above weather forecast results, where the second moment is later than the first moment.
[0042] Through the above steps, meteorological elements from different spatial locations within the target area are first mixed and stitched together to obtain a first meteorological element matrix. The meteorological elements include multiple categories, and the first meteorological element matrix is a three-dimensional feature matrix. Then, the first meteorological element matrix is divided along the latitude and longitude dimensions to obtain multiple first meteorological element blocks. These blocks are of the same size, and their heights are the same as the height of the first meteorological element matrix, all representing the first height. Finally, these first meteorological element blocks are processed by a meteorological forecasting model to obtain the meteorological forecast results for the target area. This scheme, by mixing and stitching meteorological elements, allows the model to learn the information and relationships of all meteorological elements at all height levels. It also improves upon a Transformer architecture in the visual domain, resulting in a meteorological forecasting model capable of predicting high-resolution meteorological elements, making the processed meteorological forecast results more accurate. This solves the problem in related technologies where the amount of meteorological data is too large, and the different dimensions of different meteorological elements cannot be processed uniformly, leading to poor meteorological forecast results.
[0043] In an exemplary embodiment, the first meteorological element matrix is segmented starting from the first latitude and longitude coordinate to obtain multiple first meteorological element blocks, including: determining the size information of each first meteorological element block; segmenting the first meteorological element matrix according to the size information starting from the first latitude and longitude coordinate to obtain m complete meteorological element blocks and n incomplete meteorological element blocks, where m is a positive integer and n is an integer; zero-filling the n incomplete meteorological element blocks according to the size information to obtain n completed meteorological element blocks, wherein the multiple first meteorological element blocks include the m complete meteorological element blocks and the n completed meteorological element blocks.
[0044] First, a square region size is defined, representing the dimensions of the first meteorological element. The side length of the square is represented by `region_size`. Then, the first meteorological element matrix obtained after concatenation is segmented starting from the edge of the target region (i.e., the aforementioned first latitude and longitude coordinates). If any remaining edge portion of the segmented matrix (i.e., the aforementioned incomplete meteorological element blocks) is smaller than the defined square region size, zero-padding is used to fill it in. The segmentation process is as follows: Figure 3 As shown, Figure 3 The "meteorological elements displayed in latitude and longitude" is the first meteorological element matrix, and the "defined square area" is used to indicate the aforementioned size information. Figure 3 The right side of the diagram shows a schematic diagram of the segmented matrix, with the shaded areas on the right and bottom edges representing zero-filled portions.
[0045] Further, the multiple first meteorological element blocks are processed by a meteorological forecasting model to obtain the meteorological forecast result for the target area, including: encoding the multiple first meteorological element blocks by an encoder to obtain multiple first coded blocks, wherein the latitude and longitude coordinates of the multiple first coded blocks are the same as the latitude and longitude coordinates of the multiple first meteorological element blocks, and the height of the multiple first coded blocks is a second height, which is less than the first height; processing the multiple first coded blocks by an alignment network to obtain a first feature map corresponding to the first meteorological element matrix; and decoding the first feature map by a decoder to obtain the meteorological forecast result.
[0046] This application proposes an optional weather forecasting model architecture, including an encoder, an alignment network, and a decoder; the specific process of completing the weather forecasting process using this architecture is as follows:
[0047] 1. Encoder: CNN can be used as the encoder. The parameter settings are shown in Table 1. The number of output channels, Embed_dim (corresponding to the second height mentioned above), can be set as needed.
[0048] Table 1 Encoder CNN Parameter Settings
[0049]
[0050] 2. Alignment network: The architecture of the alignment network module is region self-attention-MLP-transformed region self-attention-MLP, with residual connections introduced in between to avoid gradient vanishing.
[0051] Optionally, processing the plurality of first coding blocks through an alignment network to obtain a first feature map corresponding to the first meteorological element matrix includes: performing multi-head self-attention operation on the plurality of first coding blocks to obtain a first operation result; performing multilayer perceptron operation on the first operation result to obtain a second feature map, wherein the multilayer perceptron operation is used to perform a nonlinear transformation on the first operation result, and the second feature map includes: a second meteorological element matrix and meteorological element features corresponding to the second meteorological element matrix, the second meteorological element matrix corresponding to the plurality of first meteorological element blocks; performing transform region self-attention operation on the second feature map to obtain a second operation result; and performing multilayer perceptron operation on the second operation result to obtain the first feature map.
[0052] Regional self-attention and transformed regional self-attention are implemented based on the multi-head self-attention mechanism. Regional self-attention transforms the variables within each square region (i.e., meteorological element block) from 3D to 2D by performing multi-head self-attention operations. Multilayer perceptron operation, also known as MLP operation, is calculated as follows: MLP = ReLU(ReLU(MultiHeadAttR W+b)W+b), where ReLU is the activation function, MultiHeadAttR is the first operation result, and W and b are training parameters.
[0053] Optionally, a transform region self-attention operation is performed on the second feature map to obtain a second operation result, including: segmenting the second feature map in the latitude and longitude dimension starting from the second latitude and longitude coordinates to obtain multiple second coding blocks; and performing a multi-head self-attention operation on the multiple second coding blocks to obtain the second operation result.
[0054] The transformation region self-attention operation requires the second feature map to be segmented again, but the starting point of the segmentation is different. Compared with the first segmentation, the starting point of the segmentation will be shifted by ([region_size / 2], [region_size / 2]) steps to obtain multiple second coding blocks. Then, multi-head self-attention operation is performed on these second coding blocks to obtain the second budget result.
[0055] Optionally, a multi-head self-attention operation is performed on the plurality of first coding blocks to obtain a first operation result, including: using the formula AttR i=Softmax((Region i *W+b)×(Region i *W+b) T / (region_size×region_size))(Region i *W+b) Calculate the region feature values for the plurality of first coding blocks to obtain a plurality of region feature values, wherein AttR i For the region feature value corresponding to the i-th first coding block, Region i For the meteorological element features corresponding to the i-th first coding block, W and b are the network parameters of the alignment network used to transform the meteorological element features from three-dimensional features to two-dimensional features. Softmax is used to calculate the self-attention weights corresponding to the first coding block, where i is a positive integer. The formula MultiHeadAttR=Concat(AttR1,AttR2,...,AttR) is used to calculate the self-attention weights corresponding to the first coding block. n The first operation result is obtained by processing the feature values of the multiple regions using )*W, where MultiHeadAttR is the first operation result and Concat is the concatenation function.
[0056] The multi-head self-attention operation process includes: first, using the formula AttR i =Softmax((Region i *W+b)×(Region i *W+b) T / (region_size×region_size))(Region i *W+b) calculates regional feature values for multiple input coded blocks, resulting in multiple regional feature values, AttR. i For the region feature value corresponding to the i-th coded block, Region i Let W and b be the meteorological feature corresponding to the i-th coding block, and W and b be the network training parameters of the alignment network. Based on these parameters, the meteorological feature can be transformed from three-dimensional features to two-dimensional features. Softmax is used to calculate the self-attention weights corresponding to the coding block. Then, the obtained multiple regional feature values are substituted into the formula MultiHeadAttR=Concat(AttR1,AttR2,...,AttR) n The first result is obtained by performing the operation in W.
[0057] 3. Decoder: Optional. Deconvolution can be used as the decoder. The parameter settings are shown in Table 2.
[0058] Table 2 Decoder Parameter Settings
[0059]
[0060] In an optional embodiment, this application proposes a high-resolution weather forecasting method based on artificial intelligence technology. This method improves upon a Transformer architecture from the vision domain, proposing a novel encoding-network-decoding approach for predicting high-resolution weather elements at time T1 from high-resolution weather elements at time T0. The overall flowchart of this method is shown below. Figure 4 As shown, it includes the following steps:
[0061] Step 1: Input meteorological element data at time T0;
[0062] Step 2: Integration of meteorological elements;
[0063] Step 3: Use an encoder to encode the integrated meteorological elements;
[0064] Step 4: Process the encoded results using an alignment network;
[0065] Step 5: Use a decoder to decode the processing result;
[0066] Step 6: Output meteorological element data at time T1.
[0067] The aforementioned high-resolution weather forecasting methods can be applied to, for example... Figure 5 In the high-resolution weather forecasting model shown, such as Figure 5 As shown, the model includes: a meteorological element integration module, an encoder, an alignment network, and a decoder; the functions of each module are as follows:
[0068] (1) Meteorological element integration module: First, meteorological elements are mixed and spliced. Because some meteorological elements contain multiple layers in the height dimension, while others only contain one layer in the height dimension, all meteorological element variables are spliced in the height dimension so that the model can learn the information and correlation of all meteorological elements in all height layers.
[0069] Next, the size of the square region is set (i.e., the size information mentioned above), identified by region_size. The stitched meteorological elements (i.e., the first meteorological element matrix mentioned above) are divided into regions according to the latitude and longitude dimensions. If any edge part after division is smaller than the set square region size, zero-padding is used to fill it in, as shown in the diagram. Figure 3 As shown.
[0070] (2) Encoder: CNN is used as the encoder. The parameter settings are shown in Table 1. The number of output channels, Embed_dim, can be set as needed.
[0071] (3) Alignment Network: The architecture of the network modules is constructed as Region Self-Attention - MLP - Transformed Region Self-Attention - MLP, with residual connections introduced in between to avoid gradient vanishing. Region self-attention and transformed region self-attention are implemented based on the multi-head self-attention mechanism. Region self-attention transforms the variables in each square region after region segmentation from 3D to 2D and performs multi-head self-attention operation. Transformed region self-attention performs multi-head self-attention operation in each square region after the square region is translated ([region_size / 2], [region_size / 2]) and compensated. The translation rule follows the window translation rule in Swing Transformer.
[0072] It should be noted that the alignment network module can be used N times in the model to increase the model network depth and improve the model's learning ability.
[0073] (4) Decoder: Deconvolution is used as the decoder, and the parameter settings are shown in Table 2. The decoder output is the high-resolution meteorological element value at time T1, which is the above meteorological forecast result.
[0074] Through the above embodiments, a high-resolution weather forecasting method based on the Swin Transformer, namely encoding-alignment network-decoding, is proposed, which reduces the computational load of the model and effectively realizes the transfer of Swin Transformer to the meteorological field.
[0075] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods of the various embodiments of this application.
[0076] This embodiment also provides a weather forecasting device for a target area, which is used to implement the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0077] Figure 6This is a structural block diagram of a weather forecasting device for a target area according to an embodiment of this application. The device includes:
[0078] Integration module 62 is used to integrate multiple meteorological elements at different spatial locations in the target area to obtain a first meteorological element matrix, wherein the multiple meteorological elements include multiple categories, and the first meteorological element matrix is a three-dimensional feature matrix.
[0079] The segmentation module 64 is used to segment the first meteorological element matrix in the latitude and longitude dimension starting from the first latitude and longitude coordinates to obtain multiple first meteorological element blocks, wherein the multiple first meteorological element blocks are the same size and the height of the multiple first meteorological element blocks and the height of the first meteorological element matrix are both the first height.
[0080] The processing module 66 is used to process the multiple first meteorological element blocks through a meteorological forecasting model to obtain the meteorological forecast results for the target area.
[0081] Using the aforementioned device, meteorological elements from different spatial locations within the target area are first mixed and stitched together to obtain a first meteorological element matrix. The meteorological elements include multiple categories, and the first meteorological element matrix is a three-dimensional feature matrix. Then, the first meteorological element matrix is divided along latitude and longitude dimensions to obtain multiple first meteorological element blocks. These blocks are of the same size, and their heights are the same as the height of the first meteorological element matrix, all representing the first height. Finally, these first meteorological element blocks are processed by a meteorological forecasting model to obtain the meteorological forecast results for the target area. This scheme, by mixing and stitching meteorological elements, allows the model to learn the information and relationships of all meteorological elements at all height levels. It also improves upon a Transformer architecture in the visual domain, resulting in a meteorological forecasting model capable of predicting high-resolution meteorological elements, making the processed meteorological forecast results more accurate. This solves the problem in related technologies where the amount of meteorological data is too large, and the different dimensions of different meteorological elements cannot be processed uniformly, leading to poor meteorological forecast results.
[0082] Optionally, the segmentation module 64 is further configured to determine the size information of each first meteorological element block; starting from the first latitude and longitude coordinates, the first meteorological element matrix is segmented according to the size information to obtain m complete meteorological element blocks and n incomplete meteorological element blocks, where m is a positive integer and n is an integer; the n incomplete meteorological element blocks are zero-filled according to the size information to obtain n completed meteorological element blocks, wherein the plurality of first meteorological element blocks include the m complete meteorological element blocks and the n completed meteorological element blocks.
[0083] Optionally, the processing module 66 is further configured to encode the plurality of first meteorological element blocks using an encoder to obtain a plurality of first coded blocks, wherein the latitude and longitude coordinates of the plurality of first coded blocks are the same as the latitude and longitude coordinates of the plurality of first meteorological element blocks, and the height of the plurality of first coded blocks is a second height, which is less than the first height; process the plurality of first coded blocks using an alignment network to obtain a first feature map corresponding to the first meteorological element matrix; and decode the first feature map using a decoder to obtain the weather forecast result.
[0084] Optionally, the processing module 66 is further configured to perform multi-head self-attention operation on the plurality of first coding blocks to obtain a first operation result; perform multilayer perceptron operation on the first operation result to obtain a second feature map, wherein the multilayer perceptron operation is used to perform nonlinear transformation on the first operation result, the second feature map includes: a second meteorological element matrix and meteorological element features corresponding to the second meteorological element matrix, the second meteorological element matrix corresponding to the plurality of first meteorological element blocks; perform transform region self-attention operation on the second feature map to obtain a second operation result; and perform multilayer perceptron operation on the second operation result to obtain the first feature map.
[0085] Optionally, the processing module 66 is further configured to segment the second feature map starting from the second latitude and longitude coordinates in the latitude and longitude dimension to obtain multiple second coding blocks; and to perform multi-head self-attention operation on the multiple second coding blocks to obtain the second operation result.
[0086] Optionally, the aforementioned processing module 66 is also used to process the formula AttR i =Softmax((Region i *W+b)×(Region i *W+b) T / (region_size×region_size))(Region i *W+b) Calculate the region feature values for the plurality of first coding blocks to obtain a plurality of region feature values, wherein AttR i For the region feature value corresponding to the i-th first coding block, Region i For the meteorological element features corresponding to the i-th first coding block, W and b are the network parameters of the alignment network used to transform the meteorological element features from three-dimensional features to two-dimensional features. Softmax is used to calculate the self-attention weights corresponding to the first coding block, where i is a positive integer. The formula MultiHeadAttR=Concat(AttR1,AttR2,...,AttR) is used to calculate the self-attention weights corresponding to the first coding block. nThe first operation result is obtained by processing the feature values of the multiple regions using )*W, where MultiHeadAttR is the first operation result and Concat is the concatenation function.
[0087] Embodiments of this application also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above method embodiments when run.
[0088] Optionally, in this embodiment, the storage medium may be configured to store a computer program for performing the following steps:
[0089] S1, integrate multiple meteorological elements at different spatial locations in the target area to obtain a first meteorological element matrix, wherein the multiple meteorological elements include multiple categories, and the first meteorological element matrix is a three-dimensional feature matrix;
[0090] S2, the first meteorological element matrix is segmented starting from the first latitude and longitude coordinates in the latitude and longitude dimension to obtain multiple first meteorological element blocks, wherein the multiple first meteorological element blocks are the same size and the height of the multiple first meteorological element blocks and the height of the first meteorological element matrix are both the first height;
[0091] S3, the multiple first meteorological element blocks are processed by the meteorological forecast model to obtain the meteorological forecast results for the target area.
[0092] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.
[0093] Specific examples in this embodiment can be found in the examples described in the above embodiments and exemplary implementations, and will not be repeated here.
[0094] Embodiments of this application also provide an electronic device including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.
[0095] Optionally, in this embodiment, the processor can be configured to perform the following steps via a computer program:
[0096] S1, integrate multiple meteorological elements at different spatial locations in the target area to obtain a first meteorological element matrix, wherein the multiple meteorological elements include multiple categories, and the first meteorological element matrix is a three-dimensional feature matrix;
[0097] S2, the first meteorological element matrix is segmented starting from the first latitude and longitude coordinates in the latitude and longitude dimension to obtain multiple first meteorological element blocks, wherein the multiple first meteorological element blocks are the same size and the height of the multiple first meteorological element blocks and the height of the first meteorological element matrix are both the first height;
[0098] S3, the multiple first meteorological element blocks are processed by the meteorological forecast model to obtain the meteorological forecast results for the target area.
[0099] In one exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.
[0100] Embodiments of this application also provide a computer program product, including a non-volatile computer-readable storage medium storing the computer program product, wherein the computer program, when executed by a processor, implements the steps of the methods described in various embodiments of this application.
[0101] Optionally, in this embodiment, the computer program described above can be configured to perform the following steps when executed by the processor:
[0102] S1, integrate multiple meteorological elements at different spatial locations in the target area to obtain a first meteorological element matrix, wherein the multiple meteorological elements include multiple categories, and the first meteorological element matrix is a three-dimensional feature matrix;
[0103] S2, the first meteorological element matrix is segmented starting from the first latitude and longitude coordinates in the latitude and longitude dimension to obtain multiple first meteorological element blocks, wherein the multiple first meteorological element blocks are the same size and the height of the multiple first meteorological element blocks and the height of the first meteorological element matrix are both the first height;
[0104] S3, the multiple first meteorological element blocks are processed by the meteorological forecast model to obtain the meteorological forecast results for the target area.
[0105] Specific examples in this embodiment can be found in the examples described in the above embodiments and exemplary implementations, and will not be repeated here.
[0106] Obviously, those skilled in the art should understand that the modules or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented here, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.
[0107] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A method of weather prediction for a target area, characterized by, The method comprises the following steps: Integrating a plurality of meteorological elements at different spatial positions in a target area to obtain a first meteorological element matrix, wherein the plurality of meteorological elements comprise a plurality of categories, and the first meteorological element matrix is a three-dimensional feature matrix; Segmenting the first meteorological element matrix in the latitude and longitude dimensions starting from a first latitude and longitude coordinate to obtain a plurality of first meteorological element blocks, wherein the plurality of first meteorological element blocks are of the same size, and the height of the plurality of first meteorological element blocks and the height of the first meteorological element matrix are both a first height; Processing the plurality of first meteorological element blocks through a weather forecasting model to obtain a weather forecasting result of the target area.
2. The method of claim 1, wherein, Segmenting the first meteorological element matrix in the latitude and longitude dimensions starting from a first latitude and longitude to obtain a plurality of first meteorological element blocks, comprising: Determining the size information of each first meteorological element block; Segmenting the first meteorological element matrix according to the size information starting from the first latitude and longitude coordinate to obtain m complete meteorological element blocks and n incomplete meteorological element blocks, wherein m is a positive integer and n is an integer; Zero-padding the n incomplete meteorological element blocks according to the size information to obtain n completed meteorological element blocks, wherein the plurality of first meteorological element blocks comprise the m complete meteorological element blocks and the n completed meteorological element blocks.
3. The method of claim 1, wherein, Processing the plurality of first meteorological element blocks through a weather forecasting model to obtain a weather forecasting result of the target area, comprising: Encoding the plurality of first meteorological element blocks through an encoder to obtain a plurality of first encoded blocks, wherein the latitude and longitude coordinates of the plurality of first encoded blocks are the same as the latitude and longitude coordinates of the plurality of first meteorological element blocks, the height of the plurality of first encoded blocks is a second height, and the second height is less than the first height; Processing the plurality of first encoded blocks through an alignment network to obtain a first feature map corresponding to the first meteorological element matrix; Decoding the first feature map through a decoder to obtain the weather forecasting result.
4. The method of claim 3, wherein, Processing the plurality of first encoded blocks through an alignment network to obtain a first feature map corresponding to the first meteorological element matrix, comprising: Performing multi-head self-attention operation on the plurality of first encoded blocks to obtain a first operation result; Performing multi-layer perceptron operation on the first operation result to obtain a second feature map, wherein the multi-layer perceptron operation is used for nonlinear transformation of the first operation result, and the second feature map comprises a second meteorological element matrix and meteorological element features corresponding to the second meteorological element matrix, and the second meteorological element matrix corresponds to the plurality of first meteorological element blocks; Performing transformation region self-attention operation on the second feature map to obtain a second operation result; Performing multi-layer perceptron operation on the second operation result to obtain the first feature map.
5. The method of claim 4, wherein, Performing transformation region self-attention operation on the second feature map to obtain a second operation result, comprising: Segmenting the second feature map in the latitude and longitude dimensions starting from a second latitude and longitude coordinate to obtain a plurality of second encoded blocks; Perform multi-head self-attention operation on the plurality of second encoding blocks to obtain the second operation result.
6. The method of claim 4, wherein, Performing multi-head self-attention operation on the plurality of first encoding blocks to obtain a first operation result, comprising: by formula AttR i = Softmax((Region i * W + b) x (Region i * W + b) T / (region_size x region_size)) (Region i * W + b) for the plurality of first encoding blocks to obtain a plurality of region feature values, wherein AttR i is a region feature value corresponding to an i-th first encoding block, Region i is a meteorological element feature corresponding to the i-th first encoding block, W and b are both network parameters of the alignment network and are used to transform the meteorological element feature from a three-dimensional feature to a two-dimensional feature, Softmax is used to calculate a self-attention weight corresponding to the first encoding block, and i is a positive integer. The formula MultiHeadAttR=Concat(AttR1,AttR2,...,AttR) is used to... n The first operation result is obtained by processing the feature values of the multiple regions using )*W, where MultiHeadAttR is the first operation result and Concat is the concatenation function.
7. A weather forecasting apparatus for a target area, characterized by comprising: Comprising: The integration module is used for integrating a plurality of meteorological elements at different spatial positions in the target area to obtain a first meteorological element matrix, wherein the plurality of meteorological elements include a plurality of categories, and the first meteorological element matrix is a three-dimensional feature matrix; The segmentation module is used for performing segmentation processing on the first meteorological element matrix in the latitude and longitude dimensions from a first latitude and longitude coordinate to obtain a plurality of first meteorological element blocks, wherein the plurality of first meteorological element blocks are of the same size, and the height of the plurality of first meteorological element blocks and the height of the first meteorological element matrix are both a first height; The processing module is used for processing the plurality of first meteorological element blocks through a meteorological forecast model to obtain a meteorological forecast result of the target area.
8. A computer readable storage medium, characterized in that, The computer-readable storage medium comprises a stored program, wherein the program performs the method of any one of claims 1 to 6 when executed. 9.An electronic device comprising a memory and a processor, the electronic device characterized by, The memory stores a computer program, and the processor is configured to execute the method of any one of claims 1 to 6 through the computer program.
10. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the method of any one of claims 1 to 6.