Precipitation forecasting method and system based on multi-scale double attention and electronic equipment

By using a deep learning model with a multi-scale encoder and a terrain-aware spatiotemporal fusion module, the problems of local abrupt changes and insufficient modeling of long-distance dependencies in precipitation forecasts in existing technologies are solved, achieving more efficient precipitation forecast accuracy and adaptability.

CN121327735APending Publication Date: 2026-01-13QINGHAI UNIVERSITY
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202511201603.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-26
Publication Date
2026-01-13

AI Technical Summary

Technical Problem

Existing technologies struggle to simultaneously balance local mutation capture and long-distance dependency modeling, are insufficiently adaptable to spatial heterogeneity and non-stationary temporal dynamics of precipitation, and present a trade-off between computational efficiency and forecast accuracy.

Method used

A deep learning model combining a multi-scale encoder with a terrain perception spatiotemporal fusion module is constructed. By dynamically fusing features through global and local attention modules, the ability to extract spatial features of precipitation patterns at different scales and adapt to terrain is improved.

Benefits of technology

It improves the accuracy and applicability of precipitation forecasts, better captures subtle changes in local extreme precipitation and the impact of complex terrain, balances local abrupt changes with long-distance dependency modeling, and enhances computational efficiency and forecast accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121327735A_ABST
    Figure CN121327735A_ABST
Patent Text Reader

Abstract

The invention discloses a precipitation forecasting method and system based on multi-scale double attention and electronic equipment, and relates to the technical field of artificial intelligence application, and the method comprises the steps: constructing a deep learning model comprising a multi-scale encoder, a terrain perception space-time fusion module and a decoder, and training the deep learning model to obtain a precipitation forecasting model; and based on the historical rainfall data of the preset area, carrying out rainfall forecasting by using the rainfall forecasting model to obtain a rainfall forecasting result of the preset area. The method has excellent performance in the aspects of capturing local extreme rainfall, responding to a small and medium-scale weather system and considering a terrain coupling relation, local sudden change and long-distance dependence modeling are balanced, and the accuracy and applicability of rainfall forecasting are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence application technology, and in particular to a precipitation forecasting method, system and electronic device based on multi-scale dual attention. Background Technology

[0002] Accurate precipitation forecasts are crucial for fields such as traffic management, disaster early warning, and energy planning. Traditional numerical weather prediction methods rely on physical models to simulate atmospheric evolution, but they suffer from low computational efficiency and insufficient adaptability to complex terrain. With the development of deep learning technology, data-driven methods are gradually becoming a supplement, but they still have significant limitations in spatiotemporal dynamic modeling and extreme precipitation capture.

[0003] In early deep learning methods, ConvLSTM preserved spatial features through convolutional recurrent structures, but limited by a fixed receptive field, it struggled to capture long-distance spatial dependencies, resulting in insufficient accuracy in modeling the evolution of large-scale precipitation systems. PredRNN introduced a dual-memory mechanism to improve spatiotemporal representation capabilities, but its complex memory flow design led to a surge in computational overhead, making it difficult to apply to high-resolution global forecasting scenarios. Recent efficient models such as SimVP-v2 employ an architecture combining 3D convolution and channel attention, which improves computational efficiency, but still falls short in modeling non-stationary precipitation dynamics (such as sudden downpours) and abrupt precipitation changes induced by local terrain. TAU optimizes temporal modeling through hierarchical temporal attention, but due to neglecting spatial heterogeneity, it suffers from significant forecast errors in complex terrain regions.

[0004] The introduction of Transformer technology has brought breakthroughs to spatiotemporal modeling, but key bottlenecks still exist. UniFormer integrates CNN and Transformer to improve feature extraction capabilities, but its dynamic convolutional operations lead to poor hardware adaptability and low training efficiency. PoolFormer reduces computational costs through pooling operations, but sacrifices the ability to distinguish fine-grained precipitation features, making it difficult to differentiate boundaries between precipitation intensities. In meteorological models, the hierarchical interaction mechanism of Swin Transformer struggles to capture subtle changes in local extreme precipitation. Earthformer, while capable of simulating periodic climate models, lags behind in responding to rapidly evolving small- and medium-scale weather systems. WeatherBERT incorporates prior meteorological knowledge, but due to insufficient consideration of the coupling relationship between topography and precipitation, it exhibits significant topographic dependence bias.

[0005] The core problem with existing technologies is that they are difficult to balance local mutation capture and long-distance dependency modeling at the same time, and they are not adaptable enough to the spatial heterogeneity and non-stationary temporal dynamics of precipitation. Furthermore, some models have a contradiction between computational efficiency and forecast accuracy. The root cause of these defects lies in the insufficient design of multi-scale feature fusion and dynamic adaptation mechanisms of meteorological systems in traditional architectures. Summary of the Invention

[0006] The technical problem to be solved by this invention is to address the shortcomings of existing technologies. Specifically, it provides a precipitation forecasting method, system, and electronic device based on multi-scale dual attention, as detailed below: 1) In a first aspect, the present invention provides a precipitation forecasting method based on multi-scale dual attention, the specific technical solution of which is as follows: A deep learning model is constructed, comprising a multi-scale encoder, a terrain-aware spatiotemporal fusion module, and a decoder. The multi-scale encoder processes pre-defined univariate precipitation data to obtain spatial features of precipitation patterns at different scales. The terrain-aware spatiotemporal fusion module processes the spatial features using a global attention module and a fusion attention module, and dynamically fuses the global features of the pre-defined univariate precipitation data output by the global attention module with the local features of the pre-defined univariate precipitation data output by the fusion attention module through learnable parameters to obtain a spatiotemporal feature tensor. The decoder performs precipitation forecasting based on the spatiotemporal feature tensor; trains the deep learning model to obtain a precipitation forecasting model; and performs precipitation forecasting based on historical precipitation data for a pre-defined region using the precipitation forecasting model to obtain the precipitation forecast results for the pre-defined region.

[0007] The beneficial effects of the precipitation forecasting method based on multi-scale dual attention provided by this invention are as follows: The multi-scale encoder of this invention can process preset univariate precipitation data to obtain spatial features of precipitation patterns at different scales. The global attention module in the terrain-aware spatiotemporal fusion module can capture broader long-distance spatial dependencies, while the fusion attention module focuses on local features. The combination of these two modules, dynamically fused through learnable parameters, achieves an effective integration of global and local features, overcoming the shortcomings of ConvLSTM and PredRNN in modeling large-scale precipitation systems and handling high-resolution global forecast scenarios. In this invention, the spatial features extracted by the multi-scale encoder at different scales serve as the foundation. The terrain-aware spatiotemporal fusion module fully considers terrain factors, using two attention modules to process and fuse global and local features respectively. This allows the model to better adapt to the non-stationary dynamics of precipitation and the impact of complex terrain, thereby improving precipitation forecast accuracy in complex terrain areas and in scenarios such as sudden rainstorms. This invention employs a combination of multi-scale encoding and terrain-aware spatiotemporal fusion, ensuring computational efficiency while also effectively identifying boundaries of precipitation of different intensities and processing fine-grained precipitation features. This invention excels in capturing subtle changes in local extreme precipitation, responding to rapidly evolving small-scale weather systems, and considering the coupling relationship between topography and precipitation. It achieves effective fusion and dynamic adaptation of multi-scale features, thereby improving the overall accuracy and applicability of precipitation forecasts. It effectively balances the capture of local abrupt changes with long-distance dependency modeling, enhances adaptability to spatial heterogeneity and non-stationary temporal dynamics of precipitation, and alleviates the contradiction between computational efficiency and forecast accuracy in some models.

[0008] 2) Secondly, the present invention also provides a precipitation forecasting system based on multi-scale dual attention, the specific technical solution of which is as follows: The system includes a model building module, a model training module, and a precipitation forecasting module. The model building module constructs a deep learning model comprising a multi-scale encoder, a terrain-aware spatiotemporal fusion module, and a decoder. The multi-scale encoder processes preset univariate precipitation data to obtain spatial features of precipitation patterns at different scales. The terrain-aware spatiotemporal fusion module processes spatial features using a global attention module and a fusion attention module, and dynamically fuses the global features of the preset univariate precipitation data output by the global attention module with the local features output by the fusion attention module using learnable parameters to obtain a spatiotemporal feature tensor. The decoder performs precipitation forecasting based on the spatiotemporal feature tensor. The model training module trains the deep learning model to obtain a precipitation forecasting model. The precipitation forecasting module uses the precipitation forecasting model to perform precipitation forecasting based on historical precipitation data for a preset area, obtaining the precipitation forecast results for that area.

