A method and device for data gridification of a binary tree and acquisition of grid point data

The binary tree model algorithm converts discrete site data into grid point data, solving the problem of large amount of site data calculation and long time in the field of power emergency, and achieving efficient data retrieval and simplified analysis.

CN114049463BActive Publication Date: 2025-07-08GUANGZHOU POWER SUPPLY BUREAU GUANGDONG POWER GRID CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111329278.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-10
Publication Date
2025-07-08
Estimated Expiration
2041-11-10

AI Technical Summary

Technical Problem

In the fields of power emergency, due to the limited monitoring sites, discrete site data is used to analyze the equipment under the influence of meteorological factors, and the calculation time is long. The existing methods require multiple calculations to find the nearest data site, which is inconvenient to use.

Method used

Through the binary tree model algorithm, discrete site data is grid-transformed into grid point data. The k-dimensional binary tree model is used to build and find leaf nodes, determine the attribute values of grid point data, and realize orderly arrangement and rapid retrieval of data.

Benefits of technology

It realizes fast and efficient data retrieval, reduces the amount of calculation, improves processing efficiency, and simplifies the analysis of equipment being affected by spatially related elements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114049463B_ABST
    Figure CN114049463B_ABST
Patent Text Reader

Abstract

This application relates to a method and device for data gridification of a binary tree and acquisition of grid point data. The method includes: obtaining discrete site data; wherein, the discrete site data includes attribute values; constructing a k-dimensional binary tree model through the attribute values; obtaining grid point data; finding the leaf node corresponding to the grid point data through the k-dimensional binary tree model; and determining the attribute value corresponding to the leaf node as the attribute value of the grid point data. By using this method, discrete site data can be gridified into grid point data through the binary tree model algorithm, decoupled from the original site data, with less computational effort and high processing efficiency when used.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular, to a method and device for data gridification of binary trees, a computer device, a storage medium, and a computer program product; as well as a method and device for obtaining grid point data, a computer device, a storage medium, and a computer program product. Background Art

[0002] In fields such as power emergency, the data of the nearest site to the pole tower / substation is usually selected approximately as the influence received by the pole tower / substation. Due to limited funds, there are generally only a limited number of monitoring sites for spatial-related factors. When using site data, since the data of any monitoring site is not necessarily available and there may be missing measurements, each time the data of the nearest site is associated, it is necessary to calculate and find the nearest site with available data, and then associate with that site.

[0003] However, the existing discrete site data is inconvenient to use in the analysis of the influence of equipment by meteorological elements. When multiple time series analyses are required, it is necessary to calculate and find the nearest site with available data each time, resulting in a large amount of calculation and a long calculation time when using. Summary of the Invention

[0004] Based on this, in view of the above technical problems, it is necessary to provide a method and device for data gridification of binary trees, a method and device for obtaining grid point data, a computer device, a computer-readable storage medium, and a computer program product that can transform discrete site data into grid point data through a binary tree model algorithm, transform the disordered discrete site data into an ordered arrangement, and facilitate use.

[0005] A method for data gridification of a binary tree, the method comprising:

[0006] Obtain discrete site data; wherein the discrete site data includes attribute values;

[0007] Construct a k-dimensional binary tree model through the attribute values;

[0008] Obtain grid point data;

[0009] Find the leaf node corresponding to the grid point data through the k-dimensional binary tree model;

[0010] Determine the attribute value corresponding to the leaf node as the attribute value of the grid point data.

[0011] In one embodiment, the attribute values include longitude, latitude, and data value.

[0012] In one embodiment, the constructing a k-dimensional binary tree model through the discrete site data includes:

[0013] Calculate the variance for the data of each dimension in the attribute values, and determine the dimension with the maximum variance as the splitting axis;

[0014] Retrieve the current attribute values according to the splitting axis to obtain the first median, and place the first median into the current node of the k-dimensional binary tree model;

[0015] Divide the current attribute values according to the first median, and place the current attribute values into the left branch or the right branch;

[0016] Update the splitting axis to obtain a new splitting axis;

[0017] According to the new splitting axis, perform median division on the data in the left branch or the right branch to obtain the second median, and place the second median into the left child node or the right child node to construct a k-dimensional binary tree model.

[0018] In one embodiment, the obtaining of the grid point data includes:

[0019] Obtain preset parameters; the preset parameters include longitude interval, latitude interval, and longitude and latitude range;

[0020] Divide the longitude and latitude range by the longitude interval and the latitude interval to obtain a plurality of grid point data.

[0021] In one embodiment, the method includes:

[0022] Traverse the grid point data to obtain the leaf nodes corresponding to each grid point data of the k-dimensional binary tree model;

[0023] Establish an association relationship between the attribute values of the leaf nodes and the grid point data to obtain a grid point data file.

[0024] A method for obtaining grid point data, the method includes:

[0025] Obtain device-related information;

[0026] Match the device-related information with the preset parameters in the grid point data file to obtain the corresponding grid point data;

[0027] Extract the attribute values corresponding to the grid point data.

[0028] In one embodiment, the method further includes:

[0029] Associate the device-related information with the grid point data to obtain a device data file.

[0030] A data grid-forming device for a binary tree, the device includes:

[0031] A discrete site data acquisition module for acquiring discrete site data; wherein the discrete site data includes attribute values;

[0032] A binary tree construction module for constructing a k-dimensional binary tree model through the attribute values;

[0033] A grid point data acquisition module for acquiring grid point data;

