Identification of peat type and humification by laboratory VNIR/SWIR hyperspectral imaging of peat profiles with focus on fen-bog transition in aapa mires

Hyperspectral imaging (HSI) has high potential for analysing peat cores, but methodologies are deficient. We aimed for robust peat type classification and humification estimation. We also explored other factors affecting peat spectral properties. We used two laboratory setups: VNIR (visible to near-infrared) and SWIR (shortwave infrared) for high resolution imaging of intact peat profiles with fen-bog transitions. Peat types were classified with support vector machines, indices were developed for von Post estimation, and K-means clustering was used to analyse stratigraphic patterns in peat quality. With separate experiments, we studied spectral effects of drying and oxidation. Despite major effects, oxidation and water content did not impede robust HSI classification. The accuracy between Carex peat and Sphagnum peat in validation was 80% with VNIR and 81% with SWIR data. The spectral humification indices had accuracies of 82% with VNIR and 56%. Stratigraphic HSI patterns revealed that 36% of peat layer shifts were inclined by over 20 degrees. Spectral indices were used to extrapolate visualisations of element concentrations. HSI provided reliable information of basic peat quality and was useful in visual mapping, that can guide sampling for other analyses. HSI can manage large amounts of samples to widen the scope of detailed analysis beyond single profiles and it has wide potential in peat research beyond the exploratory scope of this paper. We were able to confirm the capacity of HSI to reveal shifts of peat quality, connected to ecosystem-scale change.


Introduction
Hyperspectral imaging (HSI) allows the measurement of diffuse reflectance spectra in fine spatial resolution and has high potential in analysis of soil profiles. So far, HSI has rarely been used in analyses of peat profiles (Voigt et al. 2017), but it has been applied to mineral soil (Hobley et al. 2018;Sorenson et al. 2020) and rock core analyses (Krupnik and Khan 2019). Traditionally, the examination of peat profiles is based on subjective visual inspection of plant material (peat type) and the degree of humification, which requires considerable expertise and experience (von Post 1922). More detailed research on peat composition requires time-consuming and labour-intensive analysis, such as microscopy, chemical, and gravimetric analyses to achieve fine sequence stratigraphy. While both expert visual inspection and many stratigraphic methods are well defined and reliable, HSI has certain obvious benefits, as it can be applied to a large sample size with extremely fine spatial resolution, and it is non-destructive.
In soil core applications, HSI been used for estimation of organic carbon and nitrogen concentrations (Hobley et al. 2018;Sorenson et al. 2020) and for mineralogical classification (Krupnik and Khan 2019;Stenberg et al. 2010). Generally, the mid-wave infrared (MWIR, 2500 nm -5500 nm) region provides better accuracies in quantification and classification studies than shorter wavelengths in soil studies, since absorbance peaks are broad and superimposed in the visible to near infrared (VNIR, 400 nm -1000 nm) and short wave infrared (SWIR, 1000 nm -2500 nm) regions (Bellon-Maurel and McBratney 2011). The overlapping spectral signatures make connecting the absorbance peaks to individual substances difficult. Yet, the MWIR has limited applicability in field conditions due to the high absorbance of water (Bellon-Maurel and McBratney 2011). Compared to mineralogical studies, the classification of peat composition is complicated by the diversity of the organic material and the potentially overlapping effects of oxidation state, water content, and the degree of humification. However, there are major benefits for peat profile analysis, such as the ability to process a large number of samples in a small amount of time to make high resolution maps of peat layers (Voigt et al. 2017). Even very high spatial samplings of peat cores (<5 mm) assume that the changes in core stratigraphy are horizontal, but all stratified soil samples can have complicated three dimensional structures that are effectively revealed by HSI (Hobley et al. 2018;Steffens and Buddenbaum 2013;Voigt et al. 2017). Therefore, HSI could be used in determining the sampling resolution, and locations for other analysis of peat cores could be guided by imaging, as changes in peat composition can vary from finely detailed structural features to large uniform areas.
Chemical compounds (pigments, humic substances etc.) and structural features control the spectral properties of peat. Pigments dominate absorbance in the visible region (400-700 nm) and before decomposition plant material has high reflection in the near infrared region (700-1000 nm) (Jacquemoud and Baret 1990;Jacquemoud et al. 2009). Spectra in the shortwave infrared (SWIR, 1000-2500 nm) region are more heavily influenced by water and chemical compounds, such as cellulose and humic acids (Stenberg et al. 2010). These effects might mask changes in peat forming plant material. Many compounds and cell structures in organic matter break down during decomposition process and humic acids are formed (Klavins et al. 2008;Maurer et al. 2010) and the texture of the sample surface is altered (Silamikele et al. 2010), changing its light scattering properties. All of these signals can be affected by broad absorption peaks of water (970 nm, 1200 nm, 1470 nm, 1940 nm, and 2900 nm) (Gerber et al. 2011;Stenberg et al. 2010). Therefore, high water content of samples can mask the reflectance of other compounds. Furthermore, peat beneath the water table level is in anoxic conditions and oxidation of humic substances can alter their spectra after sampling (Maurer et al. 2010). Indeed, "browning" of peat samples is a generally well-known phenomenon, but the importance of oxidation to spectral properties has not been studied in detail.
As fresh plant matter and litter are sequentially buried deeper to form peat, the material undergoes different phases of decomposition and physico-chemical alteration, and becomes more humified. Changing conditions of water-table level, hydrochemistry, nutrient availability, climate, vegetation and many other factors affect this transformation and can cause fluctuations of the degree of humification in peat stratigraphy. Importantly, humification is merely a conventional name for a complex of phenomena that can hardly be quantified with single instrumental measurements or concentrations. Hence, for a hundred years, the subjective von Post classification method (von Post 1922) has been in use as a robust, fast and cheap way to classify peat humification, and it will likely remain in wide use. The method is based on combination of visible characters and a test of squeezing peat samples with bare hand, and classifying them on a ten tier ordinal scale. One obvious fault of the method is its limitation to the coarse scale of resolution. More detailed and objective proxies for humification include absorption and fluorescence measures of peat extracts (Biester et al. 2014;Bu et al. 2019). Both the subjective visible characters and common use of spectrocsopy of peat extracts indicate that HSI has potential for detecting the degree of humification of peat. The capacity of HSI for detailed mapping is a further advantage, as stratigraphic patterns of humification can have fine grain changes, reflecting environmental fluctuations and ecosystem state.
Peatlands are unique ecosystems, as they archive sedentary, chronological information of their history in their peat strata. The remains of dominant plants comprise the main component of peat. With a remarkable consistency, mire succession follows the sequence from rich to poor fen and, in a climax successional phase, bog vegetation (Rydin and Jeglum 2013). Dominance of peat mosses (Sphagnum), dwarf shrubs, and tussock grass (Eriophorum vaginatum) characterize bogs and poor fens, while rich fens are characterized by 'brown mosses' (e.g. Amblystegiaceae, Mniaceae), herbaceous plants, and sedges. Along with plant remains, mineralogy of peat reflects its origin, while being complicated by ongoing slow decay and changing redox-conditions. Aapa mires are patterned fens of the north-boreal zone that provide an interesting test case for peat HSI profiling, since they are potentially subject to ongoing and future ecosystem transitions due to changes of climate and hydrology (Tahvanainen 2011;Väliranta et al. 2017). Hydrological disturbances can be caused by drainage, and it has been estimated that more than half of the Finnish peatland area has been drained (Sallinen et al. 2019). Fen-bog transition, and in particular, the increased growth of Sphagnum mosses can greatly alter ecosystem structures by launching the development of new bogs over aapa mires (Tahvanainen 2011). Such changes can pose a threat to biodiversity, characteristic communities, and endangered species, while carbon accumulation could increase substantially. Specialized high precision sampling methods have been developed to detect recent rapid sub-decadal changes (Amesbury et al. 2011;Vorren et al. 2007), and we expect HSI to provide yet more fine-detailed information of peat stratigraphy applicable for large sample sets.
We collected peat cores from sites with evidence of recent transitions from fen to bog vegetation and tested the performance of HSI in detecting respective changes of peat quality. We first explored the effects of oxidation and water on the spectrum of peat in the VNIR and SWIR regions, in order to take these factors into account in sampling and interpretation, with small separate experiments. Second, according to the established protocol we tested the ability of HSI to classify Sphagnum and Carex peat and their mixtures of varying degree of humification using samples from an independent mire as a test set. We further explored for HSI methods to reveal patterns of peat humification. We used the von Post scale, determined by experienced peat researcher, to guide the search for HSIbased normalized difference index of humification.