[0009] 3) In a third aspect, the present invention also provides an electronic device, the electronic device including a processor coupled to a memory, the memory storing at least one computer program, the at least one computer program being loaded and executed by the processor, so as to enable the electronic device to implement any of the above-mentioned precipitation forecasting methods based on multi-scale dual attention.

[0010] 4) In a fourth aspect, the present invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements any of the above-mentioned precipitation forecasting methods based on multi-scale dual attention.

[0011] It should be noted that the beneficial effects of the technical solutions of the second to fourth aspects of the present invention and their corresponding possible implementations can be found in the above description of the technical effects of the first aspect and its corresponding possible implementations, and will not be repeated here. Attached Figure Description

[0012] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments of the present invention will be briefly introduced below: Figure 1 This is a flowchart illustrating a precipitation forecasting method based on multi-scale dual attention according to an embodiment of the present invention. Figure 2 This is a schematic diagram of the structure of a deep learning model; Figure 3 This is a schematic diagram of the MSAG module. Figure 4 This is a schematic diagram of the MultiKernelMixer module; Figure 5 This is a structural diagram of the terrain perception spatiotemporal fusion module; Figure 6 This is a schematic diagram of the attention module. Figure 7 This is a schematic diagram of the structure of the attention fusion module; Figure 8 Visualization of precipitation forecasts; Figure 9 This is a schematic diagram of a precipitation forecasting system based on multi-scale dual attention according to an embodiment of the present invention. Detailed Implementation

[0013] The principles and features of the present invention are described below. The examples given are only for explaining the present invention and are not intended to limit the scope of the present invention.

[0014] like Figure 1 As shown in the figure, a precipitation forecasting method based on multi-scale dual attention according to an embodiment of the present invention includes the following steps: S1. Construct a deep learning model including a multi-scale encoder, a terrain-aware spatiotemporal fusion module, and a decoder. The multi-scale encoder processes preset univariate precipitation data to obtain spatial features of precipitation patterns at different scales. The terrain-aware spatiotemporal fusion module processes the spatial features using a global attention module and a fusion attention module, and dynamically fuses the global features of the preset univariate precipitation data output by the global attention module with the local features of the preset univariate precipitation data output by the fusion attention module through learnable parameters to obtain a spatiotemporal feature tensor. The decoder performs precipitation forecasting based on the spatiotemporal feature tensor. S2. Train the deep learning model to obtain a precipitation forecast model; S3. Based on historical precipitation data of the preset area, use the precipitation forecasting model to make precipitation forecasts and obtain the precipitation forecast results for the preset area.

[0015] Optionally, in the above technical solution, the multi-scale encoder includes a ConvSC module and an MSAG module. The ConvSC module is used to process preset univariate precipitation data to obtain precipitation patterns at different scales. The MSAG module is used to obtain the spatial features of precipitation patterns at different scales by using convolution kernels of different sizes.

[0016] The ConvSC module can process pre-defined univariate precipitation data to obtain precipitation patterns at different scales. This solves the problem of insufficient multi-scale feature extraction capability in previous methods, enabling a more comprehensive capture of precipitation variation patterns at different spatial scales. The MSAG module uses convolutional kernels of different sizes to obtain spatial features of precipitation patterns at different scales. Through the application of multi-size convolutional kernels, the spatial distribution and changes of precipitation patterns can be more detailed, effectively improving the ability to distinguish spatial features of precipitation. This multi-scale feature extraction method provides a richer and more accurate spatial feature foundation for the subsequent spatiotemporal fusion module, enabling the entire model to better adapt to the spatial heterogeneity and non-stationary temporal dynamics of precipitation, improving the accuracy and reliability of precipitation forecasts, and thus enhancing the overall performance and applicability of the precipitation forecast model.

[0017] Optionally, in the above technical solution, the global attention module obtains the global features of the preset univariate precipitation data by expanding the convolutional layer; the fusion attention module obtains the local features of the preset univariate precipitation data by using the adaptive pooling layer and the convolutional layer.

[0018] The global attention module expands the receptive field by extending convolutional layers, effectively extracting global features from pre-defined univariate precipitation data and addressing the insufficient accuracy of long-distance dependent modeling in traditional methods. The fusion attention module focuses on key regions through adaptive pooling layers and refines local features using convolutional layers, compensating for the inadequacy in capturing sudden local precipitation events. Global features capture the macroscopic evolution trend of the precipitation system, while local features accurately identify sudden events such as torrential rain. Through dynamic fusion of learnable parameters, the module achieves an adaptive balance between global and local features, avoiding the insufficient adaptability caused by fixed feature extraction methods in traditional architectures. This design not only improves the spatial resolution accuracy of precipitation forecasts but also enhances the sensitivity to precipitation patterns in complex terrain areas, providing a richer feature base for subsequent terrain-aware spatiotemporal fusion modules and significantly improving the robustness and generalization ability of precipitation forecast models in multi-scale dynamic scenarios.

[0019] Optionally, in S2, the deep learning model is trained to obtain a precipitation forecast model, including: A precipitation forecasting model is obtained by training a deep learning model using the Log-Cosh loss function. Compared with traditional loss functions, the Log-Cosh loss function is more advantageous in handling extreme values ​​in precipitation forecasts. It can effectively balance the model's ability to fit different precipitation intensities, making the model more robust when learning precipitation data. This improves the accuracy of the precipitation forecasting model in capturing multi-scale precipitation patterns and enhances the reliability of precipitation forecast results.

[0020] Optionally, the above technical solution also includes: correcting the precipitation forecast results for the preset area, specifically including the following steps: S40. Synchronously acquire multi-source real-time precipitation observation data within a preset area through a meteorological data interface, including measured values ​​from ground meteorological stations, precipitation data retrieved from meteorological radar reflectivity, and satellite remote sensing precipitation products; construct a dynamic observation dataset with a time resolution of no less than 1 hour; and uniformly convert the dynamic observation dataset to the same spatial coordinate system as the precipitation forecast model; specifically: ① Interact with various meteorological data interfaces, including ground meteorological station data interfaces, meteorological radar reflectivity inversion precipitation data interfaces, and satellite remote sensing precipitation product data interfaces. Thoroughly study the interface documentation for each interface, clarifying key information such as data transmission protocols, data formats, and access frequency restrictions. Based on the geographical scope of the preset area, set appropriate spatial filtering conditions to accurately obtain precipitation observation data within that area from the data interfaces. For example, in the ground meteorological station data interface, use spatial query statements to filter data from stations located within the preset area; for meteorological radar data and satellite remote sensing data, extract data based on the overlap between their coverage area and the preset area. To achieve real-time data synchronization, set up scheduled tasks or use the real-time push mechanism provided by the data interfaces to ensure that the latest precipitation observation data is obtained no more than once every hour. During the data acquisition process, strictly follow the interface requirements for authentication, data request parameter settings, and other operations to ensure the stability and reliability of the data acquisition.

[0021] ② Standardize the format and perform quality control on the acquired multi-source data. Since data formats may differ between sources—for example, ground station data may be in structured tabular form, weather radar data may be in a specific binary format, and satellite remote sensing data may be stored in image or raster format—it is necessary to convert them to a unified data format, such as NetCDF or CSV, to facilitate subsequent data processing and storage. Then, data quality control is performed, handling outliers and missing values. For example, for measured values ​​from ground meteorological stations, referencing historical observation data from the stations and data from surrounding stations at the same time, values ​​significantly exceeding reasonable ranges are corrected or removed. For precipitation data retrieved from weather radar reflectivity and satellite remote sensing precipitation products, based on the accuracy range of their retrieval algorithms and data quality indicators, data with low reliability are marked or removed.

[0022] ③ Integrate the preprocessed multi-source precipitation observation data into a unified spatial data structure to construct a dynamic observation dataset. Based on the spatial grid of a predefined region, map each data point (ground station, radar grid point, satellite pixel, etc.) to the corresponding grid cell to construct a spatial database for multi-source data fusion. In the time dimension, organize and store the data in time series with a time resolution of no less than 1 hour. Create corresponding data records for precipitation observation data at each time point to ensure that the dataset can dynamically reflect the evolution of precipitation in time and space. At the same time, establish a data indexing mechanism to facilitate quick querying and access to precipitation observation data within a specific time period and region.

