CN114049463A - Binary tree data gridding and grid point data obtaining method and device - Google Patents

Binary tree data gridding and grid point data obtaining method and device Download PDF

Info

Publication number
CN114049463A
CN114049463A CN202111329278.XA CN202111329278A CN114049463A CN 114049463 A CN114049463 A CN 114049463A CN 202111329278 A CN202111329278 A CN 202111329278A CN 114049463 A CN114049463 A CN 114049463A
Authority
CN
China
Prior art keywords
grid point
point data
data
binary tree
attribute value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111329278.XA
Other languages
Chinese (zh)
Inventor
王勇
许中
栾乐
周凯
马智远
饶毅
徐硕
代晓丰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Power Supply Bureau of Guangdong Power Grid Co Ltd
Original Assignee
Guangzhou Power Supply Bureau of Guangdong Power Grid Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Power Supply Bureau of Guangdong Power Grid Co Ltd filed Critical Guangzhou Power Supply Bureau of Guangdong Power Grid Co Ltd
Priority to CN202111329278.XA priority Critical patent/CN114049463A/en
Publication of CN114049463A publication Critical patent/CN114049463A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T17/00Three dimensional [3D] modelling, e.g. data description of 3D objects
    • G06T17/20Finite element generation, e.g. wire-frame surface description, tesselation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/29Geographical information databases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q50/00Systems or methods specially adapted for specific business sectors, e.g. utilities or tourism
    • G06Q50/06Electricity, gas or water supply
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/20Drawing from basic elements, e.g. lines or circles
    • G06T11/206Drawing of charts or graphs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T17/00Three dimensional [3D] modelling, e.g. data description of 3D objects
    • G06T17/005Tree description, e.g. octree, quadtree

Abstract

The application relates to a method and a device for data gridding and grid point data acquisition of a binary tree. The method comprises the following steps: acquiring discrete station data; wherein the discrete site data comprises attribute values; constructing a k-dimensional binary tree model through the attribute values; acquiring grid point data; searching and obtaining leaf nodes corresponding to the grid point data through a 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 adopting the method, the discrete site data can be converted into the grid point data through gridding by the binary tree model algorithm, and the grid point data is decoupled from the original site data, so that the method has the advantages of less calculation amount and high processing efficiency in use.

Description