Field sampling
The 16 peat core samples were collected from seven separate aapa mires, all located in the middle-boreal zone in Finland, representing southern part of the main climatic distribution range of aapa mires (Table 1). These mires typically occur in mixed systems with patterned aapa mire parts and eccentric bog parts, both contributing significant portions of total mire area (Tolonen 1967). The bog parts are ombrotrophic (i.e. rain nourished), while minerogenic hydrological input from the catchment spreads in central fen parts. In bog areas, peat surface is raised relative to the fen areas due to accumulation of peat composed of Sphagnum mosses (Sphagnum balticum, S. majus and S. papillosum), while aapa mire areas have shallower peat layers predominantly formed by remains of sedges (Carex limosa, C. rostrata) (Laitinen et al. 2007). Our sampling locations were focused on recently transformed areas in aapa mires, selected by comparison of aerial images from 2010s with old areal images from 1940s to 1960s (Fig. 1). In many cases, bog zones had expanded over aapa mire zones, while at some sites more uniform change was observed over the aapa mires (e.g. Valkeasuo mire studied by Tahvanainen 2011). In all cases, we sampled surfaces with full cover of Sphagnum mosses and presumable change to this state from previous fen vegetation. All sites are also studied in more detail for their vegetation patterns and changes in connected studies.
After transport, the collected samples were kept in +4°C for at least 24 h before imaging to avoid transient effects of immediate oxidation of the peat surface before the imaging. The surface of the core was cleaned and carefully scraped to ensure a uniform surface layer with minimal sampling induced contaminations from other layers.

