Weather forecasting method and device, electronic equipment and storage medium

By using 3D SwinTransformer model and surface elevation data in weather forecasts, the problem of high consumption of computing resources in the existing technology is solved, and high-precision weather forecast for specific areas is achieved, data and computing resource requirements are reduced, and forecast accuracy is improved. sex.

CN118915190APending Publication Date: 2024-11-08BEIJING CAICHE QUMING TECH
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202410867644.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-28
Publication Date
2024-11-08

AI Technical Summary

Technical Problem

The existing weather forecasting methods consume a lot of computing resources, long time, and it is difficult to achieve high-precision forecasts in specific areas in medium and long-term forecasts. In particular, the global forecasting model has high requirements for computing resources and time, and has limited forecasting effects on specific regions.

Method used

Using the 3D SwinTransformer model, by obtaining the historical ERA5 data and surface elevation data of the preset area, establish a weather forecast model for the area, conduct single-step and iterative forecast training, optimize the model to reduce data and computing resource requirements, and enhance the forecast effect.

Benefits of technology

High-precision weather forecast for specific areas is realized, the amount of data and computing resources required for forecasting is significantly reduced, the prediction accuracy is improved, the model applicability is enhanced through surface elevation data, and the cumulative error of iterative forecast is reduced through iterative training.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118915190A_ABST
    Figure CN118915190A_ABST
Patent Text Reader

Abstract

The invention discloses a weather forecasting method, and the method comprises the steps: obtaining the historical meteorological data of a preset region, and the meteorological data comprise ERA5 data and surface elevation data at a historical time stage; according to the historical meteorological data of the preset area, based on a 3D Swin Transform model, establishing a forecasting model for the preset area; current meteorological data of the preset area are obtained, the current meteorological data are input into the forecasting model, a weather forecasting result for the current area is output and obtained, and the current meteorological data comprise ERA5 data and surface elevation data of the preset area at the current moment. According to the method, the forecasting model for the preset region is generated based on the 3D Swin Transform model, regional weather forecasting can be effectively carried out, and the data volume and computing resources required by the model are reduced. And in combination with the ERA5 data and the surface elevation data, the forecasting effect on different regions is enhanced, so that the forecasting accuracy is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of weather forecasting, and in particular to a weather forecasting method, a forecasting device, an electronic device and a storage medium. Background Art

[0002] The forecast of temperature, pressure, humidity, wind and other meteorological factors has an important impact on agricultural production, people's lives, atmospheric and ocean research, social and economic activities and decision-making. Currently, there are two main methods for medium- and long-term weather forecasts of meteorological elements such as temperature, air pressure and wind direction: numerical forecast model and neural network forecast:

[0003] 1) Numerical forecasting model. This forecasting model usually includes multiple complex modules such as data forecasting, data assimilation, and physical parameterization. Since the entire forecasting process is based on the weather forecast equation, it requires multiple iterations and step-by-step integration. Therefore, a single forecast requires a lot of computing resources and takes a long time, resulting in limited forecasting time in a day and limited spatial resolution of the initial forecast.

[0004] 2) Neural network forecasting model. This forecasting method extracts features from massive amounts of data and learns the mapping relationship between the data to provide forecast results. However, this model is currently mostly aimed at global forecasts, which results in a large amount of data required for training the model, more computing resources required, and a relatively time-consuming training model. Summary of the invention

[0005] The object of the present invention is to solve one of the above-mentioned technical problems at least to a certain extent.

[0006] To this end, the first purpose of the present invention is to propose a weather forecasting method, which obtains historical ERA5 data, boundary conditions and surface elevation data of a preset area, establishes a 3D SwinTransformer weather forecast model for the preset area, and obtains the forecast result of the preset area based on the current meteorological data, thereby realizing regional weather forecasting, reducing data and computing resources, enhancing the forecast effect for a specific region, and improving the accuracy of the forecast.

[0007] To achieve the above-mentioned purpose, a first aspect of an embodiment of the present invention proposes a weather forecast method, which includes: obtaining historical meteorological data of a preset area, wherein the historical meteorological data includes ERA5 data and surface elevation data of the preset area at historical moments; establishing a weather forecast model for the preset area based on a 3D SwinTransformer model according to the historical meteorological data of the preset area; obtaining current meteorological data of the preset area, and inputting the current meteorological data into the weather forecast model, and outputting a weather forecast result for the preset area, wherein the current meteorological data includes ERA5 data and surface elevation data of the preset area at the current moment.