[0023] ④ Determine the spatial coordinate system parameters used in the precipitation forecasting model, including detailed information such as projection method, coordinate origin, and coordinate units. Perform spatial coordinate system transformation on all data points in the dynamic observation dataset. Employ appropriate coordinate transformation algorithms, such as geographic coordinate transformation formulas (e.g., converting latitude and longitude coordinates to planar coordinates in the target projected coordinate system) or utilize professional spatial data processing libraries (e.g., Proj.4) to ensure that the coordinates of each precipitation observation point in the dataset are accurately transformed to the same spatial coordinate system as the precipitation forecasting model. During the coordinate transformation process, assess and correct for potential accuracy losses and distortions. By setting reasonable transformation parameters and employing interpolation algorithms, ensure that the spatial accuracy of the transformed data meets the requirements of the precipitation forecasting model. The resulting dynamic observation dataset matches the precipitation forecasting model in both time and space, providing high-quality data support for subsequent precipitation forecasting analysis and modeling.

[0024] S41. The dynamic observation dataset is gridded using the Kriging spatial interpolation algorithm to generate a real-time observation field with the same spatial resolution as the original precipitation forecast results output by the precipitation forecast model. Simultaneously, boundary effect corrections are applied to the original precipitation forecast results to ensure a strict spatial grid match between the real-time observation field and the corrected original precipitation forecast field. Specifically: ① The previously constructed dynamic observation dataset, which includes multi-source data such as measured values ​​from ground meteorological stations, precipitation data retrieved from meteorological radar reflectivity, and precipitation products from satellite remote sensing, was integrated. This ensured that the data was arranged at a resolution of at least one hour in the time dimension, and that each data point had accurate spatial coordinate information for subsequent interpolation calculations. The dynamic observation dataset underwent another quality review, removing data points with obvious errors or excessive missing data. Targeted cleaning processes were performed for different types of data. For example, for meteorological radar data, false high precipitation values ​​caused by clutter interference were removed; for satellite remote sensing data, portions with low reliability due to factors such as cloud cover were removed based on their data quality assessment indicators.

[0025] ② Based on the spatial distribution characteristics of the dynamic observation dataset, select a suitable Kriging interpolation method, such as ordinary Kriging or universal Kriging. After determining the interpolation method, analyze the semivariogram of the data to determine the parameters required for interpolation, including range, sill value, partial sill value, and nugget effect. These parameters directly affect the accuracy of the interpolation results. To improve interpolation efficiency and ensure the reasonableness of the interpolation results, define a search neighborhood to determine how many neighboring observation points to consider during interpolation calculations. The size and shape of the search neighborhood can usually be set based on the spatial density of observation points and the spatial correlation range of precipitation phenomena, such as using a circular or rectangular neighborhood, and specifying the minimum and maximum number of observation points contained within the neighborhood. Using the selected Kriging interpolation method and the determined parameters, divide the preset area into grids with the same spatial resolution as the original precipitation forecast results output by the precipitation forecast model. Map the data points in the dynamic observation dataset to these grid points using the Kriging interpolation algorithm, thereby generating a real-time observation field. During the interpolation process, the data weight of each observation point is fully considered. Based on the distance between the observation point and the grid point to be interpolated, as well as the characteristics of the semivariogram, the precipitation estimate and its variance at each grid point are calculated.

[0026] ③ Analyze the raw precipitation forecast results output by the precipitation forecast model to determine the spatial range where boundary effects exist. Boundary effects typically occur near the edge of the model's computational domain, manifesting as abnormal precipitation intensity, discontinuous precipitation distribution, or inconsistencies with precipitation trends in surrounding areas. The affected areas can be identified by comparing the spatial distribution differences of precipitation between the model's internal regions and the boundary regions, as well as by examining precipitation gradient changes. For the identified boundary effect areas, select appropriate correction methods. Common boundary effect correction methods include statistical empirical formula correction, physical process correction, and smoothing transitions with precipitation data from surrounding areas. For example, statistical methods such as polynomial fitting can be used to establish a correction model based on the relationship between precipitation data inside and outside the boundary effect area; or atmospheric physical processes at the boundary can be incorporated to adjust the precipitation forecast results; interpolation or weighted averaging of precipitation data near the boundary can be performed to smoothly integrate it with precipitation data from the internal regions. Correct the raw precipitation forecast results for boundary effects using the selected correction method and verify the corrected results. Verification methods can include comparative analysis with measured precipitation data (such as data from surface meteorological stations) in the boundary region to assess whether the accuracy of the corrected precipitation forecast has improved. The effectiveness of the correction can also be comprehensively judged by examining the rationality of the spatial distribution of precipitation and the consistency between precipitation intensity and weather system evolution. If the corrected results are still unsatisfactory, the correction method and parameters can be adjusted, and the correction process repeated until the requirements are met.

[0027] ④ Spatial grid alignment is performed between the real-time observation field generated by Kriging interpolation and the original precipitation forecast field corrected for boundary effects. Since both have the same spatial resolution and coordinate system, it is only necessary to ensure that their grids are geographically strictly aligned, meaning the coordinates of each grid point are completely consistent. This allows for subsequent comparative analysis or fusion processing within the same spatial reference frame. Based on strict spatial grid matching, the real-time observation field and the corrected original precipitation forecast field can be fused to further improve the accuracy and completeness of precipitation information. For example, according to certain weighting rules, the observation data and forecast data can be weighted and fused to generate a more valuable precipitation analysis field. Simultaneously, comparative analysis can be performed on precipitation data from both fields on the same grid to evaluate the performance of the precipitation forecast model, analyze the sources and distribution characteristics of forecast errors, and provide a basis for subsequent improvements to the precipitation forecast model.

[0028] S42. Calculate the absolute deviation between the real-time observed field and the corrected original precipitation forecast field point by point, introduce a time decay factor to construct a dynamic error weight matrix, and generate a spatially correlated error correction field by combining historical error distribution characteristics through variational assimilation techniques; specifically: ① Ensure that the real-time observation field and the corrected original precipitation forecast field are strictly matched on the spatial grid, meaning they have the same spatial resolution, grid coordinate range, and geographic projection method. The aligned data needs preprocessing, such as converting it to the same storage format (e.g., NetCDF) to facilitate subsequent calculations. Simultaneously, perform a quality check on the data, removing grid points with obvious errors or outliers. For each grid point, calculate the absolute deviation between the real-time observation field and the corrected original precipitation forecast field. Specifically, iterate through each corresponding grid point in both fields, subtract the forecast value from the observed value, and take the absolute value to obtain the absolute deviation for that grid point. Combine the absolute deviations of all grid points into a deviation field of the same dimension as the original field for subsequent analysis and processing.

[0029] ② Based on the temporal evolution characteristics of precipitation processes and the analysis of historical data, determine the value range and variation law of the time decay factor. The time decay factor reflects the degree of attenuation of the influence of past errors on current errors. It generally takes values ​​between 0 and 1, with smaller values ​​indicating faster attenuation. A suitable initial value for the time decay factor can be determined based on experience or statistical analysis, and adjusted according to actual effects in subsequent processes. A dynamic error weight matrix is ​​constructed based on the time decay factor. For each grid point, consider its absolute deviation sequence over the most recent several time steps. Starting from the current time step, assign weights to past deviations sequentially according to time, with the weight values ​​decreasing according to the time decay factor as the time interval increases. For example, if the time decay factor is 0.8, the deviation weight for the most recent time step is 0.8, the deviation weight for the previous time step is 0.8² = 0.64, and so on. Normalize the deviation weights for each grid point at different time steps so that the sum of their weights is 1, thus obtaining the dynamic error weight vector for each grid point. The weight vectors of all grid points are combined into a matrix, which is the dynamic error weight matrix.

[0030] ③ Statistical analysis is performed on the accumulated absolute deviation field data over a period of time to study the spatial distribution patterns and correlation characteristics of errors. The long-term average error, error variance, and error covariance between adjacent grid points are calculated for each grid point, constructing a historical error covariance matrix. This matrix reflects the spatial correlation structure of errors; for example, errors at adjacent grid points may have a positive correlation, while errors at distant grid points have a weaker correlation. Based on the current absolute deviation field and dynamic error weight matrix, combined with the historical error covariance matrix, a spatially correlated error correction field is generated using variational assimilation techniques. During variational assimilation, an objective function is constructed that comprehensively considers the differences between the current deviation and historical error distribution characteristics, as well as constraints such as the spatial smoothness of the error correction field. The objective function is minimized using an optimization algorithm (such as the conjugate gradient method) to obtain the optimal error correction field. Specifically, the objective function can be constructed by using the sum of squared differences between the current weighted bias value and the expected historical error value as the principal term, while incorporating the sum of squared gradients of the error correction field as a regularization term to ensure the spatial continuity and rationality of the correction field. During the optimization process, the value of the error correction field is continuously adjusted, causing the objective function to gradually decrease until it converges to an optimal solution, thus obtaining a spatially correlated error correction field.

