Discrete point interpolation, contour drawing and smoothing techniques

Source: Internet
Author: User
Discrete point interpolation, contour drawing and smoothing techniques
LV Yongping Dai jingru
(Guangdong Institute of climate application, 510080)
As the isoplot looks very intuitive and visual, it has become an indispensable tool for forecaster because it is used in many aspects such as weather forecasting and climate prediction analysis. For example, the potential height map, high-altitude circulation, temperature and precipitation distribution chart of each isothermal layer. There are also some very good computer graphics software, such as SUFER and GRADS. These software are generally only DOS versions. On a popular WINDOWS platform, although they can be called, they cannot be operated with the mouse. Therefore, it is not as convenient as using the software developed in a WINDOWS environment. Therefore, many people who want to easily display and print all kinds of isograms in their own applications want to know how to draw the isograms. How to Use grid point data to draw the isoplot has been introduced in document [1], and discrete points (such as meteorological stations) data must be interpolated to draw the isoplot. There are several kinds of interpolation methods, such as Triangle network interpolation, which connects the adjacent three points into triangles, then, the tracing method or other method described in [1] is used to perform Interpolation on the edge of the triangle. This method has the following advantages: less value to be inserted, simple interpolation algorithm, and less data processing. The disadvantage is that the formation of a tin can be very random. Any four points can generate two groups of different triangles, and the contour obtained by different tin interpolation cannot be exactly the same. If the artificial TID mesh is fixed, when there is a lack of data, you have to re-adjust the TID mesh, so the versatility of the program is not high. Currently, common grid methods are widely used.
1. Gridded Discrete Points
In theory, partial surface fitting can be used for discrete point gridding.
Integration Method, established using the multivariate regression method
V (X, Y) = a + bX + c Y
Or quadratic equation
V (X, Y) = a + bX + c Y + dX2 + eY2 + f X Y
The so-called local refers to the part that uses a certain range around the fitting point
Separate scatter plots for fitting. However
The results are good, but there are usually some places with actual conditions.
There are large discrepancies. Therefore, when the contour is manually drawn
To use the following steps.
111 Fixed Point
(1) determine the entire grid based on the distribution range of Discrete Points
Grid distance, grid distance should not be too large or too small.
(2) determine which grid Each discrete point belongs.
That is, the discrete points contained in each grid.
(3) within a certain range of mesh points to be interpolated
(About 3 ~ The distance between the four grids is 1 ).
Find a suitable discrete point, removing the farthest from the interpolation point
A point (or a point in the opposite quadrant, placing the grid point in another
Within a triangle composed of three points ). If there are 2 quadrants, no
To discrete points, you need to determine whether there are interpolation grid points.
If there is no interpolation to replace, the point is temporarily
Without interpolation, write down the location of the grid point and leave the last interpolation.
Figure 1 gridded Discrete Points
Principles for finding appropriate points:
A bs (Xi-X0) × A + a BS (Yi-y0) × B = Minimum
Formula: x0, y0 --- grid point coordinates,
A, B --- is the weight coefficient (according to its adjacent image
Limit whether discrete points are constantly adjusted ).
112 insert value
When the distance between a discrete point and a grid point is less
199814 (increased by 2) Guangdong Meteorology
. 1995-2004 Tsinghua Tongfang optical disc Co., Ltd. All rights reserved.