[0008] According to one embodiment of the present invention, the weather forecast model for the preset area is established based on the 3D SwinTransformer model according to the historical meteorological data of the preset area, including: preprocessing the historical meteorological data of the preset area to generate a data set for model training; using the data set to pre-train the 3D SwinTransformer model to obtain corresponding forecast training results, wherein the pre-training includes single-step forecast training and iterative forecast training; optimizing the 3D SwinTransformer model based on a comparison between the forecast training results and the actual forecast results, and using the optimized 3D Swin Transformer model as the weather forecast model for the preset area.

[0009] According to one embodiment of the present invention, the preprocessing of the historical meteorological data of the preset area includes: calculating the statistics of each input data variable and standardizing each variable; and matching the surface elevation data of the preset area with the ERA5 data through interpolation calculation.

[0010] According to one embodiment of the present invention, the single-step forecast training includes: setting an interval time period; inputting the ERA5 data of the historical moment, the surface elevation data and the interval time period into the 3D Swin Transformer model, so that the model outputs the weather forecast result of the historical target moment, wherein the historical target moment is the time obtained by adding the interval time period to the current moment.

[0011] According to one embodiment of the present invention, the iterative forecast training includes: setting the number of iteration steps of the iterative forecast; obtaining the forecast result of the previous step; using the forecast result of the previous step as input data for the next step forecast to obtain the forecast result for the next step forecast, looping the above forecast until the number of forecast steps reaches the number of iteration steps, and using the output forecast result as the final forecast result of the iterative forecast.

[0012] According to one embodiment of the present invention, the 3D Swin Transformer model is optimized based on the comparison between the forecast training results and the actual forecast results of the preset area at the historical moment, including: based on the forecast training results and the actual forecast results, calculating the MSE loss used to characterize the error between the two; based on the MSE loss, calculating the optimization gradient of the model parameters; based on the optimization gradient of the model parameters, updating the model parameters of the model to train the updated model again.

[0013] According to one embodiment of the present invention, the weather forecast method further includes: setting boundary conditions for predicting the weather in the preset area; inputting the boundary conditions and the current meteorological data into the weather forecast model to generate a weather forecast result for the preset area.

[0014] To achieve the above-mentioned purpose, a second aspect of the present invention proposes a weather forecast device, which includes: an acquisition unit, used to acquire historical meteorological data of a preset area, wherein the historical meteorological data include ERA5 data and surface elevation data of the preset area at historical moments; an establishment unit, used to establish a weather forecast model for the preset area based on a 3D Swin Transformer model according to the historical meteorological data of the preset area; a forecasting unit, used to acquire current meteorological data of the preset area, and input the current meteorological data into the weather forecast model, and output a weather forecast result for the preset area, wherein the current meteorological data include ERA5 data and surface elevation data of the preset area at the current moment.

[0015] To achieve the above-mentioned purpose, the third aspect of the present invention proposes an electronic device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the weather forecast method described in the first aspect of the present invention is implemented.

[0016] To achieve the above-mentioned purpose, a computer-readable storage medium is proposed in the fourth aspect of the present invention, and when the computer program is executed by a processor, the weather forecast method described in the first aspect of the present invention is implemented.

[0017] 1) It can realize regional weather forecast for specific areas, significantly reducing the amount of data and computing resources required for forecasting;

[0018] 2) Adding surface elevation data enhances the applicability of the model in different regions and improves the forecasting effect of the model;

[0019] 3) By using the 3D Swin Transformer model, the characteristics of three-dimensional atmospheric variables between different pressure layers are better learned and integrated;

[0020] 4) Through iterative training of a single forecast model, the multi-step iterative output of the model is achieved, which can reduce the cumulative error of iterative forecasting and improve the forecasting effect;

[0021] 5) By adding optional boundary conditions, the forecast error that increases with the increase of iterative forecast step size can be reduced, thereby improving the overall forecast effect.

[0022] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:

[0024] Figure 1 is a schematic flow chart of a weather forecasting method according to an exemplary embodiment;

[0025] Figure 2 is a forecast schematic diagram based on a 3D Swin Transformer model according to an exemplary embodiment;

[0026] Figure 3 This is a schematic diagram of a process of establishing a weather forecast model according to an exemplary embodiment;

[0027] Figure 4 is a schematic diagram of a single-step forecast training process according to an exemplary embodiment;

[0028] Figure 5 is a schematic diagram of an iterative forecast training process according to an exemplary embodiment;

[0029] Figure 6 is a schematic diagram of a process flow of optimizing a 3D Swin Transformer model according to an exemplary embodiment;

[0030] Figure 7 is a data graph showing latitude-weighted RMSE and ACC at the surface and at 500 hPa in the upper air according to an exemplary embodiment;

[0031] Figure 8 is a plane diagram showing a comparison between a forecast result and an actual result according to an exemplary embodiment;

[0032] Fig. 9is a schematic block diagram of a weather forecast device according to an exemplary embodiment; and

[0033] Fig.10 The diagram is a schematic structural diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION

[0034] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present invention, and should not be construed as limiting the present invention.

[0035] Compared with existing global forecasts, this application aims to propose a regionalized forecasting method for a specific area, and combine deep learning to achieve regionalized weather forecasts with less computing resources and time, thereby obtaining accurate forecast results.

[0036] Specifically, a weather forecast method, forecast device, electronic device and storage medium according to an embodiment of the present invention are described below with reference to the accompanying drawings.

[0037] Figure 1 It is a flow chart of a weather forecast method according to an exemplary embodiment. It should be noted that the method of the embodiment of the present invention can be applied to the weather forecast device of the embodiment of the present invention, and the weather forecast device can be configured on an electronic device or in a server. The electronic device can be a PC or a mobile terminal. The embodiment of the present invention does not impose too many restrictions on this.

[0038] like Figure 1 As shown, the weather forecast method includes:

[0039] Step S110, obtaining historical meteorological data of a preset area, wherein the historical meteorological data includes ERA5 data and surface elevation data at a historical moment.

[0040] For example, ERA5 refers to the fifth generation of atmospheric reanalysis data sets of the global climate from January 1950 to the present by ECMWF (European Centre for Medium-Range Weather Forecasts). Among them, ERAS provides a large number of hourly estimates of atmospheric, land and ocean climate variables. Therefore, this application can obtain the public ERA5 data from ECMWF from 1980 to 2021, and it is for a preset area. For example, the preset area is China, that is, the historical ERA5 data for China is obtained, and the time resolution is set to 1 hour. Furthermore, taking into account the complexity of the underlying surface in the Chinese region, with surface types such as plateaus, deserts, plains and oceans, this application introduces surface elevation data for the preset area, so as to use ERA5 data and surface elevation data to more accurately predict the weather conditions in the preset area.

[0041] According to the acquired historical meteorological data, the present application can acquire different types of data variables. For example, the acquired variables are shown in Table 1 below:

[0042] Table 1

[0043]

[0044] Note: The variable names in Table 1 specifically represent: t2m is the temperature 2m near the ground, msl is the mean sea level pressure, u10 and v10 are the u and v direction wind speeds at 10m above the ground, tp is the total surface precipitation, t represents the temperature of each pressure layer, z is the potential height of each pressure layer, q is the specific humidity of each pressure layer, u and v are the u and v direction wind speeds of each pressure layer, respectively.

[0045] It should be noted that the present application is not limited to the above-mentioned variable types, and those skilled in the art can obtain other variable types according to actual needs.

[0046] Step S120, establishing a weather forecast model for the preset area based on the historical meteorological data of the preset area and the 3D Swin Transformer model.