[0031] S44. The error correction field is decomposed into systematic deviation components and random disturbance components. A Bayesian model averaging method is used to globally correct the systematic deviation components, while ensemble Kalman filtering is used to probabilistically fuse the random disturbance components. Finally, the corrected precipitation forecast result is output. Specifically: ① Analyze the error correction field to identify stable and regular components, which are then used as systematic bias components. These components can be extracted by long-term averaging of the error correction field over time, fitting a trend line, or using low-pass filtering. For example, the systematic bias estimate for each grid point can be obtained by calculating the average of the error correction field over multiple time periods; alternatively, low-pass filtering techniques such as moving averages can be used to remove high-frequency random fluctuations in the error while retaining low-frequency systematic bias information. After extracting the systematic bias components, subtract them from the error correction field to obtain the random disturbance components. This reflects the unpredictable random fluctuations in the error. Statistical analysis of the random disturbance components is necessary, such as calculating their mean, variance, and probability distribution, to understand their randomness and prepare for subsequent probability fusion.

[0032] ② Collect various models or methods that may affect the systematic bias of precipitation forecasts, forming a model set for the Bayesian model averaging method. These models can be precipitation forecast systematic bias correction models based on different physical processes, employing different parameterization schemes, or originating from different numerical weather prediction models. For example, they can include correction models based on statistical regression, correction models based on physical feedback processes, etc., each model having a different correction effect on the systematic bias components. Based on historical data and model performance, determine the weight of each model in the set using the Bayesian model averaging method. The weight is determined based on the accuracy and reliability of each model's past systematic bias corrections. Specifically, the posterior probability of each model can be calculated by comparing the error between the corrected precipitation forecast results of each model and the actual observed data, thus determining its weight. The model weight reflects its relative importance in the set; models with higher weights contribute more to the final correction result. Using the determined model weights, perform a weighted average of the systematic bias components to obtain the globally corrected systematic bias components. Combine the corrected systematic bias components with the original precipitation forecast results to obtain the preliminary corrected precipitation forecast field. This process, by integrating the advantages of multiple models, effectively reduces the impact of system bias on precipitation forecasts and improves forecast accuracy.

[0033] ③ Based on the statistical characteristics of the random disturbance components, a set of ensemble samples reflecting their uncertainty is generated. The number of ensemble samples is usually determined according to computational resources and accuracy requirements, typically ranging from tens to hundreds of samples. Each ensemble sample represents a possible realization of the random disturbance component, and its initial state can be generated by random sampling of the random disturbance component or based on its probability distribution. On a time series basis, prediction and update operations are performed on the ensemble samples. In the prediction phase, the dynamic equations of the numerical prediction model are used to advance the ensemble samples from the current time step to the next time step, resulting in the predicted ensemble samples. In the update phase, the predicted ensemble samples are compared with new observation data (such as random disturbance information in the real-time observation field), and the ensemble samples are adjusted and updated using the Kalman gain matrix to incorporate observation information and reduce uncertainty. The Kalman gain matrix is ​​calculated based on the covariance matrix of the ensemble samples and the observation error covariance matrix, determining the optimal update weights by balancing the uncertainty of model prediction and observation information. After ensemble Kalman filtering, a set of random disturbance component ensemble samples incorporating observation information is obtained. Statistical analysis is performed on these sample sets, calculating their mean, variance, and other statistical measures to obtain the probabilistic fusion results of the random disturbance components. The mean reflects the most likely estimate of the random disturbance, while the variance reflects the magnitude of its uncertainty. This probabilistic fusion result is combined with the systematic bias component corrected by the Bayesian model averaging method to obtain the final corrected precipitation forecast result.

[0034] The following embodiments illustrate a precipitation forecasting method based on multi-scale dual attention according to the present invention, specifically including the following steps: S10. Construct a deep learning model, specifically: like Figure 2 As shown, the deep learning model includes a multi-scale encoder (MM-Encoder), a terrain-aware spatiotemporal fusion module, and a decoder (HarmoFormer). The multi-scale encoder includes a ConvSC module and an MSAG module. This deep learning model can also be called an MS-HarmoFormer model. The decoder uses a CNN decoder, which is a key component in the deep learning model, used to progressively restore the high-level features extracted by the encoder to an output that matches the spatial dimension of the input data. In the precipitation forecast model, it receives the feature map fused from the encoder and attention module, and through deconvolution or upsampling operations, progressively restores the spatial resolution of the feature map, ultimately generating the predicted precipitation distribution. Its main function is to restore the spatial details of the prediction results while preserving key features, so as to more accurately predict the precipitation distribution.

[0035] The ConvSC module is a network architecture containing alternating convolutional layers. Convolutional layers are a crucial component for feature extraction in deep learning. In the ConvSC module, these alternating convolutional layers enable multi-level feature learning from the input data. It extracts features at different levels by sliding convolutional kernels along the spatial dimensions of the input data and performing convolution operations. This structural design allows the ConvSC module to effectively process spatially correlated data and efficiently capture precipitation patterns at different scales.

[0036] Different scales of precipitation patterns refer to the spatial and temporal differences in precipitation distribution. Small-scale precipitation patterns represent localized precipitation changes (such as in cities or valleys), influenced by topography and local meteorological conditions, and may last from a few minutes to a few hours. Large-scale precipitation patterns cover larger areas (such as across provinces or climate zones), are associated with large-scale meteorological systems (such as cyclones or fronts), and last for longer periods, from several days to several weeks. This classification helps in understanding the formation mechanisms of precipitation and its environmental impacts.

[0037] like Figure 3 As shown, the MSAG module includes a first convolutional layer Conv1, a MultiKernelMixer module, and a second convolutional layer Conv2. The data processing logic of the MSAG module is as follows: ① The first convolutional layer Conv1 receives and processes the output of the ConvSC module (precipitation patterns at different scales) through convolution operations to obtain the output of the first convolutional layer Conv1. The preset univariate precipitation data includes precipitation data.

[0038] ② The output of the first convolutional layer Conv1 is input into the MultiKernelMixer module for processing. The output of the MultiKernelMixer module is then input into the StarReLU activation function. The resulting calculations are input into the second convolutional layer Conv1 for convolutional processing, yielding spatial features of precipitation patterns at different scales. This process effectively extracts the spatial features of precipitation patterns at various scales. This not only enhances the model's ability to perceive precipitation features at multiple scales but also introduces nonlinearity through the activation function, enabling the model to better capture the complex changes in precipitation patterns.

[0039] Spatial characteristics of precipitation patterns at different scales refer to the distribution and variation of precipitation at different spatial scales. In precipitation forecasting models, convolutional operations and the MultiKernelMixer module are used to process meteorological data, capturing spatial information of precipitation patterns from local to large-scale. These characteristics include the intensity, extent, shape, and spatial variation trends of precipitation, such as the characteristics of mesoscale convective systems and topographically induced precipitation distribution. The model extracts multi-scale features through convolutional layers with different kernel sizes, and combines dilated convolution and attention mechanisms to further enhance its ability to perceive complex terrain and extreme precipitation events, thus providing a more accurate spatial description of precipitation forecasts.

[0040] like Figure 4 As shown, the MultiKernelMixer module includes a third convolutional layer (Conv3), a fourth convolutional layer (Conv4), a fifth convolutional layer (Conv5), a sixth convolutional layer (Conv6), a seventh convolutional layer (Conv7), an eighth convolutional layer (Conv8), a ninth convolutional layer (Conv9), and a tenth convolutional layer (Conv10). The data processing logic is as follows: ① The third convolutional layer, Conv3, receives and processes the output of the first convolutional layer, Conv1, through a convolution operation to obtain the output of the third convolutional layer, Conv3, which can further extract spatial information from the feature map. This process helps enhance the model's ability to perceive details of precipitation patterns and provides richer basic features for subsequent feature fusion and multi-scale analysis.

[0041] ② The output of the third convolutional layer Conv3 is processed by convolution operations through the fourth convolutional layer Conv4, the fifth convolutional layer Conv5, and the sixth convolutional layer Conv6. This multi-branch structure can capture precipitation pattern features at different scales and improve the model's ability to perceive multi-scale information.

