# README - Supplemental Data
## Description

Data and scripts supporting "Combustion completeness and location determine ash leachate chemistry"

Authors: Micheline Campbell, Pauline C. Treble, Liza K. McDonough, Sebastian Naeher, Andy Baker, Pauline Grierson, Henri Wong, and Martin S. Andersen

Contact: Micheline Campbell michelineleecampbell@gmail.com

## Tools used
R and Google Earth Engine. 

## Components

1. Code and data for inorganic ash leachate data processing

  Filename: inorganic ash leachate processing

  Folder containing two subfolders:

    1.1 data

      1.1.1 20221110_MacleayFireHistories - .csv containing fire histories for Macleay ash samples.
      1.1.2 20221110_YanchepAshFireHistories - .csv containing fire histories for Yanchep ash samples.
      1.1.3 20230809_MargsAshFireHistories - .csv containing fire histories for Margaret River region ash samples.
      1.1.4 20231010_allTidyAsh - .csv file containing the inorganic ash chemistry data
      1.1.5 20231010_allTidyAshFireHistories - .csv file containing the inorganic ash chemistry with fire histories. The output from 1.2.4.
      1.1.6 20231010_allTidyAshFireHistoriesDupsProcessed - .csv file containing the inorganic ash chemistry with fire histories and duplicates processed. The output from 1.2.5.
      1.1.7 20231010_AshSampleOutliers - .csv containing samples identified as outliers. The output from 1.2.7.
      1.1.8 20231010_allTidyAshFireHistoriesDupsProcessedOutliersChanged - .csv file containing the inorganic ash chemistry with fire histories, duplicates processed, and outliers changed. The output from 1.2.8
      1.1.9 20231010_allTidyAshFireHistoriesDupsProcessedOutliersChangedDistCoast - .csv file containing the inorganic ash chemistry with fire histories, duplicates processed, outliers changed, and distance to the coast added. The output from 1.2.9.
      1.1.10 20231010_allTidyAshStandardised - .csv file containing the inorganic ash chemistry with fire histories, duplicates processed, and z-scores calculated. The output from 1.2.6.

    1.2 scripts

      1.2.1 FireHistoryMacleayAsh.R - script to extract fire histories for Macleay ash samples. NOTE that you will need to download the relevant fire history database.
      1.2.2 FireMargsAsh.R - script to extract fire histories for Macleay ash samples. NOTE that you will need to download the relevant fire history database.
      1.2.3 FireHistoryYanchepAsh.R - script to extract fire histories for Macleay ash samples. NOTE that you will need to download the relevant fire history database.
      1.2.4 addAshFireHistory.R - script to add the fire history to the ash dataset
      1.2.5 processDuplicates.R - script to process the duplicate analyses
      1.2.6 standardisingAll.R - script to calculate z-scores for ash leachate data
      1.2.7 checkNormalityIDOutliersAsh.R - script to ID outliers and check normality of data
      1.2.8 ReplaceOutliersAshSamples.R - script to replace outliers IDd by 1.2.7
      1.2.9 DistToCoast.R - script to calculate the distance to the coast for ash samples

2. Code and data for inorganic soil leachate data processing

  Filename: inorganic soil leachate processing

  Folder containing two subfolders:

    2.1 data

      2.1.1 20221111_YanchepSoilFireHistories - .csv file containing extracted fire histories for Yanchep soil samples
      2.1.2 20230316_MargsSoilFireHistories - .csv file containing extracted fire histories for Capes region soil samples
      2.1.3 20231010_allTidySoilFireHistories - .csv file containing the inorganic soil chemistry with fire histories
      2.1.4 20231114_WCCorrection - .csv file containing sample weights pre-and post-drying and calculated Moisture Content.
      2.1.5 20231116_allTidySoilFireHistoriesWC - .csv file containing the inorganic soil chemistry with fire histories, values corrected by the moisture content. The output from 2.2.1
      2.1.6 20231016_allTidySoilFireHsitoriesWCDupsProcessed - .csv file containing the inorganic soil chemistry with fire histories, values corrected by the moisture content, and duplicates processed. The output from 2.2.2
      2.1.7 20231016_allTidySoilFireHsitoriesWCDupsProcessedALLVARS - as for 2.1.6, but for all variables (including those which failed to meet threshold for inclusion in analyses).
      2.1.8 20231010_SoilSampleOutliers - .csv containing samples identified as outliers. The output from 2.2.3.
      2.1.9 20231010_SoilSampleOutliersALLVARIABLES - as for 2.1.8, but for all variables (including those which failed to meet the threshold for inclusion in analyses)
      2.1.10 20231116_allTidySoilFireHsitoriesWCDupsProcessedOutliersChanged - .csv file containing the inorganic soil chemistry with fire histories, values corrected by the moisture content, duplicates processed, and outliers changed. The output from 2.2.4.
      2.1.11 20231116_allTidySoilFireHsitoriesWCDupsProcessedOutliersChangedALLVARS - as for 2.1.10 but for all variables (including those which failed to meet the threshold for inclusion in analyses).
      2.1.12 20231116_allTidySoilFireHsitoriesWCDupsProcessedOutliersChangedDistFromCoast - .csv file containing the inorganic soil chemistry with fire histories, values corrected by the moisture content, duplicates processed, outliers changed, and distance to the coast calculated. The output from 2.2.5
      2.1.13 20231116_allTidySoilFireHsitoriesWCDupsProcessedOutliersChangedALLVARSDistFromCoast - as for 2.1.12, but for all variables (including those which failed to meet the threshold for inclusion in analyses).
      
    2.2 scripts

      2.2.1 correctSoils.R - script to do the moisture correction for soils (batch 2022/0199)
      2.2.2 processSoilDuplicates.R - script to process the duplicate analyses
      2.2.3 checkNormalityIDoutliers.R - script to ID outliers and check normality of data
      2.2.4 ReplaceOutliersSoilSamples.R - script to replace outliers IDd by 2.2.3
      2.2.5 DistanceFromCoastSELECT.R - script to calculate the distance to the coast for soil samples.

