dataesr/scientific-paragraphs-categorization huggingface dataset:
It does this without an entropy coder. Zstandard is a fast lossless compressor offering high compression ratios. It makes use of dictionary coding (repcode modeling) and a finite-state entropy coder (tANS)  (Duda, 2013). It offers a compression ratio similar to that of Deflate coupled with high compression/decompression speeds. This paper also evaluates Shuffle and Bitshuffle. The Shuffle groups all the data samples' first bytes together, all the second bytes together, etc. In smooth datasets, or datasets with highly correlated consecutive sample values, this rearrangement creates long runs of similar bytes, improving the dataset's compression. Bitshuffle extends the concept of Shuffle to the bit level by grouping together all the data samples' first bits, second bits, etc. Last, we evaluate the lossy compression algorithms Sz, Decimal Rounding and Bit Grooming.
We chose to evaluate the Sz algorithm because it provides better rate-distortion results than FPZIP and ZFP, see  Tao et al. (2017). The Sz algorithm predicts data samples using an n-layers prediction model and performs an error-control quantization of the data before variable length encoding. Unpredictable data samples are encoded after a binary representation analysis: the insignificant bits are truncated after computation of the smallest number of mantissa bits required to achieve the specified error bound. The Decimal Rounding algorithm achieves a uniform scalar quantization of the data. The quantization step is a power of 2 pre-computed so as to preserve a specific number of decimal digits. The Bit Grooming algorithm creates a bitmask to remove the least significant bits of the mantissa of IEEE 754 floating-point data.
Only 5 tabulated values are used in our implementation, enough to provide a good precision. The tabulated values v for log 10 (m i ) are such that v ≤ log 10 (m i ). They are provided in the Supplement. Number d i of significant digits before the decimal separator in sample value s i is thus approximated with the following equation: d i ≈ e i log 10 (2) + v + 1 (9) This computation slightly underestimates the values for d i but provides a more conservative quantization, guaranteeing the specified number of significant digits. The optimization slightly decreases the achievable compression ratios in exchange for a much higher compression speed. The Digit Rounding algorithm is summarized below. We have developed an HDF5 dynamically loaded filter plugin so as to apply the Digit Rounding algorithm to netCDF-4 or HDF5 datasets.
It should be noted that data values rounded by the Digit Rounding algorithm can be read directly: there is no reverse operation to Digit Rounding, and users do not need any software to read the rounded data. Table 2 provides the results of the Digit Rounding algorithm on the value of π with specified precisions nsd varying from 1 to 8 digits. It can be compared to the Bit Grooming results provided in Table  2  in  Zender (2016a). For a specified precision of nsd = 4 digits, the Digit Rounding algorithm preserves 11 bits in the mantissa and sets the 12th bit to 1. Compared to the Bit Grooming algorithm, 3 more bits have been set to 0. Table  3  provides the maximum absolute errors, the mean absolute errors and the mean errors (defined in Sect. 4) obtained with varying nsd values on an artificial dataset composed of 1 000 000 values evenly spaced over the interval [1.
0, 2. 0). This is the same artificial dataset used in Table  3  in  Zender (2016a). It shows that Digit Rounding always preserves an absolute error lower than or equal to half the value of the least significant digit, i. e. |s i -s i | ≤ 0. 5×10 d i -nsd. We compare the compression ratio obtained with the Digit Rounding algorithm to that obtained with the Bit Grooming algorithm for the same meteorological data from MERRA re-analysis studied in  Zender (2016a). Table  4  reports the Bit Grooming results extracted from Table  6  in  Zender (2016a)  and provides the results of the Digit Rounding algorithm. The same lossless compression is employed: Shuffle and Deflate with level 1 compression. From nsd = 7 to nsd = 5, Digit Rounding and Bit Grooming provide similar compression ratios with a slight advantage for the Bit Grooming algorithm.
Performance metrics One of the features required for lossy scientific data compression is control over the amount of loss, or the accuracy, of the abs ≤ e abs. The maximum relative error is defined by e max rel = max s i -s i s i. A relative error bound specifies the maximum relative error, e rel , allowed between any sample of the original and compressed data: e max rel ≤ e rel. The absolute error bound can be useful for data with a single dynamic range of interest. The relative error bound can be useful for data where both very low and very high values are pertinent. A near-nearly exhaustive list of metrics for assessing the performance of lossy compression of scientific datasets is provided in  Tao et al. (2019). For the sake of conciseness, only a few of them are presented in this paper.
X. Delaunay et al. : Digit rounding compression algorithm The compression and decompression speeds are expressed in MB s -1. Those reported in this paper were obtained on a Dell T1600 with an Intel Xeon E31225 4-core CPU at 3. 1 GHz, and a 4 GB memory under the RedHat 6. 5 (64-bit) OS with compression and decompression run on a single core. Parallel compression has not been considered in this work. The following metrics were chosen to assess the data degradation of the lossy compression algorithms: maximum absolute error e max abs defined previously. It is used to evaluate the maximum error between the original and compressed data; mean error e to evaluate if any bias is introduced into the compressed data. It is defined as the mean of the pointwise difference between the original and compressed data: e = 1 N N-1 i=0 (s i -s i ) mean absolute error e abs to evaluate the mean data degradation.
Analytical datasets Synthetic datasets s1 and s3D with known statistics were generated in order to test the compression algorithms under variable conditions. Dataset s1 is a noisy sinusoid of 1 dimension with a maximum absolute value of 118. The data volume of this dataset is 4 MB. Dataset s3D is a noisy sinusoid pulse of 3 dimensions with a maximum absolute value of 145. The data volume of this dataset is 512 MB. The Supplement describes these datasets in greater detail.
Performance assessment of lossless compression methods The lossless compression algorithms evaluated are Deflate and Zstandard with or without the Shuffle or Bitshuffle preprocessing step. LZ4 is always evaluated with the Bitshuffle preprocessing step because it was imposed in the LZ4 implementation we used. We ran a lossless compression algorithm using the h5repack tool from the HDF5 library, version 1. 8. Figures  2  and 3  provide the results obtained for the compression and decompression of dataset s1 and dataset s3D respectively. The vertical bars represent the results for different compression levels: from 1 to 9 for Deflate level dfl_lvl, from 1 to 22 for Zstandard level zstd_lvl, and only one level for LZ4. First, it can be observed that preprocessing steps Shuffle or Bitshuffle have a similarly favorable impact both on the compression ratio and on the compression/decompression speeds.
Second, the compression level parameters dfl_lvl and zstd_lvl have little influence on the compression ratio. However, the compression/decompression speeds decrease as compression levels increase, particularly with Zstandard compression levels. Third, the compression ratios obtained with Deflate and Zstandard are similar, but the compression speeds of Zstandard at low compression levels are far higher, and the decompression speeds of Zstandard are always higher. Fourth, Bitshuffle+LZ4 provides a slightly lower compression ratio than Shuffle+Deflate or Shuffle+Zstandard, with a compression speeds similar to Shuffle+Deflate or Shuffle+Zstandard at low compression level parameters dfl_lvl or zstd_lvl. Finally, the compression/decompression speeds obtained with Zstandard and LZ4 for the compression of dataset s3D are much lower than that achieved for the compression of dataset s1.
Further investigations are required to understand why the compression/decompression speeds are lower, but it might be related to HDF5 chunking. To summarize, these results show that preprocessing by Shuffle or Bitshuffle is very helpful in increasing compression efficiency. They also show that Zstandard can provide higher compression and decompression speeds than Deflate at low compression levels. However, on the s3D dataset, we observed that Zstandard compression and decompression speeds are lower than those obtained with Deflate. Therefore, Deflate and Zstandard are both options to consider for the lossless compression of scientific datasets as long as they follow the Shuffle or Bitshuffle preprocessing step.
The errors introduced by these two algorithms are similar. However, it can be seen that Decimal Rounding provides a higher compression ratio than Sz for dataset s1. On the other hand, Sz provides a higher compression ratio for dataset s3D. Sz may perform better on dataset s3D because it is smoother than dataset s1. Indeed, Sz integrates a prediction step. This prediction might often fail because dataset s1 is very noisy. This may explain the lower compression ratio for s1 dataset. Decimal Rounding, however, does not make any predictions, which may explain why it achieves a better compression than Sz for dataset s1. The lower compression/decompression speeds obtained with Sz on the dataset s3D are not well understood and might be related to HDF5 chunking as previously mentioned. Figure  4  compares Sz and Bit Grooming algorithms in terms of SNR versus compression ratio.
This figure was obtained with the following parameters: -For the Sz algorithm, the absErrBound parameter was successively set to 5 × 10 -5 , 5 × 10 -4 , 5 × 10 -3 , 5 × 10 -2 , 5 × 10 -1 , 5; -For the Decimal Rounding algorithm, the dsd parameter was successively set to 4, 3, 2, 1, 0, -1. For dataset s1, Decimal Rounding has a higher SNR than Sz for a given compression ratio. On the contrary, for dataset s3D, Sz has a higher SNR than Decimal Rounding for a given compression ratio. Both Sz and Bit Grooming algorithms seem valuable for error-bounded compression.
Performance comparison in relative error-bounded compression mode This section compares the performance of the relative error-bounded compression algorithms: Sz, Bit Grooming, and Digit Rounding. The results reported were obtained by applying Sz configured with the options SZ_DEFAULT_COMPRESSION and Gzip_BEST_SPEED. Shuffle and Deflate with dflt_lvl=1 were applied after the Bit Grooming and Decimal Rounding algorithms. We first focus on the results obtained with dataset s1. The number of significant digits -nsd parameter -in the Bit Grooming and Digit Rounding algorithms was set to 3. As the maximum absolute value in the s1 dataset is 118, the maximum absolute error should be lower than 0. 5. In order to be able to compare Sz configured with a relative error bound with those algorithms, we configured the relative error bound to obtain a maximum absolute error of 0.
5: the pw_relBoundRatio parameter in Sz was set to 0. 00424. The results are provided in Table  6. It can be observed that all three algorithms respect the maximum absolute error of 0. 5, which corresponds for dataset s1 to a relative error of 0. 00424. On this dataset, Sz provides higher compression ratio and compression speed than the other two algorithms. Bit Grooming is too conservative. It preserves more mantissa bits than strictly necessary to achieve the required precision. This behavior is illustrated in Table  1  with the value of π. In contrast, Digit Rounding adapts the quantization step to each value of the input dataset. Doing so, it can achieve the required precision while preserving less mantissa bits than Bit Grooming does. This results both in a higher compression ratio but also in higher errors than Bit Grooming.
Results obtained for Bit Grooming with nsd = 2 are also provided for completeness. With this parameter, Bit Grooming provides slightly higher compression ratio and compression speed than Digit Rounding does. -For the Sz algorithm, the pw_relBoundRatio parameter was successively set to 4. 24×10 -5 , 4. 24×10 -4 , 4. 24× 10 -3 ; -For the Bit Grooming algorithm, the nsd parameter was successively set to 6, 5, 4, 3, 2, 1; -For the Digit Rounding algorithm, the nsd parameter was successively set to 6, 5, 4, 3, 2, 1. All three algorithms provide similar SNR versus compression ratio results, with a slight advantage for the Bit Grooming algorithm. Figure  6a  compares the compression ratio obtained as a function of parameter nsd, which is the userspecified number of significant digits. Even though nsd is not a parameter of the Sz algorithm, we related the pw_relBoundRatio to the nsd parameters for dataset s1 (i.
e. pw_relBoundRatio = 4. 24 × 10 -nsd ) and plotted the compression ratio obtained with the Sz algorithm on the same figure. It can be seen that, whatever the nsd specified by the user, the compression ratios obtained with Digit Rounding are higher than the compression ratio obtained with the Bit Grooming algorithm. It can also be seen that the compression ratios obtained with the Sz algorithm are even higher. We now focus on the results obtained with dataset s3D. The number of significant digits -nsd parameter -in the Bit Grooming and Digit Rounding algorithms was set to 3. As the maximum absolute value in the s3D dataset is 145, the pw_relBoundRatio parameter in Sz was set to 0. 00345. Results are provided in Table  7. It can be observed that all three algorithms comply with the relative error bound specified.
However, as previously mentioned, the Bit Grooming  algorithm is too conservative. This is why results obtained with nsd = 2 are also provided. On this dataset, Sz provides higher compression ratio than the other two algorithms but lower compression speed than Bit Grooming. At nsd = 3, Digit Rounding provides slightly higher compression ratio than Bit Grooming but with lower compression speed. Figure  5b  compares Sz, Bit Grooming, and Digit Rounding algorithms in terms of SNR versus compression ratio. This figure has been obtained with the following parameters: -For the Sz algorithm, the pw_relBoundRatio parameter was successively set to 3. 45×10 -5 , 3. 45×10 -4 , 3. 45× 10 -3 ; -For the Bit Grooming algorithm, the nsd parameter was successively set to 6, 5, 4, 3, 2, 1; -For the Digit Rounding algorithm, the nsd parameter was successively set to 6, 5, 4, 3, 2, 1.
The Bit Grooming and Digit Rounding algorithms provide similar compression ratios, but even higher compression ratios are obtained with Sz. Figure  6b  compares the compression ratio obtained as a function of the nsd parameter, which is the user-specified number of significant digits. As for dataset s1, we related pw_relBoundRatio to the nsd parameters for dataset s3D (i. e. pw_relBoundRatio = 3. 45 × 10 -nsd ) and plotted the compression ratio obtained with the Sz algorithm on the same figure. Whatever the nsd specified by the user, the compression ratios obtained with the Digit Rounding algorithm are higher than the compression ratio obtained with the Bit Grooming algorithm. The compression ratios obtained with Sz are even higher. Those results show that the Digit Rounding algorithm can be competitive with the Bit Grooming and Sz algorithms in relative error-bounded compression mode.
Application to a CFOSAT dataset Chinese-French Oceanography Satellite (CFOSAT) is a cooperative program between the French and Chinese space agencies (CNES and CNSA respectively). CFOSAT is designed to characterize the ocean surfaces to better model and predict ocean states, and improve knowledge of ocean/atmosphere exchanges. CFOSAT products will help marine and weather forecasting and will also be used to monitor the climate. The CFOSAT satellite will carry two scientific payloads -SCAT, a wind scatterometer; and SWIM, a wave scatterometer -for the joint characterization of ocean surface winds and waves. The SWIM (Surface Wave Investigation and Monitoring) instrument delivered by CNES is dedicated to measuring the directional wave spectrum (density spectrum of wave slopes as a function of direction and wavenumber of the waves).
The CFOSAT L1A product contains calibrated and geocoded waveforms. By the end of the mission in 2023/2024, CFOSAT will have generated about 350 TB of data. Moreover, during routine phase, the users should have access to the data less 3 h after their acquisition. The I/O and compression performance are thus critical. Currently, the baseline for compression of the CFOSAT L1A product involves a clipping method as a data reduction step, with Shuffle preprocessing and Deflate lossless coding with a compression level dfl_lvl of 3. Compression with a clipping method is like compression in an absolute errorbounded mode. It defines the least significant digit (lsd) and "clips" the data to keep only lsd decimal digits. The lsd is defined specifically for each dataset variable. The full list is provided in the Supplement with all the command lines and parameters used for running the compression methods described in this section.
We studied the following compression methods: -CFOSAT clipping followed by Shuffle and Deflate (dflt_lvl = 3): the baseline for the compression of CFOSAT datasets; -CFOSAT clipping followed by Shuffle and Zstandard (zstd_lvl = 2) for higher compression speeds; -Sz followed by Deflate in the absolute error bounded mode; -Decimal Rounding followed by Shuffle and Deflate (dflt_lvl = 1); -Bit Grooming (nsd = 8) followed by Shuffle and Deflate (dflt_lvl = 1); -Digit Rounding (nsd = 8) followed by Shuffle and Deflate (dflt_lvl = 1). We first focused on the ground_range_5 variable of the CFOSAT L1A product. This variable is an array of 18 451 × 3215 values in double precision. The data volume is 452. 58 MB (uncompressed). The CFOSAT clipping method defines an lsd of 3 for this variable. In absolute error-bounded mode, Decimal Rounding is configured to keep the same number of decimal digits as CFOSAT clipping: dsd = 3; Sz is configured with absErrBound = 5 × 10 4.
In relative errorbounded mode, Bit Grooming and Digit Rounding are configured with nsd = 8. The compression results are provided in Table  8. Compared to the CFOSAT baseline compression, Zstandard compression is more than twice faster while offering a similar compression ratio. On this dataset, the use of Sz instead of the CFOSAT Clipping method increases the compression ratio by a factor of 11. Sz prediction step seems to be very efficient on this dataset. Decimal Rounding increases the compression ratio by a factor of 2. 5 "only", but provides the fastest decompression. In the relative error-bounded mode, Digit Rounding provides a higher compression ratio than Bit Grooming but lower compression/decompression speeds. The results for the compression of the full CFOSAT L1A product of 7. 34 GB (uncompressed) are provided in Table  9.
The maximum absolute error and the mean absolute error are not provided because this dataset contains several variables compressed with different parameters. Compared to the CFOSAT baseline compression, Zstandard increases the compression speed by about 40 % while offering a similar compression ratio. It was not possible to apply Sz compression on the full dataset since Sz configuration file has to be modified to adapt the absErrBound to the lsd defined for each dataset variable. The way around this entails processing each variable one after the other. Sz provides a compression ratio almost 3 times higher than the baseline with faster compression and decompression. Decimal Rounding is configured on a per-variable basis to keep the precision required by the scientists on each variable. It increases the compression ratio by a factor of 1.
8 with twice faster compression and decompression compared to the baseline. The compression ratios achieved with Bit Grooming or Digit Rounding in the relative error-bounded mode are lower. This is not the mode targeted for the compression of CFOSAT datasets. The usability of Sz being reduced by the fact that the error bound cannot be easily configured to achieve the precision required variable per variable, our recommendation is to use the Decimal Rounding algorithm. It achieves faster and more effective compression than CFOSAT Clipping method and bounds the absolute errors.
Application to SWOT datasets The Surface Water and Ocean Topography Mission (SWOT) is a partnership between NASA and CNES, and continues the long history of altimetry missions with an innovative instrument known as KaRin, which is a Ka band synthetic aperture radar. The launch is foreseen for 2021. SWOT addresses both oceanographic and hydrological communities, accurately measuring the water level of oceans, rivers, and lakes. SWOT has two processing modes, so two different types of products are generated: high-resolution products dedicated to hydrology, and low-resolution products mostly dedicated to oceanography. The Pixel Cloud product (called  L2_HR_PIXC) contains data from the KaRin instrument's high-resolution (HR) mode. It contains information on the pixels that are detected as being over water.
This product is generated when the HR mask is turned on. The Pixel Cloud product is organized into sub-orbit tiles for each swath and each pass, and this is an intermediate product between the L1 Single Look Complex products and the L2 lake/river ones. The product granularity is a tile 64 km long in the alongtrack direction, and it covers either the left or right swath (∼ 60 km wide). The SWOT mission will generate about 20 PB of data during the mission lifetime. Compression algorithms and performance are thus very critical. The mission center is currently defining files format and structure, and thus in this section we evaluated different compression options. The compression of two different datasets was evaluated: -A simplified simulated SWOT L2_HR_PIXC pixel cloud product of 460 MB (uncompressed); -A realistic and representative SWOT L2 pixel cloud dataset of 199 MB (uncompressed).
The current baseline for the compression of the simplified simulated SWOT L2 pixel cloud product involves Shuffle preprocessing and Deflate lossless coding with a compression level dfl_lvl of 4. However, the compression method for the official SWOT L2 pixel cloud product has not yet been defined. A required precision is defined by the scientists as a number of significant digits (nsd) for each dataset variable. The full list is provided in the Supplement. We studied the following lossless or relative error bounded compression methods: -Shuffle and Deflate (dflt_lvl = 4): the current baseline for the compression of SWOT datasets; -Shuffle and Zstandard (zstd_lvl = 2) lossless alternative; -Sz with Deflate in the relative error bounded mode; -Bit Grooming followed by Shuffle and Deflate (dflt_lvl = 1); -Digit Rounding followed by Shuffle and Deflate (dflt_lvl = 1).
We first focused on the height variable of the SWOT L2_HR_PIXC pixel cloud product. This variable is a list of 1 421 888 values in double precision. The data volume is 10. 85 MB (uncompressed). A precision of 6 significant digits is required for this variable (nsd = 6). Sz is configured in the relative error bounded mode with pw_relBoundRatio = 5 × 10 -6. Bit Grooming and Digit Rounding are configured with nsd = 6. The results are provided in Table  10. Compared to the SWOT baseline compression, Zstandard compression is more than 10 times faster while offering a similar compression ratio. On this dataset, Digit Rounding provides the highest compression ratio with compression/decompression speeds similar to the one obtained with Bit Grooming. The lowest errors are obtained with Bit Grooming but with a compression ratio slightly lower than Digit Rounding.