[0047] For example, the 3D Swin Transformer model is a new type of neural network architecture that is mainly used to handle visual tasks, especially for high-resolution image processing. Figure 2 As shown, Figure 2 It is a forecast diagram based on the 3D Swintransformer model. Figure 2 In the figure, the left part is the input, the middle part is the overall structure of the 3D Swintransformer model, and the right part is the output. The left part inputs different types of data variables, such as Figure 2The surface and high altitude in the 3DSwintransformer model are respectively embedded with convolution operations for patch embedding and input into the 3DSwintransformer model. Figure 2 The 3D Swin transformer model shown in the figure includes the first layer (Layer1), the second layer (Layer2) and the third layer (Layer3), and each layer includes 3, 9 and 3 window attention blocks respectively. Among them, the input meteorological data is downsampled after passing through the 3 blocks of Layer1, then upsampled after passing through the 9 blocks of Layer2, and finally passed through the 3 blocks of Layer3, which can fully extract and fuse the data features, separate the features, and then restore the forecast data of the surface and the high altitude respectively, and finally obtain the future temperature, pressure, humidity and wind forecast results.

[0048] Furthermore, by inputting historical meteorological data into the 3DSwintransformer model and adjusting the model according to the forecast results, a weather forecast model suitable for forecasting the weather in the current preset area is generated.

[0049] Step S130, obtaining current meteorological data of the preset area, and inputting the current meteorological data into the weather forecast model, and outputting a weather forecast result for the preset area, wherein the current meteorological data includes ERA5 data and surface elevation data of the preset area at the current moment.

[0050] For example, after a regionalized weather forecast model is generated, the current meteorological data can be obtained in real time, and the obtained meteorological data can be input into the established weather forecast model to output the weather forecast results for the preset area.

[0051] The embodiment of the present invention generates a forecast model for a preset area based on the 3DSwin Transformer model, which can effectively perform regional weather forecasts and reduce the amount of data and computing resources required for the model. At the same time, the embodiment of the present invention combines ERA5 data and surface elevation data to enhance the forecast effect for different regions, thereby improving the forecast accuracy.

[0052] In a preferred embodiment, Figure 3 As shown, the weather forecast model for the preset area is established based on the historical meteorological data of the preset area and the 3DSwin Transformer model, including:

[0053] Step S310, preprocessing the historical meteorological data of the preset area to generate a data set for model training.

[0054] Preferably, the preprocessing of the historical meteorological data of the preset area includes: calculating corresponding statistics based on the historical meteorological data and standardizing the historical meteorological data; matching the ERA5 data of the preset area with the surface elevation data.

[0055] For example, the statistics of the embodiment of the present invention may include the mean, variance and other statistics of each data variable. Standardization of each data variable may include uniformly processing each data format into a standard format required by the subsequent model to meet the data requirements of subsequent weather forecasting based on the model. At the same time, since the present invention introduces surface elevation data, in order to make the subsequent forecast more accurate and reliable, the implementation of the present invention can also match the surface elevation data with the ERA5 data through interpolation calculation to improve the accuracy of the subsequent forecast.

[0056] Step S320, pre-training the 3D Swin Transformer model using the data set to obtain corresponding prediction training results, wherein the pre-training includes single-step prediction training and iterative prediction training.

[0057] For example, single-step forecast training refers to the training that uses the forecast data at the initial moment as input and outputs the forecast result at the target moment (for example, one hour in the future or the third day in the future) through the model. Iterative forecast training refers to the training that uses the forecast result at a certain moment in the middle as the input for the next moment. For example, the forecast result of 3 hours is used as the input for the 6-hour forecast, and the forecast result of the target moment (for example, the fifth day) is obtained through iteration.

[0058] Step S330, optimizing the 3DSwin Transformer model according to the comparison between the forecast training result and the actual forecast result, and using the optimized 3DSwin Transformer model as the weather forecast model for the preset area.

[0059] For example, since historical meteorological data is used for model training, after the forecast training results are obtained through model prediction, the present invention can evaluate the forecast training results based on the actual forecast results. For example, when the forecast training results deviate greatly from the actual forecast results, the model needs to be optimized and adjusted, so as to finally generate a weather forecast model suitable for weather forecasting for the current preset area.

[0060] The above two forecast training methods are further described in detail below in conjunction with the embodiments.

[0061] In a preferred embodiment, Figure 4 As shown, the single-step forecast training includes:

[0062] Step S410, setting an interval time period;

[0063] Step S420, inputting the ERA5 data of the historical moment, the surface elevation data and the interval time period into the 3D Swin Transformer model, so that the model outputs the weather forecast result of the historical target moment, wherein the historical target moment is the time obtained by adding the interval time period to the historical moment.

