# Marine (https://nolantw.github.io/cwa/en/guides/marine/)

## Tide forecasts

`cwa.marine.tides()` returns the one-month tide forecast for a township or coastal point. Pass a township name, a `Township`, a CWA location ID, or a sequence of them.

```python
import cwa

forecast = cwa.marine.tides("花蓮縣吉安鄉")
for day in forecast.days[:2]:
    print(day.date, day.lunar_date, day.tide_range)
    for tide in day.tides:
        print(tide.time, tide.type, tide.height_twvd)
```

Tide heights are in centimetres. `height_twvd`, `height_local_msl` and `height_chart_datum` are relative to the Taiwan vertical datum, local mean sea level and chart datum. `tide_range` is 大, 中 or 小 (large, medium or small).

## Sea conditions

`cwa.marine.sea()` returns buoy and tide station observations in time order. `days=2` covers the past 48 hours and `days=30` the past 30 days.

```python
station = cwa.marine.sea("46694A")
latest = station.observations[-1]
print(latest.time, latest.wave_height, latest.sea_temperature, latest.wind_speed)
```

Each observation has tide height, wave height (m), wave direction, wave period (s), sea and air temperature (°C), pressure (hPa), wind and gust speed (m/s), and `currents` by depth layer. Anything a station does not measure is `None`.

Without an argument, every station is returned. A sequence returns a mapping keyed by your inputs, in input order.