Binary tree data gridding and grid point data obtaining method and device
Technical Field
The present application relates to the field of computer technologies, and in particular, to a data meshing method and apparatus for a binary tree, a computer device, a storage medium, and a computer program product; and a method, an apparatus, a computer device, a storage medium and a computer program product for obtaining grid point data.
Background
In the field of electric power emergency and the like, data of a station closest to a tower/transformer substation is generally selected to be approximately used as influences on the tower/transformer substation, due to limited capital, a plurality of monitoring stations for space related factors are generally limited, when the station data is used, data of any monitoring station is not necessarily available and possibly lack of measurement, and when the data of the closest station is associated each time, the closest station with the data needs to be calculated and found, and then the station is associated.
However, the existing discrete site data is applied to analysis of equipment affected by meteorological elements, is inconvenient to use, needs to find the nearest site with data by calculation each time when a plurality of time analyses need to be carried out, and has large calculation amount and long calculation time when in use.
Disclosure of Invention
Based on this, it is necessary to provide a binary tree data gridding method, a binary tree data gridding apparatus, a computer device, a computer readable storage medium, and a computer program product, which are capable of converting discrete site data into grid point data through a binary tree model algorithm, converting unordered discrete site data into ordered arrangement, and are convenient to use.
A method of data gridding of a binary tree, the method comprising:
acquiring discrete station data; wherein the discrete site data comprises attribute values;
constructing a k-dimensional binary tree model through the attribute values;
acquiring grid point data;
searching and obtaining leaf nodes corresponding to the grid point data through a k-dimensional binary tree model;
and determining the attribute value corresponding to the leaf node as the attribute value of the grid point data.
In one embodiment, the attribute values include longitude, latitude, and data value.
In one embodiment, the constructing a k-dimensional binary tree model by the discrete site data includes:
performing variance calculation on data of each dimension in the attribute values, and determining the dimension with the maximum variance as a segmentation axis;
retrieving the current attribute value according to a segmentation axis to obtain a first median, and putting the first median into a current node of the k-dimensional binary tree model;
dividing the current attribute value according to the first median, and putting the current attribute value into a left branch or a right branch;
updating the segmentation axis to obtain a new segmentation axis;
and carrying out median division on the data in the left branch or the right branch according to the new segmentation axis to obtain a second median, and putting the second median into the left subnode or the right subnode to construct a k-dimensional binary tree model.
In one embodiment, the obtaining grid point data includes:
acquiring preset parameters; the preset parameters comprise longitude intervals, latitude intervals and longitude and latitude ranges;
and dividing the latitude and longitude range through the longitude interval and the latitude interval to obtain a plurality of grid point data.
In one embodiment, the method comprises:
traversing the grid point data to obtain leaf nodes corresponding to each grid point data of the k-dimensional binary tree model;
and establishing an association relation between the attribute values of the leaf nodes and the grid point data to obtain a grid point data file.
A method for obtaining grid point data, the method comprising:
acquiring equipment related information;
matching the relevant information of the equipment with preset parameters in a grid point data file to obtain corresponding grid point data;
and extracting the attribute value corresponding to the grid point data.
In one embodiment, the method further comprises:
and associating the equipment related information with the grid point data to obtain an equipment data file.
An apparatus for data gridding of a binary tree, the apparatus comprising:
the discrete station data acquisition module is used for acquiring discrete station data; wherein the discrete site data comprises attribute values;
a binary tree construction module for constructing a k-dimensional binary tree model through the attribute values;
the grid point data acquisition module is used for acquiring grid point data;
the leaf node searching module is used for searching and obtaining leaf nodes corresponding to the grid point data through a k-dimensional binary tree model;
and the attribute value determining module is used for determining the attribute value corresponding to the leaf node as the attribute value of the grid point data.
An apparatus for obtaining grid point data, the apparatus comprising:
the device related information acquisition module is used for acquiring device related information;
the matching module is used for matching the relevant information of the equipment with preset parameters in the grid point data file to obtain corresponding grid point data;
and the attribute value extraction module is used for extracting the attribute value corresponding to the grid point data.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having a computer program stored therein, the processor implementing the following steps when executing the computer program:
acquiring discrete station data; wherein the discrete site data comprises attribute values;
constructing a k-dimensional binary tree model through the attribute values;
acquiring grid point data;
searching and obtaining leaf nodes corresponding to the grid point data through a k-dimensional binary tree model;
and determining the attribute value corresponding to the leaf node as the attribute value of the grid point data.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
performing variance calculation on data of each dimension in the attribute values, and determining the dimension with the maximum variance as a segmentation axis;
retrieving the current attribute value according to a segmentation axis to obtain a first median, and putting the first median into a current node of the k-dimensional binary tree model;
dividing the current attribute value according to the first median, and putting the current attribute value into a left branch or a right branch;
updating the segmentation axis to obtain a new segmentation axis;
and carrying out median division on the data in the left branch or the right branch according to the new segmentation axis to obtain a second median, and putting the second median into the left subnode or the right subnode to construct a k-dimensional binary tree model.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
acquiring preset parameters; the preset parameters comprise longitude intervals, latitude intervals and longitude and latitude ranges;
and dividing the latitude and longitude range through the longitude interval and the latitude interval to obtain a plurality of grid point data.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
traversing the grid point data to obtain leaf nodes corresponding to each grid point data of the k-dimensional binary tree model;
and establishing an association relation between the attribute values of the leaf nodes and the grid point data to obtain a grid point data file.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having a computer program stored therein, the processor implementing the following steps when executing the computer program:
acquiring equipment related information;
matching the relevant information of the equipment with preset parameters in a grid point data file to obtain corresponding grid point data;
and extracting the attribute value corresponding to the grid point data.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
and associating the equipment related information with the grid point data to obtain an equipment data file.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of:
acquiring discrete station data; wherein the discrete site data comprises attribute values;
constructing a k-dimensional binary tree model through the attribute values;
acquiring grid point data;
searching and obtaining leaf nodes corresponding to the grid point data through a k-dimensional binary tree model;
and determining the attribute value corresponding to the leaf node as the attribute value of the grid point data.
In one embodiment, the computer program when executed by the processor further performs the steps of:
performing variance calculation on data of each dimension in the attribute values, and determining the dimension with the maximum variance as a segmentation axis;
retrieving the current attribute value according to a segmentation axis to obtain a first median, and putting the first median into a current node of the k-dimensional binary tree model;
dividing the current attribute value according to the first median, and putting the current attribute value into a left branch or a right branch;
updating the segmentation axis to obtain a new segmentation axis;
and carrying out median division on the data in the left branch or the right branch according to the new segmentation axis to obtain a second median, and putting the second median into the left subnode or the right subnode to construct a k-dimensional binary tree model.
In one embodiment, the computer program when executed by the processor further performs the steps of:
acquiring preset parameters; the preset parameters comprise longitude intervals, latitude intervals and longitude and latitude ranges;
and dividing the latitude and longitude range through the longitude interval and the latitude interval to obtain a plurality of grid point data.
In one embodiment, the computer program when executed by the processor further performs the steps of:
traversing the grid point data to obtain leaf nodes corresponding to each grid point data of the k-dimensional binary tree model;
and establishing an association relation between the attribute values of the leaf nodes and the grid point data to obtain a grid point data file.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of:
acquiring equipment related information;
matching the relevant information of the equipment with preset parameters in a grid point data file to obtain corresponding grid point data;
and extracting the attribute value corresponding to the grid point data.
In one embodiment, the computer program when executed by the processor further performs the steps of:
and associating the equipment related information with the grid point data to obtain an equipment data file.
In one embodiment, a computer program product is provided, comprising a computer program which, when executed by a processor, performs the steps of:
acquiring discrete station data; wherein the discrete site data comprises attribute values;
constructing a k-dimensional binary tree model through the attribute values;
acquiring grid point data;
searching and obtaining leaf nodes corresponding to the grid point data through a k-dimensional binary tree model;
and determining the attribute value corresponding to the leaf node as the attribute value of the grid point data.
In one embodiment, the computer program when executed by the processor further performs the steps of:
performing variance calculation on data of each dimension in the attribute values, and determining the dimension with the maximum variance as a segmentation axis;
retrieving the current attribute value according to a segmentation axis to obtain a first median, and putting the first median into a current node of the k-dimensional binary tree model;
dividing the current attribute value according to the first median, and putting the current attribute value into a left branch or a right branch;
updating the segmentation axis to obtain a new segmentation axis;
and carrying out median division on the data in the left branch or the right branch according to the new segmentation axis to obtain a second median, and putting the second median into the left subnode or the right subnode to construct a k-dimensional binary tree model.
In one embodiment, the computer program when executed by the processor further performs the steps of:
acquiring preset parameters; the preset parameters comprise longitude intervals, latitude intervals and longitude and latitude ranges;
and dividing the latitude and longitude range through the longitude interval and the latitude interval to obtain a plurality of grid point data.
In one embodiment, the computer program when executed by the processor further performs the steps of:
traversing the grid point data to obtain leaf nodes corresponding to each grid point data of the k-dimensional binary tree model;
and establishing an association relation between the attribute values of the leaf nodes and the grid point data to obtain a grid point data file.
In one embodiment, a computer program product is provided, comprising a computer program which, when executed by a processor, performs the steps of:
acquiring equipment related information;
matching the relevant information of the equipment with preset parameters in a grid point data file to obtain corresponding grid point data;
and extracting the attribute value corresponding to the grid point data.
In one embodiment, the computer program when executed by the processor further performs the steps of:
and associating the equipment related information with the grid point data to obtain an equipment data file.
According to the binary tree data gridding method, the binary tree data gridding device, the computer equipment, the storage medium and the computer program product, discrete site data are gridded and converted into grid point data through a binary tree model algorithm, unordered discrete site data are converted and ordered, rapid and efficient retrieval is convenient to carry out, the grid point data are convenient to use, and are decoupled from original site data. The calculation amount is less when the device is used, and the processing efficiency is high.
The method, the device, the computer equipment, the storage medium and the computer program product for acquiring the grid point data can quickly acquire the latest station data according to the related information of the electrical equipment, simplify the analysis of the equipment and the like under the influence of certain space related elements, are convenient to use, have simple use of the grid point data, and have less calculation amount and high processing efficiency in use.
Drawings
FIG. 1 is a flowchart illustrating a data gridding method for a binary tree in an embodiment;
FIG. 2 is a flowchart illustrating the steps of constructing a binary tree model in one embodiment;
FIG. 3 is a flowchart illustrating a mesh point data obtaining step in one embodiment;
FIG. 4 is a flowchart illustrating a mesh point data file obtaining step in one embodiment;
FIG. 5 is a flowchart illustrating a method for obtaining grid point data according to an embodiment;
FIG. 6 is a flowchart illustrating an apparatus data file obtaining step according to an embodiment;
FIG. 7 is a block diagram of an embodiment of a binary tree data meshing apparatus;
FIG. 8 is a block diagram of an embodiment of a binary tree data meshing apparatus;
FIG. 9 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
In an embodiment, as shown in fig. 1, a binary tree data meshing method is provided, and this embodiment is illustrated by applying the method to a terminal, it is to be understood that the method may also be applied to a server, and may also be applied to a system including a terminal and a server, and is implemented by interaction between the terminal and the server. In this embodiment, the method includes the steps of:
step 101, acquiring discrete station data; wherein the discrete site data comprises attribute values;
in this embodiment, a terminal or a server may first obtain discrete site data, where the discrete site data includes attribute values, and the attribute values include longitude, latitude, data values, and the like, and this embodiment does not impose too many restrictions on the types of the attribute values;
it should be noted that the terminal may be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, internet of things devices, portable wearable devices, and the like. The server 104 may be implemented as a stand-alone server or as a server cluster comprised of multiple servers.
Step 102, constructing a k-dimensional binary tree model through the attribute values;
further, after obtaining the attribute value, constructing a k-dimensional binary tree model according to the attribute value,
it should be noted that the k-dimensional binary tree model is a binary tree in which each node is a k-dimensional numerical value point, each node on the binary tree represents a hyperplane, the hyperplane is perpendicular to the coordinate axis of the current division dimension, and the space is divided into two parts in the dimension, one part is on the left subtree (left branch) and the other part is on the right subtree (right branch) of the dimension. That is, if the division dimension of the current node is d, the coordinate values of all points on the left sub-tree in the d dimension are all smaller than the current value, and the coordinate values of all points on the right sub-tree in the d dimension are all larger than or equal to the current value. Further, the nodes in the binary tree include a parent node, a child node and a leaf node in addition to the root node.
Specifically, the unordered points are arranged in an ordered manner according to a certain order, so that the quick and efficient retrieval is conveniently performed.
Firstly, variance calculation can be carried out on data of each dimension in an attribute value, the maximum variance obtained through calculation is determined as a segmentation axis, retrieval is carried out according to the segmentation axis to obtain middle data, and the data are placed into a left branch and a right branch according to the middle data; and updating the segmentation axis, repeating the steps, and dividing the left child node and the right child node according to the second median obtained by calculation to complete the construction of the k-dimensional binary tree model.
Step 103, obtaining grid point data;
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 the grid point data may be plural; the grid point data includes longitude and latitude coordinates.
Step 104, searching and obtaining leaf nodes corresponding to the grid point data through a k-dimensional binary tree model;
actually applied to this embodiment, the closest node to the grid point data is found through the k-dimensional binary tree model, and whether the node is a leaf node is determined.
Specifically, whether the current node is the nearest node may be determined by calculating the euclidean distance, and if so, the nearest node is a leaf node.
And 105, determining the attribute value corresponding to the leaf node as the attribute value of the grid point data.
After the leaf node corresponding to the grid point data is obtained, the attribute value corresponding to the leaf node is extracted, and the attribute value is determined as the attribute value of the grid point data.
Further, all grid point data may be traversed, and the attribute value of the leaf node corresponding to each grid point data may be associated as the attribute value of itself.
In the binary tree data gridding method, discrete site data are gridded and converted into grid point data through a binary tree model algorithm, disordered discrete site data are converted and orderly arranged, rapid and efficient retrieval is convenient to carry out, and the grid point data are convenient to use and are decoupled from original site data. The calculation amount is less when the device is used, and the processing efficiency is high.
In an embodiment, as shown in fig. 2, it is a flowchart of a binary tree model building step of this embodiment, and the flowchart includes:
step 201, performing variance calculation on data of each dimension in the attribute values, and determining the dimension with the maximum variance as a segmentation axis;
step 202, retrieving the current attribute value according to a segmentation axis to obtain a first median, and putting the first median into a current node of the k-dimensional binary tree model;
step 203, dividing the current attribute value according to the median, and putting the current attribute value into a left branch or a right branch;
step 204, updating the segmentation axis to obtain a new segmentation axis;
and step 205, carrying out median division on the data in the left branch or the right branch according to the new segmentation axis to obtain a second median, and putting the second median into the left subnode or the right subnode to construct a k-dimensional binary tree model.
In this embodiment, data of each dimension in the attribute values of the discrete site data is extracted to perform variance calculation, data of dimensions such as longitude, latitude, and data value are subjected to variance calculation, the size of the calculated variance is determined, and the data of the dimension corresponding to the largest variance is determined as the segmentation axis.
Retrieving the current attribute value according to the dimensionality corresponding to the segmentation axis, identifying a first median, and putting the first median into the current node of the k-dimensional binary tree model; and dividing the current attribute value according to the first median, dividing the value smaller than the first median into the left branch, and dividing the value larger than or equal to the median into the right branch.
Updating the segmentation axis, carrying out median division on data in the left branch or the right branch to obtain a second median, putting the second median into the left subnode or the right subnode, and carrying out second median search on the data in all the left branches or the right branches and adding the data into the subnodes to complete the construction of the k-dimensional binary tree model.
As shown in fig. 3, the flowchart of the grid point data acquiring step in this embodiment is specifically applied to this embodiment, and includes:
step 301, acquiring preset parameters; the preset parameters comprise longitude intervals, latitude intervals and longitude and latitude ranges;
and step 302, dividing the latitude and longitude range through the longitude interval and the latitude interval to obtain grid point data.
In one embodiment, the latitude and longitude range is divided by a certain data interval to obtain a plurality of different latitude and longitude coordinates, and the latitude and longitude coordinates are the grid point data.
For example, longitude range: 112.83-114.16, latitude range: 112.83-114.16, longitude interval: 0.005, latitude interval: 0.005, the latitude and longitude range can be divided according to the longitude interval and the latitude interval to obtain a plurality of grid point data.
It should be noted that longitude intervals, latitude intervals, longitude and latitude ranges and grid point data can be stored in the same file; or longitude intervals, latitude intervals and longitude and latitude ranges can be stored as description files, grid point data can be stored into another data file, and the description files and the data files can be packaged into a compressed file, so that the calling is convenient.
In a specific implementation, as shown in fig. 4, the flowchart of the step of obtaining a grid point data file in this embodiment is shown, and includes:
step 401, traversing the grid point data to obtain a leaf node corresponding to each grid point data in the k-dimensional binary tree model;
step 402, establishing an association relationship between the attribute values of the leaf nodes and the grid point data to obtain a grid point data file.
Calculating all grid point data through the constructed k-dimensional binary tree model to obtain corresponding leaf nodes, establishing an association relation between the attribute values of the leaf nodes and the grid point data to obtain a grid point data file, converting unordered data into ordered data, facilitating access and having high calculation efficiency.
In an embodiment, as shown in fig. 5, a method for obtaining grid point data is provided, and this embodiment is illustrated by applying the method to a terminal, it is to be understood that the method may also be applied to a server, and may also be applied to a system including a terminal and a server, and is implemented by interaction between the terminal and the server. In this embodiment, the method includes the steps of:
step 501, acquiring relevant information of equipment;
for example, the device-related information of the tower device, the device-related information of the substation device, and the like may be obtained; specifically, the device-related information may include longitude, latitude, altitude, and the like.
Step 502, matching the device-related information with preset parameters in a grid point data file to obtain grid point data;
in the grid point data file, the attribute values of the leaf nodes and the association relation of the grid point data are contained, and the grid point data contain preset parameters; the preset parameters comprise longitude intervals, latitude intervals and latitude and longitude ranges, the longitude and the latitude of certain grid point data can be calculated according to the preset parameters, and the longitude and the latitude of the relevant information of the equipment are compared and matched with the longitude and the latitude of the grid point data to obtain corresponding grid point data.
Step 503, extracting the attribute value corresponding to the grid point data.
After the grid point data is obtained, the corresponding attribute value, that is, the attribute value of the device, can be extracted according to the association relationship between the attribute value of the leaf node in the grid point data file and the grid point data, so as to obtain the site data of the device.
According to the method for acquiring the grid point data, the latest station data can be quickly acquired according to the relevant information of the electrical equipment, the influence analysis of the equipment and the like by certain space relevant elements can be simplified, the use is convenient, the grid point data is decoupled from the original station data, the use of the grid point data is simple, the calculated amount is small when the grid point data is used, and the processing efficiency is high.
In a specific implementation, as shown in fig. 6, the flowchart of the step of acquiring the device data file in this embodiment is shown, and includes:
step 601, associating the device related information with the grid point data to obtain a device data file.
In another preferred embodiment, an association relationship between the device-related information and the grid point data may also be established and stored to obtain a device data file, which is convenient for query and use and improves data processing efficiency.
The method can also comprise the association relation among the equipment related information, the grid point data and the attribute values, and further improves the use efficiency.
In order to make the core concept of the present application better understood by those skilled in the art, the following is illustrated by a specific example:
step 1, reading discrete point data to be processed, wherein the discrete point data comprises but is not limited to longitude, latitude, data values and other attribute values;
step 2, constructing a k-dimensional binary tree based on the discrete point data read in the step 1;
constructing a k-dimensional binary tree, wherein each node is k-dimensional data, and the data structure is as follows:
struct tree{
a data point in the Node-data vector dataset is an n-dimensional vector (here, also k-dimensional);
range-the spatial Range that the space vector represents the node;
the number of the direction axes of the split-integer vertical to the splitting hyperplane;
left-tree is a tree formed by all data points in the Left subspace of the node segmentation hyperplane
Right-tree consisting of all data points located in the Right subspace of the nodal split hyperplane
parent-Tree parent node
partitiondivision; dimension of segmentation
partitionValue; -the value of the segmentation
double [ ] value; -if a non-leaf node, the attribute is null, otherwise data
isLeaf-whether leaf or not
}
The unordered point groups are ordered and arranged according to a certain sequence, and quick and efficient retrieval is convenient to carry out.
Firstly, initializing a segmentation axis: calculating the variance of the data of each dimension, taking the dimension with the maximum variance as a segmentation axis and marking as r;
determining a node: searching the current data according to the dimension of the segmentation axis, finding median data, and putting the median data on the current node;
dividing double branches:
dividing a left branch: dividing all values smaller than the median into left branches in the dimension of the current segmentation axis;
dividing a right branch: in the current split axis dimension, all values greater than or equal to the median are split into the right branch.
Updating the cutting shaft: r ═ r + 1)% k;
determining child nodes:
determining a left node: step 2 is carried out in the data of the left branch;
determining a right node: step 2 is carried out in the data of the right branch;
step 3, obtaining a plurality of grid points, namely grid point data, according to preset parameters, such as coordinate parameters, coordinate intervals and the like; in this embodiment, longitude intervals and latitude intervals are adopted, and the latitude and longitude range is: start-stop longitude: 112.83-114.16, starting and stopping latitude: 22.42-24; longitude interval: 0.005, latitude interval: 0.005; grid point size: 0.005 x 0.005 (about 500m x 500 m);
step 4, traversing the grid points to obtain a grid point to be processed, and searching a tree node which is closer to the grid point to be processed through the k-dimensional binary tree;
step 5, judging whether the tree node is a leaf node, if so, determining that the leaf node is the nearest node; if not, performing the step 4 until the closer tree node obtained in the step 4 is the leaf node, wherein the leaf node is the nearest node;
searching the nearest node of a certain node to be inquired:
firstly, taking a root node of a binary tree as a current node, and calculating the Euclidean distance from the current node to a node to be queried to obtain the current Euclidean distance;
the euclidean distance calculation formula of the 2-dimensional space is shown as follows:
Figure BDA0003348091210000131
the calculation formula of the euclidean distance of the k-dimensional space (n ═ k) is shown as follows:
Figure BDA0003348091210000141
comparing the coordinate value of the node to be inquired with the value of the current segmentation axis of the current node, and selecting a left node if the value of the node to be inquired in the current segmentation axis is smaller than the dimension value of the current segmentation axis of the current node; otherwise, selecting a right branch node;
calculating the distance from the node to be inquired to the branch node selected in the step 2 as a distance to be compared, if the distance to be compared is smaller than the current Euclidean distance, the branch node selected in the step 2 is the current node, and the distance to be compared is the current Euclidean distance;
and fourthly, repeating the steps 2 and 3, and if the current node is a leaf node, determining that the current node is the nearest node.
Step 6, acquiring site data corresponding to the nearest node, including but not limited to longitude, latitude and data value, and using the data value corresponding to the node as the data value corresponding to the grid point;
7, repeating the steps 4 to 6 to obtain data values corresponding to all the grid points;
and 8, storing longitude intervals, latitude intervals, longitude and latitude ranges and data values (attribute values) of corresponding grid points in preset parameters.
Use of grid point data (only one calculation is needed):
step 1, reading related information (mainly comprising geographical position information such as longitude, latitude, altitude and the like) of equipment to be analyzed;
step 2, reading preset parameters of the grid point data, such as: longitude intervals, latitude and longitude ranges and the like;
step 3, calculating the position information (such as longitude and latitude) of each grid point according to the preset information read in the step 2;
step 4, calculating and obtaining the associated grid points of each device to be analyzed according to the position information in the step 1 and the step 2;
and 5, storing the association relation between each device to be analyzed and the grid point.
Grid point data grid data use:
step 1, acquiring data values of related grid points through the stored association relationship between equipment to be analyzed and grid point data during use;
and 2, carrying out subsequent analysis.
It should be understood that although the various steps in the flow charts of fig. 1-6 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 1-6 may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed in turn or alternately with other steps or at least some of the other steps.
In one embodiment, as shown in fig. 7, there is provided a binary tree data gridding apparatus, including:
a discrete site data obtaining module 701, configured to obtain discrete site data; wherein the discrete site data comprises attribute values;
a binary tree construction module 702, configured to construct a k-dimensional binary tree model through the attribute values;
a grid point data obtaining module 703, configured to obtain grid point data;
a leaf node searching module 704, configured to search, through a k-dimensional binary tree model, to obtain a leaf node corresponding to the grid point data;
an attribute value determining module 705, configured to determine an attribute value corresponding to the leaf node as an attribute value of the grid point data.
In one embodiment, the attribute values include longitude, latitude, and data value.
In one embodiment, the binary tree building module includes:
the segmentation axis determining submodule is used for performing variance calculation on data of each dimension in the attribute values and determining the dimension with the maximum variance as a segmentation axis;
the retrieval submodule is used for retrieving the current attribute value according to the segmentation axis to obtain a first median, and putting the first median into the current node of the k-dimensional binary tree model;
the dividing submodule is used for dividing the current attribute value according to the first median and placing the current attribute value into a left branch or a right branch;
the segmentation axis updating submodule is used for updating the segmentation axis to obtain a new segmentation axis;
and the binary tree construction submodule is used for carrying out median division on the data in the left branch or the right branch according to the new segmentation axis to obtain a second median, and putting the second median into the left subnode or the right subnode to construct a k-dimensional binary tree model.
In one embodiment, the grid point data obtaining module includes:
the preset parameter acquisition submodule is used for acquiring preset parameters; the preset parameters comprise longitude intervals, latitude intervals and longitude and latitude ranges;
and the grid point data acquisition submodule is used for dividing the latitude and longitude range through the longitude interval and the latitude interval to obtain a plurality of grid point data.
In one embodiment, the apparatus comprises:
the traversal module is used for traversing the grid point data to obtain leaf nodes corresponding to each grid point data of the k-dimensional binary tree model;
and the grid point data file acquisition module is used for establishing an association relationship between the attribute values of the leaf nodes and the grid point data to obtain a grid point data file.
In one embodiment, as shown in fig. 8, there is provided an acquisition apparatus of grid point data, including:
a device-related information obtaining module 801, configured to obtain device-related information;
a matching module 802, configured to match the device-related information with a preset parameter in a mesh point data file, to obtain corresponding mesh point data;
an attribute value extracting module 803, configured to extract an attribute value corresponding to the grid point data.
In one embodiment, the apparatus further comprises:
and the equipment data file acquisition module is used for associating the equipment related information with the grid point data to obtain an equipment data file.
For specific limitations of the data gridding device and the grid point data obtaining device of the binary tree, reference may be made to the above limitations on the data gridding method and the grid point data obtaining method of the binary tree, and details are not repeated here. All or part of each module in the binary tree data gridding device and the grid point data acquisition device can be realized by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as shown in fig. 9. The computer device includes a processor, a memory, a communication interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile 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 an operating system and computer programs in the non-volatile storage medium. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless communication can be realized through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. The computer program is executed by a processor to realize a data gridding method and a grid point data acquisition method of a binary tree. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on the shell of the computer equipment, an external keyboard, a touch pad or a mouse and the like.
Those skilled in the art will appreciate that the architecture shown in fig. 9 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having a computer program stored therein, the processor implementing the following steps when executing the computer program:
acquiring discrete station data; wherein the discrete site data comprises attribute values;
constructing a k-dimensional binary tree model through the attribute values;
acquiring grid point data;
searching and obtaining leaf nodes corresponding to the grid point data through a k-dimensional binary tree model;
and determining the attribute value corresponding to the leaf node as the attribute value of the grid point data.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
performing variance calculation on data of each dimension in the attribute values, and determining the dimension with the maximum variance as a segmentation axis;
retrieving the current attribute value according to a segmentation axis to obtain a first median, and putting the first median into a current node of the k-dimensional binary tree model;
dividing the current attribute value according to the first median, and putting the current attribute value into a left branch or a right branch;
updating the segmentation axis to obtain a new segmentation axis;
and carrying out median division on the data in the left branch or the right branch according to the new segmentation axis to obtain a second median, and putting the second median into the left subnode or the right subnode to construct a k-dimensional binary tree model.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
acquiring preset parameters; the preset parameters comprise longitude intervals, latitude intervals and longitude and latitude ranges;
and dividing the latitude and longitude range through the longitude interval and the latitude interval to obtain a plurality of grid point data.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
traversing the grid point data to obtain leaf nodes corresponding to each grid point data of the k-dimensional binary tree model;
and establishing an association relation between the attribute values of the leaf nodes and the grid point data to obtain a grid point data file.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having a computer program stored therein, the processor implementing the following steps when executing the computer program:
acquiring equipment related information;
matching the relevant information of the equipment with preset parameters in a grid point data file to obtain corresponding grid point data;
and extracting the attribute value corresponding to the grid point data.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
and associating the equipment related information with the grid point data to obtain an equipment data file.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of:
acquiring discrete station data; wherein the discrete site data comprises attribute values;
constructing a k-dimensional binary tree model through the attribute values;
acquiring grid point data;
searching and obtaining leaf nodes corresponding to the grid point data through a k-dimensional binary tree model;
and determining the attribute value corresponding to the leaf node as the attribute value of the grid point data.
In one embodiment, the computer program when executed by the processor further performs the steps of:
performing variance calculation on data of each dimension in the attribute values, and determining the dimension with the maximum variance as a segmentation axis;
retrieving the current attribute value according to a segmentation axis to obtain a first median, and putting the first median into a current node of the k-dimensional binary tree model;
dividing the current attribute value according to the first median, and putting the current attribute value into a left branch or a right branch;
updating the segmentation axis to obtain a new segmentation axis;
and carrying out median division on the data in the left branch or the right branch according to the new segmentation axis to obtain a second median, and putting the second median into the left subnode or the right subnode to construct a k-dimensional binary tree model.
In one embodiment, the computer program when executed by the processor further performs the steps of:
acquiring preset parameters; the preset parameters comprise longitude intervals, latitude intervals and longitude and latitude ranges;
and dividing the latitude and longitude range through the longitude interval and the latitude interval to obtain a plurality of grid point data.
In one embodiment, the computer program when executed by the processor further performs the steps of:
traversing the grid point data to obtain leaf nodes corresponding to each grid point data of the k-dimensional binary tree model;
and establishing an association relation between the attribute values of the leaf nodes and the grid point data to obtain a grid point data file.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of:
acquiring equipment related information;
matching the relevant information of the equipment with preset parameters in a grid point data file to obtain corresponding grid point data;
and extracting the attribute value corresponding to the grid point data.
In one embodiment, the computer program when executed by the processor further performs the steps of:
and associating the equipment related information with the grid point data to obtain an equipment data file.
In one embodiment, a computer program product is provided, comprising a computer program which, when executed by a processor, performs the steps of:
acquiring discrete station data; wherein the discrete site data comprises attribute values;
constructing a k-dimensional binary tree model through the attribute values;
acquiring grid point data;
searching and obtaining leaf nodes corresponding to the grid point data through a k-dimensional binary tree model;
and determining the attribute value corresponding to the leaf node as the attribute value of the grid point data.
In one embodiment, the computer program when executed by the processor further performs the steps of:
performing variance calculation on data of each dimension in the attribute values, and determining the dimension with the maximum variance as a segmentation axis;
retrieving the current attribute value according to a segmentation axis to obtain a first median, and putting the first median into a current node of the k-dimensional binary tree model;
dividing the current attribute value according to the first median, and putting the current attribute value into a left branch or a right branch;
updating the segmentation axis to obtain a new segmentation axis;
and carrying out median division on the data in the left branch or the right branch according to the new segmentation axis to obtain a second median, and putting the second median into the left subnode or the right subnode to construct a k-dimensional binary tree model.
In one embodiment, the computer program when executed by the processor further performs the steps of:
acquiring preset parameters; the preset parameters comprise longitude intervals, latitude intervals and longitude and latitude ranges;
and dividing the latitude and longitude range through the longitude interval and the latitude interval to obtain a plurality of grid point data.
In one embodiment, the computer program when executed by the processor further performs the steps of:
traversing the grid point data to obtain leaf nodes corresponding to each grid point data of the k-dimensional binary tree model;
and establishing an association relation between the attribute values of the leaf nodes and the grid point data to obtain a grid point data file.
In one embodiment, a computer program product is provided, comprising a computer program which, when executed by a processor, performs the steps of:
acquiring equipment related information;
matching the relevant information of the equipment with preset parameters in a grid point data file to obtain corresponding grid point data;
and extracting the attribute value corresponding to the grid point data.
In one embodiment, the computer program when executed by the processor further performs the steps of:
and associating the equipment related information with the grid point data to obtain an equipment data file.
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, presented data, etc.) referred to in the present application are information and data authorized by the user or sufficiently authorized by each party.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database or other medium used in the embodiments provided herein can include at least one of non-volatile and volatile memory. Non-volatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical storage, or the like. Volatile Memory can include Random Access Memory (RAM) or external cache Memory. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), among others.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (12)