[0064] For example, if a certain historical moment is T1 and the interval time period is M, then the historical target moment is T1+M. The interval time period can be 1 hour, 2 hours, or 4 hours. For example, if the historical moment is 8 o'clock and the interval time period is 2 hours, then the forecast training result for 10 o'clock (historical target moment) is output through model training.

[0065] If the model needs to be optimized, the real weather data at the historical target moment, that is, 10 o'clock, can be obtained at this time. At this time, the real weather data is compared with the forecast data, and the model can be further optimized and adjusted based on the comparison results.

[0066] In a preferred embodiment, Figure 5 As shown, the iterative forecast training includes:

[0067] Step S510, setting the number of iteration steps of the iterative prediction;

[0068] Step S520, obtaining the forecast result of the previous step;

[0069] Step S530, using the forecast result of the previous step as input data for the next forecast, obtaining the forecast result for the next forecast, looping through the above forecast until the number of forecast steps reaches the number of iteration steps, and using the output forecast result as the final forecast result of the iterative forecast.

[0070] For example, suppose the weather forecast is X t+1 =M(X t) represents, where M is a 3D Swin Transformer model, t is time, and the input and output data are X. Assuming that the time of the previous forecast is t0, and the forecast result of the previous forecast is X0, and the time of the next forecast is t1, then X0 is used as the input for the forecast at the next time t1, and then the forecast result at the time t1 obtained through the model M is X1, and the number of forecast steps increases to 1. Similarly, X1 is input to the model M again as input, that is, as the input data for the next time t2 forecast, and then the forecast result X2 is obtained through the model M, and the number of forecast steps continues to increase by 1. In this way, it is iterated in sequence until the number of forecast steps reaches the preset number of iteration steps, and the final forecast result for the time T is obtained.

[0071] It can be seen that the preset number of iteration steps can be obtained based on the interval time between the historical target moment to be predicted and the historical moment and the interval time of adjacent forecasts. For example, the historical moment is 8 o'clock in the morning, and the historical target moment is 8 o'clock in the morning of the next day, that is, the weather forecast for the next 24 hours, the adjacent interval is 1 hour, and the number of iteration steps obtained is 24 steps. Then the forecast result at 8 o'clock can be used as input to obtain the forecast result at 9 o'clock. Again, the forecast result at 9 o'clock is used as input to obtain the forecast result at 10 o'clock, and so on and so forth until the number of forecast steps reaches 24 steps to output the final forecast result. It should be noted that the final forecast result here includes not only the forecast data of the last step, but also the forecast data outputted by each step of iteration. It can be seen that the forecast of each step of iteration is actually a single-step forecast, that is to say, iterative forecast training is implemented on the basis of single-step forecast training.

[0072] Therefore, through iterative forecasting, we can know the weather change trend in the future based on the current forecast results, and thus obtain the weather conditions at different times from the time dimension.

[0073] In a preferred embodiment, boundary conditions are input into the 3D Swin Transformer model to generate corresponding forecast results based on the boundary conditions and the meteorological data at the current moment.

[0074] For example, since the weather system will evolve over time and be affected by the surrounding weather conditions, when forecasting for a preset area, appropriately expanding the boundaries of the forecasted area outward can improve the accuracy of the regional forecast. In an embodiment of the present invention, the expanded weather information such as temperature, pressure, humidity and wind in the surrounding area is the boundary condition required for the model input. In addition, for iterative forecasting, if the weather information of the surrounding area is not limited, the accuracy of the iterative forecast will decrease faster as the step length increases. Therefore, for iterative forecasting, adding optional boundary conditions can also reduce the forecast error accumulated as the step length of the iterative forecast increases, so that the forecast result will not diverge too quickly as the iteration step length increases, thereby improving the overall forecast effect.

[0075] In a preferred embodiment, Figure 6 As shown, the optimization of the 3DSwin Transformer model based on the comparison between the forecast training result and the actual forecast result of the preset area at the historical moment includes:

[0076] Step S610, based on the forecast training result and the true forecast result, calculate the MSE loss used to characterize the error between the two.