Analysis of peat properties
The plant material composition and humification degree (von Post) of peat profiles was analysed with a visual inspection by one of the authors (T. Tahvanainen). In all cases of plant material identification, selected samples (n = 5-20 per core) were inspected under a light microscope to aid decision between main peat types, while no quantitative microscopy of plant macrofossiles was performed. In all cases, live vegetation and weakly humified peat plant material were identified to species level. In most cases, recent surface peat layers were fairly homogenous and dominated by single Sphagnum moss species. The ground thruthing for spectral image classifications was thus based on expert judgement to the level of most commonly used peat types and humification degree scale. In a subsequent study, we will proceed to spectral analyses of dated peat cores with quantitatively identified plant macrofossiles.
For analyses of peat bulk density (g cm −3 dry weight) and mineral ash content (% of dry weight), the peat cores were frozen overnight and marked with needles in 5 cm intervals to facilitate the samping. The frozen cores were cut with a fine-tooth saw into 1 cm thick slices of known volume and weighed after drying at 50°C for 72 h. For the ash content analysis, 500.0 mg of the dried peat was heated in furnace for minimum of 3 h (510°C), checked for complete burning of organic material, and weighted to obtain mineral ash weight. In a few cores, some of the samples were pooled to 2 cm resolution, when there was not enough material for the ash analysis.
For the Ilajansuo core used in the oxidation experiment, elemental compositions were determined by inductively coupled plasma-mass spectrometry (ICP-MS). The ash samples were dissolved in Aqua regia (conc. HCl + conc. HNO 3 ) and analyzed with ICP-mass spectroscopy for concentrations (mg g-1 dry weight) of Al, As, Ba, Ca, Cd, Co, Cr, Cu, Fe, Ga, K, Li, Mg, Mn, Na, Ni, P, Pb, Rb, Sr, V, and Zn. While it is not conceivable that individual trace elements would actually affect peat spectra, we expect many element concentration profiles to indirectly reflect variation of peat quality, hydrological-ecological conditions during peat formation, and prevailing redox state. Thus, any connection between spectral features and element concentrations may indicate potential for further hypotheses and development of spectral methodology.
Metal concentrations were determined using solution-based inductively coupled plasma mass-spectrometry (ICP-MS) following pressurised acid digestion. The digestion process was carried out in 55 ml, closed, TMF vessels. To precisely weighed ash samples (5.5-87.4 mg) 2.0 ml of concentrated (65-68% w/w) nitric acid (TraceMetal™ grade, Fisher Chemical) and 6.0 ml of concentrated (36% w/w) hydrochloric acid (Suprapur® grade, Sigma-Aldrich) were added. Samples were then heated to 200°C for 15 min in a MARS6 microwave oven (CEM Corporation, USA). Digestion vessels were cooled to room temperature and digested samples were transferred quantitatively to 50 ml, certified metal-free centrifuge tubes (VWR, Germany) and diluted up to 20 ml using de-ionized water (resistivity of 18.2 MΩ·cm, USF Elga Purelab Ultra). Two levels of sample dilution were needed to measure both main and trace elements accurately. Commercial certified standard reference material (NIST SRM 1573a Tomato Leaves, Sigma-Aldrich) was used to confirm the validity of methods.
Metal concentrations were analysed by inductively coupled plasma mass-spectrometry (ICP-MS) using a NeXION 350D ICP-MS instrument (PerkinElmer Inc., Waltham, MA, USA) and ESI PrepFAST autosampler (Elemental Scientific, Omaha, NE, USA). Element isotopes without known spectral interferences were preferentially selected for analysis and a triple-quadrupole reaction system was used to remove polyatomic interferences. The reaction system was operated in collision mode with kinetic energy discrimination (KED), using helium as the cell gas (3.7 ml min −1 ). Two internal standards, scandium-45 and lutetium-175, were mixed online with the samples to compensate for matrix effects and instrument drift. Scandium-45 was used to correct measurements of analytes which have an atomic weight below 120 amu and lutetium-175 for those over Table 1 The samples used for the classification (area of classes = cm 2 ) and the locations of the sampled mires

Mire
Cores SH L (cm 2 ) SH M (cm 2 ) SC (cm 2 ) CS (cm 2 ) C M (cm 2 ) CH H (cm 2 ) Location Härkösuo 1 2 0 a m u . M u l t i e l e m e n t s t a n d a r d s o l u t i o n (TraceCERT® Periodic table mix 1 for ICP, Sigma-Aldrich) was used for the calibration of ICP-MS. Separate calibration ranges were used for different analytes: 4-400 ppb was used for Al, Ca, Fe, K, Mg and Na and 1-100 ppb for other elements. The sample uptake rate was 3.5 ml min −1 and dwell times were set 100 ms per amu. Three replicates were obtained for each sample.
The data was processed using PerkinElmer Syngistix Data Analysis Software™.

Hyperspectral imaging with the VNIR and SWIR cameras
The peat cores were placed on an imaging table, where the image acquisition took 20-30 s. The images were  Fig. 1). The VNIR (visible to near infrared) camera, (Zyla 5.5 sCMOS; Andor Technology, Belfast, UK) combined with an imaging spectrograph (ImSpector V10E; Specim) with a camera lens (V18.5f /2.4) covers the spectral range of 400-1000 nm. This camera has a spatial resolution of 1024 pixels and 240 spectral channels (FWHM = 3.5 nm). The SWIR (short-wave infrared) camera (ImSpector N25E; Specim) with a camera lens (OLES15f/2.0) covers the spectral range of 1000-2500 nm. The camera has a spatial resolution of 320 pixels and 256 spectral channels (FWHM = 12 nm). The samples were illuminated with ten 35 W tungsten halogen lamps, in a 45°/0°geometry, moving with the cameras. The exposure time was 8.1 ms for VNIR and 2.8 ms for SWIR. A white spectralon plate was included in each image and it was used for the white reference in the image standardization. A minimum of 100 dark current images was acquired before every image, and the average of these was subtracted from the sample and white reference images. After this, final reflectance was calculated by dividing the raw sample images with the white reference.

