CN114385932A - Meteorological data query method and device - Google Patents

Meteorological data query method and device Download PDF

Info

Publication number
CN114385932A
CN114385932A CN202210043661.7A CN202210043661A CN114385932A CN 114385932 A CN114385932 A CN 114385932A CN 202210043661 A CN202210043661 A CN 202210043661A CN 114385932 A CN114385932 A CN 114385932A
Authority
CN
China
Prior art keywords
data
meteorological data
grid
determining
coordinates
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
CN202210043661.7A
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.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology 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 Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202210043661.7A priority Critical patent/CN114385932A/en
Publication of CN114385932A publication Critical patent/CN114385932A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/953Querying, e.g. by the use of web search engines
    • G06F16/9537Spatial or temporal dependent retrieval, e.g. spatiotemporal queries
    • 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/21Design, administration or maintenance of databases
    • G06F16/215Improving data quality; Data cleansing, e.g. de-duplication, removing invalid entries or correcting typographical errors
    • 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/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • 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/24Querying
    • G06F16/245Query processing
    • G06F16/2453Query optimisation

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Software Systems (AREA)
  • Quality & Reliability (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present disclosure provides a method and an apparatus for querying meteorological data, which relates to a map technology and big data in the technical field of data processing, and comprises the following steps: the method comprises the steps of receiving a query request, wherein the query request is used for querying meteorological data of a target geographical position, determining a grid to which the target geographical position belongs in a preset grid, the preset grid is provided with grid identification, determining and outputting the meteorological data corresponding to the query request from an index structure of a memory according to the grid identification corresponding to the target geographical position, the index structure is a data structure of key value pairs, keys in the key value pairs comprise the grid identification, data values in the key value pairs comprise the meteorological data, and the preset grid is obtained by grid cutting a preset range area.

Description

Meteorological data query method and device
Technical Field
The present disclosure relates to map technologies and big data in the field of data processing technologies, and in particular, to a method and an apparatus for querying weather data.
Background
The meteorological data are used for reflecting weather data, are one of important basic data for supporting the construction of a road data team service line product, and can be widely applied to use scenes including excavation of heavy weather blockage, mass-source acquisition of road sections, information early warning of heavy weather blockage and the like.
In the related art, meteorological data are usually partitioned according to time, and stored in a distributed file system in different files according to elements such as air temperature data and precipitation data, and when the meteorological data are queried, the meteorological data in a certain sliding time window need to be traversed in a full amount, which results in the technical problems of long query time and low efficiency.
Disclosure of Invention
The present disclosure provides a meteorological data query method and apparatus for improving efficiency of meteorological data query.
According to a first aspect of the present disclosure, there is provided a method for querying meteorological data, including:
receiving a query request, wherein the query request is used for querying meteorological data of a target geographic position;
determining a grid to which the target geographic position belongs in a preset grid, wherein the preset grid is provided with a grid identifier, and determining and outputting meteorological data corresponding to the query request from an index structure of a memory according to the grid identifier corresponding to the target geographic position;
the index structure is a data structure of key value pairs, keys in the key value pairs comprise grid identifications, the data values in the key value pairs comprise meteorological data, and the preset grids are obtained by carrying out grid cutting processing on preset range areas.
According to a second aspect of the present disclosure, there is provided a weather data query device, including:
the receiving unit is used for receiving an inquiry request, wherein the inquiry request is used for inquiring weather data of a target geographic position;
the first determining unit is used for determining a grid to which the target geographic position belongs in a preset grid, and the preset grid is provided with a grid identifier;
the second determining unit is used for determining and outputting meteorological data corresponding to the query request from an index structure of a memory according to the grid identifier corresponding to the target geographic position;
the index structure is a data structure of key value pairs, keys in the key value pairs comprise grid identifications, the data values in the key value pairs comprise meteorological data, and the preset grids are obtained by carrying out grid cutting processing on preset range areas.
According to a third aspect of the present disclosure, there is provided an electronic device comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of the first aspect.
According to a fourth aspect of the present disclosure, there is provided a non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method according to the first aspect.
According to a fifth aspect of the present disclosure, there is provided a computer program product comprising: a computer program, stored in a readable storage medium, from which at least one processor of an electronic device can read the computer program, execution of the computer program by the at least one processor causing the electronic device to perform the method of the first aspect.
According to the meteorological data query method and device, the index structure with the data structure as the key value pair is built in the memory, the keys in the key value pair comprise the grid marks, the data values in the key value pair comprise the meteorological data so as to combine the grid marks corresponding to the target geographic position, the technical characteristics of the meteorological data corresponding to the query request are obtained and output from the key value pair, the defects that the traversal time is long and the efficiency is low when the meteorological data are queried by adopting a distributed file system are avoided, the query efficiency is improved, the defect of resource waste caused by adopting the distributed file system can be avoided by querying the meteorological data in the memory, resources are saved, and the storage cost is saved.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present disclosure, nor do they limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description.
Drawings
The drawings are included to provide a better understanding of the present solution and are not to be construed as limiting the present disclosure. Wherein:
FIG. 1 is a schematic diagram according to a first embodiment of the present disclosure;
FIG. 2 is a schematic diagram according to a second embodiment of the present disclosure;
FIG. 3 is a schematic diagram of a grid according to an embodiment of the present disclosure;
FIG. 4 is a schematic diagram according to a third embodiment of the present disclosure;
FIG. 5 is a schematic diagram of a stack structure according to an embodiment of the present disclosure;
FIG. 6 is a schematic diagram according to a fourth embodiment of the present disclosure;
FIG. 7 is a schematic diagram according to a fifth embodiment of the present disclosure;
FIG. 8 is a schematic diagram according to a sixth embodiment of the present disclosure;
FIG. 9 is a block diagram of an electronic device for implementing a method for querying weather data according to an embodiment of the present disclosure.
Detailed Description
Exemplary embodiments of the present disclosure are described below with reference to the accompanying drawings, in which various details of the embodiments of the disclosure are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present disclosure. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
The weather data is a set of data reflecting weather, and the weather data can be divided into weather data and weather data. The weather data refers to the collection of various original data observed by conventional meteorological instruments and professional meteorological equipment and various data formed by processing, sorting and editing. The weather data refers to weather data with strong real-time performance of weather analysis and forecast service.
In contrast, weather data is converted into weather data over time, and the content of the weather data is much wider than that of the weather data, the weather data is data of a long time sequence, and the weather data is data of a short time.
The weather data in this embodiment may be weather data, weather data and weather data, and this embodiment is not limited.
Weather data plays a particularly important role, both from the production activity side and from people travel side. Taking production activities as an example, and particularly taking road construction as an example, meteorological data is one of important basic data for supporting the construction of a road data team service line product, and can be widely applied to use scenes including excavation of severe weather ponding blocking, road section avoidance of mass source collection, information early warning of severe weather blocking and the like. According to the behavior example of people, people can select the time and/or place of travel according to meteorological data so as to improve the safety of travel.
The query of weather data is important for utilizing the weather data, and in the related art, a commonly used query method of weather data includes:
the method comprises the steps of carrying out partition processing on meteorological data based on time to obtain meteorological data of different time partitions, storing the meteorological data of different time partitions in different files in a distributed file system according to weather elements such as air temperature data, precipitation data and the like, for example, storing the air temperature data in the meteorological data in a file independent of precipitation data in the distributed file system, and simultaneously storing the precipitation data in the meteorological data in a file independent of the air temperature data in the distributed file system so as to inquire the meteorological data from the distributed file system.
For example, when the weather data needs to be queried, the weather data in the sliding time window is traversed in a sliding time window manner, for example, all files of the air temperature data in the distributed file system are traversed, and all files of the precipitation data in the distributed file system are traversed, so that the corresponding weather data is obtained.
However, when the method is used for meteorological data query, the meteorological data in a certain sliding time window needs to be traversed in a full amount, so that the query time is long, the efficiency is low, and the meteorological data is stored in a distributed file system mode, so that relatively speaking, the consumed storage space is large, namely, resources are consumed, and the cost is high.
In order to avoid at least one of the above technical problems, the inventors of the present disclosure have made creative efforts to obtain the inventive concept of the present disclosure: and constructing an index structure of a data structure of key value pairs in the memory, wherein the keys in the key value pairs comprise grid identifications, and the data values in the key value pairs comprise meteorological data, so that when an inquiry request is received, the meteorological data corresponding to the inquiry request is determined and output based on the grid identifications corresponding to the inquiry position indicated by the inquiry request.
Based on the inventive concept, the present disclosure provides a method and an apparatus for querying meteorological data, which are applied to map technology and big data in the technical field of data processing.
Fig. 1 is a schematic diagram according to a first embodiment of the disclosure, and as shown in fig. 1, a meteorological data query method according to an embodiment of the disclosure includes:
s101: a query request is received.
Wherein the query request is used for querying the meteorological data of the target geographic position. The target geographic location may be one or more regions or may be one or more coordinates.
For example, the execution subject of the present embodiment is a query device for meteorological data (hereinafter, simply referred to as a query device). The query device may be a server (e.g., a cloud server or a local server), a computer, a terminal device, a processor, a chip, or the like, and this embodiment is not limited thereto.
The following example implementations may be employed with respect to receiving a query request:
in one example, the query device may include a display device, and the query device may control the display device to output a query box, and accordingly, the user may input a query request in the query box.
In another example, the query device may be connected to the display device and output a query box through the display device, and accordingly, the user may input a query request in the query box.
That is, the query device and the display device may be an integrated device or two independent devices, which is not limited in this embodiment. And the user may enter the query request in the query box through an input device such as a mouse or a keyboard.
In another example, the query device may include a voice processing device, and the user may initiate the query request by voice, and accordingly, the voice processing device performs voice recognition processing on the received query request in a voice format, and transmits the processed query request to the query device.
Similarly, the query device and the voice processing device may be an integrated device or two independent devices, which is not limited in this embodiment.
It should be noted that the above examples are only exemplary, and the manner in which the query device may receive the query request is not to be construed as limiting the receipt of the query request.
S102: and determining the grid to which the target geographic position belongs in the preset grid. Wherein the preset grid has a grid identifier.
S103: and determining and outputting meteorological data corresponding to the query request from an index structure of the memory according to the grid identifier corresponding to the target geographic position.
The index structure is a data structure of key value pairs, keys in the key value pairs comprise grid identifications, data values in the key value pairs comprise meteorological data, and the preset grids are obtained by carrying out grid cutting processing on preset range areas.
The preset range area may be set based on a requirement, a history, a test, and the like, and this embodiment is not limited. For example, the preset range region may be a region in the global range, a region in the national range, or a region in the province range.
The grid cutting processing is to perform gridding processing on the preset range area to obtain each grid of the preset range area, and each grid has a unique identifier ID (namely a grid identifier).
For example, the grid cutting process may be implemented by using a spatial index algorithm (such as a divide and conquer algorithm, which may be specifically the S2 algorithm), so as to determine each grid of the preset range area and a grid identifier corresponding to each grid based on the spatial index algorithm.
In the present embodiment, the weather data is stored in the memory as a value in a key-value pair (key-value), instead of in a distributed file system as in the related art, and the grid identifier is used as a key in the key-value pair, so as to determine the corresponding weather data through the grid identifier.
It should be noted that, by storing the key value pairs in the memory, the data values in the key value pairs can represent the meteorological data, and compared with the case of storing the meteorological data in the distributed file system, the storage space can be reduced, i.e., the technical effect of saving the storage resources can be achieved, and by storing the meteorological data as the data values in the key value pairs, the efficiency of querying the meteorological data and the technical effect of saving the query resources can be improved.
For example, the grid to which the target geographic position belongs may be determined from the preset grids, and the preset grids have the grid identifier, so that the grid to which the target geographic position belongs also has the grid identifier, and the grid identifier corresponding to the target geographic position may be determined.
Because the meteorological data is stored in the key value pair in the memory, the meteorological data can be directly determined from the memory, and specifically, the meteorological data corresponding to the query request is obtained from the key value pair in the memory.
Based on the above analysis, an embodiment of the present disclosure provides a method for querying meteorological data, including: receiving a query request, wherein the query request is used for querying meteorological data of a target geographical position, determining a grid to which the target geographical position belongs in a preset grid, the preset grid has grid identification, and determining and outputting the meteorological data corresponding to the query request from an index structure of a memory according to the grid identification corresponding to the target geographical position, wherein the index structure is a data structure of key value pairs, keys in the key value pairs comprise the grid identification, data values in the key value pairs comprise the meteorological data, the preset grid is obtained by performing grid cutting processing on a preset range area, in the embodiment, by constructing the index structure of which the data structure is the key value pairs in the memory, the keys in the key value pairs comprise the grid identification, the data values in the key value pairs comprise the meteorological data so as to combine the grid identification corresponding to the target geographical position, and obtain and output technical characteristics of the meteorological data corresponding to the query request from the key value pairs, the method and the device avoid the defects of long traversal time and low efficiency caused by the fact that a distributed file system is adopted to inquire meteorological data, improve the inquiry efficiency, avoid the defect of resource waste caused by the adoption of the distributed file system by inquiring the meteorological data in the memory, improve the resource saving and save the technical effect of storage cost.
Fig. 2 is a schematic diagram of a second embodiment of the present disclosure, and as shown in fig. 2, the meteorological data query method of the embodiment of the present disclosure includes:
s201: and analyzing the acquired data file of the preset range area to obtain coordinates and meteorological data.
It is understood that, in order to avoid redundant description, the technical features of the present embodiment that are the same as those of the above embodiments are not described again in this embodiment.
The data file includes information related to the meteorological data, such as the meteorological data, and coordinates corresponding to the meteorological data. The format of the data file may be a netcdf file format.
For example, this step can be understood as: acquiring a data file in a netcdf file format in a preset range area, wherein the data file comprises meteorological data and coordinates corresponding to the meteorological data, and analyzing the data file to extract the meteorological data and the coordinates corresponding to the meteorological data from the data file.
In some embodiments, after the parsing process is performed on the data file, the parsed weather data may be preprocessed, such as at least one of an outlier filtering process, a precision clipping process, and an encoding process, is performed on the parsed weather data.
The abnormal value filtering process is to remove abnormal meteorological data from the meteorological data obtained by analysis, and the present embodiment is not limited to the determination of the abnormal value.
In one example, the normal value interval may be determined in advance (similarly, the normal value interval may be determined based on experience or history records, etc.), and of the analyzed weather data, the weather data that does not belong to the normal value interval is determined as an abnormal value, and the abnormal value is removed.
In another example, the meteorological data of 0 may be determined as an abnormal value, so that the meteorological data of 0 may be subjected to the culling processing.
By means of abnormal value filtering processing, on one hand, unreal meteorological data can be filtered out, so that the reserved meteorological data has high reliability and accuracy; on the other hand, the storage space for the abnormal value can be reduced, namely, the storage resource of the memory is saved; on the other hand, the interference of the output meteorological data with the query request by an abnormal value can be avoided, so that the accuracy and the reliability of the output meteorological data with the query request are improved; on the other hand, the time for inquiring can be reduced, and the inquiring efficiency is improved.
The precision interception processing means that the data bit number of the meteorological data obtained by analysis is adaptively adjusted so as to avoid complicated representation. For example, the precipitation amount 0.12345 (mm) is cut to 0.123 (mm) with accuracy.
Through the precision interception processing, on one hand, the defect that data representation is complicated due to excessive data digits can be avoided; on the other hand, the storage space can be relatively reduced, so that the technical effect of saving storage resources is realized; in another aspect, the processed meteorological data can be made uniform.
The encoding processing is to process the meteorological data obtained by the analysis based on a preset bit integer. For example, the parsed weather data is processed based on a 32-bit integer (int 32). Through coding processing, the storage space of the meteorological data stored in the memory can be relatively reduced, so that storage resources are saved, and query efficiency is improved.
In this embodiment, the meteorological data obtained by analysis is preprocessed in one or more of the above manners, so that the technical effects of avoiding data redundancy and improving the efficiency of data processing can be achieved.
The meteorological data obtained by analysis may be subjected to abnormal value filtering, precision clipping, and encoding in sequence.
S202: and performing grid cutting processing on the preset range area to obtain each grid identifier of the preset range area, and determining the mapping relation between the meteorological data obtained by analysis and each grid identifier of the preset range area according to the coordinates obtained by analysis.
For example, the spatial index algorithm described in the above embodiment may be used to perform a grid cutting process on the preset range region, so as to divide the preset range region into a plurality of grids, as shown in fig. 3, where each grid has a grid identifier.
For example, the grid cutting processing may be performed on the preset range area based on a preset cutting level, and the cutting level may be determined based on a demand, a history, a test, and the like, which is not limited in this embodiment. If the cutting level is 13 levels, the predetermined range area is divided into a series of grids of about 1km by 1km in size based on the cutting level.
The coordinates obtained by analysis can be used as a mapping basis, and the meteorological data is mapped to each grid identifier to construct a mapping relation.
In some embodiments, determining the mapping relationship between the weather data obtained by the analysis and each grid identifier of the preset range area according to the coordinates obtained by the analysis includes the following steps:
the first step is as follows: and performing interval division processing on the coordinates obtained by analysis and the meteorological data obtained by analysis according to a preset time interval to obtain the coordinates of each time interval and the meteorological data of each time interval.
Similarly, the time interval may be determined based on a demand, a history, a test, and the like, and this embodiment is not limited. For example, the time interval may be 5 minutes, and the time interval may be represented by [ T, T +5 ] (in minutes).
For example, the data files may include data files within 24 hours before the current time based on the current time, and data files 72 hours in the future based on the current time. Then, at 5 minute intervals, the 96(72+24) hours are divided into different time intervals, so as to obtain the coordinates (such as longitude and latitude coordinates, which can be characterized by [ lat, lng ], lat is latitude, and lng is longitude) of each time interval and the meteorological data of each time interval.
The second step is as follows: and determining the mapping relation between the meteorological data in each time interval and each grid mark of the preset range area according to the coordinates in each time interval by taking the time interval as a unit.
Exemplarily, in combination with the above embodiment, the number of time intervals is (96 × 60)/5 is 1142, that is, there are 1142 time intervals. And determining the mapping relation between the meteorological data and each grid identifier in each time interval by taking the longitude and latitude coordinates in the time interval as a reference.
In this embodiment, the time interval is determined by combining the time intervals, so as to determine the mapping relationship in units of time intervals, which can improve the efficiency of determining the mapping relationship, and can improve the technical effects that the determined mapping relationship has higher accuracy and reliability.
S203: and constructing an index structure with a data structure as a key value pair in the memory according to the coordinates obtained by analysis, the meteorological data obtained by analysis, the mapping relation and each grid mark of the preset range area.
That is, the memory stores an index structure, the data structure of the index structure is a key-value pair, and the key-value pair can be used for representing coordinates, meteorological data, and grid identification.
It should be noted that, in this embodiment, by combining the coordinates obtained through analysis, the weather data obtained through analysis, the mapping relationship, and each grid identifier in the preset range area, a key value pair is constructed, so that the key value pair can fully represent the corresponding relationship between the coordinates and the weather data, and between the grid identifier and the weather data, for example, and further, when the weather data corresponding to the query request is determined based on the key value pair, the determined weather data corresponding to the query request has the technical effects of higher accuracy and reliability.
In combination with the above analysis, the mapping relationship may be determined based on the time interval, and accordingly, the key-value pair may be further constructed in combination with the time interval. For example, in some embodiments, constructing the key-value pair according to the analyzed coordinates, the analyzed weather data, the mapping relationship, and the grid identifiers of the preset range area includes the following steps:
the first step is as follows: the maximum time of each time interval is determined as the timestamp of each time interval.
For example, in conjunction with the above embodiment, the time interval is [ T, T +5 ], the maximum time is T +5, and correspondingly, T +5 is the timestamp of the time interval.
The second step is as follows: and constructing a key value pair according to the coordinate obtained by analysis, the meteorological data obtained by analysis, the mapping relation, each timestamp and each grid identifier of the preset range area.
That is to say, in this embodiment, the key value pairs may further represent information related to time, i.e., a timestamp, on the basis of representing the coordinates, the weather data, and the grid identifiers, and the key value pairs may have higher reliability, diversity, and flexibility by representing richer contents, so that when determining the weather data corresponding to the query request in combination with the key value pairs, the efficiency of determining the weather data corresponding to the query request may be improved, that is, the technical effect of improving the efficiency of weather data query may be improved.
Of course, in other embodiments, the timestamp of each time interval may also be determined from the minimum time of each time interval, such as determining T as the timestamp.
In some embodiments, the second step may comprise the sub-steps of:
the first substep: and constructing the coordinates obtained by analysis, the grid identifications of the preset range area and the timestamps as keys in the key value pairs.
The second substep: and constructing the meteorological data obtained by analysis into data values in the key value pairs according to the mapping relation and the grid identifications of the preset range area.
For example, the key value pair includes two parts of content, one part of content is a key, and one part of content is a data value, in this embodiment, the key in the key value pair may include three-dimensional content, which are respectively a coordinate, a grid identifier, and a timestamp obtained by analysis, and the data value in the key value pair includes weather data obtained by analysis.
Wherein the data structure of key-value pairs can be characterized as follows:
map<cellid,map<coordinate,map<time,weatherData>>>。
the method comprises the steps of obtaining weather data, analyzing coordinate, time and weather data, wherein cellid is a grid mark, the coordinate is obtained through analysis, the time is a timestamp, and the weather data is obtained through analysis.
In this embodiment, the grid identifier, the timestamp and the coordinate obtained through analysis are determined as the key in the key value pair, and the meteorological data obtained through analysis are determined as the data value in the key value pair, so that corresponding meteorological data can be obtained through different dimensionality queries, and the technical effects of flexibility and diversity of the queries are improved.
In some embodiments, after the index structure is obtained through the above-mentioned building, if a new data file is obtained, that is, new meteorological data is obtained, the index structure may be updated based on the new meteorological data, and the updating process may include the following steps:
the first step is as follows: and deep copying the index structure to obtain backup data.
The deep copy refers to that a source object (i.e., an index structure) and a copy object (i.e., backup data) are independent from each other, and a change of any one object does not affect another object. That is, the index structure and the backup data are two independent objects, and the processing of the backup data does not affect the index structure, and the processing of the index structure does not affect the backup data.
The first step is as follows: and combining the backup data with the newly-added meteorological data to obtain an updated index structure. And the updated index structure is used for subsequent meteorological data query.
For example, the merging processing method may be understood as a process of merging a key and a data value in a key value pair, for example, adding a new key and a new data value, and a specific implementation method may refer to the principle of constructing a key value pair, which is not described herein again.
In this embodiment, the index structure is updated in a deep copy and merge processing manner, so that independence between a preceding index structure and a succeeding index structure can be achieved, and data interference between the preceding index structure and the succeeding index structure is avoided, thereby improving the reliability and accuracy of updating, and improving the technical effects of reliability and effectiveness of query when the weather data is queried based on the updated index structure.
In some embodiments, the updated index structure may be obtained based on the stored weather data being time-invariant, that is, the time of the weather data stored in the index structure before and after the update is the same, for example, 96 hours.
For example, determining the corresponding time length of the newly added meteorological data, determining a removal time interval according to the time length and the current time, wherein the time in the removal time interval is the longest from the current time, and removing the key and the data value in the removal time interval from the backup data.
In some embodiments, after the updated index structure is obtained, the index structure before updating may be deleted from the memory to release the storage space and improve the query efficiency.
In connection with the above analysis, the meteorological data is a time-varying process, and therefore, the data files may be acquired based on time periods, so that after a key-value pair is constructed based on the data files of the previous time periods, the key-value pair is updated based on the data files of the later time periods, and so on.
In some embodiments, progress data associated with characterizing the progress of the meteorological data may be configured in the memory, and may be implemented based on temporal complexity. When the previous key value pair is updated, corresponding updating processing is carried out on the progress data.
S204: a query request is received.
Wherein the query request is used for querying the meteorological data of the target geographic position.
S205: and determining the grid to which the target geographic position belongs in the preset grid, wherein the preset grid is provided with a grid identifier.
S206: and determining and outputting meteorological data corresponding to the query request from an index structure of the memory according to the grid identifier corresponding to the target geographic position.
It is worth mentioning that, in some embodiments, the query of the weather data may be implemented in combination with the time complexity, that is, the query of the weather data is implemented within a constant time range, and if the query of the weather data is completed within the constant time range, that is, the weather data corresponding to the query request is determined within the constant time range, the weather data corresponding to the query request is output; on the contrary, if the weather data corresponding to the query request is not obtained in the constant time range, a prompt message of query failure can be output, so that the defect that query experience of a user is influenced due to too long query time can be avoided, and the defect that query resources are wasted due to repeated query can be avoided.
It should be understood that the above-mentioned embodiment for constructing key-value pairs may be a separate embodiment, the above-mentioned updating of key-value pairs may also be a separate embodiment, and may also be combined with each other to obtain a new embodiment, and the disclosure is not limited thereto.
Fig. 4 is a schematic diagram of a third embodiment of the present disclosure, and as shown in fig. 4, the meteorological data query method according to the embodiment of the present disclosure includes:
s401: a query request is received.
Wherein the query request is used for querying the meteorological data of the target geographic position.
Similarly, in order to avoid redundant description, the technical features of the present embodiment that are the same as those of the above embodiments are not described again in this embodiment.
S402: and determining the grid to which the target geographic position belongs in the preset grid, wherein the preset grid is provided with a grid identifier.
The preset grid is obtained by carrying out grid cutting processing on the preset range area.
S403: and determining the grid identifier which is the same as the grid identifier corresponding to the target geographic position from the grid identifiers of the key value pairs.
The memory comprises an index structure, the index structure is a data structure of key value pairs, keys in the key value pairs comprise grid marks, and data values in the key value pairs comprise meteorological data.
This step may be understood as determining, in the key value pair, the key corresponding to the grid identity corresponding to the target geographic location.
S404: and acquiring meteorological data corresponding to the determined same grid identification from the key value pair, and determining the meteorological data corresponding to the query request according to the acquired meteorological data.
In this embodiment, by combining the key representing the grid identifier in the key value pair, the data value (i.e., the meteorological data) corresponding to the key is determined, so that the query efficiency can be improved.
In some embodiments, the key in the key value pair further includes coordinates corresponding to meteorological data, and accordingly, determining the meteorological data corresponding to the query request according to the acquired meteorological data includes the following steps:
the first step is as follows: and obtaining each coordinate included in the area covered by the same grid identification as the determined grid identification from each coordinate of the key value pair.
As can be known from the foregoing embodiments, the grid identifier is an identifier of one area, and the area may include multiple coordinates, so in this step, from the coordinates representing the values in the key value pairs, the coordinates included in the area covered by the same grid identifier, that is, the coordinates in the grid to which the target geographic location belongs, may be determined.
The second step is as follows: the coordinates closest to the target geographical position are determined from the acquired coordinates, and the weather data corresponding to the coordinates closest to the target geographical position are extracted from the acquired weather data.
And the extracted meteorological data is meteorological data corresponding to the query request.
In combination with the above analysis, considering that the coordinates are obtained through analysis, there may be a difference in the division precision, there may be a decimal place, there may also be a certain error, and the like, and the coordinates in the key value pair may not be completely the same as the coordinates corresponding to the target geographic position, the coordinates that are relatively closest to the target geographic position may be determined from each coordinate in the key value pair, and the data value (i.e., the meteorological data) corresponding to the coordinates may be determined from the key value pair based on the coordinates, so that the determined meteorological data has the technical effects of higher accuracy and reliability.
With reference to the foregoing embodiment, it can be seen that the keys in the key value pair may further include a timestamp, and correspondingly, if the query request carries the query time, the weather data corresponding to the query request may be determined with reference to the timestamp and the query time, which may be implemented by the following steps:
the first step is as follows: a timestamp in the key-value pair corresponding to the query time is determined.
For example, a time interval corresponding to the query time may be determined based on the above dividing manner of the time interval, and a maximum time value corresponding to the time interval is determined as a time stamp of the query time corresponding to the key value pair.
The second step is as follows: and extracting weather data of a time stamp corresponding to the query time from the acquired weather data.
And determining the extracted meteorological data as the meteorological data corresponding to the query request.
In this embodiment, the meteorological data corresponding to the query request is determined by combining the query time and the timestamp, so that the technical effect of improving the query efficiency is achieved. Moreover, it can be understood that the query of the weather data in the embodiment and the above manner of combining the coordinates may be independent embodiments, or may be combined to obtain a new embodiment, so as to improve the technical effects of flexibility and diversity of the query.
It should be noted that the query method using the timestamp may be understood as a "time query method", the query method using the coordinate may be understood as a "point query method", and in other embodiments, the "space query method" and the "Top N query method" may also be used.
The following is set forth with respect to the "spatial query approach":
the "spatial query method" may also be referred to as an "area query method", that is, a "spatial query method" is a query for weather data in a certain area range, compared to a "point query method" for a certain specific location point (e.g., specific coordinates).
Illustratively, the target geographic position comprises at least two incoming coordinates, a query area is generated according to each incoming coordinate, and a grid to which the query area belongs is determined from preset grids; and determining the grid identifier corresponding to the grid, and determining the grid identifier which is the same as the grid identifier from the key value pair so as to determine the meteorological data corresponding to the same grid identifier from the data values in the key value pair.
In this embodiment, the query region is determined based on the plurality of incoming coordinates to determine the grid identifier corresponding to the query region, so that the data value of the grid identifier corresponding to the query region in the key value pair is determined as the meteorological data corresponding to the query request, thereby implementing query on the meteorological data, and achieving the technical effects of flexibility and diversity of query.
Similarly, the present embodiment may also be combined with a timestamp to form a new embodiment.
In some embodiments, each incoming coordinate is a vertex coordinate of a polygon corresponding to the query region.
That is, one incoming coordinate may be determined as a vertex coordinate, so as to obtain a plurality of vertices, and a polygon is determined according to the plurality of vertices, and a region surrounded by the polygon is the query region, so as to improve the technical effect of determining the reliability and efficiency of the query region.
The following is set forth with respect to the "Top N query approach":
the "Top N query mode" refers to a query of weather data for the first N (N is a positive integer greater than 1) areas whose target geographic location meets the weather data requirement.
Wherein, the meteorological data demand can be rainfall data demand, such as inquiring 10 areas with the maximum rainfall; the meteorological data requirements may also be temperature data requirements, for example, the temperature data requirements may be the temperature (° c) of the 10 regions with the highest query temperature, and the meteorological data requirements may also be other requirements related to the meteorological data, which are not listed here.
For example, the query device may construct a heap structure or a tree structure in the memory based on the meteorological data requirements, and sequentially select data values from the key value pairs to perform traversal processing on the heap structure or the tree structure to obtain data values in the key value pairs satisfying the meteorological data; and determining the data value in the key value pair meeting the meteorological data as the meteorological data corresponding to the query request.
The stack structure may be a small top stack structure or a large top stack structure, and this embodiment is not limited. Regarding the construction principle of the heap structure and the tree structure, the description in the related art can be referred to, and the description is omitted here.
Taking the small top heap structure and precipitation data as an example, how to determine the weather data corresponding to the query request is exemplarily described as follows with reference to fig. 5:
with reference to the foregoing embodiment, the precipitation data may represent precipitation, and the unit of precipitation may be millimeter, and correspondingly, if the meteorological data requirement may be 7 areas with the maximum precipitation, a small top pile with a pile number of 7 as shown in fig. 5 is constructed in the memory, and the data in each pile is precipitation (in millimeter).
As shown in fig. 5, a circle represents a pile, the value in the pile is precipitation data, and 0.1 in the pile represents that the precipitation is 0.1 mm, and so on, which are not listed here.
Traversing the data values (namely the meteorological data, and specifically the precipitation in the meteorological data) in the key value pairs, and when the precipitation is greater than the precipitation in any pile, replacing the minimum precipitation in each pile with the traversed precipitation, and so on until 7 piles with the maximum precipitation are obtained, and determining the areas corresponding to the precipitation in the 7 piles respectively, thereby obtaining 7 areas with the maximum precipitation.
As shown in fig. 5, if the precipitation obtained by traversal in the key-value pair is 0.9 mm, the 0.9 mm precipitation is replaced by the 0.1 mm precipitation.
In this embodiment, by constructing a heap structure or a tree structure and determining the meteorological data corresponding to the query request, the meteorological data corresponding to the query request can be quickly acquired based on the meteorological data requirement, so that the query efficiency and reliability are improved.
Based on the analysis, the technical scheme provided by the disclosure can support different query modes, so that the weather data query has flexibility and diversity, and the technical effects of adaptability and timeliness of various query modes are improved.
S405: and outputting the meteorological data corresponding to the query request.
In some embodiments, if the weather data corresponding to the query request is an array or a sequence table, S405 may include: and traversing the array or the sequence table to convert the array or the sequence table into a data stream, and outputting the meteorological data corresponding to the query request based on the data stream.
In this embodiment, the meteorological data corresponding to the query request is output in a data stream (stream) manner, so that on one hand, diversity and flexibility of outputting the meteorological data corresponding to the query request can be achieved, and on the other hand, the disadvantage of low transmission speed caused by too large amount of transmitted data can be avoided, thereby improving the technical effect of efficiency of transmitting the meteorological data corresponding to the query request.
For example, the data amount of the meteorological data corresponding to the query request may be determined first, and the data amount is compared with a preset data amount threshold, and if the data amount reaches (i.e., is greater than or equal to) the data amount threshold, the meteorological data corresponding to the query request may be output in a data stream manner; conversely, if the amount of data does not reach (i.e., is less than) the data amount threshold, the weather data corresponding to the query request may be directly output.
Similarly, the data amount threshold may be determined based on a demand, a history, a test, and the like, which is not limited in this embodiment.
In this embodiment, whether to transmit the meteorological data corresponding to the query request in a data stream manner is determined by the data size of the meteorological data corresponding to the query request, so that the technical effects of effectiveness and reliability of data transmission can be ensured as much as possible.
Fig. 6 is a schematic diagram of a weather data query device 600 according to a fourth embodiment of the disclosure, as shown in fig. 6, including:
the receiving unit 601 is configured to receive an inquiry request, where the inquiry request is used to inquire weather data of a target geographic location.
A first determining unit 602, configured to determine a grid to which a target geographic location belongs in a preset grid, where the preset grid has a grid identifier.
The second determining unit 603 is configured to determine weather data corresponding to the query request from the index structure of the memory according to the grid identifier corresponding to the target geographic location.
The output unit 604 is configured to output weather data corresponding to the query request.
The index structure is a data structure of key value pairs, keys in the key value pairs comprise grid identifications, data values in the key value pairs comprise meteorological data, and the preset grids are obtained by carrying out grid cutting processing on preset range areas.
Fig. 7 is a schematic diagram according to a fifth embodiment of the disclosure, and as shown in fig. 7, a weather data query device 700 according to an embodiment of the disclosure includes:
and the analyzing unit 701 is configured to analyze the acquired data file in the preset range area to obtain coordinates and meteorological data.
The processing unit 702 is configured to perform at least one of an abnormal value filtering process, a precision clipping process, and an encoding process on the weather data obtained through the analysis.
The cutting unit 703 is configured to perform grid cutting processing on the preset range area to obtain each grid identifier of the preset range area.
A third determining unit 704, configured to determine, according to the coordinates obtained through the analysis, a mapping relationship between the weather data obtained through the analysis and each grid identifier of the preset range area.
As can be seen in fig. 7, in some embodiments, the third determining unit 704 includes:
a dividing subunit 7041, configured to perform interval division processing on the coordinates obtained by the analysis and the meteorological data obtained by the analysis according to a preset time interval, so as to obtain coordinates of each time interval and meteorological data of each time interval.
A fourth determining subunit 7042, configured to determine, by taking the time interval as a unit, a mapping relationship between the weather data in each time interval and each grid identifier of the preset range area according to the coordinate in each time interval.
The first constructing unit 705 is configured to construct key value pairs according to the analyzed coordinates, the analyzed weather data, the mapping relationship, and each grid identifier of the preset range area.
As can be seen in fig. 7, in some embodiments, the first constructing unit 705 includes:
a fifth determining subunit 7051, configured to determine the maximum time of each time interval as the timestamp of each time interval.
A constructing subunit 7052, configured to construct a key-value pair according to the analyzed coordinates, the analyzed weather data, the mapping relationship, each timestamp, and each grid identifier of the preset range area.
In some embodiments, build subunit 7052 includes:
and the first construction module is used for constructing the coordinates obtained by analysis, the grid identifications of the preset range area and the timestamps as keys in the key value pairs.
And the second construction module is used for constructing the meteorological data obtained by analysis into data values in the key value pairs according to the mapping relation and the grid identifications of the preset range area.
The obtaining unit 706 is configured to obtain the newly added meteorological data.
And a copying unit 707, configured to perform deep copy on the index structure to obtain backup data.
The merging unit 708 is configured to merge the backup data with the newly added meteorological data to obtain an updated index structure.
The receiving unit 709 is configured to receive an inquiry request, where the inquiry request is used to inquire weather data of the target geographic location.
The first determining unit 710 is configured to determine a grid to which a target geographic location belongs in a preset grid, where the preset grid has a grid identifier.
As may be appreciated in connection with FIG. 7, in some embodiments, the target geographic location includes at least two incoming coordinates; the first determining unit 710 includes:
a generating subunit 7101, configured to generate a query region from the incoming coordinates.
A third determining subunit 7102, configured to determine, from the preset grids, a grid to which the query region belongs.
In some embodiments, each incoming coordinate is a vertex coordinate of a polygon corresponding to the query region.
The second determining unit 711 is configured to determine weather data corresponding to the query request from the index structure of the memory according to the grid identifier corresponding to the target geographic location.
The index structure is a data structure of key value pairs, keys in the key value pairs comprise grid identifications, data values in the key value pairs comprise meteorological data, and the preset grids are obtained by carrying out grid cutting processing on preset range areas.
As can be seen in fig. 7, in some embodiments, the second determining unit 711 includes:
a first determining subunit 7111, configured to determine, from the grid identifiers of the key-value pairs, a grid identifier that is the same as the grid identifier corresponding to the target geographic location.
An obtaining subunit 7112, configured to obtain, from the key value pair, the meteorological data corresponding to the determined same grid identifier.
And a second determining subunit 7113, configured to determine, according to the obtained weather data, weather data corresponding to the query request.
In some embodiments, the keys in the key-value pair further comprise coordinates corresponding to meteorological data; a second determining subunit 7113 comprising:
and the obtaining module is used for obtaining the coordinates included in the area covered by the grid identification which is the same as the determined grid identification from the coordinates of the key value pair.
And the first determining module is used for determining the coordinate closest to the target geographic position from the acquired coordinates.
The first extraction module is used for extracting meteorological data corresponding to the coordinates closest to the target geographic position from the acquired meteorological data, wherein the extracted meteorological data are meteorological data corresponding to the query request.
In some embodiments, the keys in the key-value pair further include timestamps corresponding to the meteorological data; the query request carries query time; a second determining subunit 7113 comprising:
and the second determining module is used for determining the timestamp corresponding to the query time in the key value pair.
And the second extraction module is used for extracting the meteorological data of the time stamp corresponding to the query time from the acquired meteorological data, wherein the extracted meteorological data is determined as the meteorological data corresponding to the query request.
And an output unit 712, configured to output the weather data corresponding to the query request.
As can be seen from fig. 7, in some embodiments, if the weather data corresponding to the query request is an array or a sequence table, the output unit 712 includes:
a sixth determining subunit 7121, configured to determine the data amount of the weather data corresponding to the query request.
And the converting subunit 7122 is configured to traverse the array or the sequence table to convert the array or the sequence table into a data stream if the data amount reaches a preset data amount threshold.
And the output subunit 7123 is used for outputting the meteorological data corresponding to the query request based on the data stream.
In some embodiments, the target geographic location is the first N regions that satisfy the meteorological data requirements, N being a positive integer greater than 1; the apparatus 700 further comprises:
a second building unit 713 for building a heap structure or a tree structure in the memory based on the meteorological data requirements.
And the traversing unit 714 is used for sequentially selecting data values from the key value pairs to perform traversing processing on the heap structure or the tree structure to obtain the data values in the key value pairs meeting the meteorological data.
A fourth determining unit 715, configured to determine a data value in the key-value pair satisfying the meteorological data as the meteorological data corresponding to the query request.
Fig. 8 is a schematic diagram according to a sixth embodiment of the present disclosure, and as shown in fig. 8, an electronic device 800 in the present disclosure may include: a processor 801 and a memory 802.
A memory 802 for storing programs; the Memory 802 may include a volatile Memory (RAM), such as a Static Random Access Memory (SRAM), a Double Data Rate Synchronous Dynamic Random Access Memory (DDR SDRAM), and the like; the memory may also comprise a non-volatile memory, such as a flash memory. The memory 802 is used to store computer programs (e.g., applications, functional modules, etc. that implement the above-described methods), computer instructions, etc., which may be stored in one or more of the memories 802 in a partitioned manner. And the above-described computer programs, computer instructions, data, and the like can be called by the processor 801.
The computer programs, computer instructions, etc. described above may be stored in one or more memories 802 in partitions. And the above-mentioned computer program, computer instruction, or the like can be called by the processor 801.
A processor 801 for executing the computer program stored in the memory 802 to implement the steps of the method according to the above embodiments.
Reference may be made in particular to the description relating to the preceding method embodiment.
The processor 801 and the memory 802 may be separate structures or may be integrated structures integrated together. When the processor 801 and the memory 802 are separate structures, the memory 802 and the processor 801 may be coupled by a bus 803.
The electronic device of this embodiment may execute the technical solution in the method, and the specific implementation process and the technical principle are the same, which are not described herein again.
In the technical scheme of the disclosure, the collection, storage, use, processing, transmission, provision, disclosure and other processing of the personal information (such as the position related information in the query request) of the related user all meet the regulations of related laws and regulations, and do not violate the good custom of the public order.
The present disclosure also provides an electronic device, a readable storage medium, and a computer program product according to embodiments of the present disclosure.
According to an embodiment of the present disclosure, the present disclosure also provides a computer program product comprising: a computer program, stored in a readable storage medium, from which at least one processor of the electronic device can read the computer program, the at least one processor executing the computer program causing the electronic device to perform the solution provided by any of the embodiments described above.
FIG. 9 illustrates a schematic block diagram of an example electronic device 900 that can be used to implement embodiments of the present disclosure. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital assistants, cellular telephones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the disclosure described and/or claimed herein.
As shown in fig. 9, the apparatus 900 includes a computing unit 901, which can perform various appropriate actions and processes in accordance with a computer program stored in a Read Only Memory (ROM)902 or a computer program loaded from a storage unit 908 into a Random Access Memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the device 900 can also be stored. The calculation unit 901, ROM 902, and RAM 903 are connected to each other via a bus 904. An input/output (I/O) interface 905 is also connected to bus 904.
A number of components in the device 900 are connected to the I/O interface 905, including: an input unit 906 such as a keyboard, a mouse, and the like; an output unit 907 such as various types of displays, speakers, and the like; a storage unit 908 such as a magnetic disk, optical disk, or the like; and a communication unit 909 such as a network card, a modem, a wireless communication transceiver, and the like. The communication unit 909 allows the device 900 to exchange information/data with other devices through a computer network such as the internet and/or various telecommunication networks.
The computing unit 901 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of the computing unit 901 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various dedicated Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, and so forth. The calculation unit 901 performs the respective methods and processes described above, such as the inquiry method of the weather data. For example, in some embodiments, the method of querying weather data may be implemented as a computer software program tangibly embodied in a machine-readable medium, such as storage unit 908. In some embodiments, part or all of the computer program may be loaded and/or installed onto device 900 via ROM 902 and/or communications unit 909. When the computer program is loaded into the RAM 903 and executed by the computing unit 901, one or more steps of the above-described method of querying weather data may be performed. Alternatively, in other embodiments, the computing unit 901 may be configured to perform the query method of the meteorological data by any other suitable means (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, Field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), system on a chip (SOCs), Complex Programmable Logic Devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for implementing the methods of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the program codes, when executed by the processor or controller, cause the functions/operations specified in the flowchart and/or block diagram to be performed. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), Wide Area Networks (WANs), and the Internet.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The Server can be a cloud Server, also called a cloud computing Server or a cloud host, and is a host product in a cloud computing service system, so as to solve the defects of high management difficulty and weak service expansibility in the traditional physical host and VPS service ("Virtual Private Server", or simply "VPS"). The server may also be a server of a distributed system, or a server incorporating a blockchain.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present disclosure may be executed in parallel, sequentially, or in different orders, as long as the desired results of the technical solutions disclosed in the present disclosure can be achieved, and the present disclosure is not limited herein.
The above detailed description should not be construed as limiting the scope of the disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present disclosure should be included in the scope of protection of the present disclosure.