1. A data gridding method for a binary tree, the method comprising:
acquiring discrete station data; wherein the discrete site data comprises attribute values;
constructing a k-dimensional binary tree model through the attribute values;
acquiring grid point data;
searching and obtaining leaf nodes corresponding to the grid point data through a k-dimensional binary tree model;
and determining the attribute value corresponding to the leaf node as the attribute value of the grid point data.
2. The method of claim 1, wherein the attribute values include longitude, latitude, and data value.
3. The method of claim 1, wherein constructing a k-dimensional binary tree model from the discrete site data comprises:
performing variance calculation on data of each dimension in the attribute values, and determining the dimension with the maximum variance as a segmentation axis;
retrieving the current attribute value according to a segmentation axis to obtain a first median, and putting the first median into a current node of the k-dimensional binary tree model;
dividing the current attribute value according to the first median, and putting the current attribute value into a left branch or a right branch;
updating the segmentation axis to obtain a new segmentation axis;
and carrying out median division on the data in the left branch or the right branch according to the new segmentation axis to obtain a second median, and putting the second median into the left subnode or the right subnode to construct a k-dimensional binary tree model.
4. The method of claim 1, wherein the obtaining mesh point data comprises:
acquiring preset parameters; the preset parameters comprise longitude intervals, latitude intervals and longitude and latitude ranges;
and dividing the latitude and longitude range through the longitude interval and the latitude interval to obtain a plurality of grid point data.
5. The method according to claim 1, characterized in that it comprises:
traversing the grid point data to obtain leaf nodes corresponding to each grid point data of the k-dimensional binary tree model;
and establishing an association relation between the attribute values of the leaf nodes and the grid point data to obtain a grid point data file.
6. A method for obtaining grid point data is characterized in that the method comprises the following steps:
acquiring equipment related information;
matching the relevant information of the equipment with preset parameters in a grid point data file to obtain corresponding grid point data;
and extracting the attribute value corresponding to the grid point data.
7. The method of claim 6, further comprising:
and associating the equipment related information with the grid point data to obtain an equipment data file.
8. An apparatus for data gridding of a binary tree, the apparatus comprising:
the discrete station data acquisition module is used for acquiring discrete station data; wherein the discrete site data comprises attribute values;
a binary tree construction module for constructing a k-dimensional binary tree model through the attribute values;
the grid point data acquisition module is used for acquiring grid point data;
the leaf node searching module is used for searching and obtaining leaf nodes corresponding to the grid point data through a k-dimensional binary tree model;
and the attribute value determining module is used for determining 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, the apparatus comprising:
the device related information acquisition module is used for acquiring device related information;
the matching module is used for matching the relevant information of the equipment with preset parameters in the grid point data file to obtain corresponding grid point data;
and the attribute value extraction module is used for extracting 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 the processor, when executing the computer program, implements the steps of the method of any of claims 1 to 7.
11. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
12. A computer program product comprising a computer program, characterized in that the computer program realizes the steps of the method of any one of claims 1 to 7 when executed by a processor.
CN202111329278.XA 2021-11-10 2021-11-10 Binary tree data gridding and grid point data obtaining method and device Pending CN114049463A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111329278.XA CN114049463A (en) 2021-11-10 2021-11-10 Binary tree data gridding and grid point data obtaining method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111329278.XA CN114049463A (en) 2021-11-10 2021-11-10 Binary tree data gridding and grid point data obtaining method and device