The grid point value can be approximately used as the grid point value.
Generally, the three points are first inserted into the weft direction line.
The intersection of the two values, the last two values are inserted into the grid point
. To make the interpolation value more accurate, consider the selected
Distance between each of the three discrete points and the mesh point, multiplied by the interpolation time
Weight coefficient. The closer the distance is, the larger the weight coefficient is.
When the value of 2 for four discrete points
It can be a high center, and normal interpolation must be less than the maximum of the four points
Attention, which is not high-center. Therefore, it is necessary to separate the values based on the surrounding discrete points.
Figure 2 special high-center Processing
113 plugging
Points that cannot be recorded by interpolation for the first time, which are heavy
New check for interpolation.
114 peripheral point interpolation
Using this method, the obtained mesh point value can only be
The range of the peripheral discrete points. To make the interpolation Network
The grid points enclose the peripheral discrete points as much as possible.
Extension Method to expand the interpolation mesh point. Method
Yes: For any non-interpolation mesh point, there should be
Eight (five sides online) Directions, any direction, as long
If there are values for the last two points, the point value can be pushed out,
Calculate the arithmetic flat of more than two values that may be introduced in the 8 direction
Are used as the interpolation of the grid point.
115 skill
To facilitate the next line, the values of all vertices are not
To be equal to the contour value, you can increase or decrease the inserted point value.
A very small value (e. g. 0101 ). If there is
If the value of the grid point is greater than this value, ε is subtracted; otherwise, ε is added.
2. draw contour lines
How to draw the contour of grid points
The direct tracing method is introduced here.
(1) first, place each interpolation mesh point on its right and
The following two mesh points are compared. If the conditions are met
Sgn (Z (x, y)-Z0) + Sgn (Z (x + 1, y)-Z0) = 0
Two coordinates of a vertical line segment are recorded.
Sgn (Z (x, y)-Z0) + Sgn (Z (x, y + 1)-Z0) = 0
Two coordinates of a horizontal line segment are recorded.
Formula: Z (3) --- lattice value;
Z0 --- contour value;
Sgn () --- positive and negative signs function.
That is to say, we think of all lattice values as only two values. One is greater
Z0, the first is less than Z0 (the previous interpolation makes any grid point
The value is not equal to Z0). Finally, several line segments can be obtained (Figure 3 ).
Figure 3 two-valued isoplot
(2) line segments are connected. For a first-line segment X
End Point, which is used to sequentially locate the start or end line of a common vertex.
Y, determine their connection relationship, according to the points on both sides of Line X
The position of the value inserted into the contour, which is a point of the contour.
Coordinates and records them. Based on the end point or start point of Y
Continue searching... when the connection cannot be found again
An endpoint must also be interpolated to determine and record the end point of the line.
. Go back to the starting point of Line X and continue searching
Find another endpoint. When the start and end of the contour line belong to the same
When a grid is created, the contour is closed.
When the start and end points of a first-line segment cannot be found
You can consider not to use this line segment for other line segments. When
When one line segment shares a point with the other three line segments (4), that is
Figure 4 multi-line common points
0 7 Guangdong meteorology 1998. 4 (increased by 2)
. 1995-2004 Tsinghua Tongfang optical disc Co., Ltd. All rights reserved.

