diff --git a/examples/notebooks/generate_eta_file_netcdf.ipynb b/examples/notebooks/generate_eta_file_netcdf.ipynb deleted file mode 100644 index bf9623c7..00000000 --- a/examples/notebooks/generate_eta_file_netcdf.ipynb +++ /dev/null @@ -1,148 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": null, - "id": "2c056479", - "metadata": { - "lines_to_next_cell": 0 - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "8c96fbff", - "metadata": {}, - "outputs": [], - "source": [ - "import netCDF4 as nc\n", - "import numpy as np" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "6827b1b5", - "metadata": {}, - "outputs": [], - "source": [ - "\"\"\"\n", - "This notebook uses the python netCDF4 module\n", - "to create an eta_file containg\n", - "ak and bk coefficients for km=79\n", - "\"\"\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "45d4a704", - "metadata": {}, - "outputs": [], - "source": [ - "#create a Dataset instance\n", - "coefficients = nc.Dataset(\"eta79.nc\", \"w\", format=\"NETCDF4\")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "b964a014", - "metadata": {}, - "outputs": [], - "source": [ - "#Set dimensionsion\n", - "km = coefficients.createDimension(\"km\", 80)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "d51c395f", - "metadata": {}, - "outputs": [], - "source": [ - "#Create ak and bk variables\n", - "ak = coefficients.createVariable(\"ak\", np.float64, (\"km\"))\n", - "bk = coefficients.createVariable(\"bk\", np.float64, (\"km\"))\n", - "ak.units=\"\"\n", - "bk.units=\"\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "6723352e", - "metadata": {}, - "outputs": [], - "source": [ - "#Assign and write out values of ak\n", - "ak[:] = np.array(\n", - " [ 3.000000e+02, 6.467159e+02, 1.045222e+03, 1.469188e+03, 1.897829e+03,\n", - " 2.325385e+03, 2.754396e+03, 3.191294e+03, 3.648332e+03, 4.135675e+03,\n", - " 4.668282e+03, 5.247940e+03, 5.876271e+03, 6.554716e+03, 7.284521e+03,\n", - " 8.066738e+03, 8.902188e+03, 9.791482e+03, 1.073499e+04, 1.162625e+04,\n", - " 1.237212e+04, 1.299041e+04, 1.349629e+04, 1.390277e+04, 1.422098e+04,\n", - " 1.446058e+04, 1.462993e+04, 1.473633e+04, 1.478617e+04, 1.478511e+04,\n", - " 1.473812e+04, 1.464966e+04, 1.452370e+04, 1.436382e+04, 1.417324e+04,\n", - " 1.395491e+04, 1.371148e+04, 1.344540e+04, 1.315890e+04, 1.285407e+04,\n", - " 1.253280e+04, 1.219685e+04, 1.184788e+04, 1.148739e+04, 1.111682e+04,\n", - " 1.073748e+04, 1.035062e+04, 9.957395e+03, 9.558875e+03, 9.156069e+03,\n", - " 8.749922e+03, 8.341315e+03, 7.931065e+03, 7.519942e+03, 7.108648e+03,\n", - " 6.698281e+03, 6.290007e+03, 5.884984e+03, 5.484372e+03, 5.089319e+03,\n", - " 4.700960e+03, 4.320421e+03, 3.948807e+03, 3.587201e+03, 3.236666e+03,\n", - " 2.898237e+03, 2.572912e+03, 2.261667e+03, 1.965424e+03, 1.685079e+03,\n", - " 1.421479e+03, 1.175419e+03, 9.476516e+02, 7.388688e+02, 5.497130e+02,\n", - " 3.807626e+02, 2.325417e+02, 1.054810e+02, -8.381903e-04, 0.000000e+00] )" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "195c9ef5", - "metadata": {}, - "outputs": [], - "source": [ - "#Assign and write out values of bk \n", - "bk[:] = np.array(\n", - " [ 0., 0., 0., 0., 0., 0.,\n", - " 0., 0., 0., 0., 0., 0.,\n", - " 0., 0., 0., 0., 0., 0.,\n", - " 0., 0.00106595, 0.00412866, 0.00900663, 0.01554263, 0.02359921,\n", - " 0.03305481, 0.0438012, 0.05574095, 0.06878554, 0.08285347, 0.09786981,\n", - " 0.1137643, 0.130471, 0.1479275, 0.1660746, 0.1848558, 0.2042166,\n", - " 0.2241053, 0.2444716, 0.2652672, 0.286445, 0.3079604, 0.3297701,\n", - " 0.351832, 0.3741062, 0.3965532, 0.4191364, 0.4418194, 0.4645682,\n", - " 0.48735, 0.5101338, 0.5328897, 0.5555894, 0.5782067, 0.6007158,\n", - " 0.6230936, 0.6452944, 0.6672683, 0.6889648, 0.7103333, 0.7313231,\n", - " 0.7518838, 0.7719651, 0.7915173, 0.8104913, 0.828839, 0.846513,\n", - " 0.8634676, 0.8796583, 0.8950421, 0.9095779, 0.9232264, 0.9359506,\n", - " 0.9477157, 0.9584892, 0.9682413, 0.9769447, 0.9845753, 0.9911126,\n", - " 0.9965372, 1. ] )" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "c0f3bd9d", - "metadata": {}, - "outputs": [], - "source": [ - "#Close netcdf file\n", - "coefficients.close()" - ] - } - ], - "metadata": { - "jupytext": { - "cell_metadata_filter": "-all", - "executable": "/usr/bin/env python3", - "main_language": "python", - "notebook_metadata_filter": "-all" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/examples/notebooks/generate_eta_file_xarray.ipynb b/examples/notebooks/generate_eta_file_xarray.ipynb deleted file mode 100644 index a47b09e6..00000000 --- a/examples/notebooks/generate_eta_file_xarray.ipynb +++ /dev/null @@ -1,140 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": null, - "id": "6dc5fe4c", - "metadata": { - "lines_to_next_cell": 0 - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "81be9a15", - "metadata": {}, - "outputs": [], - "source": [ - "import numpy as np\n", - "import xarray as xr" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "c74c6c07", - "metadata": {}, - "outputs": [], - "source": [ - "\"\"\"\n", - "This notebook uses the python xarray module\n", - "to create an eta_file containg\n", - "ak and bk coefficients for km=79\n", - "\"\"\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "f72c5d5b", - "metadata": {}, - "outputs": [], - "source": [ - "#Assign ak data\n", - "ak=np.array(\n", - " [ 3.000000e+02, 6.467159e+02, 1.045222e+03, 1.469188e+03, 1.897829e+03,\n", - " 2.325385e+03, 2.754396e+03, 3.191294e+03, 3.648332e+03, 4.135675e+03,\n", - " 4.668282e+03, 5.247940e+03, 5.876271e+03, 6.554716e+03, 7.284521e+03,\n", - " 8.066738e+03, 8.902188e+03, 9.791482e+03, 1.073499e+04, 1.162625e+04,\n", - " 1.237212e+04, 1.299041e+04, 1.349629e+04, 1.390277e+04, 1.422098e+04,\n", - " 1.446058e+04, 1.462993e+04, 1.473633e+04, 1.478617e+04, 1.478511e+04,\n", - " 1.473812e+04, 1.464966e+04, 1.452370e+04, 1.436382e+04, 1.417324e+04,\n", - " 1.395491e+04, 1.371148e+04, 1.344540e+04, 1.315890e+04, 1.285407e+04,\n", - " 1.253280e+04, 1.219685e+04, 1.184788e+04, 1.148739e+04, 1.111682e+04,\n", - " 1.073748e+04, 1.035062e+04, 9.957395e+03, 9.558875e+03, 9.156069e+03,\n", - " 8.749922e+03, 8.341315e+03, 7.931065e+03, 7.519942e+03, 7.108648e+03,\n", - " 6.698281e+03, 6.290007e+03, 5.884984e+03, 5.484372e+03, 5.089319e+03,\n", - " 4.700960e+03, 4.320421e+03, 3.948807e+03, 3.587201e+03, 3.236666e+03,\n", - " 2.898237e+03, 2.572912e+03, 2.261667e+03, 1.965424e+03, 1.685079e+03,\n", - " 1.421479e+03, 1.175419e+03, 9.476516e+02, 7.388688e+02, 5.497130e+02,\n", - " 3.807626e+02, 2.325417e+02, 1.054810e+02, -8.381903e-04, 0.000000e+00] )" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "f5b85c7e", - "metadata": { - "lines_to_next_cell": 2 - }, - "outputs": [], - "source": [ - "#Assign bk data\n", - "bk=np.array(\n", - " [ 0., 0., 0., 0., 0., 0.,\n", - " 0., 0., 0., 0., 0., 0.,\n", - " 0., 0., 0., 0., 0., 0.,\n", - " 0., 0.00106595, 0.00412866, 0.00900663, 0.01554263, 0.02359921,\n", - " 0.03305481, 0.0438012, 0.05574095, 0.06878554, 0.08285347, 0.09786981,\n", - " 0.1137643, 0.130471, 0.1479275, 0.1660746, 0.1848558, 0.2042166,\n", - " 0.2241053, 0.2444716, 0.2652672, 0.286445, 0.3079604, 0.3297701,\n", - " 0.351832, 0.3741062, 0.3965532, 0.4191364, 0.4418194, 0.4645682,\n", - " 0.48735, 0.5101338, 0.5328897, 0.5555894, 0.5782067, 0.6007158,\n", - " 0.6230936, 0.6452944, 0.6672683, 0.6889648, 0.7103333, 0.7313231,\n", - " 0.7518838, 0.7719651, 0.7915173, 0.8104913, 0.828839, 0.846513,\n", - " 0.8634676, 0.8796583, 0.8950421, 0.9095779, 0.9232264, 0.9359506,\n", - " 0.9477157, 0.9584892, 0.9682413, 0.9769447, 0.9845753, 0.9911126,\n", - " 0.9965372, 1. ] )" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "c5450f7f", - "metadata": {}, - "outputs": [], - "source": [ - "#Create a Dataset instance\n", - "coefficients = xr.Dataset(\n", - " { \"ak\": ([\"km1\"], ak),\n", - " \"bk\": ([\"km1\"], bk) \n", - " })" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "5a0e5487", - "metadata": {}, - "outputs": [], - "source": [ - "#Set attributes for each variable\n", - "coefficients[\"ak\"].attrs[\"units\"]=\"\"\n", - "coefficients[\"bk\"].attrs[\"units\"]=\"\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "612b0134", - "metadata": {}, - "outputs": [], - "source": [ - "#Write netcdf file\n", - "coefficients.to_netcdf(\"eta79.nc\")" - ] - } - ], - "metadata": { - "jupytext": { - "cell_metadata_filter": "-all", - "executable": "/usr/bin/env python3", - "main_language": "python", - "notebook_metadata_filter": "-all" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/examples/notebooks/generate_eta_files.ipynb b/examples/notebooks/generate_eta_files.ipynb new file mode 100644 index 00000000..d128a048 --- /dev/null +++ b/examples/notebooks/generate_eta_files.ipynb @@ -0,0 +1,164 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "32f38057", + "metadata": { + "lines_to_next_cell": 0 + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "437183c9", + "metadata": {}, + "outputs": [], + "source": [ + "import numpy as np\n", + "import xarray as xr" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "078a8e75", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "This notebook uses the python xarray module\n", + "to create an eta_file containing ak and bk coefficients \n", + "for km=79 and km=91. The coefficients are written out to\n", + "eta79.nc and eta91.nc netcdf files respectively\n", + "\"\"\"" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1ff6a397", + "metadata": { + "lines_to_next_cell": 2 + }, + "outputs": [], + "source": [ + "# km = 79\n", + "ak = xr.DataArray( dims=[\"km1\"], attrs=dict(units=\"Pa\", _FillValue=False), \n", + " data=np.array([ 3.000000e+02, 6.467159e+02, 1.045222e+03, 1.469188e+03, 1.897829e+03,\n", + " 2.325385e+03, 2.754396e+03, 3.191294e+03, 3.648332e+03, 4.135675e+03,\n", + " 4.668282e+03, 5.247940e+03, 5.876271e+03, 6.554716e+03, 7.284521e+03,\n", + " 8.066738e+03, 8.902188e+03, 9.791482e+03, 1.073499e+04, 1.162625e+04,\n", + " 1.237212e+04, 1.299041e+04, 1.349629e+04, 1.390277e+04, 1.422098e+04,\n", + " 1.446058e+04, 1.462993e+04, 1.473633e+04, 1.478617e+04, 1.478511e+04,\n", + " 1.473812e+04, 1.464966e+04, 1.452370e+04, 1.436382e+04, 1.417324e+04,\n", + " 1.395491e+04, 1.371148e+04, 1.344540e+04, 1.315890e+04, 1.285407e+04,\n", + " 1.253280e+04, 1.219685e+04, 1.184788e+04, 1.148739e+04, 1.111682e+04,\n", + " 1.073748e+04, 1.035062e+04, 9.957395e+03, 9.558875e+03, 9.156069e+03,\n", + " 8.749922e+03, 8.341315e+03, 7.931065e+03, 7.519942e+03, 7.108648e+03,\n", + " 6.698281e+03, 6.290007e+03, 5.884984e+03, 5.484372e+03, 5.089319e+03,\n", + " 4.700960e+03, 4.320421e+03, 3.948807e+03, 3.587201e+03, 3.236666e+03,\n", + " 2.898237e+03, 2.572912e+03, 2.261667e+03, 1.965424e+03, 1.685079e+03,\n", + " 1.421479e+03, 1.175419e+03, 9.476516e+02, 7.388688e+02, 5.497130e+02,\n", + " 3.807626e+02, 2.325417e+02, 1.054810e+02, -8.381903e-04, 0.000000e+00]) )\n", + "bk = xr.DataArray( dims=['km1'], attrs=dict(units=\"None\", _FillValue=False), \n", + " data=np.array([0., 0., 0., 0., 0., 0.,\n", + " 0., 0., 0., 0., 0., 0.,\n", + " 0., 0., 0., 0., 0., 0.,\n", + " 0., 0.00106595, 0.00412866, 0.00900663, 0.01554263, 0.02359921,\n", + " 0.03305481, 0.0438012, 0.05574095, 0.06878554, 0.08285347, 0.09786981,\n", + " 0.1137643, 0.130471, 0.1479275, 0.1660746, 0.1848558, 0.2042166,\n", + " 0.2241053, 0.2444716, 0.2652672, 0.286445, 0.3079604, 0.3297701,\n", + " 0.351832, 0.3741062, 0.3965532, 0.4191364, 0.4418194, 0.4645682,\n", + " 0.48735, 0.5101338, 0.5328897, 0.5555894, 0.5782067, 0.6007158,\n", + " 0.6230936, 0.6452944, 0.6672683, 0.6889648, 0.7103333, 0.7313231,\n", + " 0.7518838, 0.7719651, 0.7915173, 0.8104913, 0.828839, 0.846513,\n", + " 0.8634676, 0.8796583, 0.8950421, 0.9095779, 0.9232264, 0.9359506,\n", + " 0.9477157, 0.9584892, 0.9682413, 0.9769447, 0.9845753, 0.9911126,\n", + " 0.9965372, 1. ]) )\n", + "coefficients=xr.Dataset(data_vars={\"ak\":ak, \"bk\":bk})\n", + "coefficients.to_netcdf(\"eta79.nc\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1a8301f4", + "metadata": {}, + "outputs": [], + "source": [ + "# km = 91\n", + "ak = xr.DataArray( dims=[\"km1\"], attrs=dict(units=\"Pa\", _FillValue=False), \n", + " data = np.array([1.00000000e+00, 1.75000000e+00, 2.75000000e+00, 4.09999990e+00,\n", + " 5.98951054e+00, 8.62932968e+00, 1.22572632e+01, 1.71510906e+01,\n", + " 2.36545467e+01, 3.21627693e+01, 4.31310921e+01, 5.71100426e+01,\n", + " 7.46595764e+01, 9.64470978e+01, 1.23169769e+02, 1.55601318e+02,\n", + " 1.94594009e+02, 2.41047531e+02, 2.95873840e+02, 3.60046967e+02,\n", + " 4.34604828e+02, 5.20628723e+02, 6.19154846e+02, 7.31296021e+02,\n", + " 8.58240906e+02, 1.00106561e+03, 1.16092859e+03, 1.33903992e+03,\n", + " 1.53650012e+03, 1.75448938e+03, 1.99417834e+03, 2.25667407e+03,\n", + " 2.54317139e+03, 2.85476392e+03, 3.19258569e+03, 3.55775366e+03,\n", + " 3.95135107e+03, 4.37428662e+03, 4.82711084e+03, 5.31022168e+03,\n", + " 5.82387793e+03, 6.36904248e+03, 6.94875244e+03, 7.56691992e+03,\n", + " 8.22634277e+03, 8.93120996e+03, 9.68446191e+03, 1.04822725e+04,\n", + " 1.13182793e+04, 1.21840771e+04, 1.30655674e+04, 1.39532207e+04,\n", + " 1.48307285e+04, 1.56872617e+04, 1.65080645e+04, 1.72810996e+04,\n", + " 1.79942988e+04, 1.86363223e+04, 1.91961797e+04, 1.96640723e+04,\n", + " 2.00301914e+04, 2.02853691e+04, 2.04215254e+04, 2.04300684e+04,\n", + " 2.03028730e+04, 2.00323711e+04, 1.96110664e+04, 1.90313848e+04,\n", + " 1.82866426e+04, 1.73777930e+04, 1.63224639e+04, 1.51444033e+04,\n", + " 1.38725674e+04, 1.25404785e+04, 1.11834170e+04, 9.83532715e+03,\n", + " 8.52630664e+03, 7.28224512e+03, 6.12326074e+03, 5.06350684e+03,\n", + " 4.11124902e+03, 3.27000122e+03, 2.53922729e+03, 1.91530762e+03,\n", + " 1.39244995e+03, 9.63134766e+02, 6.20599365e+02, 3.57989502e+02,\n", + " 1.69421387e+02, 5.10314941e+01, 2.48413086e+00, 0.00000000e+00]))\n", + "bk = xr.DataArray( dims=[\"km1\"], attrs=dict(units=\"None\", _FillValue=False), \n", + " data = np.array([0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,\n", + " 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,\n", + " 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,\n", + " 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,\n", + " 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,\n", + " 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,\n", + " 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,\n", + " 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,\n", + " 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,\n", + " 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,\n", + " 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 3.50123992e-06,\n", + " 2.81484008e-05, 9.38666999e-05, 2.28561999e-04, 5.12343016e-04,\n", + " 1.04712998e-03, 1.95625005e-03, 3.42317997e-03, 5.58632007e-03,\n", + " 8.65428988e-03, 1.27844000e-02, 1.81719996e-02, 2.49934997e-02,\n", + " 3.34198996e-02, 4.36249003e-02, 5.57769015e-02, 7.00351968e-02,\n", + " 8.65636021e-02, 1.05520003e-01, 1.27051994e-01, 1.51319996e-01,\n", + " 1.78477004e-01, 2.08675995e-01, 2.42069006e-01, 2.78813988e-01,\n", + " 3.19043010e-01, 3.62558991e-01, 4.08596009e-01, 4.56384987e-01,\n", + " 5.05111992e-01, 5.53902984e-01, 6.01903021e-01, 6.48333013e-01,\n", + " 6.92534983e-01, 7.33981013e-01, 7.72292018e-01, 8.07236016e-01,\n", + " 8.38724971e-01, 8.66774976e-01, 8.91497016e-01, 9.13065016e-01,\n", + " 9.31702971e-01, 9.47658002e-01, 9.61175978e-01, 9.72495019e-01,\n", + " 9.81844008e-01, 9.89410996e-01, 9.95342016e-01, 1.00000000e+00]))\n", + "coefficients=xr.Dataset(data_vars={\"ak\":ak, \"bk\":bk})\n", + "coefficients.to_netcdf(\"eta91.nc\")" + ] + }, + { + "cell_type": "markdown", + "id": "5b6cafbb", + "metadata": {}, + "source": [ + "km = " + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all", + "executable": "/usr/bin/env python3", + "main_language": "python", + "notebook_metadata_filter": "-all" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}