Separate experiments on effects of water and oxidation of peat samples
The effects of water content, were examined in a small separate experiment. Eight model samples of pure Sphagnum and Carex peat with different humification levels and one mixed sample, were collected from the Viitasuo mire. The Sphagnum samples were between H 1-4 in the von Post classification and the Carex samples were between H 4-7. Samples were cut into two parts (ca. 1 cm in thickness), one of which was dried at 50°C for 72 h, and the other kept in a closed plastic container at 4°C. The moist and dry peat surfaces were imaged side by side and the median spectra were calculated for both surfaces.
One of the most obvious potential problems with spectral imaging of peat concerns the unknown effects of oxidation after sampling. Anaerobic conditions prevail in saturated peat under the water-table level, and sudden exposure to oxygen changes redox conditions, potentially affecting many spectral features. To assess the effects of oxidation, one peat core with a clear shift from Carex to Sphagnum peat was collected from the Ilajansuo study site, and transported intact inside the corer and held overnight at +4°C. The core was cut longitudinally into halves with a sharp knife and the unoxidized surface of the core was imaged immediately after the cutting. The imaging was then repeated several times resulting in a timeseries of spectra at 0, 5, 10, 20, 35, 75, 300 and 1440 min after exposure to air. During the intervals between the imaging time points, the core was kept under a plastic cover (but not wrapped) and the cover was sprayed with deionized water to prevent drying.

Data analysis
All of the peat cores were collected from recent fen to bog transition zones. In order to create a robust model for separating Sphagnum and Carex with spectral data. These peat cores were divided into eight classes of composition and von Post degree. The composition classes were Sphagnum (S), Carex (C) and mixtures of Sphagnum and Carex (CS for Sphagnum dominated mixture and SC for Carex dominated mixture). In addition, the Sphagnum samples were divided into low humification (H L, H1-2 in the von Post Scale) and medium humification (H M, H3-5 in the von Post scale) classes. The Carex peat samples were divided into medium humification (H M, H3-5 in the von Post scale) and high humification (H H , H6-9 in the von Post scale) classes. These classes were created to reveal if the classification method would have difficulties in separating Sphagnum and Carex peat with a similar humification degree. Following expert inspection, an image mask with these classes was created with image processing software Fiji (Schindelin et al. 2012). The photosynthetically active layer, defined by the presence chlorophyll absorption at 680 nm and the red edge at 700 nm, was excluded from the data. For testing the classification performance, three peat cores from a separate mire site (Ilajansuo) were used as an independent test set (Matlab 2019b). For the VNIR training set, 1000 randomly selected spectra from each class and from each image were used for training the quadratic SVM model (support vector machine). For SWIR only 300 spectra per class from each image were used. These spectra were normalized with standard normal variate (SNV) before analysis (Barnes et al. 1989). Theoretically, data from both cameras could have been combined (as in Rogass et al. 2017), since the spectral data is continuous in nature. However, combining the data would require specialised corrections for resolution, lens distortions, pixel shapes etc. In addition, the cameras had separate illuminations and this would have made pixel-wise classification unreliable.
Most of the spectral data is redundant since all wavelengths are not significant in every study and nearby spectral wavelengths tend to autocorrelate with each other. Detecting the most important wavelengths can be used in speeding up the data processing and deciding between spectral cameras. To find the most important wavelengths for separating the selected classes, a knearest neighbour predictor weight analysis (Robnik-Sikonja and Kononenko 2003) was applied on each wavelength with 20 predictor variables.
For the oxidation experiment, a principal component analysis (PCA) analysis was used after binning the data spatially in 5 × 5 pixel bins for VNIR and in 2 × 2 pixel bins for the SWIR data. The data was binned to reduce the analysis size, since all of the spectral images (eight timepoints) were included into the same analysis. The kmeans clustering analysis with 12 classes (for each time point separately) was used to identify how much would the oxidation impede the ability of spectral data to separate classes. Thus the purpose of the PCA analysis is to evaluate the effect of oxidation on peat cores and the purpose of the k-means clustering analysis is to find out whether the fully oxidised samples can be used for classification.
In order to explore the potential for inferring degree of humification from spectral data, we calculated all possible NDI indices (by testing every possible wavelength combination) and correlated them with the von Post class using the training set, and best correlation was selected. The final coefficient of determination (R 2 ) and normalised root mean squared error (nRMSE %) was calculated against the separate test set. The same method was applied to select the best possible NDIs for applications in the individual elements' mapping (Supplementary Table 1). Since only one core was analysed for the element concentrations the results were not tested against a separate test set.
where R is the reflectance at wavelength λ.

Results
Main features affecting peat spectra All peat cores, except the samples from Mahlaneva, had a transition from Sphagnum to Carex peat. The samples from Mahlaneva did not contain layers of pure Carex peat. In the entire dataset, Sphagnum peat was less humidified (average von Post scale 2.7, min 1, max 6) than Carex peat (average von Post scale 6.0, min 4, max 9). Sharp peaks of ash content located at, or adjacent to the transitional zones were found in the following samples: Valkeasuo 1, Valkeasuo 2, Valkeasuo 3, Sumukka 1, Lahna 1 Mahlaneva 2, and Ilajansuo 3. On average, Sphagnum peat had higher reflectance between 450 nm and 1100 nm than Carex peat (Fig. 2). Conversely, the reflectance of Carex peat was higher beyond 1100 nm, in the SWIR region. In Sphagnum peat, clear absorption features were found at 680, 803, 850, 966, 1181, 1446, and 1925 nm, and nearly all of these features were absent from Carex peat. The mineral soil containing layers, differed greatly from organic peat at longer wavelengths than 1100 nm.
Higher humification in the von Post scale reduced the reflection of Sphagnum peat between 450 and 1200 nm, but beyond 1200 nm these effects were minor and nonlinear (Fig. 2). In Carex peat, the most humidified samples (H8-9) had the lowest reflectance between 450 and 1200 nm, while reflectance increased between 1300 nm and 2500 nm in high humification.