Publications (1)

Publication Number Publication Date
CN114049463A true CN114049463A (en) 2022-02-15

Family

ID=80208572

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111329278.XA Pending CN114049463A (en) 2021-11-10 2021-11-10 Binary tree data gridding and grid point data obtaining method and device

Country Status (1)

Country Link
CN (1) CN114049463A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114866370A (en) * 2022-03-22 2022-08-05 深圳市立创电子商务有限公司 Communication method, device, equipment and medium based on asymmetric binary tree link
CN116227268A (en) * 2022-12-30 2023-06-06 上海尚实航空发动机股份有限公司 Method, device, equipment and medium for determining thermal parameters of turbine blade of engine

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114866370A (en) * 2022-03-22 2022-08-05 深圳市立创电子商务有限公司 Communication method, device, equipment and medium based on asymmetric binary tree link
CN114866370B (en) * 2022-03-22 2024-04-16 深圳市立创电子商务有限公司 Communication method, device, equipment and medium based on asymmetric binary tree link
CN116227268A (en) * 2022-12-30 2023-06-06 上海尚实航空发动机股份有限公司 Method, device, equipment and medium for determining thermal parameters of turbine blade of engine
CN116227268B (en) * 2022-12-30 2023-11-17 上海尚实航空发动机股份有限公司 Method, device, equipment and medium for determining thermal parameters of turbine blade of engine