[0042] ③ The output of the fourth convolutional layer (Conv4) is input to the seventh convolutional layer (Conv7) for convolutional processing; the output of the fifth convolutional layer (Conv5) is input to the eighth convolutional layer (Conv8) for convolutional processing; and the output of the sixth convolutional layer (Conv6) is input to the ninth convolutional layer (Conv9) for convolutional processing. This design, through the combination of different convolutional kernel sizes, can further refine the feature map and enhance the ability to capture the complex structure of precipitation patterns.

[0043] ④ The outputs of the third convolutional layer (Conv3), the eighth convolutional layer (Conv8), the ninth convolutional layer (Conv9), and the tenth convolutional layer (Conv10) are added together, and the result is input into the tenth convolutional layer (Conv10) for convolutional processing. This residual connection and feature fusion method helps to preserve multi-scale feature information while enhancing the model's expressive power and convergence speed.

[0044] ⑤ Perform a matrix multiplication between the output of the tenth convolutional layer (Conv10) and the output of the first convolutional layer (Conv1). The result of this matrix multiplication is the output of the MultiKernelMixer module. This cross-layer matrix multiplication operation enables deep feature fusion, enhances the model's ability to integrate spatial features of precipitation patterns, and improves prediction accuracy.

[0045] The kernel size of the third convolutional layer (Conv3) is 3×3, the kernel size of the fourth convolutional layer (Conv4) is 1×7, the kernel size of the fifth convolutional layer (Conv5) is 1×11, the kernel size of the sixth convolutional layer (Conv6) is 21×1, the kernel size of the seventh convolutional layer (Conv7) is 7×1, the kernel size of the eighth convolutional layer (Conv8) is 11×1, the kernel size of the ninth convolutional layer (Conv9) is 1×21, and the kernel size of the tenth convolutional layer (Conv10) is 3×3. The kernel sizes of the third convolutional layer (Conv3), fourth convolutional layer (Conv4), fifth convolutional layer (Conv5), sixth convolutional layer (Conv6), seventh convolutional layer (Conv7), eighth convolutional layer (Conv8), ninth convolutional layer (Conv9), and tenth convolutional layer (Conv10) can also be set according to actual needs.

[0046] like Figure 5 As shown, the terrain perception spatiotemporal fusion module includes a first normalization layer (Norm1), a global attention module (GlobalAttention), a second normalization layer (Norm2), and a fusion attention module (FusedAttention). The data processing logic is as follows: ① The first normalization layer Norm1 receives and normalizes the spatial features of precipitation patterns at different scales. It can capture the global features of the preset univariate precipitation data, enhance the model's ability to perceive large-scale meteorological information, and provide global context information for subsequent feature fusion.

[0047] ② The output of the first normalization layer Norm1 is input into the global attention module GlobalAttention for processing to obtain the global features of the preset univariate precipitation data; it can capture the global features of the preset univariate precipitation data, enhance the model's ability to perceive large-scale meteorological information, and provide global context information for subsequent feature fusion.

[0048] ③ The spatial features of precipitation patterns at different scales are weighted and summed with the output of the GlobalAttention module (which outputs global features of pre-defined univariate precipitation data) to obtain the first processing result. The weighting parameter used is 'a', which is a learnable parameter. Dynamically adjusting the weights using the learnable parameter 'a' can highlight important features and suppress noise, thereby improving the model's ability to focus on key information.

[0049] ④ The first processing result is added to the output of the GlobalAttention module to obtain the first addition result, and the first addition result is input into the second normalization layer Norm2 for normalization processing; this further stabilizes the distribution of the feature map, enhances the generalization ability of the model, and ensures the feature quality of subsequent processing.

[0050] ⑤ The output of the second normalization layer Norm2 is input into the fusion attention module FusedAttention for processing to obtain the local features of the preset univariate precipitation data; it can extract the local features of the preset univariate precipitation data, enhance the model's ability to capture local details, and improve the multi-scale understanding of precipitation patterns.

[0051] ⑥ The first summation result is weighted and summed with the output of the fusion attention module FusedAttention (preset local features of univariate precipitation data) to obtain the second processing result. The weighting parameter used is 1-a, which is a learnable parameter. By dynamically adjusting the weights using the learnable parameter 1-a, the contributions of global and local features can be balanced, the feature fusion effect can be optimized, and the expressive power of the model can be improved.

[0052] ⑦ The output of the fused attention module FusedAttention is added to the result of the second processing to obtain the spatiotemporal feature tensor. This tensor integrates global and local information to form a complete spatiotemporal description of the precipitation pattern, providing high-quality feature input for the final precipitation prediction.

[0053] In this model, the two weighted parameters mentioned above are used as part of the deep learning model. During the training of the deep learning model, the weighted parameters are also learned and optimized.

[0054] The specific implementation process of "dynamically fusing the global features of preset univariate precipitation data output by the global attention module with the local features of preset univariate precipitation data output by the fusion attention module through learnable parameters to obtain a spatiotemporal feature tensor" is described as follows: The GlobalAttention module receives spatial features of precipitation patterns at different scales from the output of the first normalization layer, Norm1, and extracts global features from them. Global feature extraction utilizes dilated convolutions to expand the receptive field and combines spatiotemporal location encoding to capture slowly varying climate features such as the evolution of large-scale weather systems. The output of this module contains large-scale meteorological feature information, providing the model with a perception of overall meteorological characteristics. The FusedAttention module receives the output of the second normalization layer, Norm2, and extracts local features. This process is achieved through adaptive pooling and one-dimensional convolution operations, enabling the extraction of multi-scale local features, which is highly consistent with the precipitation characteristics of areas significantly affected by elevation gradients. The FusedAttention module uses elevation gradients to guide the attention to dynamically adjust weights, enabling rapid response to extreme precipitation events and adapting to topographically induced abrupt changes in precipitation intensity, thereby highlighting local abrupt changes. After obtaining the global and local features, these two features are dynamically fused using learnable parameters. Specifically, a weighted summation operation is used to combine the global and local features, with the weighting parameter being 1-a, where a is a learnable parameter. This weighting parameter can be automatically adjusted during model training, dynamically balancing the contributions of global and local features. This process not only enhances the modeling ability for complex terrain and extreme precipitation events but also enables the model to adapt to non-uniform precipitation distributions by dynamically adjusting the weights. Finally, a spatiotemporal feature tensor is obtained, which integrates global and local information to form a complete spatiotemporal description of the precipitation pattern. This feature tensor contains rich spatial and temporal feature information, providing high-quality feature input for the final precipitation prediction, effectively improving the accuracy and robustness of precipitation forecasts. During model training, these learnable parameters are continuously optimized through backpropagation, enabling the model to automatically learn the optimal feature fusion method. This process not only improves the model's adaptability to complex meteorological conditions but also enhances its predictive ability for extreme precipitation events. Through this method, the model can more accurately capture the multi-scale features of the precipitation field, thereby achieving accurate simulation and efficient prediction of precipitation fields in complex terrain.

[0055] like Figure 6 As shown, the GlobalAttention module includes a third normalization layer (Norm3), a first dilated convolutional layer (Dilated Conv1), a second dilated convolutional layer (Dilated Conv2), and a third dilated convolutional layer (Dilated Conv3). The third normalization layer (Norm3) is a layer-by-layer normalization layer. The data processing logic of the GlobalAttention module is as follows: ① The output of the first normalization layer Norm1 is input into the third normalization layer Norm3 for layer normalization processing; this can further stabilize the distribution of feature maps, eliminate the dimensional differences between different features, improve the stability and convergence speed of the model, and provide higher quality input features for subsequent dilated convolution operations.

[0056] ② The output of the third normalization layer Norm3 is input into the first dilated convolutional layer Dilated Conv1, the second dilated convolutional layer Dilated Conv2, and the third dilated convolutional layer Dilated Conv3 respectively for dilated convolution operations. This can expand the receptive field by using convolutional kernels with different dilation rates, capture global features at different scales, and enhance the model's ability to perceive large-scale meteorological information.

[0057] ③ Multiply the output Q of the first dilated convolutional layer Dilated Conv1 and the output K of the second dilated convolutional layer Dilated Conv2 by matrix multiplication to obtain the first matrix multiplication result, which can enhance the model's ability to focus on key meteorological information.