[0077] Step S620: Calculate the optimization gradient of the model parameters according to the MSE loss.

[0078] Step S630: updating the model parameters of the model based on the optimization gradient of the model parameters, so as to train the updated model again.

[0079] For example, in order to effectively obtain the comparison results between the prediction results and the real data, the present invention introduces the MSE loss function, and determines the specific optimization parameters for the model based on the loss function. Then, the optimized model is further trained to make the output results of the current model infinitely close to the real data.

[0080] In addition, if Figure 7 As shown, in order to check the performance and generalization of the model's one-hour forecast, the present invention calculates the latitude-weighted RMSE and ACC for the variables at the surface and 500hPa above ground. Figure 7 From the data in , we can see that the latitude-weighted RMSE of each variable is small, and the forecast results are close to the real ERA5 data. Figure 8 As shown in the plane distribution diagram, the forecast results are also very close to the actual ERA5.

[0081] In summary, the regional weather forecast method provided by the present invention has the following advantages:

[0082] 1) It can train medium- and long-term forecast models for specific regions, which can significantly reduce the amount of data and computing resources required for model training;

[0083] 2) Adding surface elevation data further enhances the applicability of the model in different regions and improves the forecasting effect of the model;

[0084] 3) By using the 3D Swin Transformer model, the characteristics of three-dimensional atmospheric variables between different pressure layers are better learned and integrated;

[0085] 4) Through iterative training of a single forecast model, the multi-step iterative output of the model is achieved, which can reduce the cumulative error of iterative forecasting and improve the forecasting effect;

[0086] 5) By adding optional boundary conditions, the forecast error that increases with the increase of iterative forecast step size can be reduced, thereby improving the overall forecast effect.

[0087] Based on the same inventive concept as the above-mentioned method for generating image samples, an embodiment of the present invention provides a weather forecast device, such as Fig. 9 As shown, the weather forecast device 900 includes: an acquisition unit 910, used to acquire historical meteorological data of a preset area, wherein the historical meteorological data includes ERA5 data and surface elevation data of the preset area at historical moments; an establishment unit 920, used to establish a weather forecast model for the preset area based on a 3D Swin Transformer model according to the historical meteorological data of the preset area; a forecast unit 930, used to acquire current meteorological data of the preset area, and input the current meteorological data into the weather forecast model, and output a weather forecast result for the preset area, wherein the current meteorological data includes ERA5 data and surface elevation data of the preset area at the current moment.

[0088] The specific implementation contents and advantages of the weather forecast device of the present invention can be referred to the embodiments of the weather forecast method described above, and will not be elaborated herein.

[0089] Accordingly, an embodiment of the present invention further provides an electronic device, such as Fig.10 , which shows a schematic diagram of the structure of an electronic device suitable for implementing an embodiment of the present invention. The electronic device in the embodiment of the present invention may include, but is not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Fig.10The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0090] like Fig.10 As shown, the electronic device may include a processing device (e.g., a central processing unit, a graphics processor, etc.) 1001, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage device 1008 into a random access memory (RAM) 1003. In the RAM 1003, various programs and data required for the operation of the electronic device are also stored. The processing device 1001, the ROM 1002, and the RAM 1003 are connected to each other via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.

[0091] Typically, the following devices may be connected to the I / O interface 1005: input devices 1006 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices 1007 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 1008 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 1009. The communication device 1009 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although Fig.10 An electronic device having various devices is shown, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.

[0092] In particular, according to an embodiment of the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present invention provides a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 1009, or installed from the storage device 1008, or installed from the ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment of the present invention are executed.

[0093] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.

[0094] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: obtains historical meteorological data of a preset area, wherein the historical meteorological data includes ERA5 data and surface elevation data of the preset area at historical moments; establishes a weather forecast model for the preset area based on a 3D Swin Transformer model according to the historical meteorological data of the preset area; obtains current meteorological data of the preset area, and inputs the current meteorological data into the weather forecast model, and outputs a weather forecast result for the preset area, wherein the current meteorological data includes ERA5 data and surface elevation data of the preset area at the current moment.

[0095] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0096] The units involved in the embodiments of the present invention may be implemented by software or hardware. The name of a unit does not limit the unit itself in some cases. For example, the first acquisition unit may also be described as a "unit for acquiring at least two Internet Protocol addresses".