[0034] A leaf node search module for searching for the leaf node corresponding to the grid point data through the k-dimensional binary tree model;

[0035] An attribute value determination module for determining the attribute value corresponding to the leaf node as the attribute value of the grid point data.

[0036] An apparatus for acquiring grid point data, the apparatus comprising:

[0037] A device-related information acquisition module for acquiring device-related information;

[0038] A matching module for matching the device-related information with preset parameters in a grid point data file to obtain corresponding grid point data;

[0039] An attribute value extraction module for extracting the attribute value corresponding to the grid point data.

[0040] In one embodiment, a computer device is provided, including a memory and a processor. A computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:

[0041] Acquire discrete site data; wherein the discrete site data includes attribute values;

[0042] Construct a k-dimensional binary tree model through the attribute values;

[0043] Acquire grid point data;

[0044] Search for the leaf node corresponding to the grid point data through the k-dimensional binary tree model;

[0045] Determine the attribute value corresponding to the leaf node as the attribute value of the grid point data.

[0046] In one embodiment, when the processor executes the computer program, the following steps are further implemented:

[0047] Perform variance calculation on the data of each dimension in the attribute values, and determine the dimension with the maximum variance as the splitting axis;

[0048] Retrieve the current attribute value according to the splitting axis to obtain the first median, and place the first median into the current node of the k-dimensional binary tree model;

[0049] Divide the current attribute value according to the first median, and place the current attribute value into the left branch or the right branch;

[0050] Update the splitting axis to obtain a new splitting axis;

[0051] Perform median division on the data in the left branch or the right branch according to the new splitting axis to obtain the second median, and place the second median into the left child node or the right child node to construct a k-dimensional binary tree model.

[0052] In one embodiment, when the processor executes the computer program, the following steps are further implemented:

[0053] Obtain preset parameters; the preset parameters include longitude interval, latitude interval, and longitude and latitude range;

[0054] Divide the longitude and latitude range by the longitude interval and the latitude interval to obtain a plurality of grid point data.

[0055] In one embodiment, when the processor executes the computer program, the following steps are further implemented:

[0056] Traverse the grid point data to obtain the leaf nodes corresponding to each grid point data of the k-dimensional binary tree model;

[0057] Establish an association relationship between the attribute values of the leaf nodes and the grid point data to obtain a grid point data file.

[0058] In one embodiment, a computer device is provided, including a memory and a processor. A computer program is stored in the memory. When the processor executes the computer program, the following steps are implemented:

[0059] Obtain device-related information;

[0060] Match the device-related information with the preset parameters in the grid point data file to obtain the corresponding grid point data;

[0061] Extract the attribute values corresponding to the grid point data.

[0062] In one embodiment, when the processor executes the computer program, the following steps are further implemented:

[0063] Associate the device-related information with the grid point data to obtain a device data file.

[0064] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:

[0065] Obtain discrete site data; wherein, the discrete site data includes attribute values;

[0066] Construct a k-dimensional binary tree model through the attribute values;

[0067] Obtain grid point data;

[0068] Find the leaf node corresponding to the grid point data through the k-dimensional binary tree model;

[0069] Determine the attribute value corresponding to the leaf node as the attribute value of the grid point data.

[0070] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:

[0071] Perform variance calculation on the data of each dimension in the attribute values, and determine the dimension with the maximum variance as the splitting axis;

[0072] Retrieve the current attribute values according to the splitting axis to obtain the first median, and put the first median into the current node of the k-dimensional binary tree model;

[0073] Divide the current attribute values according to the first median, and put the current attribute values into the left branch or the right branch;

[0074] Update the splitting axis to obtain a new splitting axis;

[0075] According to the new splitting axis, perform median division on the data in the left branch or the right branch to obtain the second median, and put the second median into the left child node or the right child node to construct a k-dimensional binary tree model.

[0076] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:

[0077] Obtain preset parameters; the preset parameters include longitude interval, latitude interval and longitude-latitude range;

[0078] Divide the longitude-latitude range through the longitude interval and the latitude interval to obtain a plurality of grid point data.

[0079] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:

[0080] Traverse the grid point data to obtain the leaf node corresponding to each grid point data of the k-dimensional binary tree model;

[0081] Associate the attribute values of the leaf nodes with the grid point data to obtain a grid point data file.

[0082] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:

[0083] Obtain device-related information;

[0084] Match the device-related information with preset parameters in the grid point data file to obtain corresponding grid point data;

[0085] Extract the attribute values corresponding to the grid point data.

[0086] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0087] Associate the device-related information with the grid point data to obtain a device data file.

[0088] In one embodiment, a computer program product is provided, including a computer program. When the computer program is executed by a processor, the following steps are implemented:

[0089] Obtain discrete site data; wherein, the discrete site data includes attribute values;

[0090] Construct a k-dimensional binary tree model through the attribute values;

[0091] Obtain grid point data;

[0092] Find the leaf nodes corresponding to the grid point data through the k-dimensional binary tree model;

[0093] Determine the attribute values of the leaf nodes as the attribute values of the grid point data.

[0094] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0095] Perform variance calculation on the data of each dimension in the attribute values, and determine the dimension with the largest variance as the splitting axis;

[0096] Retrieve the current attribute values according to the splitting axis to obtain a first median, and put the first median into the current node of the k-dimensional binary tree model;

[0097] Divide the current attribute values according to the first median, and put the current attribute values into the left branch or the right branch;

[0098] Update the splitting axis to obtain a new splitting axis;

[0099] Perform median partitioning on the data in the left or right branch according to the new splitting axis to obtain a second median, and place the second median into the left child node or the right child node to construct a k-dimensional binary tree model.

[0100] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:

[0101] Obtain preset parameters; the preset parameters include longitude interval, latitude interval, and longitude and latitude range;

[0102] Divide the longitude and latitude range by the longitude interval and the latitude interval to obtain a plurality of grid point data.

[0103] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:

[0104] Traverse the grid point data to obtain the leaf nodes corresponding to each grid point data of the k-dimensional binary tree model;

[0105] Establish an association relationship between the attribute values of the leaf nodes and the grid point data to obtain a grid point data file.

[0106] In one embodiment, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0107] Obtain device-related information;

[0108] Match the device-related information with the preset parameters in the grid point data file to obtain corresponding grid point data;

[0109] Extract the attribute values corresponding to the grid point data.

[0110] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:

[0111] Associate the device-related information with the grid point data to obtain a device data file.

[0112] The above binary tree data meshing method, device, computer device, storage medium, and computer program product convert discrete station data into grid point data through the binary tree model algorithm, convert the disordered discrete station data into an ordered arrangement, facilitate fast and efficient retrieval, the grid point data is easy to use, and is decoupled from the original station data. When used, the calculation amount is small and the processing efficiency is high.

[0113] The above method, device, computer device, storage medium, and computer program product for obtaining grid point data can quickly obtain the nearest site data according to the relevant information of electrical equipment, simplify the impact analysis of equipment and other factors related to certain spatial elements, facilitate use, have simple use of grid point data, less calculation amount during use, and high processing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0114] Figure 1 It is a schematic flowchart of the data meshing method of a binary tree in an embodiment;

[0115] Figure 2 It is a schematic flowchart of the steps for constructing a binary tree model in an embodiment;

[0116] Figure 3 It is a schematic flowchart of the steps for obtaining grid point data in an embodiment;

[0117] Figure 4 It is a schematic flowchart of the steps for obtaining a grid point data file in an embodiment;

[0118] Figure 5 It is a schematic flowchart of the method for obtaining grid point data in an embodiment;

[0119] Figure 6 It is a schematic flowchart of the steps for obtaining an equipment data file in an embodiment;

[0120] Figure 7 It is a structural block diagram of a data meshing device for a binary tree in an embodiment;

[0121] Figure 8 It is a structural block diagram of a data meshing device for a binary tree in an embodiment;

[0122] Figure 9 It is an internal structure diagram of a computer device in an embodiment. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0123] In order to make the objectives, technical solutions, and advantages of the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0124] In one embodiment, as Figure 1 shown, a data meshing method for a binary tree is provided. In this embodiment, the method is exemplified by being applied to a terminal. It can be understood that the method can also be applied to a server, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:

[0125] Step 101, obtain discrete site data; wherein, the discrete site data includes attribute values;

[0126] In this embodiment, the terminal or the server can first obtain discrete site data, wherein the discrete site data includes attribute values, and the attribute values include longitude, latitude, data values, etc. This embodiment does not impose too many restrictions on the types of attribute values;

[0127] It should be noted that the terminal can be, but is not limited to, various personal computers, laptop computers, smart phones, tablet computers, Internet of Things devices, and portable wearable devices, etc. The server 104 can be implemented by an independent server or a server cluster composed of multiple servers.

[0128] Step 102, construct a k-dimensional binary tree model through the attribute values;

[0129] Furthermore, after obtaining the attribute values, construct a k-dimensional binary tree model according to the above-mentioned attribute values,

[0130] It should be noted that a k-dimensional binary tree model is a binary tree in which each node is a k-dimensional numerical point. Each node on it represents a hyperplane, which is perpendicular to the coordinate axis of the current division dimension and divides the space into two parts in this dimension, one part in its left subtree (left branch) and the other part in its right subtree (right branch). That is, if the division dimension of the current node is d, the coordinate values of all points on its left subtree in the d dimension are less than the current value, and the coordinate values of all points on its right subtree in the d dimension are greater than or equal to the current value. Furthermore, except for the root node, the nodes in the binary tree also include parent nodes, child nodes, and leaf nodes.

[0131] Specifically, arrange the disordered points in an ordered manner according to a certain order to facilitate fast and efficient retrieval.

[0132] First, variance calculation can be performed on the data of each dimension in the attribute values, determine the maximum variance obtained by the calculation as the splitting axis, then perform retrieval according to the splitting axis to obtain the median data, and place the data into the left branch and the right branch according to the median data; update the splitting axis, repeat the above steps, and then divide the left child node and the right child node according to the second median obtained by the calculation to complete the construction of the k-dimensional binary tree model.

[0133] Step 103, obtain grid point data;

[0134] In this embodiment, the grid point data refers to longitude and latitude data divided at preset intervals within a certain longitude and latitude range, and the number of grid point data can be multiple; the grid point data includes longitude coordinates and latitude coordinates.

[0135] Step 104: Find the leaf node corresponding to the grid point data through the k-dimensional binary tree model;

[0136] In practical application to this embodiment, find the nearest node to the grid point data through the k-dimensional binary tree model, and determine whether this node is a leaf node.

[0137] Specifically, it is possible to determine whether the current node is the nearest node by calculating the Euclidean distance. If so, this nearest node is the leaf node.