[0058] ④ Multiply the result of the first matrix by the output V of the third dilated convolutional layer Dilated Conv3 to obtain the result of the second matrix by multiplying the first matrix by multiplying the second ...

[0059] ⑤ Add the output of the first normalization layer Norm1 to the result of multiplying the second matrix to obtain the output of the GlobalAttention module. This allows the model to retain original feature information through residual connections, enhancing its feature transfer capability, improving its integration of global features, and promoting stable convergence during model training.

[0060] The kernel size of the first dilated convolutional layer Dilated Conv1 is 1×1, the kernel size of the second dilated convolutional layer Dilated Conv2 is 1×1, and the kernel size of the third dilated convolutional layer Dilated Conv3 is 1×1. The kernel sizes of the first dilated convolutional layer Dilated Conv1, the second dilated convolutional layer Dilated Conv2, and the third dilated convolutional layer Dilated Conv3 can also be set according to the actual situation.

[0061] like Figure 7 As shown, the adaptive pooling layer in the fusion attention module adopts the global average pooling layer (GAP). The data processing logic of the fusion attention module is as follows: The Global Average Pooling (GAP) layer receives the output of the second normalization layer (Norm2) and performs global average pooling to obtain a dimensionality-reduced feature vector. To obtain local channel information in the dimensionality-reduced feature vector, a band matrix (band) is used to perform local channel interaction on the dimensionality-reduced feature vector to obtain local channel information. To obtain global channel information in the dimensionality-reduced feature vector, a diagonal matrix (diag) is used to perform local channel interaction on the dimensionality-reduced feature vector to obtain global channel information. The local channel information and global channel information are mixed, and the result is multiplied by the output of the second normalization layer (Norm2) to obtain the local features of the preset univariate precipitation data, thereby achieving the enhancement and accurate extraction of precipitation features.

[0062] The deep learning model is a deep learning architecture specifically designed for precipitation forecasting under complex terrain conditions. The deep learning model includes a multi-scale encoder (MS-Encoder), a terrain-aware spatiotemporal fusion module (HarmoFormer), and a decoder (the decoder can be a CNN decoder). The multi-scale encoder (MS-Encoder) includes a ConvSC module and a MSAG module (also known as a multi-scale channel attention module). ConvSC compresses resolution through convolutional layers, performs spatial downsampling, and increases the number of channels to capture precipitation patterns at multiple scales. The MSAG module is inserted after downsampling, using parallel dilated convolutions to aggregate multi-scale contextual information, capture local and global dependencies, and highlight key feature regions. The terrain-aware spatiotemporal fusion module (HarmoFormer) is the core of the deep learning model. It employs a dual-path feature fusion strategy, capturing multi-scale local correlations and long-range dependencies by fusing the FusedAttention and GlobalAttention attention modules. Specifically, the Global Attention module expands the receptive field through dilated convolutions, establishing global spatial correlations. The Fused Attention module extracts multi-scale local features through adaptive pooling and 1D convolution operations, and dynamically fuses channel and spatial attention using the Mix module to enhance the perception of small- and medium-scale convective systems. Learnable parameters are used to dynamically balance the contributions of the Fused Attention and Global Attention modules, adapting to non-uniform precipitation distribution and strengthening the modeling ability of complex terrain and precipitation coupling. Finally, the model generates precipitation prediction results through a CNN decoder combined with skip connections. The skip connections retain the output of the initial layers, providing high-frequency detail information to the CNN decoder, thereby achieving accurate simulation and efficient prediction of precipitation changes in complex terrain, improving prediction accuracy and adaptability to precipitation changes in complex terrain.

[0063] The multi-scale encoder MS-Encoder employs an innovative hierarchical downsampling architecture, constructed alternately from ConvSC and MSAG modules. Specifically, the ConvSC module reduces the spatial resolution by a factor of 2 in even-numbered layers through convolutional operations while increasing channel dimensions to capture precipitation patterns at multiple scales. Following each downsampling step, an MSAG module is connected. The MSAG module aggregates multi-scale contextual information through parallel dilated convolutions, using convolutional kernels of varying sizes from 3×3 to 7×3 to highlight key regions, such as topographic precipitation areas. Furthermore, the output of the initial layers is retained for skip connections to provide high-frequency detail information during the decoding stage, assisting the decoder in accurate reconstruction.

[0064] HarmoFormer, a terrain-aware spatiotemporal fusion module, is a highly innovative weather forecasting network. By fusing local feature interactions with a global spatial attention mechanism, it effectively achieves efficient spatiotemporal modeling of precipitation fields under complex terrain conditions. The core innovation of this module lies in its dual-path feature fusion and dynamic weight allocation mechanism. During feature fusion, the fusion attention module (Fused Attention) and the global attention module (Global Attention) have clearly defined roles. Specifically, Fused Attention focuses on capturing multi-scale local correlations, while Global Attention is dedicated to establishing long-range spatial dependencies, thus effectively addressing the challenges posed by the non-uniform distribution of precipitation fields. The dynamic weight allocation mechanism automatically adjusts the contribution of each module through learnable parameters, thereby enhancing the modeling ability for areas heavily influenced by altitude and the complex coupling relationship between precipitation and these factors.

[0065] HarmoFormer, a terrain-aware spatiotemporal fusion module, is a highly innovative weather forecasting network that effectively achieves efficient spatiotemporal modeling of precipitation fields under complex terrain conditions by fusing local feature interactions with a global spatial attention mechanism. The core innovation of this module lies in its dual-path feature fusion and dynamic weight allocation mechanism. During feature fusion, the Global Attention module focuses on building global spatial correlations, expanding the receptive field through dilated convolutions to cover the influence range of weather systems across a wide area. Dilated convolutions increase the spacing between convolutional kernels, expanding the receptive field of the deep learning model and enabling it to capture meteorological features over a larger area, which is crucial for understanding weather changes under complex terrain conditions. The Fused Attention module addresses the challenge of jointly modeling local abrupt changes and regional continuity in precipitation fields. Operating through adaptive pooling layers and one-dimensional convolutional layers, this module can extract multi-scale features, which perfectly matches the precipitation characteristics of areas significantly affected by elevation gradients. Simultaneously, the Mix module dynamically fuses channels and spatial attention, significantly enhancing the perception capability of small- and medium-scale convective systems. The dynamic weight allocation mechanism automatically adjusts the contribution of each module through learnable parameters, enhancing the modeling ability of complex coupling relationships between regions with high altitude and precipitation, thereby achieving accurate simulation and efficient prediction of precipitation fields in complex terrains.

[0066] S11. Training the deep learning model: ERA5 is the fifth-generation atmospheric reanalysis dataset of global climate from January 1950 to the present, compiled by the ECMWF (European Centre for Medium-Range Weather Forecasts). ERA5 was produced by the ECMWF's Copernicus Climate Change Service (C3S). ERA5 provides hourly estimates of a large number of atmospheric, terrestrial, and oceanic climate variables. The data covers the Earth on a 30-kilometer grid and uses 137 altitude layers from the surface to 80 kilometers to resolve the atmosphere, including uncertainty information for all variables when spatial and temporal resolution is reduced. ERA5 combines model data with observational data from around the world to form a complete and consistent global dataset, replacing its predecessor, ERA-Interim reanalysis.

[0067] The data acquisition and preprocessing for the deep learning model revolves around the needs of precipitation forecasting in complex terrain. The core data comes from the ERA5 global reanalysis dataset, selecting total precipitation (TP) from June to September 2019-2023 in a predefined region as the core research object. In this predefined region, 85% of precipitation is concentrated in summer and exhibits significant spatiotemporal heterogeneity, with precipitation primarily of low to medium intensity, while also including rare heavy precipitation events (≥10 mm) coupled with complex terrain. Data was split: summer data from 2019-2021 was used for model training, 2022 data served as the validation set for parameter optimization, and 2023 data served as the test set for evaluating generalization ability. Considering the model's sensitivity to extreme values, the raw precipitation data was standardized to a format suitable for model input. This preserved the precipitation intensity distribution characteristics and terrain-induced spatial heterogeneity, provided high-quality data support for multi-scale feature extraction and attention mechanism modeling, and laid the data foundation for subsequent adaptive optimization based on the Log-Cosh loss function.