Experiments on effect of oxidation and water
In the oxidation experiment, the freshly exposed surface of a peat core showed prominent changes in the region that was located under the water-table level. This region was under anoxic conditions before the experiment (ca. below 12 cm). Exposure to air reduced spectral reflectance in Sphagnum peat between 450 nm and 820 nm in the anoxic regions (Fig. 3). The reflectance in Sphagnum peat decreased also between 820 nm and 1000 nm after 20 min until 300 min but started to decrease at the last timepoint. During the 24 h, the changes were more prominent in Sphagnum peat (maximal change 40% at 650 nm) than in Carex peat (maximal change less than 15% at 700 nm). In Carex peat, the reflectance decreased uniformly between 450 and 1000 nm, with only the last timepoint starting to increase reflectance between 820 and 1000 nm. Oxidation also increased the reflectance of Carex peat in the SWIR region (1050-1350 nm and 1450-1800 nm).
The PCA analysis (Fig. 4, supplementary Fig. 19) of the VNIR region spectral data indicated that the first component was dominated by oxidation-susceptible variation (the first PC explained 52% of the variance), and the second axis was dominated by vertical changes in peat composition (the second PC explained 28% of the variance). The PCA analysis of the SWIR region was not time dependent (the first and second PCs explained 93% and 5% of the variance, respectively). According to K-means clustering, Sphagnum and Carex peat were separated similarly before and after oxidation. In the VNIR region, Sphagnum peat (20-40 cm) was classified differently between the oxidation endpoints. In the SWIR-region, the larger changes in clustering were found only in the Carex peat (70-80 cm).
In the separate drying experiment, peat reflectance increased remarkably above 1200 nm (SWIR) after drying, but the changes were less prominent in the VNIR region and below 1200 nm in the SWIR region. After drying certain results in the raw spectra were reversed, so that reflectance between 1200 nm -2500 nm increased more with the lowest humification degree (supplementary Fig. 2). New absorption peaks also appeared in the dry samples and the location of many absorption peaks found in the wet samples shifted. Generally, drying also increased the spectral differences of the different peat types.
Classification of peat type and estimating humification The k-nearest neighbour analysis of the training data set (Table 1), revealed that in the VNIR region the wavelengths with the best ability to separate the eight classes in the visible region were located at 465 nm, 532 nm, and 593 nm, 769 nm, 816 nm, 845 nm, 924 nm, and 972 nm (Fig. 5). The predictor weights were higher in the NIR region than in the visible region. In the SWIR region, the prediction weight peaks were located at 1079 nm, 1162 nm, 1364 nm, 1446 nm, 1624 nm, 1881 nm, 2069 nm, and 2345 nm. These sets of eight peak wavelengths (from both VNIR and SWIR spectra) were selected for the subsequent classification analysis explained below.
The classification analysis with the entire VNIRregion achieved an overall accuracy of 50% for all eight peat classes but was able to distinguish between is expressed as minutes after exposure to the air. R = average reflectance spectra during oxidation, R 0 = average reflectance spectra before oxidation simplified classes without the humification degree (Sphagnum, transition, and Carex peat) with 80% accuracy (Table 2). When using only the eight channels selected from the k-nearest neighbour analysis, the overall VNIR accuracies fell slightly to 43% and 76% for all classes and the simplified classes, respectively. For the entire SWIR region, the overall accuracy was 50% for all eight peat classes and 81% accuracy for the simplified classes (Table 3). When only the selected eight channels were used, the overall accuracies were 47% and 82% for all peat classes and the simplified classes, respectively. Most of the misclassified samples were either the mixtures of Sphagnum and Carex peat, or misclassified humification levels, while pure Sphagnum peat and pure Carex peat were rarely misidentified. In addition, the pixel-wise classifications show (Fig. 6) that despite classification errors, the stratigraphic sequence of the classifications were logically ordered. Based on the training set, a new spectral reflectance index was developed for estimation of peat humification adjusted to the von Post scale (NDVPI, normalized difference von Post index). With the VNIR set up, wavelengths 463 nm and 725 nm were selected for the index. From SWIR data, wavelengths 1573 nm and 1724 nm gave the best fitting index (Fig. 7). The measured von Post degree of humification explained 82% of variation in NDVPI VNIR and 59% of NDVPI SWIR . The error estimates of the indexes (nRMSE) were 8.7% and 13.2% for VNIR and SWIR, respectively.
Image based analysis of peat stratigraphic patterns All 16 peat cores were also analysed together in one analysis with K-means clustering in order to detect peat layering and to compare samples from separate mires (Fig. 8, Supplementary Figs. 2-17). From the detected layers, 51% were at a low angle (below 9 degrees) and 36% above 20 degrees (Fig. 9). Peat layer angle was not related to depth (R 2 < 0.001).
One of the peat cores (Ilajansuo 3) was analysed with ICP-MS for elemental concentrations. These results were then correlated with spectral indices Fig. 4 Imaging of PCA and K-means clustering analyses of the oxidation experiment. The PCA score images (PC1 = first component, PC2 = second component) represent the start and endpoints of the oxidation experiment (the original analysis contained all of the timepoints 0, 5, 10, 20, 35, 75, 300, and 1440 min). The Kmeans clustering with 12 classes was performed independently for the timepoints, in order to determine whether the oxidised "darker" samples would separate similar regions. Therefore, the timepoints were analysed separately, however, the randomly assigned classes were assigned similar but arbitrary colours to facilitate comparison between timepoints in the VNIR and SWIR regions (Fig. 10). The selected wavelengths are indicated in the supplementary Table 1. Elements such as K, Na and Mg had high correlations in both spectral regions (R 2 > 0.79). The analysis was also designed to explain high peaks of ash content in some of the samples, often close to peat type transition from Carex to Sphagnum peat, but no spectral features emerged to correlate with these peaks. The only elements following the ash content peak were barium and gallium.