When the contour value is 10, four lines are recorded in order.
Segments A, B, C, and D have a common end.
Point. In this case, according to the contour value and four cells
Point value, connected by the two closest to each other, the other two
(Dotted line in the figure ).
(3) when less than 4 points constitute a line, you can
Do not use this line.
3. contour Smoothing
The preceding contour lines are actually broken lines,
When the grid is small enough (you can insert a fine grid on the coarse grid ),
The broken lines look smooth. However
There are two disadvantages: one is to do a very fine grid interpolation, But no matter
The curve gradually changes with the enlargement of the image.
Line. Second, we need to record very detailed lattice values and their equivalents.
Line, you may need to open a large array, if you want to store in
The disk will occupy a large disk capacity. Save
The only way to store space and draw curves more accurately
Is to increase the data processing workload, must be found from the discount data
To a series of functional relationships, so that they fully pass these folds
Point. The line drawn by encrypting data points based on these functions is
It looks continuous and smooth. The larger the image, the encryption is required.
The more data points you have. Currently, the smoothing method is polynomial.
Fitting, spline function, lagerlang-day interpolation function, oblique axis parabolic
Line average weighting method and other methods for segment-by-segment fitting. No matter
Which method can be used directly may be unreasonable?
(Figure 5), the solution is to first
Preliminary processing or called preprocessing, and final coordinate (rotation)
After the transformation, use the lagerlang-day interpolation function to draw a smooth curve.
Figure 5 direct Interpolation Curve
311 preprocessing
(1) Check the closed line
When the first point of a curve is the same as the last one
Grid, you can think that this line is closed, in the most
Add the coordinates of the first vertex after the last vertex.
(2) Merge adjacent points
When the distance between the two points is less than grid distances,
You can insert a vertex in the middle and cancel the two vertices.
(3) Reduce the angle
When the angle between the three adjacent points is less than a certain angle
By gradually adjusting the Y coordinates of the three points, add the angle
Large (angle β decreases ). It can be merged and reduced multiple times.
Turns to gradually smooth the curve.
312 function plot line
The program of the Laplace interpolation function for Data Encryption points is as follows:
For I = 1 To N: Z (I) = 1: Next I
For I = 1 To N: For J = 1 To N
If I <> J then z (j) = z (j) × (XX-
X (I)/(x (j)-X (I ))
Next J: Next I
YX = 0: for I = 1 to n: YX = Yx + z (I)
× Y (I): Next I
N is the number of sample points, corresponding to array X (), y (),
XX is the interpolation X coordinate, and Y x is the inserted y coordinate.
The specific method of using 3-Point Sample interpolation is:
(1) Use interpolation between the first and second vertices.
(2) In order to avoid such unreasonable insertion
Value, which can be converted to coordinates. That is, according to
The angle between the two-point connection and the second-point connection and the third-point connection.
Determine the Rotation Angle of the new coordinate gamma (fig. 6) so that angular α is equal to angular β.
(3) between the first and second points in the new Coordinate System
Interpolation. The interpolation step size can be based on the grid distance and
Figure 6 determine the Rotation Angle of the new coordinate (
Go down to page 73rd)
1 7 199814 (increased by 2) Guangdong Meteorology
. 1995-2004 Tsinghua Tongfang optical disc Co., Ltd. All rights reserved.

After the data file is transferred in, return to the random sub-menu to select
Select output and enter the output file name. The extension is
1grd, and then select begin to split the input file Grid
To generate output files.
1GRD file generated by Begin.
Distribution of each value between the given longitude, latitude maximum, and minimum
Segment. If you call TOPO1EXE directly
The whole graph is covered. To avoid contour, you must use
Perform the following steps to perform blank processing for Modify:
(1) edit an empty white file with the extension generated
1BLN. Format: First line: (points-1) 0
Row 2: the first point of the horizontal coordinate (longitude), the first point of the vertical
Coordinates (latitude)
Row 3: horizontal coordinate (longitude) of the second Vertex
Coordinates (latitude)
The closed areas associated with these points will be blank.
(2) Select Modify → Blank from the main menu, and
Current dialog box,
In Input grid file: Enter
1GRD file, in Output grid file: Fill in and enter
Output file with the extension of 1GRD,
In Blank file: Enter
1BLN file,
In Begin creating grid with current param2
Eters? Enter YES to generate the output file in a blank space.
312 run TOPO1EXE
The main menu is as follows:
[Topo] Input Level Scale Conline Title
Border Xyline Grid Post Output Equip
The options used are as follows:
Input: Enter the Input file name, which is GRID1EXE.
Level: Adjust the maximum, minimum, and spacing of the contour.
Scale: adjust the size of the screen image (F2 key display ).
Title: Enter the Title.
Post: Mark a single point and its values at a specified position,
If you enter the map file name here, you can enter the map.
Output: prints the Output of the displayed image.
4. Full Screen Modification
The SURFER software package has a high contour precision,
Smooth enough to make full screen modifications.
Press any key after F2 is displayed.
Press al t-E to display the following words at the bottom of the screen:
X = 110 Y = 25 Z = 19173 ESC
Al t-s or new z:
Indicates that the current coordinate of the Small Cross is (110, 25), numerical value
It is set to 19173. enter a new Z value to partially modify the image.
The modified image can be stored on an al t-S disk.
5 standardization of contour values
Some of the top values of the contour drawn by the above method are not,
There are more than two, which is a defect of SURFER. Author
The program is corrected to draw out the isopleth value standard.
The Climate Chart. The basic idea is to use an assembly compiler to find
Write the modified subroutine.
(Next to page 71st) the magnification of the graph is automatically determined by the program.
Each interpolation is restored to a line in the original coordinate system.
(4) In this way, we can plot points 1, 2, and 3 between points 1 and 2.
The curve between 2, 3, and 4 points draws the curve between 2 and 3 points, and the last 2 points.
Point Curve, only need to change the last point and the last three points
Location. You can plot it by calling the same subroutine.
4. Limitations
The maximum value of a discrete point cannot be larger than that of a sample.
Or the minimum value is smaller, so when the high (low) center is off
When the value of a scatter plot is slightly greater than the value of the contour chart, the plot is higher.
(Low) area surrounded by the inmost closed line in the center
The image size must be small. Further improvement is required in this case.
1 Feng Yirong: screen presentation and recognition of weather images in June 1DOS
(Iv) 1 Guangdong meteorology, 199614
3 7 199814 (increased by 2) Guangdong Meteorology
. 1995-2004 Tsinghua Tongfang Optical Disc Co., Ltd. All rights reserved.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.