{
  "cells": [
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "%matplotlib inline"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# Wavelength\n\nWave-length for a given frequency can be calculated using .. function::helpers.wavelength.\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "import numpy as np\nfrom mafredo.helpers import wavelength\nimport matplotlib.pyplot as plt\n\nT = np.linspace(1,20)\nomega = 2*np.pi / T\n\nfor wd in (5,10,20, 40,100,0):\n    wave_lengths = [wavelength(om, waterdepth=wd) for om in omega]\n    if wd == 0:\n        name = 'deep water'\n    else:\n        name = f'waterdepth = {wd}m'\n\n    plt.plot(T, wave_lengths, label=name)\nplt.legend()\nplt.xlabel('Wave period [s]')\nplt.ylabel('Wave length [m]')\nplt.ylim(0,200)\nplt.grid()"
      ]
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.8.6"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}