3. Code for statistical analyses of inorganic ash leachates

  Filename: inorganic ash leachate statistics

    3.1 plot_signif_colour_Standardised.R - script that applies the Kruskal-Wallis Ranked Sum Test and Dunn's Test to inorganic ash leachate data. Produces Figure 5 and Figure S4. Input file is 1.1.7. 
    3.2 ShapleyValsBootstrapping.R - script that calculates the bootstrapped Shapley Values for inorganic ash leachates. Produces results in Table S6 Figure S8. Input file is 1.1.5. 
    3.3 AshPCAAll.R - script that does the Principal Component Analysis for inorganic ash leachates. Produces results in Table 1, Figure 6, Figure S7, Figure S8 and Figure S9. Input file is 1.1.5. 
    3.4 ShapleyValsBootstrappingNoMacleay - script that repeats 3.2, with Macleay samples excluded. Produces results in Table S9.

4. Code for statistical analyses of inorganic soil leachates

  Filename: inorganic soil leachate statistics

    4.1 SoilShapleyValsBoostrapping.R - script that calculates the bootstrapped Shapley Values for inorganic soil leachates. Produces results in Table S11 and Figure S10. Input file is 2.1.10. 
    4.2 SoilPCALimited.R - script that does the Principal Component Analysis for inorganic soil leachates. Produces results in Table 2, Figures 8 and 9, Figure S11. Input file is 2.1.13. 
  
5. Code and data for dNBR analyses of fires 

  Filename: dNBR analyses

  Folder containing two subfolders:

    5.1 scripts

      5.1.1 Macleay2019.txt - calculates and exports dNBR for the Carrai East Fire, which burned through the Macleay Karst Arc in 2019/2020. Use in Google Earth Engine. 
      5.1.2 Yanchep2019.txt - calculates and exports dNBR for the Yanchep Fire, which burned through Yanchep National Park in 2019. Use in Google Earth Engine.
      5.1.3 Boranup2021.txt - calculates and exports dNBR for the Boranup Fire, which burned through the Capes region in 2021. Use in Google Earth Engine. 
      5.1.4 plotMacleaydNBR.R - plot the dNBR of the Carrai East Fire. Produces Figure S1.1 in the supplemental material. Input file is 5.2.1.
      5.1.5 plotYanchepdNBR.R - plot the dNBR of the Yanchep Fire. Produces Figure S1.2 in the supplemental material. Input file is 5.2.2.
      5.1.6 plotBoranupdNBR.r - plot the dNBR of the Boranup Fire. Produces Figure S1.3 in the supplemental material. Input file is 5.2.3.
    
    5.2 data

      5.2.1 macleaydNBR.tiff - tiff file of the calculated dNBR for the Carrai East Fire. Exported via 5.1.1 in Google Earth Engine. 
      5.2.2 Yanchep2019.tiff - tiff file of the calculated dNBR for the Yanchep Fire. Exported via 5.1.2 in Google Earth Engine
      5.2.3 2021Boranup.tiff - tiff file of the calculated dNBR for the Boranup Fire. Exported via 5.1.3 in Google Earth Engine
  

6. Code and data for biomarker analyses

  Filename: biomarkers

  Folder containing two subfolders:

    6.1 scripts

      6.1.1 replotBiomarkersBoxplot.R - plot pyrogenic biomarkers. Produces Figures 7, S4.1, and S4.2. Input file is 6.2.1.

    6.2 data

      6.2.1 20231219_AllBiomarkersTidy - .csv file of pyrogenic biomarker data. 

7. Code for other figures   

  Filename: other figures

  7.1 Figure2.R - plot sample distribution, produces Figure 2. Input files are 1.1.3 and 2.1.6.

  7.2 Figure4.R - plot Ca/Mg ratio for ash leachates. Produces Figure 4, input file is 1.1.3.

  7.3 Figure10.R - plot soil and ash leachate concentrations. Produces Figure 10. Input files are 1.1.5 and 2.1.11.


  

  

             


      
          