# DriveLog

A pile-driving record, one entry per logged foot.

Usage

[Source](https://github.com/lornearnold/driven-pile/blob/main/src/driven_pile/inputs.py#L145-L326)

``` python
DriveLog(
    pile,
    hammer,
    elevation,
    bpm,
    bpf,
    pile_id=None,
)
```

## Attributes

`pile: Pile`  
The pile that was driven.

`hammer: Hammer`  
The hammer that drove it.

`elevation: ndarray`  
Toe elevation at the end of each logged foot, ft.

`bpm: ndarray`  
Hammer blows per minute.

`bpf: ndarray`  
Blows per foot.

`pile_id: (str, optional)`  
Identifier of the pile.

## Attributes

| Name | Description |
|----|----|
| [depth](#depth) | Depth below the first logged foot, ft. |
| [stroke](#stroke) | Hammer stroke (drop height) derived from the blow rate, ft. |
| [valid](#valid) | Boolean mask of feet with finite elevation, blow rate and blow count. |

### depth

Depth below the first logged foot, ft.

`depth: np.ndarray`

### stroke

Hammer stroke (drop height) derived from the blow rate, ft.

`stroke: np.ndarray`

### valid

Boolean mask of feet with finite elevation, blow rate and blow count.

`valid: np.ndarray`

## Methods

| Name                          | Description                            |
|-------------------------------|----------------------------------------|
| [from_arrays()](#from_arrays) | Build a log from per-foot arrays.      |
| [from_csv()](#from_csv)       | Read a log from a delimited text file. |

### from_arrays()

Build a log from per-foot arrays.

Usage

[Source](https://github.com/lornearnold/driven-pile/blob/main/src/driven_pile/inputs.py#L195-L265)

``` python
from_arrays(
    pile,
    hammer,
    *,
    bpf,
    bpm=None,
    stroke=None,
    elevation=None,
    depth=None,
    tip_elevation=None,
    forward_fill=False,
    pile_id=None,
)
```

#### Parameters

`pile: Pile`  
The pile that was driven.

`hammer: Hammer`  
The hammer that drove it.

`bpf: array_like`  
Blows per foot. Non-numeric entries become NaN.

`bpm: array_like = None`  
Hammer blows per minute. Non-numeric entries become NaN.

`stroke: array_like = None`  
Hammer stroke, ft, for a log that records the stroke instead of the blow rate; converted to bpm with [stroke_to_bpm](../reference/stroke_to_bpm.md#driven_pile.stroke_to_bpm). Exactly one of `bpm` and [stroke](../reference/DriveLog.md#driven_pile.DriveLog.stroke) must be given.

`elevation: array_like = None`  
Toe elevation at the end of each foot, ft.

`depth: array_like and float = None`  
Depth of each foot (ft) and the final toe elevation (ft), used instead of `elevation`. The elevation of each foot is `tip_elevation + depth[-1] - depth` after trimming.

`tip_elevation: array_like and float = None`  
Depth of each foot (ft) and the final toe elevation (ft), used instead of `elevation`. The elevation of each foot is `tip_elevation + depth[-1] - depth` after trimming.

`forward_fill: bool = False`  
Carry the last recorded blow rate (or stroke) forward over unrecorded feet.

#### Returns

`DriveLog`  
The log trimmed to the span from the first to the last foot where both the blow rate and the blow count are recorded.

### from_csv()

Read a log from a delimited text file.

Usage

[Source](https://github.com/lornearnold/driven-pile/blob/main/src/driven_pile/inputs.py#L267-L326)

``` python
from_csv(
    path,
    pile,
    hammer,
    *,
    bpf,
    bpm=None,
    stroke=None,
    elevation=None,
    depth=None,
    tip_elevation=None,
    skiprows=0,
    delimiter=",",
    forward_fill=False,
    pile_id=None,
)
```

#### Parameters

`path: str or Path`  
File to read.

`pile: Pile`  
The pile that was driven.

`hammer: Hammer`  
The hammer that drove it.

`bpf: str or int`  
Column holding each quantity, by header name or zero-based index. Exactly one of `bpm`/[stroke](../reference/DriveLog.md#driven_pile.DriveLog.stroke) and one of `elevation`/[depth](../reference/DriveLog.md#driven_pile.DriveLog.depth) must be given.

`bpm: str or int`  
Column holding each quantity, by header name or zero-based index. Exactly one of `bpm`/[stroke](../reference/DriveLog.md#driven_pile.DriveLog.stroke) and one of `elevation`/[depth](../reference/DriveLog.md#driven_pile.DriveLog.depth) must be given.

`stroke: str or int`  
Column holding each quantity, by header name or zero-based index. Exactly one of `bpm`/[stroke](../reference/DriveLog.md#driven_pile.DriveLog.stroke) and one of `elevation`/[depth](../reference/DriveLog.md#driven_pile.DriveLog.depth) must be given.

`elevation: str or int`  
Column holding each quantity, by header name or zero-based index. Exactly one of `bpm`/[stroke](../reference/DriveLog.md#driven_pile.DriveLog.stroke) and one of `elevation`/[depth](../reference/DriveLog.md#driven_pile.DriveLog.depth) must be given.

`depth: str or int`  
Column holding each quantity, by header name or zero-based index. Exactly one of `bpm`/[stroke](../reference/DriveLog.md#driven_pile.DriveLog.stroke) and one of `elevation`/[depth](../reference/DriveLog.md#driven_pile.DriveLog.depth) must be given.

`tip_elevation: float = None`  
Final toe elevation, ft; required with [depth](../reference/DriveLog.md#driven_pile.DriveLog.depth).

`skiprows: int = 0`  
Lines to skip before the data (or before the header row when columns are named).

`delimiter: str = ","`  
Field delimiter.

`forward_fill: bool = False`  
See [from_arrays](../reference/DriveLog.md#driven_pile.DriveLog.from_arrays).

`pile_id: str = None`  
Identifier of the pile.

#### Returns

`DriveLog`  
