Summary of the invention
It is an object of the invention to propose a kind of data compression method for subsurface buoy thermohaline depth data, guaranteeing data
Under the premise of accuracy, so that the compression ratio of subsurface buoy thermohaline depth data is promoted.
The present invention to achieve the goals above, adopts the following technical scheme that
A kind of data compression method for subsurface buoy thermohaline depth data, includes the following steps:
S1. it pre-processes
S1.1. subsurface buoy thermohaline depth data are read and are stored in initial data array, acquire data format according to sensor
Temperature, salinity and the depth data that will be extracted respectively in array, independently form temperature array, salinity array and depth array;
S1.2. phase is expanded to temperature array, salinity array and depth array with depth data resolution ratio according to temperature, salinity
Answer multiple;
S1.3. forced type conversion operation is carried out to the element in temperature array, salinity array and depth array, from floating-point
Type data are converted to integer data, are respectively stored in temperature integer array, salinity integer array and depth integer array;
S1.4. the symbolic information of the element in temperature integer array is read, and is stored in symbol array;
S1.5. it takes absolute value to all elements in temperature integer array;
S1.6. to the data element in temperature integer array, salinity integer array and depth integer array with its resolution ratio
Inverse be that divisor carries out rounding operation and complementation, by the fractional part of initial data and integer part respectively with integer
According to presentation;
Wherein, the integer part of initial data is obtained by rounding operation, the integer part of three kinds of data is stored in same
In a integer part array;Data are respectively stored in temperature number by the fractional part that three kinds of data are obtained by complementation
According in fractional part array, Salinity Data fractional part array and depth data fractional part array;
S2. position is spliced
Respectively to integer part array, temperature data fractional part array, Salinity Data fractional part array, depth data
Fractional part array and symbol array carry out position splicing, and the position splicing of each integer array is as follows:
S2.1. by traversing the element of each array, the greatest member in array is found, is defined and is spliced according to greatest member
Width;
S2.2. by carrying out shifting function to array element, the deletion in vacancy and the splicing of element is realized, splicing number is obtained
Group;
Compressed integer part array, compressed temperature data fractional part are respectively obtained by upper rheme splicing
Fraction set, compressed Salinity Data fractional part array and compressed depth data fractional part array;
Compressed data frame format is splicing width array, compressed integer part array, compressed temperature number
According to fractional part array, compressed Salinity Data fractional part array, compressed depth data fractional part array and symbol
Number group;
Wherein, splicing width array memory space shared by each data block in frame for storing data, it is extensive for data
It is multiple.
Preferably, the step s2.2 specifically: carry out shift operation since first element, and be assigned to splicing number
Then first element of group carries out shifting function to further element and is successively added on previous element.
Preferably, in the step s2.2, following principle is followed when carrying out shifting function to array element:
The remaining space of splicing array element is judged before splicing each time, if it is wide to be large enough to hold a splicing
Degree, then move to left n for element to be spliced, be added on corresponding splicing array element;If it is inadequate to splice array element remaining space
A splicing width is accommodated, then low n of element to be spliced is intercepted out and then moves to left m-n and be assigned to next splicing
Then array element moves to right corresponding digit to element to be spliced, be added on the splicing corresponding element of array;
Wherein, m be splice each element of array occupy-place number, n by splicing width and array remaining space relativeness
It determines.
The present invention has the advantage that
1, position joining method is easily achieved and safeguards in subsurface buoy application, can be by way of being embedded in subsurface buoy main control software
Realize application of the data compression function in submerged buoy system.
2, in subsurface buoy data compression, position joining method is higher compared to the compression ratio of universal compressed method, for subsurface buoy temperature
Salt depth data, may be implemented 40% or more compression ratio.
3, in the application of real time communication subsurface buoy, by using the compression method, system communication efficiency can be greatly promoted, is subtracted
The work times of few communication module and then the reduction for realizing overall power consumption.
Specific embodiment
Basic ideas of the invention are as follows:
1, subsurface buoy thermohaline depth data are with single-precision floating point type data format (IEEE754) storage, before compression processing, first
It is pre-processed, is intercepted the integer part of data and fractional part according to the resolution ratio of temperature, depth and Salinity Data
It is converted with type, converts data to integer data, the integer of formation temperature data symbol array (Boolean type), all data
Part array (integer) and temperature, depth, the fractional part array (integer) of Salinity Data.
This step operation can reduce the flops of subsequent operation, reduce the operation pressure of subsurface buoy main control chip.
2, after executing completion data prediction, the compression processing of data is carried out, splicing of ascending the throne, principle is to delete
Except redundancy 0 between integer array element.In compression process, record concatenation width information is needed, splicing width refers to
Digit shared by greatest member in each array parses to bank station end data and restores.Bank station end data parsing with it is extensive
It is multiple, using the splicing width information recorded in data compression process, data recovery operation is carried out to each compressed data.
Wherein, the subsurface buoy thermohaline depth data in the embodiment of the present invention specifically refer to three kinds of temperature, salinity and depth data.
It is proposed that the theoretical foundation of above-mentioned basic ideas is:
Data compression method proposed by the present invention is suitable for subsurface buoy thermohaline depth data, and the storage format of this data is using single
Precision float format (IEEE754) storage, the resolution ratio of temperature, salinity and depth is respectively 0.0001 DEG C, 0.00001S/m
With the 0.002% of pressure full scale.It is same as the lower data of resolution ratio suitable using the storage of IEEE754 format for others
With.
It is that the memory mappings such as positive integer, character type data will not be because being superimposed small variation that position joining method, which is suitable for data type,
Measure and generate the data of acute variation.And the data type of thermohaline depth data is floating type, it is therefore desirable to which, by pretreatment, use is whole
Type data are indicated initial data, then carry out position concatenation to integer data.
In addition, for negative integer data, due to variable quantity equally can to causing to vary widely on its memory mapping,
It needs individually to store the symbolic information of data.Then, the data compression method in the present invention is divided into two steps, such as Fig. 5 institute
Show:
The first, pretreatment operation is converted by type, thermohaline depth data is converted to from real-coded GA expression with positive
Integer data indicates, and saves the symbolic information of corresponding data;
The second, by position concatenation, by the deletion of part 0 in integer data, while by data element according to set
Format and sequential storage, and save the information needed for data are restored.
With reference to the accompanying drawing and specific embodiment invention is further described in detail:
As shown in Figure 1, a kind of data compression method for subsurface buoy thermohaline depth data, includes the following steps:
S1. it pre-processes
Pretreatment refers to that, for the type conversion of initial data and deconsolidation process, position splicing data compression method is needed to original
Data carry out type conversion, and it is to convert raw data into positive integer data that type, which converts pretreated purpose, in order to position
Concatenation.
As shown in fig. 6, illustrating preprocessing process with certain collection process subsurface buoy thermohaline depth data instance:
S1.1. temperature, salinity and pressure array are constructed
It reads subsurface buoy thermohaline depth data and is stored in initial data array, buoy [220]=21.1807,5.551,
2.63212,……,4.58742}.Temperature, salinity and the depth that will be extracted respectively in array according to sensor acquisition data format
Data independently form temperature array mid_t, salinity array mid_c and depth (pressure) array mid_d.
S1.2. according to data resolution, corresponding multiple is expanded to array mid_t, mid_c, mid_d
For example, the resolution ratio of temperature is 0.0001 DEG C, temperature array mid_t element is expanded 10000 times;
The resolution ratio of salinity is 0.00001S/m, and salinity array mid_c element is expanded 100000 times;
The resolution ratio of depth is 0.002%, and depth array mid_d element is expanded 1000 times.
S1.3. type is converted
Forced type conversion is carried out to the element in temperature array mid_t, salinity array mid_c and depth array mid_d
Operation, is converted to integer data from real-coded GA, and be respectively stored in temperature integer array mid_i_t, salinity integer array
In mid_i_c and depth integer array mid_i_d.
S1.4. temperature data symbol is read
Since temperature data ranges are -5~35 degrees Celsius, it is therefore desirable to by the symbol of temperature integer array mid_i_t element
Number information is stored in symbol array temp_sgn.Salinity and pressure data perseverance are positive number, therefore do not need to read symbol letter
Breath.
S1.5. it takes absolute value to data
It takes absolute value to all elements in temperature integer array mid_i_t.
S1.6. data are split
To the number in temperature integer array mid_i_t, salinity integer array mid_i_c and depth integer array mid_i_d
Rounding operation and complementation are carried out by divisor of the inverse of its resolution ratio according to element.
The fractional part of initial data and integer part are presented respectively with integer data.Wherein, it is obtained by rounding operation
The integer part of initial data is taken, the integer part of three kinds of data is stored in the same integer part array buoy_i;It is logical
The fractional part that complementation obtains three kinds of data is crossed, since the resolution ratio of three classes data is different, the fractional part taken out
Size be different, in order to obtain higher compression ratio in splicing in place, the data of taking-up are respectively stored in temperature
Data fractional part array buoy_t, Salinity Data fractional part array buoy_c, depth data fractional part array buoy_d
In the middle.
As shown in Fig. 2, initial data is finally obtained symbol array, integer portion by s1.1 to s1.6 step operation
Fraction set and three groups of fractional part arrays, wherein symbolic information array tem_sgn is Boolean type, remaining is integer and data element
Element is positive number.Such as temperature data element mid_t [0]=21.1807, after s1.2 to s1.6 step operation
It will be split as the symbolic variable 0 of two integer datas 21 and 1807 and a Boolean type.
By after pretreatment operation, original real-coded GA is converted into integer data and by the whole of initial data
Number part is stored separately with fractional part.On the basis of these arrays, next step concatenation can be carried out.
S2. position is spliced
Respectively to integer part array buoy_i, temperature data fractional part array buoy_t, Salinity Data fractional part
Array buoy_c and depth data fractional part array buoy_d and symbol array temp_sgn carry out position splicing.
In splicing in place, if to obtain highest compression ratio, the vacancy of each element can be deleted and then be spelled
It connects, but will increase data in this way and restore information, lose more than gain.Therefore it needs to be grouped data according to the order of magnitude, using up can
Data volume transmitting data that can be few restore information.In order to obtain higher compression ratio, according to temperature, salt, deep data resolution ratio, will
Array is grouped according to the overall quantity grade of array element.In these arrays, integer part array buoy_i element compares
Smaller, the order of magnitude is below 102;In fractional part array, data are judged according to the resolution ratio of temperature, salinity and pressure data
Descending element entirety numerical value is respectively buoy_c, buoy_t and buoy_d, the number of the overall data element of array buoy_c
Magnitude is 105, the number data elements grade of buoy_t is 104, the buoy_d order of magnitude is 103。
According to the grouping of the above order of magnitude, position concatenation is carried out to each array respectively.
The principle and operating procedure of position splicing are as shown in figure 3, mainly include two steps:
S2.1. by traversing the element of each array, the greatest member in array is found, is defined and is spliced according to greatest member
Width.Such as array a, greatest member 10, therefore splicing width is 4.
S2.2. by carrying out shifting function to array element, the deletion in vacancy and the splicing of element is realized, splicing number is obtained
Group.Array to be spliced for one carries out shift operation since first element, and is assigned to first member of splicing array
Then element carries out shifting function to further element and is successively added on previous element.
During shift operation, there are two key points: 1) judging direction of displacement and mobile digit;2) splicing
In element overflow problem, i.e., the space of some element can not accommodate next splicing element in splicing array.
In order to solve above-mentioned two problems, following principle is followed when carrying out shifting function to array element:
The remaining space of splicing array element is judged before splicing each time, if it is wide to be large enough to hold a splicing
Degree, then move to left n for element to be spliced, be added on corresponding splicing array element;If it is inadequate to splice array element remaining space
A splicing width is accommodated, then low n of element to be spliced is intercepted out and then moves to left m-n and be assigned to next splicing
Then array element moves to right corresponding digit to element to be spliced, be added on the splicing corresponding element of array;
Wherein, m be splice each element of array occupy-place number, n by splicing width and array remaining space relativeness
It determines.
It is illustrated by taking the shifting function of depth data fractional part array buoy_d as an example:
1. array is traversed, with maximum value definition splicing width u, the splicing array sd_d in array.
For example, greatest member value is 468 in array buoy_d, number of significant digit accounts for 9, defines 8 unsigned int splicings
Width variance u=9;Buoy_d totally 44 elements, therefore spliced data volume is 396, splicing array is defined as int number
Group, each element account for 32, and array size 13, all elements set 0.
2. realizing the deletion in vacancy and the splicing of element by the shifting function to array element.
As shown in figure 3, array to be spliced for one, carries out shift operation, and be assigned to spelling since first element
First element of array is connect, shifting function then is carried out to further element and is sequentially added on previous element.
During shift operation, there are two key points: 1) judging direction of displacement and mobile digit;2) splicing
In element overflow problem, solution aiming at the problem that the two is as shown in Figure 7.Such as the splicing in array buoy_d
Cheng Zhong, buoy_d [0] occupy first 27 of splicing first element sd_d [0] of array to buoy_d [2], and remaining 5 are not
Next element buoy_d [3] can be accommodated, it is therefore desirable to this element is divided into two parts, low 4 for reading element first assign
To sd_d [1] and 28 are moved to left, buoy_d [3] is then moved to right 4 and is added on sd_d [0].
It is small that compressed integer part array sd_i, compressed temperature data are respectively obtained by upper rheme splicing
Number part array sd_t, compressed Salinity Data fractional part array sd_c and compressed depth data fractional part array
sd_d。
These arrays will be treated as following components by position concatenation: (1) splicing width array u, for remembering
Record the splicing width used in each array concatenation in place, the recovery for data;(2) the spliced thermohaline depth data in position
Sd_i, sd_d, sd_t, sd_c are arranged according to the data format of regulation, and specific data frame format is as shown in Figure 4.
At bank station end, needs to carry out data recovery for position splicing, be believed according to the data saved in the splicing of position
Breath and the format of prespecified data arrangement carry out.Data to be saved is needed to restore information in the splicing of position wide for splicing
Degree group, data type uint_8, the information that array element represents are as shown in Figure 4.
Data compression method in the embodiment of the present invention can be embedded in subsurface buoy primary control program, not increase excessive fortune
The Efficient Compression that subsurface buoy data are realized under the premise of calculating burden, improves the communication efficiency of subsurface buoy data back, reduces every
Data transmission times needed for secondary data communication, reduces the power consumption of submerged buoy system.
Certainly, described above is only that presently preferred embodiments of the present invention is answered the present invention is not limited to enumerate above-described embodiment
When explanation, anyone skilled in the art is all equivalent substitutes for being made, bright under the introduction of this specification
Aobvious variant, all falls within the essential scope of this specification, ought to be by protection of the invention.