Discussion
Comparison of historical and present-day aerial images of aapa mires can reveal a reduction of areas dominated by fen vegetation and an increase of peat mosses. We used these images to select sample locations, from where HSI analysis of peat cores could be used to detect these resent changes in peat forming vegetation. Based on these samples we wanted test what would be the main factors affecting peat spectra and to create a robust model for separating Sphagnum and Carex peat.  Accuracies for combined classes of Sphagnum, transition, and Carex peat are highlighted. The data is converted to cm 2 from the pixelwise classification Do effects of water content and oxidation impair interpretation of peat hyperspectral images?
The average Sphagnum peat reflectance greatly differed from Carex peat between 400 and 1200 nm, and in general, Carex peat is considerably less reflective with no distinct spectral features. However, highly humidified Sphagnum peat begins to resemble Carex peat spectrally. This is not surprising, since humification of organic matter in general reduces reflectance (Ben-Dor et al. 1997). Changes of the original compounds into humic substances, that contain complex aromatic hydrocarbon structures, increase light absorption in this wavelength region (Del Vecchio and Blough 2004). At the same time, the decomposition processes alter the surface structure of peat, and the breakdown of intact cells reduces reflectance caused by light scattering from cell walls between 700 and 1000 nm (Jacquemoud et al. 1996). Despite the large differences in spectral reflectance, the raw spectra are unreliable in any classification analysis, since they are affected largely by the surface structure, particle size effects, and other artefacts (Vidal and Amigo 2012). These effects can be reduced by normalisation techniques such as standard normal variate (SNV) pre-processing (Barnes et al. 1989), that was used in this study. Another factor that can reduce the accuracy of classification is water, since water dominates large portions of peat spectrum beyond the visible region. After drying new absorbance peaks masked by water emerged at 2088 nm, 2301 nm, and 2338 nm. These peaks have previously been attributed to cellulose, humic acid, and pectin, respectively (Ben-Dor et al. 1997), although they might be influenced by other overlapping constituents. Drying of peat samples could improve laboratory-based measurements, since water dominates a large part of the spectra, and since water tends to have nonlinear effects on reflectance, indeed, small amounts of water may cause large differences in spectra (Mcmorrow et al. 2003). Quantitative analysis of soil organic carbon improves with drying of samples in the VNIR and SWIR regions, and drying is almost compulsory in the MWIR region (Nayak et al. 2019;Stenberg et al. 2010). Variation of moisture content also inevitably influences some of our results since water retention capacity can differ considerably between the different peat types. Yet, imaging samples wet increases the speed of analysis and greatly facilitates further sampling.
Oxidation of peat samples lowered the reflectance, especially in the VNIR region between 450 and 820 nm. In Sphagnum peat, we also found lowering of reflectance between 820 nm and 1000 nm, but it took longer time to appear and dissipated after 24 h. The general decrease of reflectance could be attributed to the oxidaton of humic substances, since chemically reducing humic acid decreases its absorbance between 400 and 700 nm, and this effect can be reversed by reoxidation (Maurer et al. 2010). Humic substances are a chemically complex and heterogenous group, with very broad featureless absorption beginning in the UV-range and gradually decreasing until the end of the visible spectrum (Del Vecchio and Blough 2004). This featureless and wide absorption is caused by complex chargetransfer bands between molecules (Del Vecchio and Blough 2004). Oxygen may change these chargetransfer contacts and cause reduced albedo (Maurer et al. 2010). Since these changes make samples darker, they will also most likely make the classification more difficult in fully oxidized samples. Lowered reflectance reduces the measured signal and lowers the signal to noise ratio. The PCA analysis of cores undergoing oxidation revealed that in the VNIR region oxidation caused major changes (PC1 52%), but in the SWIR region these changes were much less prominent. This means that for the VNIR region, the timing of imaging after exposing samples to oxidative conditions should be standardized. In the laboratory, large enough peat Fig. 9 Angle orientations of the k-means cluster borders in the entire dataset (a) and relationship of angle with depth (b) Fig. 10 Elemental analysis of the Ilajansuo 3 core. The NDI indices with the highest correlation (R 2 ) were calculated separately for the VNIR and SWIR regions. The spectral data cannot detect the elements directly and the NDIs have no predictive value for unknown samples. Therefore, the calculated images can only be used as spectral correlation-guided spatial extrapolations of elemental concentration cores can be cut half to expose best preserved core part of samples right before imaging. Oxidative changes will start immediately, however, and in practise allowing the imaged surface to oxidize completely is the easiest way to standardize the changes.
Despite the practicality, allowing oxidization of the imaged surfaces might hamper the classification. We used K-means clustering to test whether oxidation affects the ability of HSI to detect spatial layers within peat cores. As an unsupervised method, K-means clustering gives a class for each pixel revealing areas of similarity that can be separated by HSI. According to our results, oxidation caused some changes in the classification of Sphagnum between 20 and 40 cm in the VNIR images. This depth corresponds to the zone of varying oxidation in the field; i.e. the zone of water table fluctuations and abundance of roots of vascular plants.
In the SWIR region, the changes were smaller and in the Carex peat, near the end of the core (70-78 cm). Both changes did not seem to affect the ability to separate Sphagnum and Carex peat. These differences could be due to lower albedo of the oxidized samples that reduces differences between the peat types. Using unoxidized samples might thus be useful, but since there are large differences in the spectra within minutes of exposure to the air, the standardization of imaging is difficult for unoxidized samples. Yet, HSI in the field conditions would require standardization of time after sampling.