[0068] When training the deep learning model, the Log-Cosh loss function is used as the regression objective function. The Log-Cosh loss function calculates the difference between the predicted value and the actual precipitation through the logarithmic transformation of hyperbolic cosine. Its mathematical expression is: Where y represents the actual precipitation. These are the model's predicted values. The parameter is set to adjust (default value is 1.0). The Log-Cosh loss function has significant advantages in precipitation prediction scenarios. It addresses the uneven spatiotemporal distribution of precipitation and the frequent occurrence of extreme precipitation events. Its penalty mechanism for large errors approximates the mean absolute error (MAE), effectively avoiding the gradient explosion problem that traditional mean squared error (MSE) might cause when dealing with extreme values, thus enhancing the model's robustness to anomalous precipitation events. Unlike MAE, which is non-differentiable at zero, the Log-Cosh loss function is second-order differentiable across its entire domain, providing a smoother gradient signal for gradient descent optimization algorithms and promoting stable convergence during model training. Furthermore, by adjusting the parameter δ, the Log-Cosh loss function can flexibly adjust the penalty weights for small and large errors, approximating MSE in the small error range and MAE in the large error range. This characteristic allows it to adapt to the modeling needs of different precipitation intensity ranges, achieving accurate fitting of multi-scale features of the precipitation field.

[0069] Table 1 compares the MS-HarmoFormer model of this invention with related deep learning models from recent years. Specifically, it compares the proposed method with cutting-edge model architectures such as ConvLSTM, PredRNN, SimVP-v2, TAU, UniFormer, and PoolFormer. This comparison aims to evaluate the performance and efficiency of the proposed method in processing time series data. The table shows that the MS-HarmoFormer model of this invention achieves a significant performance improvement compared to other models.

[0070] Table 1: Based on the precipitation classification, four threshold ranges were selected from sunny to heavy rain. For 12-hour precipitation, thresholds of 0.1, 4.9, 14.9, and 29.9 were generally chosen. The CSI index results for different thresholds are shown in Table 2.

[0071] Table 2: The calculation formulas for the meteorological assessment indicators used in this invention are as follows: Where N represents the number of samples, N1 represents the number of grid points in the latitudinal direction, and N2 represents the number of grid points in the longitudinal direction; L(j) represents the weighting factor for the j-th latitude, used to adjust for area differences between regions at different latitudes. i,j,k f represents the actual precipitation of the i-th sample at the j-th latitude and k-th longitude. i,j,k This represents the predicted precipitation for the i-th sample at the j-th latitude and k-th longitude. Represents the true value image. Represents the predicted value image, μ y This represents the mean of the image of the true values. This represents the mean of the predicted value image. The variance of the image representing the true values. This represents the variance of the predicted value image. This represents the covariance between the actual and predicted images. C1 and C2 are constants used to avoid zero denominators and to adjust for area differences across different latitudes. L represents the maximum possible value of the image pixels. RMSE and MAE measure the root mean square error and absolute difference between the predicted and actual values ​​obtained from the precipitation forecast model. SSIM measures the similarity between two images, considering brightness, contrast, and structure. and These are the average brightness of the two image patches, and These are the contrast ratios of the two images. It is the covariance of two images, which measures their structural similarity.

[0072] PSNR measures the peak error between the original and compressed images, where MSE is the mean square error of the two images, and L is the maximum value that the image pixels can take. CSI measures the proportion of correctly predicted observed or predicted events, focusing on event prediction. CSI measures the proportion of correctly predicted events, focusing on event prediction. TP is the number of true positives, correctly predicted as precipitation (meaning there are precipitation events in both the actual and predicted scenarios); TN is the number of true negatives, correctly predicted as no precipitation (meaning there are no precipitation events in either the actual or predicted scenarios); FN is the number of false negatives, incorrectly predicted as no precipitation (meaning there are precipitation events in the actual scenario, but the model predicts no precipitation); FP is the number of false positives, incorrectly predicted as precipitation (meaning there are no precipitation events in the actual scenario, but the model predicts precipitation).

[0073] The variables in the samples used to train the deep learning model are precipitation data, and the output target in the samples is the total precipitation. The deep learning model is trained using the training set, hyperparameters are tuned using the validation set, and generalization ability is evaluated using the test set.

[0074] The tensor input to the deep learning model is (B,T,C,H,W), where B represents the batch size, T represents the duration, C represents one channel (the channel corresponding to precipitation), H represents latitude, W represents longitude, and H×W represents the spatial grid. The tensor corresponding to the output precipitation forecast result is (B,T,1,H,W), where "1" represents one channel through which the predicted precipitation is output.

[0075] S12. Based on historical precipitation data of the preset area, use the precipitation forecasting model to make precipitation forecasts and obtain the precipitation forecast results for the preset area.

[0076] In another embodiment, precipitation forecast data for areas significantly affected by altitude from June to September is first obtained from the ERA5 dataset and preprocessed. The preprocessed data input shape is (16, 12, 1, 32, 64), where 16 represents the batch size, 12 represents 12 time steps, 1 represents the channel size, and 32 and 64 represent latitude and longitude, respectively. Since the total precipitation (TP) data used as labels is essentially similar to a sparse matrix, the data unit needs to be converted from meters (m) to millimeters (mm), followed by regularization. After data preprocessing, the dataset is divided, and precipitation data from the first 12 time steps (e.g., precipitation data from the first 12 hours, with each hour as a time step) is used as input to predict precipitation for the next 12 time steps, thus achieving a forecast of precipitation for the next 12 hours. To construct a prediction system suitable for the complex precipitation characteristics of this region, data from June to September 2019 to 2023 are extracted as the research sample. The summer precipitation data from 2019 to 2021 were used to train the precipitation prediction model, the 2022 data served as the validation set to optimize the model parameters, and the 2023 data served as the test set to evaluate the model's generalization ability. Assume a set of input tensors is given. The number of sequences, B = |B|. In the encoder and decoder, we reshape the sequential input data B×T×C×H×W into (B×T)×C×H×W to consider only spatial correlation. This reshaping helps the model to effectively extract and encode features in the spatial dimension. In the terrain-aware spatiotemporal fusion module, the features are reshaped from B×T×C×H×W to B×(T×C)×H×W so that frames are arranged according to the channel dimension, thereby enhancing the model's ability to process time series data. Regarding the loss function, the Log-Cosh loss function is proposed. This loss function calculates the difference between the predicted value and the actual precipitation through hyperbolic cosine logarithmic transformation, significantly enhancing the stability of heavy precipitation prediction. Specifically, the Log-Cosh loss function performs well in handling extreme precipitation events, avoiding the gradient explosion problem that may occur in traditional loss functions when facing large errors, while maintaining second-order differentiability throughout the entire domain, providing a smoother gradient signal for the optimization algorithm. Since the final precipitation prediction results are multi-dimensional arrays, various metrics were used in the model performance evaluation, including root mean square error (RMSE), mean square error (MSE), peak signal-to-noise ratio (PSNR), and structural similarity (SSIM). These metrics comprehensively evaluated the model's predictive performance from different perspectives. Visualization results are shown below. Figure 8 As shown, the model's performance in precipitation prediction tasks is intuitively demonstrated.

[0077] The proposed deep learning model (MS-HarmoFormer model) is an innovative deep learning precipitation forecasting model designed to address the challenges of predicting precipitation in complex terrains and extreme events. Its core technical solution encompasses multi-dimensional innovative design. The model employs a multi-scale encoder (MS-Encoder) architecture, achieving feature extraction through a hierarchical downsampling design. Specifically, alternating convolutional layers (ConvSC) reduce spatial resolution while increasing channel dimensions to capture precipitation patterns at different scales, such as mesoscale convective systems. The multi-scale attention group (MSAG) module aggregates multi-scale contextual information through parallel dilated convolutions, using convolutional kernels of different sizes to highlight key features such as terrain-dependent precipitation regions, and retains the initial layer output as skip connections to provide high-frequency details for the decoder. At the feature fusion level, the innovatively designed HarmoFormer module implements a dual-path mechanism: global attention expands the receptive field through dilated convolutions and combines spatiotemporal location encoding to capture slowly changing climate features such as the evolution of large-scale weather systems; fusion attention uses adaptive pooling and one-dimensional convolutions to extract multi-scale local features, and leverages gradient-guided attention to dynamically adjust weights to quickly respond to extreme precipitation events. Specifically, the fusion attention module Fused Attention incorporates terrain information when extracting multi-scale local features. Through adaptive pooling and one-dimensional convolution operations, the module can capture precipitation feature changes caused by elevation gradients. This operation can effectively integrate precipitation features at different elevations to form a more comprehensive feature representation. The fusion attention module Fused Attention uses a gradient-guided attention mechanism to dynamically adjust the weights of different regions in the feature map. Specifically, the module identifies high-intensity change regions in precipitation features related to elevation gradients through gradient information and assigns higher weights to these regions. This enables the model to more accurately capture abrupt changes in precipitation patterns at different elevations. The fusion attention module Fused Attention dynamically adjusts weights through learnable parameters to adapt to precipitation features at different elevation gradients. This dynamic adjustment mechanism enables the model to flexibly allocate attention based on terrain changes, thereby enhancing its ability to model precipitation distribution under complex terrain conditions. The Fused Attention module dynamically fuses channel and spatial attention through the Mix module, significantly enhancing its ability to perceive small- and medium-scale convective systems. This capability is particularly important under complex terrain conditions because small- and medium-scale convective systems are often closely related to the terrain's altitudinal gradient. It adapts to terrain-induced abrupt changes in precipitation intensity, with both dynamically allocated weights through learnable parameters to balance local abrupt changes and long-range dependency modeling. Furthermore, the model employs a Log-Cosh loss function with adaptive parameter δ to optimize the training process, balancing extreme value and stationary region error weights through hyperbolic cosine logarithmic transformation, effectively mitigating the underestimation problem in extreme precipitation forecasts and improving model robustness.