Claims (33)

1. A meteorological data query method comprises the following steps:
receiving a query request, wherein the query request is used for querying meteorological data of a target geographic position;
determining a grid to which the target geographic position belongs in a preset grid, wherein the preset grid is provided with a grid identifier, and determining and outputting meteorological data corresponding to the query request from an index structure of a memory according to the grid identifier corresponding to the target geographic position;
the index structure is a data structure of key value pairs, keys in the key value pairs comprise grid identifications, the data values in the key value pairs comprise meteorological data, and the preset grids are obtained by carrying out grid cutting processing on preset range areas.
2. The method of claim 1, wherein determining weather data corresponding to the query request from an index structure in memory based on the grid identification corresponding to the target geographic location comprises:
determining the grid identifier which is the same as the grid identifier corresponding to the target geographic position from the grid identifiers of the key value pairs;
and acquiring meteorological data corresponding to the determined same grid identification from the key value pair, and determining the meteorological data corresponding to the query request according to the acquired meteorological data.
3. The method of claim 2, wherein a key of the key-value pair further comprises coordinates corresponding to meteorological data; determining the meteorological data corresponding to the query request according to the acquired meteorological data, wherein the determining comprises the following steps:
obtaining each coordinate included in the area covered by the same grid identification as the determined grid identification from each coordinate of the key value pair;
and determining the coordinates closest to the target geographic position from the acquired coordinates, and extracting the meteorological data corresponding to the coordinates closest to the target geographic position from the acquired meteorological data, wherein the extracted meteorological data is the meteorological data corresponding to the query request.
4. The method of claim 2 or 3, the key of the key-value pair further comprising a timestamp corresponding to meteorological data; the query request carries query time; determining the meteorological data corresponding to the query request according to the acquired meteorological data, wherein the determining comprises the following steps:
determining a timestamp in the key value pair corresponding to the query time;
and extracting weather data of a timestamp corresponding to the query time from the acquired weather data, wherein the extracted weather data is determined as the weather data corresponding to the query request.
5. The method of claim 1, wherein the target geographic location comprises at least two incoming coordinates; determining a grid to which the target geographic position belongs in a preset grid, including:
and generating a query area according to each incoming coordinate, and determining a grid to which the query area belongs from the preset grids.
6. The method of claim 5, wherein each of the incoming coordinates is a vertex coordinate of a polygon to which the query region corresponds.
7. The method of any of claims 1-6, further comprising:
analyzing the acquired data file of the preset range area to obtain coordinates and meteorological data;
performing grid cutting processing on the preset range area to obtain each grid identifier of the preset range area, and determining a mapping relation between the meteorological data obtained by analysis and each grid identifier of the preset range area according to the coordinates obtained by analysis;
and constructing the key value pair according to the coordinate obtained by analysis, the meteorological data obtained by analysis, the mapping relation and each grid mark of the preset range area.
8. The method of claim 7, wherein determining the mapping relationship between the parsed weather data and the grid identifications of the predetermined range area according to the parsed coordinates comprises:
carrying out interval segmentation processing on the coordinates obtained by analysis and the meteorological data obtained by analysis according to a preset time interval to obtain the coordinates of each time interval and the meteorological data of each time interval;
and determining the mapping relation between the meteorological data in each time interval and each grid mark of the preset range area according to the coordinates in each time interval by taking the time interval as a unit.
9. The method of claim 8, wherein constructing the key-value pairs from the parsed coordinates, the parsed weather data, the mapping relationships, and the grid identifications of the preset range region comprises:
and determining the time stamp of each time interval according to the maximum time of each time interval, and constructing the key value pair according to the coordinates obtained by analysis, the meteorological data obtained by analysis, the mapping relation, each time stamp and each grid identifier of the preset range area.
10. The method of claim 9, wherein constructing the key-value pairs from the parsed coordinates, the parsed weather data, the mapping relationships, the timestamps, and the grid identifications of the preset range region comprises:
constructing the coordinates obtained by analysis, the grid identifications of the preset range area and the timestamps as keys in the key value pairs;
and constructing the meteorological data obtained by analysis as a data value in the key value pair according to the mapping relation and each grid mark of the preset range area.
11. The method according to claim 7, after analyzing the acquired data file of the preset range area to obtain coordinate and meteorological data, the method further comprising:
and performing at least one of abnormal value filtering processing, precision intercepting processing and encoding processing on the meteorological data obtained by analysis.
12. The method according to any one of claims 7-11, further comprising:
acquiring newly added meteorological data;
and deeply copying the index structure to obtain backup data, and combining the backup data with the newly-added meteorological data to obtain an updated index structure.
13. The method of any of claims 1-12, the target geographic location being the first N regions that satisfy meteorological data requirements, N being a positive integer greater than 1; the method further comprises the following steps:
building a heap structure or a tree structure in the memory based on the meteorological data requirements, and sequentially selecting data values from the key value pairs to perform traversal processing on the heap structure or the tree structure to obtain data values in the key value pairs meeting the meteorological data;
and determining the data value in the key value pair meeting the meteorological data as the meteorological data corresponding to the query request.
14. The method of any one of claims 1-13, wherein outputting weather data corresponding to the query request if the weather data corresponding to the query request is an array or a sequence table comprises:
and traversing the array or the sequence table to convert the array or the sequence table into a data stream, and outputting the meteorological data corresponding to the query request based on the data stream.
15. The method of claim 14, further comprising:
determining the data volume of the meteorological data corresponding to the query request;
and traversing the array or the sequence table to convert the array or the sequence table into a data stream, including:
and traversing the array or the sequence table if the data volume reaches a preset data volume threshold value so as to convert the array or the sequence table into a data stream.
16. An apparatus for querying meteorological data, comprising:
the receiving unit is used for receiving an inquiry request, wherein the inquiry request is used for inquiring weather data of a target geographic position;
the first determining unit is used for determining a grid to which the target geographic position belongs in a preset grid, and the preset grid is provided with a grid identifier;
a second determining unit, configured to determine, according to the grid identifier corresponding to the target geographic location, weather data corresponding to the query request from an index structure of a memory;
the output unit is used for outputting meteorological data corresponding to the query request;
the index structure is a data structure of key value pairs, keys in the key value pairs comprise grid identifications, the data values in the key value pairs comprise meteorological data, and the preset grids are obtained by carrying out grid cutting processing on preset range areas.
17. The apparatus of claim 16, wherein the second determining unit comprises:
a first determining subunit, configured to determine, from the grid identifiers of the key-value pairs, a grid identifier that is the same as the grid identifier corresponding to the target geographic location;
the acquiring subunit is used for acquiring meteorological data corresponding to the determined same grid identifier from the key value pair;
and the second determining subunit is used for determining the meteorological data corresponding to the query request according to the acquired meteorological data.
18. The apparatus of claim 17, wherein a key of the pair of key values further comprises coordinates corresponding to meteorological data; the second determining subunit includes:
the obtaining module is used for obtaining each coordinate included in the area covered by the same grid identification as the determined grid identification from each coordinate of the key value pair;
the first determining module is used for determining the coordinate closest to the target geographic position from the acquired coordinates;
and the first extraction module is used for extracting meteorological data corresponding to the coordinates closest to the target geographic position from the acquired meteorological data, wherein the extracted meteorological data are meteorological data corresponding to the query request.
19. The apparatus of claim 17 or 18, the key of the key-value pair further comprising a timestamp corresponding to meteorological data; the query request carries query time; the second determining subunit includes:
a second determining module, configured to determine a timestamp in the key value pair corresponding to the query time;
and the second extraction module is used for extracting the meteorological data of the timestamp corresponding to the query time from the acquired meteorological data, wherein the extracted meteorological data is determined as the meteorological data corresponding to the query request.
20. The apparatus of claim 16, wherein the target geographic location comprises at least two incoming coordinates; the first determination unit includes:
a generating subunit, configured to generate a query region according to each of the incoming coordinates;
and the third determining subunit is configured to determine, from the preset grids, a grid to which the query region belongs.
21. The apparatus of claim 20, wherein each of the incoming coordinates is a vertex coordinate of a polygon to which the query region corresponds.
22. The apparatus of any of claims 16-21, further comprising:
the analysis unit is used for analyzing the acquired data file of the preset range area to obtain coordinates and meteorological data;
the cutting unit is used for carrying out grid cutting processing on the preset range area to obtain each grid mark of the preset range area;
the third determining unit is used for determining the mapping relation between the meteorological data obtained by analysis and each grid identifier of the preset range area according to the coordinates obtained by analysis;
and the first construction unit is used for constructing the key value pair according to the coordinate obtained by analysis, the meteorological data obtained by analysis, the mapping relation and each grid mark of the preset range area.
23. The apparatus of claim 22, wherein the third determining unit comprises:
the dividing subunit is used for carrying out interval dividing processing on the coordinates obtained by analysis and the meteorological data obtained by analysis according to a preset time interval to obtain the coordinates of each time interval and the meteorological data of each time interval;
and the fourth determining subunit is used for determining the mapping relationship between the meteorological data in each time interval and each grid identifier of the preset range area according to the coordinates in each time interval by taking the time interval as a unit.
24. The apparatus of claim 23, wherein the first building unit comprises:
a fifth determining subunit, configured to determine a timestamp of each time interval from the maximum time of each time interval;
and the construction subunit is used for constructing the key value pair according to the coordinate obtained by analysis, the meteorological data obtained by analysis, the mapping relation, each timestamp and each grid identifier of the preset range area.
25. The apparatus of claim 24, wherein the building subunit comprises:
the first construction module is used for constructing the coordinates obtained through analysis, the grid identifications of the preset range area and the timestamps as keys in the key value pairs;
and the second construction module is used for constructing the meteorological data obtained by analysis into the data values in the key value pair according to the mapping relation and the grid identifications of the preset range area.
26. The apparatus of claim 22, the apparatus further comprising:
and the processing unit is used for performing at least one of abnormal value filtering processing, precision interception processing and encoding processing on the meteorological data obtained by analysis.
27. The apparatus of any of claims 22-26, further comprising:
the acquiring unit is used for acquiring newly added meteorological data;
the copying unit is used for deeply copying the index structure to obtain backup data;
and the merging unit is used for merging the backup data and the newly-added meteorological data to obtain an updated index structure.
28. The apparatus of any one of claims 16-27, said target geographic location being the first N regions that meet meteorological data requirements, N being a positive integer greater than 1; the device further comprises:
the second construction unit is used for constructing a heap structure or a tree structure in the memory based on the meteorological data requirement;
the traversal unit is used for sequentially selecting data values from the key value pairs to perform traversal processing on the heap structure or the tree structure to obtain the data values in the key value pairs meeting the meteorological data;
and the fourth determining unit is used for determining the data value in the key value pair meeting the meteorological data as the meteorological data corresponding to the query request.
29. The apparatus of any one of claims 16-28, wherein if the meteorological data corresponding to the query request is an array or a sequence table, the output unit comprises:
the conversion subunit is used for traversing the array or the sequence table to convert the array or the sequence table into a data stream;
and the output subunit is used for outputting the meteorological data corresponding to the query request based on a data stream mode.
30. The apparatus of claim 29, the output unit further comprising:
a sixth determining subunit, configured to determine a data amount of the meteorological data corresponding to the query request;
and the conversion subunit is configured to, if the data amount reaches a preset data amount threshold, traverse the array or the sequence table to convert the array or the sequence table into a data stream.
31. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-15.
32. A non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method of any one of claims 1-15.
33. A computer program product comprising a computer program which, when executed by a processor, carries out the steps of the method of any one of claims 1 to 15.
CN202210043661.7A 2022-01-14 2022-01-14 Meteorological data query method and device Pending CN114385932A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210043661.7A CN114385932A (en) 2022-01-14 2022-01-14 Meteorological data query method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210043661.7A CN114385932A (en) 2022-01-14 2022-01-14 Meteorological data query method and device

Publications (1)

Publication Number Publication Date
CN114385932A true CN114385932A (en) 2022-04-22

Family

ID=81201032

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210043661.7A Pending CN114385932A (en) 2022-01-14 2022-01-14 Meteorological data query method and device

Country Status (1)

Country Link
CN (1) CN114385932A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115203159A (en) * 2022-07-25 2022-10-18 北京字跳网络技术有限公司 Data storage method and device, computer equipment and storage medium
CN115687805A (en) * 2022-12-30 2023-02-03 江西省气象信息中心(江西省气象培训中心、江西省农村经济信息中心) Meteorological data query method and system based on position
CN116881241A (en) * 2023-09-06 2023-10-13 深圳市银河系科技有限公司 Safety management method and system applied to meteorological data

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115203159A (en) * 2022-07-25 2022-10-18 北京字跳网络技术有限公司 Data storage method and device, computer equipment and storage medium
CN115203159B (en) * 2022-07-25 2024-06-04 北京字跳网络技术有限公司 Data storage method, device, computer equipment and storage medium
CN115687805A (en) * 2022-12-30 2023-02-03 江西省气象信息中心(江西省气象培训中心、江西省农村经济信息中心) Meteorological data query method and system based on position
CN116881241A (en) * 2023-09-06 2023-10-13 深圳市银河系科技有限公司 Safety management method and system applied to meteorological data
CN116881241B (en) * 2023-09-06 2023-11-07 深圳市银河系科技有限公司 Safety management method and system applied to meteorological data