[0138] Step 105: Determine the attribute value corresponding to the leaf node as the attribute value of the grid point data.

[0139] After obtaining the leaf node corresponding to the grid point data, extract the attribute value corresponding to this leaf node, and determine this attribute value as the attribute value of this grid point data.

[0140] Furthermore, it is possible to traverse all the grid point data and associate the attribute values of the leaf nodes corresponding to each grid point data as its own attribute value.

[0141] In the above binary tree data grid method, the discrete site data is grid-transformed into grid point data through the binary tree model algorithm, and the disordered discrete site data is transformed into an ordered arrangement, which is convenient for fast and efficient retrieval. The grid point data is easy to use and is decoupled from the original site data. When used, the calculation amount is small and the processing efficiency is high.

[0142] In one embodiment, as Figure 2 shown, it is a flow diagram of a binary tree model construction step of this embodiment, including:

[0143] Step 201: Calculate the variance for each dimension of the data in the attribute value, and determine the dimension with the largest variance as the splitting axis;

[0144] Step 202: Retrieve the current attribute value according to the splitting axis to obtain the first median, and put the first median into the current node of the k-dimensional binary tree model;

[0145] Step 203: Divide the current attribute value according to the median, and put the current attribute value into the left branch or the right branch;

[0146] Step 204: Update the splitting axis to obtain a new splitting axis;

[0147] Step 205: According to the new splitting axis, perform median division on the data in the left branch or the right branch to obtain the second median, and put the second median into the left child node or the right child node to construct a k-dimensional binary tree model.

[0148] In this embodiment, the data of each dimension in the attribute values of the discrete site data are extracted for variance calculation. For example, the data of dimensions such as longitude, latitude, and data value are respectively calculated for variance, and the size of the calculated variance is judged. The data of the dimension corresponding to the maximum variance is determined as the splitting axis.

[0149] The current attribute value is retrieved according to the dimension corresponding to the splitting axis, the first median is identified, and the first median is placed into the current node of the k-dimensional binary tree model; then the current attribute value is divided according to the first median, and the values less than the first median are divided into the left branch, and the values greater than or equal to the median are divided into the right branch.

[0150] The splitting axis is updated, the data in the left branch or the right branch is divided by the median to obtain the second median, the second median is placed into the left child node or the right child node, and all the data in the left branch or the right branch is searched for the second median and added to the child node, completing the construction of the k-dimensional binary tree model.

[0151] Specifically applied to this embodiment, as Figure 3 shown, it is a flow diagram of a grid point data acquisition step in this embodiment, including:

[0152] Step 301, obtain preset parameters; the preset parameters include longitude interval, latitude interval, and longitude and latitude range;

[0153] Step 302, divide the longitude and latitude range by the longitude interval and the latitude interval to obtain grid point data.

[0154] In one embodiment, the longitude and latitude range is divided by a certain data interval to obtain a plurality of different longitude and latitude coordinates, and the longitude and latitude coordinates are the grid point data.

[0155] For example, the longitude range: 112.83 - 114.16, the latitude range: 112.83 - 114.16, the longitude interval: 0.005, the latitude interval: 0.005, and the longitude and latitude range can be divided according to the above longitude interval and latitude interval to obtain a plurality of grid point data.

[0156] It should be noted that the longitude interval, latitude interval, longitude and latitude range, and grid point data can be saved to the same file; it can also be that the longitude interval, latitude interval, longitude and latitude range are saved as a description file, the grid point data is saved to another data file, and the description file and the data file are packaged into a compressed file for convenient calling.

[0157] In a specific implementation, as Figure 4 shown, it is a flow diagram of a grid point data file acquisition step in this embodiment, including:

[0158] Step 401: Traverse the grid point data to obtain the leaf nodes corresponding to each grid point data in the k-dimensional binary tree model.

[0159] Step 402: Establish an association relationship between the attribute values of the leaf nodes and the grid point data to obtain a grid point data file.

[0160] All grid point data are calculated through the constructed k-dimensional binary tree model to obtain their corresponding leaf nodes, and then an association relationship is established between the attribute values of the leaf nodes and the grid point data to obtain a grid point data file, which converts unordered data into ordered data for easy access and has high calculation efficiency.

[0161] In one embodiment, as Figure 5 shown, a method for obtaining grid point data is provided. In this embodiment, this method is exemplified by being applied to a terminal. It can be understood that this method can also be applied to a server and can also be applied to a system including a terminal and a server and implemented through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:

[0162] Step 501: Obtain device-related information.

[0163] For example, device-related information of pole and tower equipment, substation equipment, etc. can be obtained; specifically, the device-related information may include longitude, latitude, altitude, etc.

[0164] Step 502: Match the device-related information with the preset parameters in the grid point data file to obtain grid point data.

[0165] In the grid point data file, it contains the association relationship between the attribute values of the leaf nodes and the grid point data, and the grid point data contains preset parameters; the preset parameters include longitude interval, latitude interval, and longitude and latitude range. According to the above preset parameters, the longitude and latitude of a certain grid point data can be calculated, and the longitude and latitude of the device-related information are compared and matched with the longitude and latitude of the grid point data to obtain the corresponding grid point data.

[0166] Step 503: Extract the attribute values corresponding to the grid point data.

[0167] After obtaining the grid point data, according to the association relationship between the attribute values of the leaf nodes and the grid point data in the grid point data file, the corresponding attribute values can be extracted, which are the attribute values of the device, and the site data of the device can be obtained.