[0078] Although the steps have been numbered in the above embodiments, they are only specific embodiments given by the present invention. Those skilled in the art can adjust the execution order of the steps according to the actual situation, which is also within the protection scope of the present invention. It can be understood that some embodiments may include some or all of the above embodiments.

[0079] like Figure 9 As shown, a precipitation forecasting system 200 based on multi-scale dual attention according to an embodiment of the present invention includes a model building module 201, a model training module 202, and a precipitation forecasting module 203. The model building module 201 is used to: construct a deep learning model including a multi-scale encoder, a terrain-aware spatiotemporal fusion module, and a decoder. The multi-scale encoder is used to: process preset univariate precipitation data to obtain spatial features of precipitation patterns at different scales; the terrain-aware spatiotemporal fusion module is used to: process spatial features using a global attention module and a fusion attention module, and dynamically fuse the global features of the preset univariate precipitation data output by the global attention module with the local features of the preset univariate precipitation data output by the fusion attention module through learnable parameters to obtain a spatiotemporal feature tensor; the decoder is used to: perform precipitation forecasting based on the spatiotemporal feature tensor. Model training module 202 is used to: train the deep learning model to obtain a precipitation forecast model; The precipitation forecast module 203 is used to: forecast precipitation based on historical precipitation data of a preset area using a precipitation forecast model, and obtain the precipitation forecast results for the preset area.

[0080] Optionally, in the above technical solution, the multi-scale encoder includes a ConvSC module and an MSAG module. The ConvSC module is used to process preset univariate precipitation data to obtain precipitation patterns at different scales. The MSAG module is used to obtain the spatial features of precipitation patterns at different scales by using convolution kernels of different sizes.

[0081] Optionally, in the above technical solution, the global attention module obtains the global features of the preset univariate precipitation data by expanding the convolutional layer; the fusion attention module obtains the local features of the preset univariate precipitation data by using the adaptive pooling layer and the convolutional layer.

[0082] Optionally, in the above technical solution, the model training module 202 is specifically used for: A precipitation forecasting model is obtained by training a deep learning model based on the Log-Cosh loss function.

[0083] It should be noted that the beneficial effects of the precipitation forecasting system 200 based on multi-scale dual attention provided in the above embodiments are the same as those of the precipitation forecasting method based on multi-scale dual attention, and will not be repeated here. Furthermore, the system provided in the above embodiments is only illustrated by the division of the above functional modules. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the system can be divided into different functional modules according to the actual situation to complete all or part of the functions described above.

[0084] An electronic device according to an embodiment of the present invention 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, it implements any of the above-mentioned precipitation forecasting methods based on multi-scale dual attention.

[0085] An embodiment of the present invention provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements any of the above-mentioned precipitation forecasting methods based on multi-scale dual attention.

[0086] It should be noted that the terms "first," "second," etc., used in the specification and claims of this invention are used to distinguish similar objects and represent a limitation on a specific order or sequence. Where appropriate, the order of use for similar objects can be interchanged so that the embodiments of the invention described herein can be implemented in an order other than that shown or described.

[0087] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.

Claims

1. A precipitation forecast method based on multi-scale double attention, characterized in that, The method comprises the following steps: constructing a deep learning model comprising a multi-scale encoder, a terrain-aware spatio-temporal fusion module and a decoder, wherein the multi-scale encoder is configured to process preset single-variable precipitation data to obtain spatial features of precipitation patterns at different scales; the terrain-aware spatio-temporal fusion module is configured to process the spatial features by using a global attention module and a fusion attention module, and dynamically fuse global features of the preset single-variable precipitation data output by the global attention module and local features of the preset single-variable precipitation data output by the fusion attention module through learnable parameters to obtain a spatio-temporal feature tensor; and the decoder is configured to perform precipitation prediction according to the spatio-temporal feature tensor; training the deep learning model to obtain a precipitation prediction model; performing precipitation prediction based on historical precipitation data of a preset region by using the precipitation prediction model to obtain a precipitation prediction result of the preset region.

2. The method of claim 1, wherein the method is characterized by, The multi-scale encoder comprises a ConvSC module and an MSAG module, the ConvSC module is configured to process the preset single-variable precipitation data to obtain precipitation patterns at different scales; and the MSAG module is configured to obtain spatial features of the precipitation patterns at different scales by using convolution kernels of different sizes.

3. The method of claim 1, wherein the method is characterized by, The global attention module obtains global features of the preset single-variable precipitation data through a dilated convolution layer; and the fusion attention module obtains local features of the preset single-variable precipitation data through an adaptive pooling layer and a convolution layer.

4. The method according to any one of claims 1 to 3, wherein, The method of training the deep learning model to obtain a precipitation prediction model comprises: training the deep learning model based on a Log-Cosh loss function to obtain the precipitation prediction model.

5. A precipitation forecasting system based on multi-scale dual attention, characterized in that, The method comprises a model construction module, a model training module and a precipitation prediction module; The model construction module is configured to construct a deep learning model comprising a multi-scale encoder, a terrain-aware spatio-temporal fusion module and a decoder, wherein the multi-scale encoder is configured to process preset single-variable precipitation data to obtain spatial features of precipitation patterns at different scales; the terrain-aware spatio-temporal fusion module is configured to process the spatial features by using a global attention module and a fusion attention module, and dynamically fuse global features of the preset single-variable precipitation data output by the global attention module and local features of the preset single-variable precipitation data output by the fusion attention module through learnable parameters to obtain a spatio-temporal feature tensor; and the decoder is configured to perform precipitation prediction according to the spatio-temporal feature tensor; The model training module is configured to train the deep learning model to obtain a precipitation prediction model; The precipitation prediction module is configured to perform precipitation prediction based on historical precipitation data of a preset region by using the precipitation prediction model to obtain a precipitation prediction result of the preset region.

6. The precipitation forecasting system based on multi-scale dual attention of claim 5, wherein, The multi-scale encoder comprises a ConvSC module and an MSAG module, the ConvSC module is configured to process the preset single-variable precipitation data to obtain precipitation patterns at different scales; and the MSAG module is configured to obtain spatial features of the precipitation patterns at different scales by using convolution kernels of different sizes.

7. The precipitation forecasting system based on multi-scale dual attention of claim 5, wherein, The global attention module obtains global features of the preset single-variable precipitation data through a dilated convolution layer; and the fusion attention module obtains local features of the preset single-variable precipitation data through an adaptive pooling layer and a convolution layer.

8. The multi-scale dual-attention-based precipitation forecasting system according to any one of claims 5 to 7, characterized in that, The model training module is specifically configured to: Based on a Log-Cosh loss function, the deep learning model is trained to obtain a precipitation prediction model.

9. An electronic device, comprising: The computer readable storage medium stores a computer program, and the computer program is executed by the processor to implement the precipitation prediction method based on the multi-scale double attention according to any one of claims 1 to 4.

10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the computer program is executed by the processor to implement the precipitation prediction method based on the multi-scale double attention according to any one of claims 1 to 4.

Citation Information

Cited By

  • Weather forecasting method based on feature fusion and region correction and medium

    CN121524958A

  • Meteorological forecasting method and medium based on feature fusion and region revision

    CN121524958B

  • Summer rainfall sub-season prediction method and system fused with multi-scale deep learning

    CN121543028A