[0097] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.

[0098] In the context of the present invention, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0099] The above description is only a preferred embodiment of the present invention and an explanation of the technical principles used. Those skilled in the art should understand that the disclosure scope involved in the present invention is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present invention (but not limited to) by each other.

[0100] In addition, although each operation is described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be construed as limiting the scope of the present invention. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.

[0101] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.

Claims

1. A weather forecast method, characterized in that: The weather forecast method comprises: Acquire historical meteorological data of a preset area, wherein the historical meteorological data includes ERA5 data and surface elevation data of the preset area at historical moments; According to the historical meteorological data of the preset area, a weather forecast model for the preset area is established based on the 3D Swin Transformer model; The current meteorological data of the preset area is obtained, and the current meteorological data is input into the weather forecast model to output a weather forecast result for the preset area, wherein the current meteorological data includes the ERA5 data and surface elevation data of the preset area at the current moment.

2. The weather forecast method according to claim 1, characterized in that: The step of establishing a weather forecast model for the preset area based on the historical meteorological data of the preset area and the 3D Swin Transformer model includes: Preprocessing the historical meteorological data of the preset area to generate a data set for model training; Pre-training the 3D Swin Transformer model using the data set to obtain corresponding forecast training results, wherein the pre-training includes single-step forecast training and iterative forecast training; According to the comparison between the forecast training result and the actual forecast result, the 3D Swin Transformer model is optimized, and the optimized 3D Swin Transformer model is used as a weather forecast model for the preset area.

3. The weather forecast method according to claim 2, characterized in that: The preprocessing of the historical meteorological data of the preset area includes: Calculate the statistics of each input data variable and standardize each variable; The surface elevation data of the preset area is matched with the ERA5 data through interpolation calculation.

4. The weather forecast method according to claim 2, characterized in that: The single-step forecast training comprises: Set the interval time period; The ERA5 data of the historical moment, the surface elevation data and the interval time period are input into the 3D SwinTransformer model so that the model outputs the weather forecast result of the historical target moment, wherein the historical target moment is the time obtained by adding the interval time period to the historical moment.

5. The weather forecast method according to claim 2, characterized in that: The iterative forecast training comprises: Setting the number of iteration steps of the iterative prediction; Get the forecast result of the previous step; The forecast result of the previous step is used as the input data of the next step forecast to obtain the forecast result for the next step forecast, and the above forecast is executed in a loop until the number of forecast steps reaches the number of iteration steps, and the output forecast result is used as the final forecast result of the iterative forecast.

6. The weather forecast method according to claim 2, characterized in that: The optimizing the 3D Swin Transformer model according to the comparison between the forecast training result and the actual forecast result comprises: Based on the forecast training result and the true forecast result, calculating the MSE loss used to characterize the error between the two; According to the MSE loss, the optimization gradient of the model parameters is calculated; Based on the optimization gradient of the model parameters, the model parameters of the model are updated to train the updated model again.

7. The weather forecast method according to claim 1, characterized in that: The weather forecast method further comprises: Setting boundary conditions for predicting the weather in the preset area; The boundary condition data and the current meteorological data are input into the weather forecast model to generate a weather forecast result for the preset area.

8. A weather forecast device, characterized in that: The weather forecast device comprises: An acquisition unit, used for acquiring historical meteorological data of a preset area, wherein the historical meteorological data includes ERA5 data and surface elevation data of the preset area at historical moments; An establishing unit, configured to establish a weather forecast model for the preset area based on a 3D Swin Transformer model according to historical meteorological data of the preset area; A forecasting unit is used to obtain current meteorological data of the preset area, input the current meteorological data into the weather forecast model, and output a weather forecast result for the preset area, wherein the current meteorological data includes ERA5 data and surface elevation data of the preset area at the current moment.

9. An electronic device, comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the weather forecasting method according to any one of claims 1 to 7.

10. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to enable the computer to execute the weather forecasting method according to any one of claims 1-7.

Citation Information

Cited By

  • Seasonal rainfall prediction method and system for research area

    CN121254393A

  • Weather description information generation method and device, medium and equipment

    CN121413788A