Similar Documents

Publication Publication Date Title
US9454580B2 (en) Recommendation system with metric transformation
CN114049463A (en) Binary tree data gridding and grid point data obtaining method and device
CN109886719B (en) Data mining processing method and device based on grid and computer equipment
CN112214472B (en) Meteorological lattice data storage and query method, device and storage medium
CN112949842B (en) Neural network structure searching method, apparatus, computer device and storage medium
CN112434188A (en) Data integration method and device for heterogeneous database and storage medium
CN116522003B (en) Information recommendation method, device, equipment and medium based on embedded table compression
CN112699195A (en) Geospatial data processing method, geospatial data processing device, computer equipment and storage medium
US9436715B2 (en) Data management apparatus and data management method
CN114547257B (en) Class matching method and device, computer equipment and storage medium
CN115225308A (en) Attack group identification method and related equipment for large-scale group attack traffic
CN105991400B (en) Group searching method and device
CN114238334A (en) Heterogeneous data encoding method and device, heterogeneous data decoding method and device, computer equipment and storage medium
CN114003674A (en) Double-recording address determination method, device, equipment and storage medium
CN111859191A (en) GIS service aggregation method, device, computer equipment and storage medium
Gambs et al. Mapreducing gepeto or towards conducting a privacy analysis on millions of mobility traces
CN115358379B (en) Neural network processing method, neural network processing device, information processing method, information processing device and computer equipment
CN107741879A (en) A kind of big data processing method and its device
CN117667999A (en) Data pushing method, device, computer equipment and computer readable storage medium
CN112215354A (en) Neural network model pruning method and device, computer equipment and storage medium
CN116029026A (en) Model file processing method, device, equipment, storage medium and program product
CN113849715A (en) Event black point analysis method and system based on clustering algorithm
CN115438745A (en) Metadata intelligent identification method and device based on semi-supervised learning
CN117827799A (en) Database establishment method and device, computer equipment and storage medium
CN115759419A (en) Position prediction method, system, electronic device and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination