CN112783504A - Binary universal representation format meteorological data analysis method and device - Google Patents

Binary universal representation format meteorological data analysis method and device Download PDF

Info

Publication number
CN112783504A
CN112783504A CN202110088294.8A CN202110088294A CN112783504A CN 112783504 A CN112783504 A CN 112783504A CN 202110088294 A CN202110088294 A CN 202110088294A CN 112783504 A CN112783504 A CN 112783504A
Authority
CN
China
Prior art keywords
data
binary
representation format
universal representation
description document
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
CN202110088294.8A
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.)
3Clear Technology Co Ltd
Original Assignee
3Clear 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 3Clear Technology Co Ltd filed Critical 3Clear Technology Co Ltd
Priority to CN202110088294.8A priority Critical patent/CN112783504A/en
Publication of CN112783504A publication Critical patent/CN112783504A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • G06F8/427Parsing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/52Binary to binary

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Document Processing Apparatus (AREA)

Abstract

The invention discloses a BUFR data analysis method and device. The method comprises the following steps: acquiring BUFR data and a data description document thereof; reading the binary stream of BUFR data into a memory; according to the data description document, segmenting the binary stream into relatively independent data; and packaging each piece of relatively independent data after segmentation into a data entity. The device includes: the acquisition unit is used for acquiring BUFR data and a data description document thereof; the reading unit is used for reading the binary stream of the BUFR data into the memory; and the data segmentation unit is used for segmenting the binary stream into each relatively independent data according to the data description document. And the packaging unit is used for packaging each relatively independent data after segmentation into a data entity. The method and the device adopt the high-level programming language java to analyze the bufr format data file, and have the advantages of simple code and high portability.

Description

Binary universal representation format meteorological data analysis method and device
Technical Field
The present invention relates to data processing technologies, and in particular, to a method and an apparatus for analyzing Binary Universal Form for reconstruction of meteorological data in Binary Universal Representation format.
Background
For the BUFR data coding format which is issued by the national weather bureau and represents observation data, reading and analyzing the BUFR file are needed to read and understand the weather data. The existing bufr format data analysis is mostly compiled by shell scripts of a Linux system, and the code is complex and has poor portability.
The high-level programming language java has a variety of native binary read classes.
Disclosure of Invention
The invention innovatively provides a method and a device for analyzing BUFR data, which adopt a high-level programming language java to analyze a BUFR format data file and solve the problems of complex code analysis and poor portability of the existing BUFR format data.
In order to achieve the technical purpose, on one hand, the invention discloses a method for analyzing meteorological data in a binary universal representation format. The BUFR data analysis method comprises the following steps: acquiring meteorological data in a binary universal representation format and a data description document thereof; reading the binary stream of the meteorological data in the binary universal representation format into an internal memory; segmenting the binary stream into relatively independent data according to the data description document; and packaging the segmented relatively independent data into a data entity.
Further, for the method for analyzing the weather data in the binary universal representation format, reading the binary stream of the weather data in the binary universal representation format into the memory includes: reading the binary stream of the meteorological data in the binary universal representation format into a byte [ ] array in a byte stream form.
Further, for the method for parsing the weather data in the binary universal representation format, the dividing the binary stream into relatively independent data according to the data description document includes: for the binary stream of the meteorological data in the binary universal representation format put into the byte [ ] array, finding the end mark of the data section where each datum is located according to the data description document, and reading the data length from the data description document; according to the data description document, finding the initial position of the read-write operation by adopting a ByteBuffer class through moving the subscript position, and reading a binary bit corresponding to each data according to the data length; and converting each read data into data of a corresponding data type to obtain each segmented relatively independent data.
Further, for the method for analyzing the meteorological data in the binary universal representation format, the encapsulating the segmented relatively independent data into a data entity includes: and packaging each relatively independent data after segmentation into the data entity by using a set method of the data entity.
In order to achieve the above technical object, in another aspect, the present invention discloses an apparatus for analyzing weather data in binary universal representation format. The device for analyzing BUFR data comprises: the acquiring unit is used for acquiring the meteorological data in the binary universal representation format and the data description document thereof; the reading unit is used for reading the binary stream of the meteorological data in the binary universal representation format into an internal memory; the data segmentation unit is used for segmenting the binary stream into relatively independent data according to the data description document; and the packaging unit is used for packaging each relatively independent data after segmentation into a data entity.
Further, for the parsing device of the binary universal representation format meteorological data, the reading unit is further configured to read the binary stream of the binary universal representation format meteorological data into the byte [ ] array in the form of byte stream.
Further, for the parsing device of the meteorological data in the binary universal representation format, the data slicing unit includes: the data length determining module is used for finding the end mark of the data section where each data is located according to the data description document for the binary stream of the meteorological data in the binary universal representation format put in the byte [ ] array, and reading the data length from the data description document; the data initial position determining module is used for finding out the initial position of the read-write operation by adopting a ByteBuffer class through moving the subscript position according to the data description document and reading the binary digits corresponding to each data according to the data length; and the data conversion module is used for converting each read data into data of a corresponding data type to obtain each segmented relatively independent data.
Further, for the parsing device of the meteorological data in the binary universal representation format, the encapsulating unit is further configured to encapsulate the segmented individual relatively independent data into a data entity by using a set method of the data entity.
To achieve the foregoing objective and in accordance with one aspect of the present invention, a computing device is disclosed. The computing device includes: one or more processors, and a memory coupled with the one or more processors, the memory storing instructions that, when executed by the one or more processors, cause the one or more processors to perform the above-described method.
To achieve the above technical objects, in yet another aspect, the present invention discloses a machine-readable storage medium. The machine-readable storage medium stores executable instructions that, when executed, cause the machine to perform the above-described method.
The invention has the beneficial effects that:
the BUFR data analysis method and device provided by the embodiment of the invention adopt the high-level programming language JAVA to analyze the BUFR format data file, and the JAVA language has better encapsulation on the data reading method, so that the coding is extremely simple, the self high portability of the JAVA language is realized, and the problems of complex code and poor portability of the existing BUFR format data analysis are solved. The method has the advantages of simple code and high portability.
Drawings
In the figure, the position of the upper end of the main shaft,
fig. 1 is a flowchart of a method for parsing BUFR data according to an embodiment of the present invention;
fig. 2 is a flowchart of step S130 in the method for parsing BUFR data shown in fig. 1 according to an example of the present invention;
fig. 3 is a schematic structural diagram of an apparatus for parsing BUFR data according to another embodiment of the present invention;
fig. 4 is a block diagram of a computing device for parsing processing of BUFR data according to an embodiment of the present invention.
Detailed Description
The method for analyzing weather data in binary universal representation format according to the present invention will be explained and explained in detail with reference to the drawings of the specification.
Fig. 1 is a flowchart of a method for parsing BUFR data according to an embodiment of the present invention.
As shown in FIG. 1, in step S110, weather data (BUFR) in binary universal representation format and its data description document are acquired. Wherein, the BUFR data and the data description document can be obtained from the national weather service.
In step S120, the binary stream of the BUFR data is read into the memory. As an alternative, step S120 may include the following steps: the binary stream of BUFR data is read into the byte [ ] array in the form of a byte stream. As a specific example, the binary stream of BUFR data may be read into the memory in the form of a byte stream by using an InputStreamReader class in a dkio packet in java or by using a BufferedReader buffer. The speed of reading in the object by using the buffer reader cache area is faster.
In step S130, the binary stream is segmented into individual relatively independent data according to the data description document. The data description document may include type information, data segment length information, and a data segment end flag of the meteorological data stored in each data segment of the BUFR data, and optionally may further include other information. The type of meteorological data may include temperature, humidity, and/or pressure, among others. Fig. 2 is a flowchart of step S130 in the method for parsing BUFR data shown in fig. 1 according to an example of the present invention. As shown in fig. 2, step S130 may include the steps of:
step S132, for the binary stream of BUFR data put into the byte [ ] array, finding the end mark of the data segment where each data is according to the data description document, and reading the data length from the data description document.
And S134, finding the initial position of the read-write operation by adopting the ByteBuffer class through moving the subscript position according to the data description document, and reading the binary bit corresponding to each data according to the data length. The ByteBuffer can record the current subscript position, which indicates the starting position when the next read-write operation is performed. Specifically, data in the byte [ ] array is read through the byte buffer class, the data is read into the memory, the read subscript is recorded, and the current subscript position is used as the initial position in the next reading. For example, if the 1 st to 4 th bits of the byte [ ] array are pressure and the 5 th to 8 th bits are temperature, then the 1 st to 4 th bits are read by the byte bus for the first time, the 4 th bit is read by the byte buffer, and the temperature can be read by continuing to read the 5 th to 8 th bits when the temperature is read next time.
Step S136, converting each read data into data of a corresponding data type, and obtaining each segmented relatively independent data. For example, for the meteorological automatic station data, after the ByteBuffer reads the data of temperature, humidity, and/or pressure from the BUFR file in step S134, the read data segments are stored in the meteorological automatic station class file corresponding to the field types of temperature, humidity, and/or pressure, respectively.
In step S140, each of the segmented relatively independent data is encapsulated into a data entity. Creating a data entity contains all the elements. Step S140 may include the steps of: and packaging each relatively independent data after segmentation into the data entity by using a set method of the data entity.
Fig. 3 is a schematic structural diagram of a weather data analysis device in binary universal representation format according to another embodiment of the present invention. As shown in fig. 3, the apparatus 300 for parsing BUFR data provided in this embodiment includes an obtaining unit 310, a reading unit 320, a data slicing unit 330, and a packaging unit 340.
The acquiring unit 310 is used for acquiring the BUFR data and the data description document thereof. The operation of the acquisition unit 310 may refer to the operation of step S110 described above with reference to fig. 1.
The reading unit 320 is used for reading the binary stream of the BUFR data into the memory. The operation of the reading unit 320 may refer to the operation of step S120 described above in fig. 1. Further, the reading unit 320 may be configured to read the binary stream of the BUFR data into the byte [ ] array in the form of a byte stream.
The data segmenting unit 330 is configured to segment the binary stream of the BUFR data into relatively independent data according to the data specification document. The operation of the data slicing unit 330 may refer to the operation of step S130 described above with reference to fig. 1.
As an alternative embodiment, the data slicing unit 330 may include a data length determining module, a data start position determining module, and a data converting module. The data length determining module is used for finding the end mark of the data section where each data is located according to the data description document for the binary stream of the BUFR data stored in the byte [ ] array, and reading the data length from the data description document. And the data initial position determining module is used for finding the initial position during the read-write operation by adopting a ByteBuffer class through moving the subscript position according to the data description document and reading the binary bit corresponding to each data according to the data length. The data conversion module is used for converting each read data into data of a corresponding data type to obtain each segmented relatively independent data.
The encapsulating unit 340 is configured to encapsulate the segmented individual relatively independent data into a data entity. The operation of the encapsulation unit 340 may refer to the operation of step S140 described above with reference to fig. 1. Further, the encapsulating unit 340 may be configured to encapsulate each segmented relatively independent data into a data entity by using a set method of the data entity.
The BUFR data analysis method and device provided by the embodiment of the invention adopt the high-level programming language JAVA to analyze the BUFR format data file, and the JAVA language has better encapsulation on the data reading method, so that the coding is extremely simple, the self high portability of the JAVA language is realized, and the problems of complex code and poor portability of the existing BUFR format data analysis are solved. The method has the advantages of simple code and high portability.
FIG. 4 is a block diagram of a computing device for analytic processing of weather data in binary universal representation format, according to an embodiment of the invention.
As shown in fig. 4, computing device 400 may include at least one processor 410, storage 420, memory 430, communication interface 440, and internal bus 450, and at least one processor 410, storage 420, memory 430, and communication interface 440 are connected together via bus 450. The at least one processor 410 executes at least one computer-readable instruction (i.e., an element described above as being implemented in software) stored or encoded in a computer-readable storage medium (i.e., memory 420).
In one embodiment, stored in the memory 420 are computer-executable instructions that, when executed, cause the at least one processor 410 to: acquiring meteorological data in a binary universal representation format and a data description document thereof; reading the binary stream of the meteorological data in the binary universal representation format into an internal memory; segmenting the binary stream into relatively independent data according to the data description document; and packaging the segmented relatively independent data into a data entity.
It should be understood that the computer-executable instructions stored in the memory 420, when executed, cause the at least one processor 410 to perform the various operations and functions described above in connection with fig. 1-3 in the various embodiments of the present disclosure.
In the present disclosure, computing device 400 may include, but is not limited to: personal computers, server computers, workstations, desktop computers, laptop computers, notebook computers, mobile computing devices, smart phones, tablet computers, cellular phones, Personal Digital Assistants (PDAs), handheld devices, messaging devices, wearable computing devices, consumer electronics, and so forth.
According to one embodiment, a program product, such as a non-transitory machine-readable medium, is provided. A non-transitory machine-readable medium may have instructions (i.e., elements described above as being implemented in software) that, when executed by a machine, cause the machine to perform various operations and functions described above in connection with fig. 1-3 in various embodiments of the present disclosure.
Specifically, a system or apparatus may be provided which is provided with a readable storage medium on which software program code implementing the functions of any of the above embodiments is stored, and causes a computer or processor of the system or apparatus to read out and execute instructions stored in the readable storage medium.
In this case, the program code itself read from the readable medium can realize the functions of any of the above-described embodiments, and thus the machine-readable code and the readable storage medium storing the machine-readable code form part of the present invention.
Examples of the readable storage medium include floppy disks, hard disks, magneto-optical disks, optical disks (e.g., CD-ROMs, CD-R, CD-RWs, DVD-ROMs, DVD-RAMs, DVD-RWs), magnetic tapes, nonvolatile memory cards, and ROMs. Alternatively, the program code may be downloaded from a server computer or from the cloud via a communications network.
The above description is only an embodiment of the present invention, and not intended to limit the scope of the claims, and all equivalent structures or equivalent processes that are transformed by the content of the specification and the drawings, or directly or indirectly applied to other related technical fields are included in the scope of the claims.

Claims (10)

1. A method for analyzing meteorological data in a binary universal representation format is characterized by comprising the following steps:
acquiring meteorological data in a binary universal representation format and a data description document thereof;
reading the binary stream of the meteorological data in the binary universal representation format into an internal memory;
segmenting the binary stream into relatively independent data according to the data description document;
and packaging the segmented relatively independent data into a data entity.
2. The method for parsing meteorological data in binary universal representation format according to claim 1, wherein reading the binary stream of meteorological data in binary universal representation format into the memory comprises:
reading the binary stream of the meteorological data in the binary universal representation format into a byte [ ] array in a byte stream form.
3. The method for parsing weather data in binary universal representation format according to claim 2, wherein the segmenting the binary stream into respective relatively independent data according to the data description document comprises:
for the binary stream of the meteorological data in the binary universal representation format put into the byte [ ] array, finding the end mark of the data section where each datum is located according to the data description document, and reading the data length from the data description document;
according to the data description document, finding the initial position of the read-write operation by adopting a ByteBuffer class through moving the subscript position, and reading a binary bit corresponding to each data according to the data length;
and converting each read data into data of a corresponding data type to obtain each segmented relatively independent data.
4. The method for parsing weather data in binary universal representation format according to claim 1, wherein the step of encapsulating the sliced individual data into data entities comprises:
and packaging each relatively independent data after segmentation into the data entity by using a set method of the data entity.
5. An apparatus for analyzing weather data in a binary universal representation format, comprising:
the acquiring unit is used for acquiring the meteorological data in the binary universal representation format and the data description document thereof;
the reading unit is used for reading the binary stream of the meteorological data in the binary universal representation format into an internal memory;
the data segmentation unit is used for segmenting the binary stream into relatively independent data according to the data description document;
and the packaging unit is used for packaging each relatively independent data after segmentation into a data entity.
6. The device for parsing weather data in binary universal representation format according to claim 5, wherein the reading unit is further configured to read the binary stream of weather data in binary universal representation format into byte [ ] array in byte stream form.
7. The device for parsing weather data in binary universal representation format according to claim 6, wherein the data slicing unit comprises:
the data length determining module is used for finding the end mark of the data section where each data is located according to the data description document for the binary stream of the meteorological data in the binary universal representation format put in the byte [ ] array, and reading the data length from the data description document;
the data initial position determining module is used for finding out the initial position of the read-write operation by adopting a ByteBuffer class through moving the subscript position according to the data description document and reading the binary digits corresponding to each data according to the data length;
and the data conversion module is used for converting each read data into data of a corresponding data type to obtain each segmented relatively independent data.
8. The weather data analytic device of the binary universal representation format according to claim 5, wherein the encapsulation unit is further configured to encapsulate the sliced individual relatively independent data into the data entity by using a set method of the data entity.
9. A computing device, comprising:
one or more processors, and
a memory coupled with the one or more processors, the memory storing instructions that, when executed by the one or more processors, cause the one or more processors to perform the method of any of claims 1-4.
10. A machine-readable storage medium having stored thereon executable instructions that, when executed, cause the machine to perform the method of any one of claims 1 to 4.
CN202110088294.8A 2021-01-21 2021-01-21 Binary universal representation format meteorological data analysis method and device Pending CN112783504A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110088294.8A CN112783504A (en) 2021-01-21 2021-01-21 Binary universal representation format meteorological data analysis method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110088294.8A CN112783504A (en) 2021-01-21 2021-01-21 Binary universal representation format meteorological data analysis method and device

Publications (1)

Publication Number Publication Date
CN112783504A true CN112783504A (en) 2021-05-11

Family

ID=75758545

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110088294.8A Pending CN112783504A (en) 2021-01-21 2021-01-21 Binary universal representation format meteorological data analysis method and device

Country Status (1)

Country Link
CN (1) CN112783504A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115545690A (en) * 2022-11-28 2022-12-30 云账户技术(天津)有限公司 Account checking file processing method and device, electronic equipment and readable storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7011245B1 (en) * 2004-11-05 2006-03-14 Michael Hu Pedigree code enabling authentification through computer generated unbroken chain reflective coding including transaction party data
CN102999480A (en) * 2012-11-09 2013-03-27 中国电子科技集团公司第十五研究所 Method and system for editing document
CN109062872A (en) * 2018-07-13 2018-12-21 摩诃科技无锡有限公司 The algorithm that a kind of pair of different-format entry is uniformly processed

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7011245B1 (en) * 2004-11-05 2006-03-14 Michael Hu Pedigree code enabling authentification through computer generated unbroken chain reflective coding including transaction party data
CN102999480A (en) * 2012-11-09 2013-03-27 中国电子科技集团公司第十五研究所 Method and system for editing document
CN109062872A (en) * 2018-07-13 2018-12-21 摩诃科技无锡有限公司 The algorithm that a kind of pair of different-format entry is uniformly processed

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115545690A (en) * 2022-11-28 2022-12-30 云账户技术(天津)有限公司 Account checking file processing method and device, electronic equipment and readable storage medium

Similar Documents

Publication Publication Date Title
US9824212B2 (en) Method and system for recognizing advertisement plug-ins
US10452376B2 (en) Method for identifying file and mobile terminal
CN108228224B (en) Method and device for differential upgrade of embedded system
US20170126723A1 (en) Method and device for identifying url legitimacy
CN108172249B (en) NAND Flash access operation method, device and system
CN110532107B (en) Interface calling method, device, computer equipment and storage medium
US20160026728A1 (en) Interaction Method And Device Between Browsers And Browser
CN112783504A (en) Binary universal representation format meteorological data analysis method and device
CN111866577A (en) Screen recording method, electronic device and computer readable storage medium
CN112115105A (en) Service processing method, device and equipment
CN116644213A (en) XML file reading method, device, equipment and storage medium
CN106886439B (en) Method for rapidly initializing SCM (sparse code multiple Access) security baseline knowledge base
CN111722938A (en) AT instruction processing method, AT instruction processing device, computer equipment and storage medium
CN109684207B (en) Method and device for packaging operation sequence, electronic equipment and storage medium
CN111240790A (en) Multi-language adaptation method and device for application, client and storage medium
CN111159036A (en) Method, system, terminal and storage medium for testing accuracy of product translation function
US11736235B2 (en) Data processing method and related apparatus
CN106569939B (en) Control script program multi-country character analysis system and multi-country character analysis method
CN114120304A (en) Entity identification method, device and computer program product
CN113778774A (en) Test data transmission method and device, test method and communication module
CN115756328A (en) Log obtaining method and device, electronic equipment and memory
CN110674093A (en) File data processing method and device, computer equipment and storage medium
CN113360454B (en) Memory snapshot file compression and decompression method and related device
CN108733649B (en) Method, device and system for inserting voice recognition text into script document
CN104142816A (en) User card and CDMA (code division multiple access) short message analyzing method thereof

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20210511

RJ01 Rejection of invention patent application after publication