Similar Documents

Publication Publication Date Title
CN114385932A (en) Meteorological data query method and device
CN112560468B (en) Meteorological early warning text processing method, related device and computer program product
US11340827B2 (en) Method, device, and program product for managing storage space in storage system
CN113377890B (en) Map quality inspection method and device, electronic equipment and storage medium
CN113468226A (en) Service processing method, device, electronic equipment and storage medium
CN115203340A (en) Method, device, equipment and storage medium for determining companion relationship
CN110851758B (en) Webpage visitor quantity counting method and device
CN111506682B (en) Map data processing method, data query method, device and electronic equipment
CN112887910B (en) Method and device for determining abnormal coverage area and computer readable storage medium
CN109376148B (en) Data processing method and device for slow change dimension table and electronic equipment
CN114969444A (en) Data processing method and device, electronic equipment and storage medium
CN112948517A (en) Area position calibration method and device and electronic equipment
CN114840539A (en) Data processing method, device, equipment and storage medium
CN114820079B (en) Crowd determination method, device, equipment and medium
CN114238335A (en) Buried point data generation method and related equipment thereof
CN113986866A (en) Processing method, device, equipment and medium for large-scale point cloud data
CN112988932A (en) High-precision map labeling method, device, equipment, readable storage medium and product
CN113377887A (en) Map data updating method and device, electronic equipment and storage medium
CN113139258A (en) Road data processing method, device, equipment and storage medium
CN111782588A (en) File reading method, device, equipment and medium
CN113793346B (en) Region attribute method and device, electronic equipment and readable storage medium
CN113850271A (en) Online feature library construction method and device and electronic equipment
CN115840660A (en) Alarm processing method, device, equipment and storage medium
CN117390582A (en) Target dynamic and static information classification fusion method in VTS system
CN116861033A (en) Time-varying graph storage method, device, electronic equipment 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