[0168] In the above method for obtaining grid point data, the nearest station data can be quickly obtained based on the relevant information of electrical equipment, which can simplify the impact analysis of equipment and other factors related to certain spatial elements, is convenient to use, decoupled from the original station data, the grid point data is simple to use, has less computational effort during use, and high processing efficiency.

[0169] In a specific implementation, as Figure 6 shown, it is a schematic flowchart of a step for obtaining an equipment data file in this embodiment, including:

[0170] Step 601, associate the equipment-related information with the grid point data to obtain an equipment data file.

[0171] In another preferred embodiment, the association relationship between the equipment-related information and the grid point data can also be established and saved to obtain an equipment data file, which is convenient for query and use and improves the data processing efficiency.

[0172] It can also include the association relationship among the equipment-related information, the grid point data, and the attribute values, further improving the use efficiency.

[0173] To enable those skilled in the art to better understand the core concept of this application, the following is illustrated through a specific example:

[0174] Step 1, read the discrete point data to be processed, and the discrete point data includes but is not limited to attribute values such as longitude, latitude, and data value;

[0175] Step 2, construct a k-dimensional binary tree based on the discrete point data read in Step 1;

[0176] Construct a k-dimensional binary tree, where each node is k-dimensional data, and the data structure is as follows:

[0177] struct tree{

[0178] Node-data - A data point in the data vector dataset, which is an n-dimensional vector (here it is k-dimensional);

[0179] Range - A spatial vector, the spatial range represented by this node;

[0180] split - An integer, the serial number of the direction axis perpendicular to the splitting hyperplane;

[0181] Left - A tree, composed of all data points within the left subspace of the splitting hyperplane of this node

[0182] Right - A tree, composed of all data points within the right subspace of the splitting hyperplane of this node

[0183] parent - A tree, the parent node

[0184] partitionDimention; - Dimension of the partition

[0185] partitionValue; - Value of the partition

[0186] double[] value; - If it is a non-leaf node, this attribute is empty, otherwise it is the data

[0187] isLeaf - Whether it is a leaf

[0188] }

[0189] Arrange the unordered point array in an ordered manner in a certain order to facilitate fast and efficient retrieval.

[0190] ① Initialize the splitting axis: Calculate the variance of the data for each dimension, and take the dimension with the largest variance as the splitting axis, marked as r;

[0191] ② Determine the node: Retrieve the current data along the dimension of the splitting axis, find the median data, and place it on the current node;

[0192] ③ Divide into two branches:

[0193] Divide the left branch: In the dimension of the current splitting axis, all values less than the median are divided into the left branch;

[0194] Divide the right branch: In the dimension of the current splitting axis, all values greater than or equal to the median are divided into the right branch.

[0195] ④ Update the splitting axis: r = (r + 1) % k;

[0196] ⑤ Determine the child nodes:

[0197] Determine the left node: Perform step 2 on the data in the left branch;

[0198] Determine the right node: Perform step 2 on the data in the right branch;

[0199] Step 3: Obtain a number of grid points, i.e., grid point data, according to preset parameters such as coordinate parameters and coordinate intervals; In this embodiment, the longitude direction interval, latitude direction interval, and the longitude and latitude range are: starting longitude: 112.83 - 114.16, starting latitude: 22.42 - 24; longitude interval: 0.005, latitude interval: 0.005; grid point size: 0.005 * 0.005 (about 500m * 500m);

[0200] Step 4: Traverse the grid points to obtain a grid point to be processed, and find the tree node closer to the grid point to be processed through a k-dimensional binary tree;

[0201] Step 5: Determine whether the tree node is a leaf node. If it is a leaf node, then this leaf node is the nearest node; if it is not a leaf node, then go to Step 4 until the nearer tree node obtained in Step 4 is a leaf node, and this leaf node is the nearest node.

[0202] Finding the nearest node of a node to be queried:

[0203] ① Take the root node of the binary tree as the current node, and calculate the Euclidean distance from the current node to the node to be queried to obtain the current Euclidean distance.

[0204] The calculation formula for the Euclidean distance in a 2D space is shown as follows:

[0205]

[0206] The calculation formula for the Euclidean distance in a k-dimensional space (n = k) is shown as follows:

[0207]

[0208] ② Compare the coordinate value of the node to be queried and the value of the current splitting axis of the current node. If the value of the node to be queried on the current splitting axis is less than the dimension value of the current splitting axis of the current node, then select the left branch node; otherwise, select the right branch node.

[0209] ③ Calculate the distance from the node to be queried to the branch node selected in Step 2 as the distance to be compared. If the distance to be compared is less than the current Euclidean distance, then the branch node selected in Step 2 is the current node, and the distance to be compared is the current Euclidean distance.

[0210] ④ Repeat Steps 2 and 3. If the current node is a leaf node, then the current node is the nearest node.

[0211] Step 6: Obtain the site data corresponding to the nearest node, including but not limited to longitude, latitude, and data value, and use the data value corresponding to this node as the data value corresponding to this grid point.

[0212] Step 7: Repeat Steps 4 to 6 to obtain the data values corresponding to all grid points.

[0213] Step 8: Save the longitude interval, latitude interval, longitude and latitude range in the preset parameters, and the data values (attribute values) of the corresponding grid points.

[0214] Usage of grid point data (only need to be calculated once):

[0215] Step 1: Read the relevant information of the device to be analyzed (mainly including geographical location information, such as longitude, latitude, altitude, etc.).

[0216] Step 2: Read the preset parameters of the grid point data, such as: longitude interval, latitude interval, longitude and latitude range, etc.;

[0217] Step 3: The position information (such as: longitude, latitude) of each grid point can be calculated through the preset information read in Step 2;

[0218] Step 4: Calculate the grid points associated with each device to be analyzed based on the position information in Step 1 and Step 2;

[0219] Step 5: Save the association relationship between each device to be analyzed and the grid points.

[0220] Grid point data Grid data usage:

[0221] Step 1: When in use, obtain the data values of the associated grid points through the saved association relationship between the devices to be analyzed and the grid point data;

[0222] Step 2: Conduct subsequent analysis.

[0223] It should be understood that although Figures 1-6 each step in the flowchart is shown in sequence according to the arrow indication, these steps are not necessarily executed in the order indicated by the arrow. Unless there is a clear indication in this article, the execution of these steps has no strict order limit, and these steps can be executed in other orders. Moreover, Figures 1-6 at least a part of the steps in

[0224] In one embodiment, as Figure 7 shown, a data gridification device for a binary tree is provided, including:

[0225] A discrete site data acquisition module 701, configured to acquire discrete site data; wherein, the discrete site data includes attribute values;

[0226] A binary tree construction module 702, configured to construct a k-dimensional binary tree model through the attribute values;

[0227] A grid point data acquisition module 703, configured to acquire grid point data;

[0228] A leaf node search module 704, configured to search for the leaf nodes corresponding to the grid point data through the k-dimensional binary tree model;

[0229] An attribute value determination module 705, configured to determine the attribute value corresponding to the leaf node as the attribute value of the grid point data.

[0230] In one embodiment, the attribute value includes longitude, latitude, and data value.

[0231] In one embodiment, the binary tree construction module includes:

[0232] A splitting axis determination sub-module, configured to calculate the variance for the data of each dimension in the attribute value, and determine the dimension with the maximum variance as the splitting axis;

[0233] A retrieval sub-module, configured to retrieve the current attribute value according to the splitting axis, obtain a first median, and place the first median into the current node of the k-dimensional binary tree model;

[0234] A partitioning sub-module, configured to partition the current attribute value according to the first median, and place the current attribute value into the left branch or the right branch;

[0235] A splitting axis update sub-module, configured to update the splitting axis to obtain a new splitting axis;

[0236] A binary tree construction sub-module, configured to perform median partitioning on the data in the left branch or the right branch according to the new splitting axis, obtain a second median, and place the second median into the left child node or the right child node to construct a k-dimensional binary tree model.

[0237] In one embodiment, the grid point data acquisition module includes:

[0238] A preset parameter acquisition sub-module, configured to acquire preset parameters; the preset parameters include longitude interval, latitude interval, and longitude and latitude range;

[0239] A grid point data acquisition sub-module, configured to divide the longitude and latitude range through the longitude interval and the latitude interval to obtain a plurality of grid point data.

[0240] In one embodiment, the device includes:

[0241] A traversal module, configured to traverse the grid point data to obtain the leaf nodes corresponding to each grid point data of the k-dimensional binary tree model;

[0242] A grid point data file acquisition module, configured to establish an association relationship between the attribute value of the leaf node and the grid point data to obtain a grid point data file.

[0243] In one embodiment, as Figure 8 shown, there is provided a grid point data acquisition device, including:

[0244] The device - related information acquisition module 801 is used to acquire device - related information;

[0245] The matching module 802 is used to match the device - related information with preset parameters in the grid - point data file to obtain corresponding grid - point data;

[0246] The attribute - value extraction module 803 is used to extract the attribute values corresponding to the grid - point data.

[0247] In one of the embodiments, the device further includes:

[0248] The device - data file acquisition module is used to associate device - related information with grid - point data to obtain a device - data file.

[0249] For the specific limitations of the binary - tree data grid - forming device and the grid - point data acquisition device, reference can be made to the limitations of the binary - tree data grid - forming method and the grid - point data acquisition method in the above text, which will not be elaborated here. Each module in the above - mentioned binary - tree data grid - forming device and grid - point data acquisition device can be implemented in whole or in part through software, hardware, and their combination. The above - mentioned modules can be embedded in the processor of the computer device in hardware form or be independent of it, or can be stored in the memory of the computer device in software form, so as to facilitate the processor to call and execute the operations corresponding to the above - mentioned modules.

[0250] In one embodiment, a computer device is provided. The computer device can be a terminal, and its internal structure diagram can be as Figure 9 shown. The computer device includes a processor, a memory, a communication interface, a display screen, and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non - volatile storage medium and an internal memory. The non - volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non - volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner. The wireless manner can be achieved through WIFI, a mobile cellular network, NFC (Near - Field Communication), or other technologies. When the computer program is executed by the processor, it realizes a binary - tree data grid - forming method and a grid - point data acquisition method. The display screen of the computer device can be a liquid - crystal display screen or an electronic - ink display screen. The input device of the computer device can be a touch layer covering the display screen, or can be a button, a trackball, or a touchpad set on the shell of the computer device, or can also be an external keyboard, a touchpad, or a mouse, etc.

[0251] Those skilled in the art can understand, Figure 9The structure shown is only a block diagram of some structures related to the solution of this application, and does not constitute a limitation on the computer device to which the solution of this application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine some components, or have a different component layout.

[0252] In one embodiment, a computer device is provided, including a memory and a processor. A computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:

[0253] Obtain discrete site data; wherein, the discrete site data includes attribute values;

[0254] Construct a k-dimensional binary tree model through the attribute values;

[0255] Obtain grid point data;

[0256] Find the leaf node corresponding to the grid point data through the k-dimensional binary tree model;

[0257] Determine the attribute value corresponding to the leaf node as the attribute value of the grid point data.

[0258] In one embodiment, when the processor executes the computer program, the following steps are also implemented:

[0259] Perform variance calculation on the data of each dimension in the attribute values, and determine the dimension with the largest variance as the splitting axis;

[0260] Retrieve the current attribute values according to the splitting axis to obtain the first median, and put the first median into the current node of the k-dimensional binary tree model;

[0261] Divide the current attribute values according to the first median, and put the current attribute values into the left branch or the right branch;

[0262] Update the splitting axis to obtain a new splitting axis;

[0263] According to the new splitting axis, perform median division on the data in the left branch or the right branch to obtain the second median, and put the second median into the left child node or the right child node to construct a k-dimensional binary tree model.

[0264] In one embodiment, when the processor executes the computer program, the following steps are also implemented:

[0265] Obtain preset parameters; the preset parameters include longitude interval, latitude interval and longitude and latitude range;

[0266] Divide the longitude and latitude range through the longitude interval and the latitude interval to obtain a plurality of grid point data.

[0267] In one embodiment, when the processor executes the computer program, the following steps are further implemented:

[0268] Traverse the grid point data to obtain the leaf nodes corresponding to each grid point data of the k-dimensional binary tree model;

[0269] Establish an association relationship between the attribute values of the leaf nodes and the grid point data to obtain a grid point data file.

[0270] In one embodiment, a computer device is provided, including a memory and a processor. A computer program is stored in the memory. When the processor executes the computer program, the following steps are implemented:

[0271] Obtain device-related information;

[0272] Match the device-related information with preset parameters in the grid point data file to obtain corresponding grid point data;

[0273] Extract the attribute values corresponding to the grid point data.

[0274] In one embodiment, when the processor executes the computer program, the following steps are further implemented:

[0275] Associate the device-related information with the grid point data to obtain a device data file.

[0276] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:

[0277] Obtain discrete site data; wherein, the discrete site data includes attribute values;

[0278] Construct a k-dimensional binary tree model through the attribute values;

[0279] Obtain grid point data;

[0280] Find the leaf nodes corresponding to the grid point data through the k-dimensional binary tree model;

[0281] Determine the attribute value corresponding to the leaf node as the attribute value of the grid point data.

[0282] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:

[0283] Perform variance calculation on the data of each dimension in the attribute values, and determine the dimension with the largest variance as the splitting axis;

[0284] Retrieve the current attribute value along the splitting axis to obtain the first median, and place the first median into the current node of the k-dimensional binary tree model;

[0285] Divide the current attribute value according to the first median, and place the current attribute value into the left branch or the right branch;

[0286] Update the splitting axis to obtain a new splitting axis;

[0287] Perform median partitioning on the data in the left branch or the right branch according to the new splitting axis to obtain the second median, and place the second median into the left child node or the right child node to construct the k-dimensional binary tree model.

[0288] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:

[0289] Obtain preset parameters; the preset parameters include longitude interval, latitude interval, and longitude and latitude range;

[0290] Divide the longitude and latitude range by the longitude interval and the latitude interval to obtain a plurality of grid point data.

[0291] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:

[0292] Traverse the grid point data to obtain the leaf nodes corresponding to each grid point data of the k-dimensional binary tree model;

[0293] Establish an association relationship between the attribute values of the leaf nodes and the grid point data to obtain a grid point data file.

[0294] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:

[0295] Obtain device-related information;

[0296] Match the device-related information with the preset parameters in the grid point data file to obtain the corresponding grid point data;

[0297] Extract the attribute values corresponding to the grid point data.

[0298] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:

[0299] Associate the device-related information with the grid point data to obtain a device data file.

[0300] In one embodiment, a computer program product is provided, including a computer program. When the computer program is executed by a processor, the following steps are implemented:

[0301] Obtain discrete site data; wherein, the discrete site data includes attribute values;

[0302] Construct a k-dimensional binary tree model through the attribute values;

[0303] Obtain grid point data;

[0304] Find the leaf node corresponding to the grid point data through the k-dimensional binary tree model;

[0305] Determine the attribute value corresponding to the leaf node as the attribute value of the grid point data.

[0306] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:

[0307] Perform variance calculation on the data of each dimension in the attribute values, and determine the dimension with the largest variance as the splitting axis;

[0308] Retrieve the current attribute values according to the splitting axis to obtain the first median, and place the first median into the current node of the k-dimensional binary tree model;

[0309] Divide the current attribute values according to the first median, and place the current attribute values into the left branch or the right branch;

[0310] Update the splitting axis to obtain a new splitting axis;

[0311] According to the new splitting axis, perform median division on the data in the left branch or the right branch to obtain the second median, and place the second median into the left child node or the right child node to construct a k-dimensional binary tree model.

[0312] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:

[0313] Obtain preset parameters; the preset parameters include longitude interval, latitude interval and longitude and latitude range;

[0314] Divide the longitude and latitude range through the longitude interval and the latitude interval to obtain a plurality of grid point data.

[0315] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:

[0316] Traverse the grid point data to obtain the leaf node corresponding to each grid point data of the k-dimensional binary tree model;