Identification of main peat types from cores by hyperspectral imaging
In the pixel-wise SVM classification, we tried to separate pure Sphagnum peat with low and medium humification, mixtures of Sphagnum and Carex peat, and pure Carex peat with medium and high humification. For the entire data set, the overall accuracies were ca. 50% for both the VNIR and SWIR regions. However, most misclassifications only concerned the humification levels. The accuracies were considerably higher for simplified classes (Sphagnum, Carex, and transition), and misclassifications were mainly limited to identification of the transition class (a mixture of Sphagnum and Carex peat). Misclassifying the humification level has little significance, since the classification was designed only to distinguish basic peat types and we created a separate model for von Post estimation. However, the results reveal that, regardless of the humification level, pure Sphagnum and pure Carex were rarely misclassified as each other. This was especially notable in the SWIR region. Despite the similar overall accuracies, the SWIR region performed better in distinguishing Sphagnum and Carex peat even for the more humidified samples. Both spectral regions had more difficulties in classifying the transition zones, yet these are the most difficult samples to separate, since the transitions zones contain heterogenous mixtures of Sphagnum and Carex peat. The classification image indicates that despite the poor classification result for the humification classes, the results are still logically ordered and only partly offset from the ground truth achieved by expert inspection. Part of the mismatch could be due to misaligning the ground truth from the measurements.
Our results are partly explained by the tendency of spectral measurements of soil samples to lose applicability between locations, due to high heterogeneity of samples (Stenberg et al. 2010). Using internal cross-validation always gives the best results, but this can overestimate the applicability of the model (Bellon-Maurel and McBratney 2011;Brown et al. 2005Brown et al. , 2006. We used cores collected from a separate mire as test set, and it must be noted that our dataset was small considering model validation. Brown et al. (2006) estimated that a global soil characterization with VNIR reflectance spectra would require 5.6 × 10 9 independent samples for calibration, due to the heterogeneity of the samples.
The K-nearest neighbour analysis revealed that the most important wavelengths to reveal peat layers were beyond the visible range. It also revealed that the changes in spectra between our classes were similar to those caused by degree of humification. This can be caused by the skewness of our data set, as the Carex samples were generally more humidified than the Sphagnum samples. This is partly inevitable since Carex peat is formed differently to Sphagnum peat. While Sphagnum peat is formed chiefly by addition of fresh moss on top of older strata in chronological order, Carex peat is mainly comprised of mix of root material and more humified material formed from surficial accumulated litter that readily undergoes decomposition and humification. In effect, Carex peat generally tends to be more humified, especially when lying under younger Sphagnum peat, and any assessment between Carex and Sphagnum peat cannot be fully independent from degree of humification. Using only these wavelengths selected by the Knearest neighbour analysis substantially reduced the overall accuracy of SVM classification in the VNIR region but had less effects in the SWIR region. This implies that the pixel-wise classification of peat type in the SWIR region is more robust and can be achieved with a smaller dataset.
Despite the many potential error sources, our results showed a clear correlation between the von Post degree and the developed spectral humification indices in the VNIR and SWIR regions. In the VNIR region NDVPI VNIR predicted the von Post humification degree in the separate test set with accuracy of 82%. Furthermore, in all individual cores, the NDI profiles had at least a gross scale fit with the main pattern of von Post humification, and in many cores the profiles were very closely matched. Indeed, many fine-scale patterns of varying humification, as indicated by spectral NDIs, are obviously beyond resolution the von Post method and the ability to make spatial maps from these indices indicates finer detail in variation of peat humification. The common peat type classification and von Post humification index give only coarse classes and are always biased to some extent by subjective expert judgement. Even if performed perfectly the criteria of the different humification classes are ambiguous in certain aspects. For example, how peat material behaves in the von Post "squeezing" is definitely affected by many properties like water content, bulk density and how "fibrous" the plant material is. In addition, the degree of humification itself can hardly be exactly quantified, since in a mixed peat matrix, different materials undergo decomposition in different pace, and as fresh root material may be variably added in otherwise humified peat.
The wavelengths selected for the NDVPI VNIR in the VNIR region are associated with the blue region (463 nm) and NIR plateau (725 nm) of plant cell wall structures. Decomposition clearly lowered the reflectance in the NIR region, most likely due to the breaking down of intact cells and the increase of humic substances with absorbance at longer wavelengths. In the SWIR region, the selected wavelengths were 1724 nm and 1573 nm. The 1730 nm absorbance feature is prominent in dry plant matter and usually attributed to C-H bonds or to unspecific "plant dry matter" (Kokaly et al. 2009). The feature is however nearly non-existent in wet material. 1573 nm is located in a region with no characteristic absorption bands of generally diagnostic significance. Both ratios worked better in moderately humidified samples but had difficulties in distinguishing highly humidified samples. This makes sense since the spectral changes between the most humidified samples are very low. The poor performance of the NDVPI SWIR index could be due to the effect of varying water content. The NDVPI VNIR was more accurate in von Post class prediction and the selected wavelengths seemed to be less specific. However, the final robustness of the selected index should be tested against a more variable dataset.
Spatial detail obtained with hyperspectral imaging aids peat sampling One potential benefit of HSI is the ability to make finely detailed maps of peat stratigraphy that could enable more accurate recognition of peat strata, aid their interpretation, and direct other sampling methods. Continuous sampling of peat cores with high resolution allows the detection of sub-decadal changes caused by recent events and climate change (Amesbury et al. 2011;Hendon and Charman 2004). This will however quickly result in very large sample sets and requires specialized sampling equipment. HSI could be used to guide sampling for other methods that could benefit from resource allocation. The significance of the added level of detail was exemplified, as HSI analyses revealed peat layers that were not horizontally aligned. Over 25% of the detected layers were clearly inclined (in angles above 20 o ) irrespective of sample depth. HSI has potential in guiding sampling by other methods, as it can reveal which sections of peat cores have transitions and if any layers were not horizontal. Since light penetrates only the very surface layer of the imaged peat sample, HSI is limited to sensing two-dimensional surfaces with the methodology of this study.
Elemental analysis of the Ilajansuo 3 core revealed high correlations between spectral indices and elemental concentrations. It is obvious that absorbances of individual elements are not visible in the spectral data, but the spectral correlations are due to the elements correlating with features of the peat core such as the original vegetation, hydrology and humification. For instance, the spectral data correlates strongly with K, Na and Rb that all are mobile cations found in high concentrations near the surface layers, while they have leaked away from older peat (Shotyk 1988). These layers also contain pigments such as chlorophyll that have clear absorptions in the spectra and corresponding to this pattern, the correlations with spectra were strong for these elements (R2 = 0.79-0.95). Strong correlations were also found for many elements with concentrations more or less steadily decreasing (Mg, Mn, Zn) or increasing (e.g. Al, As, Co, Sr) with depth. Very similar profiles of Al and Sr were found by Weiss et al. (1999) from a peat core that also had Carex to Sphagnum transition. On the other hand, certain elements with more complex profiles were poorly correlated. For example, profiles of trace metals like Pb, Cd and V likely indicate the history of anthropogenic deposition (Weiss et al. 1999;Shotyk et al. 2017) and the peaks of these elements were clearly underestimated by spectral indices. Furthermore, certain clear stratigraphic patterns appeared to be completely missed by HSI, while some connected element correlations were fairly strong. The profiles of Ba and Ga had moderately strong spectral correlations (R2 = 0.58-0.65) and their general patterns of increasing concentrations with depth were recognized, but both elements had conspicuous concentration peaks together with residual ash content that did not emerge in HSI result. The unexplained ash content is chiefly comprised of acidinsoluble silica (mineral dust particles, biogenic silica) that typically comprise some 30-65% of peat ash (Shotyk 1988). Similar sharp peaks of ash content were found in several other samples too, and regularly located near the Carex to Sphagnum peat (fen to bog) transition zones (Valkeasuo 1, Valkeasuo 2, Valkeasuo 3, Sumukka 1, Lahna 1 Mahlaneva 2, and Ilajansuo 3). Peaks of ash content have been attributed to atmospheric mineral deposition of dust particles or to changing peat decomposition rates (Ferrat et al. 2012). However, Kokfelt et al. (2009) attributed a similar peak to the accumulation of biogenic silica caused by the increase of diatoms in transitional ecosystems. We could not determine a single spectral feature that would correspond with these changes. Even though most elements or individual substances cannot be detected directly from the spectra, our data showed deep absorptions at 803 nm and 850 nm, that we could not link to peat type. These wavelengths were also selected for the best NDI index for iron. Iron compounds have clear absorbances both in the visible region and between 800 and 1000 nm (Grove et al. 1992). Jackisch et al. (2018) used the ratio between 720 nm and 850 nm to detect iron effluent from mines. Yet, the correlation of the iron NDI index was poor with both cameras in our data. The poor correlation could be explained by the varied spectral absorption of iron compounds, modified by the complex iron chemistry in peat (Barrón and Torrent 2013). Iron can exist in different oxidation states even in anoxic peat (Bhattacharyya et al. 2017).
The limited dataset used here has no external validation and it does not have predictive value outside of this data set for mapping of element concentrations. Instead, the spectral indices can well be used to create visual representations of the analysed samples, and in further steps, to guide sampling for other connected analyses. In this approach, HSI is used simply to strengthen spatial extrapolation and similar methodology has been used in elemental analysis of soil cores (Steffens and Buddenbaum 2013). Achieving real predictive value on an external dataset would require a substantially larger and more varied training set, however. In summary, HSI correlated with many elements of trace concentrations and no logical causality except correlations with peat stratigraphy, while clear pattern of up to ca. 10% total mineral content were missed. Clearly, HSI does not see everything and caution is warranted to avoid overinterpretation of HSI-derived information.

Conclusions
We present a novel application of hyperspectral imaging for peat core analysis. Peat samples bear certain unique features and challenges for imaging. Peat occurs naturally under inundated and hypoxic conditions and is variably decomposed, hence, the oxidation of samples may result in artefacts, and high water content and humification may mask variation of interest in plant material composition. Despite these overlapping effects we were able to reliably classify the main peat types of Sphagnum and Carex peat from unknown samples. Also, a simple index in the VNIR region worked well to estimate the degree of humification assessed with the von Post classification. One benefit of HSI modelling of humification was the ability to reflect the model in detailed spatial mapping to visualize patterns of humification. Despite these successes, due to overlapping absorption features and complicated peat chemistry, HSI can hardly replace any traditional sampling methods. Instead, it can provide uniquely detailed spatial maps of peat composition changes and thus support other analysis. Since the spectral imaging does not alter the samples, these maps can be then used for designing the sampling for other analysis. While peat stratigraphical studies have assumed horizontal layering of the peat, our results showed that peat layers tend to have complex alignments.