A High-Performance Rendering Method for Regional Numerical Weather Prediction Models Based on WebGL
By performing multi-concurrent and high-precision data projection interpolation calculation in WebGL, the projection inconsistency problem of real-time display of regional numerical forecast data is solved, real-time rendering of high-precision weather forecasts is realized, and data accuracy is maintained.
Patent Information
- Application Number
- CN202410892617.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-04
- Publication Date
- 2025-06-20
- Estimated Expiration
- 2044-07-04
AI Technical Summary
When the prior art displays area numerical forecast data in real time, due to inconsistent projection, the pixel-by-pixel conversion time cannot be supported, and the real-time display of high-precision weather forecasts will be lost. Preprocessing and resampling will lose the accuracy of the original data.
Using a high-performance drawing method based on WebGL, the two-dimensional data field and projection parameters of the region numerical forecast mode are passed into WebGL, and multi-concurrent and high-precision data projection interpolation is performed through the chip shader, and the Lambotto coordinate conversion and data index position are directly calculated in the GPU.
Without losing data accuracy, the real-time rendering speed of regional numerical mode data is significantly improved, and the real-time display of high-precision weather forecasts is supported, which meets the forecaster's high-precision interactive display analysis needs.
Smart Images

Figure CN118708752B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of data processing, and particularly relates to a high-performance rendering method for a regional numerical weather prediction model based on WebGL. Background Art
[0002] Numerical weather prediction has important reference significance in the daily weather forecasting process. Through numerical weather prediction, forecasters can conveniently understand the global meteorological situation and the meteorological development trends in the next few days. Compared with global numerical weather prediction, high-precision regional models can use higher resolutions in a small area to reflect more accurate micro-meteorological information in a small regional area, which has great reference significance for accurate weather forecasting in local areas;
[0003] The output data of the regional numerical model prediction is calculated based on actual physical coordinates. The output two-dimensional data field of m*n is generally in Lambert conformal conic coordinates, and the coordinate unit is kilometers or meters from the projection center point.
[0004] Since the Earth is spherical, and WebGIS generally uses planar coordinates of equirectangular or Mercator projection. If all meteorological data needs to be displayed on a map, the points on the screen need to be coordinate-transformed. After being transformed into longitude and latitude coordinates, they are then transformed into coordinates consistent with the data projection, so as to obtain the data value at the current screen coordinate position through interpolation in the data field. Figure 1 This leads to the fact that for data with non-equirectangular projection, when performing real-time display, due to the inconsistency between the projection of the map on the display screen and the data projection, the screen coordinates need to be pixel-by-pixel transformed into longitude and latitude and then projected a second time. Due to the complexity of the projection algorithm, for data within the full screen range, pixel-by-pixel transformation takes about 1 to 2 seconds to complete as tested. Such a long time consumption cannot support the real-time display of regional numerical weather prediction data to support weather forecasting operations.
[0005] The traditional solution is to preprocess the high-precision regional model in advance. By means of resampling, it is transformed into a data field with equirectangular projection. In this way, when displaying on the front-end WebGIS, the most time-consuming step of the second transformation of Lambert conformal conic coordinates can be omitted. As long as linear interpolation is performed on the longitude and latitude positions, the data at the current position can be obtained for display, meeting the front-end display performance requirements.
[0006] However, this method will introduce a major problem. After the data is preprocessed by resampling, the accuracy of the original data will be lost, which has a certain negative impact on high-precision weather forecasting.
[0007] But this method will introduce a relatively large problem. After the data is preprocessed by resampling, it will cause loss of the accuracy of the original data, which has a certain negative impact on high-precision weather forecasting. Summary of the Invention
[0008] The present invention provides a high-performance rendering method for a regional numerical weather prediction model based on WebGL. The improvement lies in that the method includes
[0009] Step (1): Input the two-dimensional data field with a resolution in the regional numerical weather prediction model, the projection parameters of the data under the Lambert projection, and the data range parameters into WebGL; The projection parameters of the data under the Lambert projection, and the data range parameters into WebGL;
[0010] Step (2): In the WebGIS map, obtain the map longitude and latitude coordinates at the upper left corner and the lower right corner within the screen range of the map, and input them into WebGL;
[0011] Step (3): Obtain the longitude and latitude coordinates of the current screen pixel in WebGL;
[0012] Step (4): Convert the longitude and latitude coordinates of the current screen pixel into Lambert coordinates;
[0013] Step (5): Calculate the position ratio of the Lambert coordinates within the range of the two-dimensional data field;
[0014] Step (6): Calculate the corresponding data index position of the Lambert coordinate position in the two-dimensional data field, and obtain the data corresponding to this data index position in the two-dimensional data field.
[0015] Further, step (1) includes
[0016] (1-1) Extract the two-dimensional data field with a resolution from the regional numerical weather prediction model as the two-dimensional texture data of the shader, and input it into the fragment shader of WebGL; Extract the two-dimensional data field with a resolution from the regional numerical weather prediction model as the two-dimensional texture data of the shader, and input it into the fragment shader of WebGL;
[0017] (1-2) Input the projection parameters of the regional numerical weather prediction model data under the Lambert projection as calculation parameters into the fragment shader of WebGL;
[0018] (1-3) Input the data range parameters of the regional numerical weather prediction model data under the Lambert projection as calculation parameters into the fragment shader of WebGL.
[0019] Further, step (2) includes obtaining the map longitude and latitude coordinates at the upper left corner and the lower right corner within the screen range of the WebGIS map as map parameters, and inputting them into the fragment shader of WebGL.
[0020] Further, step (3) includes obtaining the longitude and latitude coordinates of the current screen pixel through linear proportional interpolation in the WebGL fragment shader. The algorithm is as follows:
[0021] ;
[0022] Among them, , is the longitude and latitude coordinate position corresponding to the current screen pixel, , is the current screen pixel coordinate, , are the width and height of the current screen display range respectively.
[0023] Furthermore, step (4) includes converting the longitude and latitude coordinates of the current screen pixel into Lambert coordinates in the fragment shader.
[0024] Even further, step (4) includes
[0025] (4-1) Converting the longitude and latitude coordinates of the current screen pixel into radian coordinates :
[0026] ;
[0027] Calculating the standard latitude of projection and the standard latitude of projection :
[0028] ;
[0029] Among them, is the ellipsoidal eccentricity, is the latitude origin;
[0030] (4-2) Calculating the scale factor and :
[0031] ;
[0032] ;
[0033] Converting the longitude and latitude coordinates into the Lambert projection coordinates of the data range:
[0034] ;
[0035] ;
[0036] Among them, is the radius of the earth;
[0037] (4-3) Converting the longitude and latitude coordinates corresponding to the current screen pixel into the Lambert coordinates of the projection used by the data , .
[0038] Furthermore, step (5) includes
[0039] Calculate Lambert coordinates , In the entire two-dimensional data field range, the position ratio is calculated as follows:
[0040] ;
[0041]
[0042] Among them, the horizontal and vertical coordinate ranges of the entire data field are respectively represented as [0 - 1], 、 represents the position ratio of the current screen coordinate position in the entire two-dimensional data field.
[0043] Further, the step (6) includes
[0044] According to the Lambert coordinate position, calculate the corresponding data index position in the two-dimensional data field, and obtain the data corresponding to the data index position in the two-dimensional data field. The data index position is:
[0045] .
[0046] Further still, in the two-dimensional data field, read the floating-point number represented by 4 bytes starting from this position, which is the data corresponding to this screen coordinate; look up the color table to obtain the color corresponding to this screen position and display it.
[0047] Beneficial effects:
[0048] The present invention utilizes the high-performance concurrent processing characteristics of the multi-rendering pipeline of the GPU. On the premise of maintaining the original accuracy of the data, the secondary projection calculation algorithm of the regional numerical model data is placed in the GPU for calculation, which can improve the projection calculation and rendering time of all pixels in the entire screen range for the regional numerical model data to within 1 - 2 ms. Enabling the regional numerical model data to perform real-time rendering and display based on WebGIS while maintaining the original accuracy, solving the performance problem of high-precision interactive display and analysis of the regional numerical model in Lambert projection.
[0049] It should be understood that the above general description and the following specific embodiments are only exemplary and explanatory, and they do not limit the scope claimed by this application. Brief description of the drawings
[0050] Figure 1 It is a flowchart of a high-performance rendering method for a regional numerical weather prediction model based on WebGL according to the present invention.
[0051] It should be understood that the drawings need not be drawn to scale and present a somewhat simplified representation of the various features illustrating the basic principles of the present disclosure. Specific design features of the present invention as disclosed herein, including, for example, specific dimensions, orientations, positions, and shapes, will be determined in part by the particular intended application and use environment.
[0052] In the figures, throughout several views of the drawings, reference numerals refer to the same or equivalent parts of the present invention. Detailed Description
[0053] Reference will now be made in detail to various embodiments of the present invention, examples of which are illustrated in the drawings and described below. Although the present invention will be described in conjunction with the exemplary embodiments of the present invention, it should be understood that this specification is not intended to limit the present invention to those exemplary embodiments. On the other hand, the present invention is intended to cover not only the exemplary embodiments of the present invention, but also various alternatives, modifications, equivalents, and other embodiments, which may be included within the spirit and scope of the present invention as defined by the appended claims.
[0054] Hereinafter, exemplary embodiments of the present invention will be described in detail with reference to the drawings. The specific structures and functions described in the exemplary embodiments of the present invention are for illustrative purposes only. Embodiments according to the concept of the present invention can be implemented in various forms, and it should be understood that they should not be construed as being limited by the exemplary embodiments described in the exemplary embodiments, but include all modifications, equivalents, or alternatives included within the spirit and scope of the present invention.
[0055] Throughout the specification, the technical terms used herein are only for describing various exemplary embodiments and are not intended to be limiting. It will be further understood that terms such as "comprising," "including," "having," etc., when used in the exemplary embodiments, specifically refer to the presence of the stated components, steps, operations, or elements, but do not exclude the presence or addition of one or more other components, steps, operations, or elements.
[0056] The problem to be solved by the present invention is to adopt a drawing method based on WebGL to convert the original high-precision meteorological data into two-dimensional data field texture data and transmit it into the GPU. By making full use of the multi-rendering pipeline technology of the GPU and performing multi-concurrent, high-precision, and high-performance data projection interpolation calculations through the fragment shader, the real-time drawing speed of the high-precision regional numerical forecast data of the Lambert projection is increased to within 2 ms, and without loss of data accuracy, it fully meets the real-time drawing requirements of forecasters for the weather forecast data of the high-precision regional data of the Lambert projection.
[0057] As Figure 1As shown in the figure, the present invention provides a high-performance rendering method for a regional numerical weather prediction model based on WebGL. In order to enable the front-end WebGIS to quickly display high-precision regional numerical weather predictions, starting from the data format preprocessing stage, while maintaining data accuracy, the data is re-encoded so that it can be directly passed into the GPU as a texture for display. The method includes:
[0058] Step S1: Pass the two-dimensional data field with a resolution of in the regional numerical weather prediction model, the data projection parameters and data range parameters under the Lambert projection, into WebGL;
[0059] S11. Extract the two-dimensional data field with a resolution of from the regional numerical weather prediction model, and use it as the two-dimensional texture data of the shader, and pass it into the fragment shader of WebGL;
[0060] S12. Pass the data projection parameters lon0, phic, lat1, lat2 of the regional numerical weather prediction model data as calculation parameters into the fragment shader of WebGL;
[0061] S13. Pass the data range parameters west, east, north, south, the east-west grid spacing dx, the north-south grid spacing dy, and the map radius earth of the regional numerical weather prediction model data under the Lambert projection as calculation parameters into the fragment shader of WebGL;
[0062] Step S2: In the WebGIS map, obtain the map longitude and latitude coordinates of the upper left corner and the lower right corner within the screen range, and pass them into WebGL;
[0063] S21. In the WebGIS map, obtain the map longitude and latitude coordinates of the upper left corner and the lower right corner within the screen range, [x0, y0], [x1, y1], and pass these two coordinates as map parameters into the fragment shader of WebGL;
[0064] Step S3: Obtain the longitude and latitude coordinates of the current screen pixel in WebGL;
[0065] S31. In the WebGL fragment shader, obtain the longitude and latitude coordinates of the current screen pixel through linear proportional interpolation. The algorithm is as follows:
[0066] ;
[0067] Among them, , are the data projection parameters, , is the current screen coordinate directly obtained through the built-in method of the fragment shader, , are the width and height of the current screen display range respectively;
[0068] Step S4: Convert the longitude and latitude coordinates of the current screen pixels into Lambert coordinates;
[0069] S41. In the fragment shader, convert the longitude and latitude coordinates of the current screen pixels into Lambert coordinates. The algorithm is as follows:
[0070] First, convert the longitude and latitude coordinates of the current screen pixels into radian coordinates ;
[0071] ;
[0072] Calculate the standard latitude of projection and the standard latitude of projection :
[0073] ;
[0074] where is the ellipsoidal eccentricity, is the latitude origin.
[0075] Calculate the scale factor and :
[0076] ;
[0077] ;
[0078] Thus, the longitude and latitude coordinates can be converted into the Lambert projection coordinates within the data range:
[0079] ;
[0080] ;
[0081] where is the radius of the earth, generally taking the value of 6378137.0 meters.
[0082] Through the above steps, the longitude and latitude coordinates corresponding to the current screen pixels can be converted into the Lambert coordinates of the projection used by the data .
[0083] Step S5: Calculate the position ratio of the Lambert coordinates within the two-dimensional data field range;
[0084] S51. Calculate the position ratio of the Lambert coordinate point within the entire two-dimensional data field range. The calculation method is as follows:
[0085] ;
[0086] ;
[0087] Among them, the horizontal and vertical coordinate ranges of the entire two-dimensional data field are respectively represented as [0-1], , indicating the position ratio of the current screen coordinate position in the entire two-dimensional data field.
[0088] Step S6: Calculate the data index position corresponding to the Lambert coordinate position in step S5 in the two-dimensional data field, and obtain the data corresponding to this data index position in the two-dimensional data field;
[0089] S61. In the GPU, according to the Lambert coordinate position, calculate the data index position corresponding to this coordinate position in the two-dimensional data field, and in the two-dimensional data field, just obtain the data corresponding to this data index position. The data index position is:
[0090] ;
[0091] In the incoming two-dimensional data field, read the floating-point number represented by 4 bytes starting from this position, which is the data corresponding to this screen coordinate. Look up the color table, obtain the color corresponding to this screen position, and display it.
[0092] The foregoing description of specific exemplary embodiments of the present invention has been presented for purposes of illustration and description. It is not intended to be exhaustive or to limit the invention to the precise form disclosed, and obviously, many modifications and variations are possible in light of the above teachings. The exemplary embodiments were chosen and described to explain certain principles of the invention and their practical application so that others skilled in the art may make and utilize various exemplary embodiments of the invention, as well as its various alternatives and modifications. The intention is that the scope of the invention be defined by the claims appended hereto and their equivalents.
[0093] The foregoing description of specific exemplary embodiments of the invention has been presented for purposes of illustration and description. It is not intended to be exhaustive or to limit the invention to the precise form disclosed, and obviously, many modifications and changes are possible in light of the above teachings. The exemplary embodiments were chosen and described to explain certain principles of the invention and their practical applications so that others skilled in the art may make or utilize the various exemplary embodiments of the invention, their various alternatives and modifications. The intention is that the scope of the invention be defined by the claims appended hereto and their equivalents.
[0094] It is understood that the above embodiments are merely exemplary embodiments adopted for the purpose of illustrating the principles of the present invention. However, the present invention is not limited thereto. For those of ordinary skill in the art, various modifications and improvements can be made without departing from the spirit and essence of the present invention, and these modifications and improvements are also regarded as the protection scope of the present invention.
Claims
1. A high-performance rendering method for regional numerical forecasting model based on WebGL, characterized in that: The method comprises Step (1): Set the resolution of the regional numerical forecast model to The two-dimensional data field, the projection parameters of the data under the Lambert projection and the data range parameters are passed into WebGL; Step (2): In the WebGIS map, obtain the longitude and latitude coordinates of the upper left corner and lower right corner of the map within the screen range and pass them into WebGL; Step (3): Get the latitude and longitude coordinates of the current screen pixel in WebGL; Step (4): Convert the latitude and longitude coordinates of the current screen pixel into Lambert coordinates; The step (4) includes Convert the latitude and longitude coordinates of the current screen pixel to radian coordinates , ; in, , The longitude and latitude coordinates corresponding to the current screen pixel; Calculate projected standard latitude and projected standard latitudes : ; in, is the eccentricity of the ellipsoid, is the latitude of the projection center origin; Calculate the scale factor and : ; ; Convert latitude and longitude coordinates to Lambert projection coordinates: ; ; in, is the radius of the Earth; Step (5): Calculate the ratio of the Lambert coordinates in the two-dimensional data field; The step (5) includes Calculate Lambert coordinates , The coordinates are within the entire two-dimensional data field, and the location ratio is calculated as follows: ; ; The east-west coordinate and north-south coordinate ranges of the entire data field are expressed as [0-1], , Indicates the ratio of the current screen coordinate position in the entire two-dimensional data field; Step (6): Calculate the data index position corresponding to the Lambert coordinate position in the two-dimensional data field, and obtain the index position data in the two-dimensional data field; The step (6) includes According to the Lambert coordinate position, the data index position corresponding to the coordinate position in the two-dimensional data field is calculated, and the data corresponding to the data index position is obtained in the two-dimensional data field. The data index position is: 。 2. According to the WebGL-based high-performance rendering method for regional numerical mode, the method is characterized in that: The step (1) includes (1-1) The resolution is extracted from the regional numerical forecast model The two-dimensional data field is used as the two-dimensional material data of the shader and is passed into the fragment shader of WebGL; (1-2) The projection parameters of the regional numerical forecast model data under the Lambert projection are used as calculation parameters and passed into the fragment shader of WebGL; (1-3) The data range parameters of the regional numerical forecast model data under the Lambert projection are used as calculation parameters and passed into the fragment shader of WebGL.
3. The high-performance rendering method of a regional numerical forecasting model based on WebGL according to claim 1, characterized in that: The step (2) includes obtaining the longitude and latitude coordinates of the upper left corner and the lower right corner of the map within the screen range in the WebGIS map, and passing them into the fragment shader of the WebGL as map parameters.
4. The high-performance rendering method of a regional numerical forecasting model based on WebGL according to claim 1, characterized in that: The step (3) includes obtaining the latitude and longitude coordinates of the current screen pixel by linear proportional interpolation in the WebGL fragment shader. The algorithm is as follows: ; in, , is the latitude and longitude coordinate position corresponding to the current screen pixel, , is the current screen pixel coordinate, , They are respectively the width and height of the current screen display range.
Citation Information
Patent Citations
A meteorological lattice point data animation display method
CN109801352A
Map drawing method and device
CN110956673A