[0317] Establish an association relationship between the attribute value of the leaf node and the grid point data to obtain a grid point data file.

[0318] In one embodiment, a computer program product is provided, including a computer program which, when executed by a processor, implements the following steps:

[0319] Obtain device-related information;

[0320] Match the device-related information with preset parameters in a grid point data file to obtain corresponding grid point data;

[0321] Extract the attribute values corresponding to the grid point data.

[0322] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:

[0323] Associate the device-related information with the grid point data to obtain a device data file.

[0324] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in this application are all information and data that have been authorized by the user or fully authorized by all parties.

[0325] Those of ordinary skill in the art can understand that all or part of the processes of implementing the methods in the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, storage, database, or other medium used in the various embodiments provided in this application can include at least one of non-volatile and volatile memories. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.

[0326] The technical features of the above embodiments can be combined arbitrarily. For the sake of concise description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope recorded in this specification.

[0327] The above-described embodiments merely represent several implementation manners of the present application. The description thereof is relatively specific and detailed, but it should not be construed as a limitation on the scope of the invention patent. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all fall within the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the appended claims.

Claims

1. A method for data gridification of a binary tree, characterized in that, The method includes: Obtaining discrete site data; wherein, the discrete site data includes attribute values; Constructing a k-dimensional binary tree model through the attribute values; Dividing the longitude and latitude range by a preset longitude interval and a preset latitude interval to obtain a plurality of grid point data, and obtaining a first data file including the preset longitude interval, the preset latitude interval, the longitude and latitude range, and the grid point data, or obtaining a compressed file including a description file of the preset longitude interval, the preset latitude interval, the longitude and latitude range, and a second data file including the grid point data; Based on the first data file or the compressed file, finding the leaf node corresponding to the grid point data through the k-dimensional binary tree model; the confirmation process of the leaf node includes: finding the node closest to the grid point data through the k-dimensional binary tree model, and determining whether the node is the leaf node; Determining the attribute value corresponding to the leaf node as the attribute value of the grid point data.

2. The method according to claim 1, wherein The attribute values include longitude, latitude, and data values.

3. The method according to claim 1, characterized in that, The constructing of the k-dimensional binary tree model through the discrete site data includes: Calculating the variance for each dimension of the attribute values, and determining the dimension with the largest variance as the splitting axis; Retrieving the current attribute values according to the splitting axis to obtain a first median, and putting the first median into the current node of the k-dimensional binary tree model; Dividing the current attribute values according to the first median, and putting the current attribute values into the left branch or the right branch; Updating the splitting axis to obtain a new splitting axis; According to the new splitting axis, performing median division on the data in the left branch or the right branch to obtain a second median, and putting the second median into the left child node or the right child node to construct a k-dimensional binary tree model.

4. The method according to claim 1, characterized in that Before dividing the longitude and latitude range by a preset longitude interval and a preset latitude interval to obtain a plurality of grid point data, it further includes: Obtaining preset parameters; the preset parameters include the preset longitude interval, the preset latitude interval, and the longitude and latitude range.

5. The method according to claim 1, wherein The method includes: Traversing the grid point data to obtain the leaf node corresponding to each grid point data of the k-dimensional binary tree model; Establishing an association relationship between the attribute value of the leaf node and the grid point data to obtain a grid point data file.

6. A method for obtaining grid point data, characterized in that, The obtained grid point data is applied to the data gridding method of the binary tree according to any one of claims 1-5, and the method includes: Obtaining device-related information; Matching the device-related information with the preset parameters in the grid point data file to obtain corresponding grid point data; Extracting the attribute value corresponding to the grid point data.

7. The method according to claim 6, wherein The method further includes: Associating the device-related information with the grid point data to obtain a device data file.

8. A data gridification device for a binary tree, characterized in that, The apparatus includes: A discrete site data acquisition module for acquiring discrete site data; wherein, the discrete site data includes attribute values; A binary tree construction module for constructing a k-dimensional binary tree model through the attribute values; A grid point data acquisition module, configured to divide a longitude and latitude range by a preset longitude interval and a preset latitude interval to obtain a plurality of grid point data, and obtain a first data file including the preset longitude interval, the preset latitude interval, the longitude and latitude range, and the grid point data, or obtain a compressed file including a description file of the preset longitude interval, the preset latitude interval, the longitude and latitude range, and a second data file including the grid point data; A leaf node search module, configured to search for a leaf node corresponding to the grid point data based on the first data file or the compressed file through a k-dimensional binary tree model; the confirmation process of the leaf node includes: searching for the node closest to the grid point data through the k-dimensional binary tree model, and determining whether the node is the leaf node; An attribute value determination module, configured to determine the attribute value corresponding to the leaf node as the attribute value of the grid point data.

9. An apparatus for obtaining grid point data, characterized in that The obtained grid point data is applied to the data grid method of the binary tree according to any one of claims 1-5, and the device includes: A device-related information acquisition module, configured to acquire device-related information; A matching module, configured to match the device-related information with preset parameters in a grid point data file to obtain corresponding grid point data; An attribute value extraction module, configured to extract the attribute value corresponding to the grid point data.

10. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

11. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, the steps of the method according to any one of claims 1 to 7 are implemented.

12. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, the steps of the method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Nearest site searching method and device based on geographic position

    CN108268493A

  • Power grid equipment vector data query method and device, computer equipment and medium

    CN113010570A