# Central Coast aerial lidar processing

Python scripts for cleaning, classifying, and extracting survey profiles from las point clouds.

### 1. Enter input parameters
Input parameters are entered into excel spreadsheets, e.g. `param-files/survey-1.xlsx`. The python scripts take their input in yaml format. The spreadsheets can be converted to yaml by running:

```
python excel_to_yaml.py
```

### 2. Manipulate las data
`las_manipulation.py` does the following to the input las file:
- clip to beach extent
- classify ground points (so vegetation and buildings can be removed later)
- draw a polygon to remove swash zone interference

Example usage:

```
# Process single survey at specific beach
python las_manipulation.py param-files/survey-1-avoca.yaml

# Process single survey at multiple beaches
python las_manipulation.py param-files/survey-1-avoca.yaml param-files/survey-1-pearl.yaml

# Process all surveys at specific beach
python las_manipulation.py param-files/*avoca.yaml

# Process all beaches for specific survey date
python las_manipulation.py param-files/survey-1*.yaml

# Process all beaches for multiple survey dates
python las_manipulation.py param-files/survey-1*.yaml param-files/survey-2*.yaml
```

### 3. Check swash clipping mask
The swash clipping mask should be checked visually to ensure it is correct.

### 4. Export results
`las_outputs.py` does the following, based on the outputs of `las_manipulation.py`:
- remove swash zone
- extract elevations from point cloud at profile locations
- complete volume analysis based on Nielsen et al. (1992)
- save figures of profile cross sections
- save raster of ground surface

Example usage:

```
# Process single survey at specific beach
python las_outputs.py param-files/survey-1-avoca.yaml

# Process all beaches for multiple survey dates
python las_outputs.py param-files/survey-1*.yaml param-files/survey-2*.yaml
```

### 5. Generate erosion heatmaps
`generate_heatmaps.py` creates a heatmap raster by calculating the elevation difference between the current and previous surveys.

`generate_heatmaps.py` relies on `arcpy`, so this script must be run using the version of `python` that was installed with ArcGIS.

Example usage:

```
C:\Python27\ArcGIS10.5\python generate_heatmaps.py param-files\survey-2*.yaml

```

### 6. Export erosion heatmaps

`plot_heatmaps.py` exports a jpg erosion heatmap at all of the beaches covered by the specified heatmap tif.

`plot_heatmaps.py` relies on `arcpy`, so this script must be run using the version of `python` that was installed with ArcGIS.

Example usage:

```
C:\Python27\ArcGIS10.5\python plot_heatmaps.py param-files\survey-2-avoca.yaml
```

### 7. Export 0.7 m contour for DSAS trend analysis
`extract_contours.py` extracts a predefined contour (say 0.7 m AHD) and outputs it in a format suitable for DSAS shoreline trend analysis.

Example usage:
```
python extract_contours.py 
```