diff --git a/.travis.yml b/.travis.yml index 54bdbae..626e52e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,13 +2,19 @@ language: minimal sudo: false +env: + global: + - secure: "c1HxpvYvasSjycR2iejkLxtlFzMvR8Gmf2GQDPJfIkEftQGvXOt+m91Wy26e819eHeXiQUuoNQwnp6RgOW8woNrlqfro4GX6pgLZlmr4K5Plum1KLa/xs8wk+bN/XpgRbcOqwAFbWfoPbfbm3oP1/QoFiwT38KbGWONlYVGKlKM=" + matrix: fast_finish: true include: - name: default env: TEST_TARGET=default PY=3.7 - - python: coding_standards + - name: coding_standards env: TEST_TARGET=coding_standards PY=3.7 + - name: docs + env: TEST_TARGET=docs PY=3.7 before_install: - wget http://bit.ly/miniconda -O miniconda.sh @@ -36,3 +42,30 @@ script: - if [[ $TEST_TARGET == 'coding_standards' ]]; then flake8 --max-line-length=105 oceans --exclude=_version.py ; fi + + - if [[ $TEST_TARGET == 'docs' ]]; then + set -e ; + conda install doctr ; + pushd docs ; + make clean html linkcheck ; + popd ; + python -m doctr deploy --built-docs docs/build/html . ; + fi + +doctr: + require-master: true + sync: False + +deploy: + skip_cleanup: true + provider: pypi + user: ocefpaf + password: + secure: "HifofjCDgTUP3hv0C8xD411JBCIp7VziSE5SiD9ZXo9CGo/rnr2rxtIcA9QDHfwO0n1iK26AhUbmeUURecn7+GjvvwCsbN3y21zfx0/D6KCSCvfEuJBJG2uAZqbNBFkT5//96umsavVngp0vNzOASDCljBgC9t5X0r1JnybQUro=" + distributions: sdist bdist_wheel + upload_docs: no + on: + repo: pyoceans/python-oceans + tags: true + all_branches: master + condition: '$TEST_TARGET == "default"' diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..69fe55e --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,19 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +SOURCEDIR = source +BUILDDIR = build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) \ No newline at end of file diff --git a/docs/source/RPSstuff.rst b/docs/source/RPSstuff.rst new file mode 100644 index 0000000..b0caccc --- /dev/null +++ b/docs/source/RPSstuff.rst @@ -0,0 +1,7 @@ +:mod:`oceans.RPSstuff` +---------------------- + +.. automodule:: oceans.RPSstuff + :members: + :undoc-members: + :show-inheritance: \ No newline at end of file diff --git a/docs/source/_static/logo.png b/docs/source/_static/logo.png new file mode 100644 index 0000000..33fe4a8 Binary files /dev/null and b/docs/source/_static/logo.png differ diff --git a/docs/source/colormaps.rst b/docs/source/colormaps.rst new file mode 100644 index 0000000..2cd332b --- /dev/null +++ b/docs/source/colormaps.rst @@ -0,0 +1,7 @@ +:mod:`oceans.colormaps` +----------------------- + +.. automodule:: oceans.colormaps + :members: + :undoc-members: + :show-inheritance: \ No newline at end of file diff --git a/docs/source/conf.py b/docs/source/conf.py new file mode 100644 index 0000000..5064314 --- /dev/null +++ b/docs/source/conf.py @@ -0,0 +1,196 @@ +# -*- coding: utf-8 -*- +# +# Configuration file for the Sphinx documentation builder. +# +# This file does only contain a selection of the most common options. For a +# full list see the documentation: +# http://www.sphinx-doc.org/en/master/config + +# -- Path setup -------------------------------------------------------------- + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +# import os +# import sys +# sys.path.insert(0, os.path.abspath('.')) + + +# -- Project information ----------------------------------------------------- + +project = 'oceans' +copyright = '2018, Filipe Fernandes' +author = 'Filipe Fernandes' + +from oceans._version import get_versions +version = release = get_versions()['version'] +del get_versions + +# -- General configuration --------------------------------------------------- + +# If your documentation needs a minimal Sphinx version, state it here. +# +# needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + 'sphinx.ext.autodoc', + 'sphinx.ext.mathjax', + 'sphinx.ext.githubpages', + 'sphinx.ext.viewcode', + 'sphinx.ext.napoleon', + 'nbsphinx', +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +# +# source_suffix = ['.rst', '.md'] +source_suffix = '.rst' + +# The master toctree document. +master_doc = 'index' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = None + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path. +exclude_patterns = [] + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = None + + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = 'alabaster' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +# +html_theme_options = { + 'logo': 'logo.png', + 'logo_name': 'oceans', + 'github_user': 'pyoceans', + 'github_repo': 'oceans', + 'github_banner': True, + 'travis_button': True, + 'fixed_sidebar': True, +} + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# Custom sidebar templates, must be a dictionary that maps document names +# to template names. +# +# The default sidebars (for documents that don't match any pattern) are +# defined by theme itself. Builtin themes are using these templates by +# default: ``['localtoc.html', 'relations.html', 'sourcelink.html', +# 'searchbox.html']``. +# +html_sidebars = { + '**': [ + 'about.html', + 'navigation.html', + 'relations.html', # needs 'show_related': True theme option to display + 'searchbox.html', + 'donate.html', + ] +} + + +# -- Options for HTMLHelp output --------------------------------------------- + +# Output file base name for HTML help builder. +htmlhelp_basename = 'oceansdoc' + + +# -- Options for LaTeX output ------------------------------------------------ + +latex_elements = { + # The paper size ('letterpaper' or 'a4paper'). + # + # 'papersize': 'letterpaper', + + # The font size ('10pt', '11pt' or '12pt'). + # + # 'pointsize': '10pt', + + # Additional stuff for the LaTeX preamble. + # + # 'preamble': '', + + # Latex figure (float) alignment + # + # 'figure_align': 'htbp', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + (master_doc, 'oceans.tex', 'oceans Documentation', + 'Filipe Fernandes', 'manual'), +] + + +# -- Options for manual page output ------------------------------------------ + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + (master_doc, 'oceans', 'oceans Documentation', + [author], 1) +] + + +# -- Options for Texinfo output ---------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + (master_doc, 'oceans', 'oceans Documentation', + author, 'oceans', 'One line description of project.', + 'Miscellaneous'), +] + + +# -- Options for Epub output ------------------------------------------------- + +# Bibliographic Dublin Core info. +epub_title = project + +# The unique identifier of the text. This can be a ISBN number +# or the project homepage. +# +# epub_identifier = '' + +# A unique identification for the text. +# +# epub_uid = '' + +# A list of files that should not be packed into the epub file. +epub_exclude_files = ['search.html'] + + +# -- Extension configuration ------------------------------------------------- \ No newline at end of file diff --git a/docs/source/datasets.rst b/docs/source/datasets.rst new file mode 100644 index 0000000..728a07a --- /dev/null +++ b/docs/source/datasets.rst @@ -0,0 +1,7 @@ +:mod:`oceans.datasets` +---------------------- + +.. automodule:: oceans.datasets + :members: + :undoc-members: + :show-inheritance: \ No newline at end of file diff --git a/docs/source/filters.rst b/docs/source/filters.rst new file mode 100644 index 0000000..52dc4c8 --- /dev/null +++ b/docs/source/filters.rst @@ -0,0 +1,7 @@ +:mod:`oceans.filters` +--------------------- + +.. automodule:: oceans.filters + :members: + :undoc-members: + :show-inheritance: \ No newline at end of file diff --git a/docs/source/index.rst b/docs/source/index.rst new file mode 100644 index 0000000..29475e8 --- /dev/null +++ b/docs/source/index.rst @@ -0,0 +1,28 @@ +.. oceans documentation master file, created by + sphinx-quickstart on Fri Nov 2 15:42:53 2018. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Misc helper functions for ocean sciences +======================================== + +Most of the functions here are Python versions of some common Matlab functions. +They are untested and probably buggy. Use with caution! + +.. toctree:: + :maxdepth: 3 + :caption: Contents: + + datasets + colormaps + plotting + ocfis + filters + RPSstuff + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/docs/source/ocfis.rst b/docs/source/ocfis.rst new file mode 100644 index 0000000..4d3853a --- /dev/null +++ b/docs/source/ocfis.rst @@ -0,0 +1,7 @@ +:mod:`oceans.ocfis` +------------------- + +.. automodule:: oceans.ocfis + :members: + :undoc-members: + :show-inheritance: \ No newline at end of file diff --git a/docs/source/plotting.rst b/docs/source/plotting.rst new file mode 100644 index 0000000..343a103 --- /dev/null +++ b/docs/source/plotting.rst @@ -0,0 +1,7 @@ +:mod:`oceans.plotting` +---------------------- + +.. automodule:: oceans.plotting + :members: + :undoc-members: + :show-inheritance: \ No newline at end of file diff --git a/github_deploy_key_pyoceans_python_oceans.enc b/github_deploy_key_pyoceans_python_oceans.enc new file mode 100644 index 0000000..901b6dc --- /dev/null +++ b/github_deploy_key_pyoceans_python_oceans.enc @@ -0,0 +1 @@ +gAAAAABb3JaWUyL3b2EjiV-1cM2kDAVwQfafXjaooKIj1QC5h4FsnMuYV3w11dr-PtLRMX48mWk3PWVYsxJ7oMrdWepoR28MktxIVd0SRmgPTgL_LBdvRdLErrudGN6jvZANKj6hPrfc7upnMsQ5SdB44E5mi79Rqh-Ktcn23JLqKcbROzGkb-dPMryjVIHQ3F2iwHBPpamgzauJGxkFErIiDh_lH6CQJCVmW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f1-RzyTltLkR_0Io0dVjDZ7f4r2WowEhKb11_MKQbmxnrG10Ye9kUXK33V4eACScOwBfTXoenZrX8aZDCYR7mWEmp61knJwXcDR_dyqAXAfc0ITMt9LypOB50GBrCRd7J1dWfiXS4L5XeldlU0zSqdxWVyZEbCagxsbnXoRhGsI7_GJyB3yjYKxLCodf_zjSvpv2yQiiTOOxMpXt53j6s0zsiv3RwOquGct-wC_L2K5c6wDuEHrluItsLaPlB3nV78jekHZZiTnoawYN-r-SpKSlUCJ2SVWEA-t6yx2_ojV_m0ZmfGaBy0g5k7IDux-YbdWfQh1YOlvyUKxQXaxtue9TG1wM6E3pOTvFgDgZtx72EP4aVpNFn3-pTKW7ajD4oavcTlnDxhZe_XxvdTsrWkQgkhsVusFLF7uDttI3zufR8Py81ifYi5DgN8pPMo_qGDIAYFQCAMLYL03pEMSWp2tAUlQhdWv6F18DAtnL-asPNWpSUunxRKbtn7Q5gkGZWLPgIEaLyZc2pZyCbC3mB0cY8TYUb8F82WDrOIG9g1bOlkDRCCgo_0FhW9dSaVnEdcgkz774JkngdrIQuUMWqR_BOiTvicpmpT7mL19UdFY5ntjTUS8jGQAFil4kuHxG9wyVWi9aiJefNCbbr8F1YvXMIEUXgUww135R7IdR_wUS7bartgB3NwlkLuGSFrxO9DT_UygBxEg3qQa7mLn7MRg20LeEwdBmdLL3FMYdTJjxcY5unlZ2p_D14d4G48V6_jKPOnvOdpNj-dk5i-Fkyu4sCtBg4S0iPBj2_c_dRKM2-R9Wb9aO9-XTz4n3A5ZFO6O7gmI8erM7AvsP-Lv3HlFDC4fIfZOX5FeER3VinyT8__QmUTwZEXRRcwUWq_lWLuQSPJDd2vAM0BDJmUoiGas5Oh0dQnSgqZtTsNGltoosWHqzACsdW-XIj9uBcTZf_fjgUQz4ejNxNYvhulXSRNcZbdg6joVGEEa5sxu0N-kOlJPCUnnAU4vQMcw== \ No newline at end of file diff --git a/oceans/RPSstuff/RPSstuff.py b/oceans/RPSstuff.py similarity index 91% rename from oceans/RPSstuff/RPSstuff.py rename to oceans/RPSstuff.py index ef467a5..fac34a2 100644 --- a/oceans/RPSstuff/RPSstuff.py +++ b/oceans/RPSstuff.py @@ -11,8 +11,8 @@ def h2hms(hours): """ Converts hours to hours, minutes, and seconds. - Example - ------- + Examples + -------- >>> h2hms(12.51) (12.0, 30.0, 36.0) @@ -28,8 +28,8 @@ def hms2h(h, m=None, s=None): """ Converts hours, minutes, and seconds to hours. - Example - ------- + Examples + -------- >>> hms2h(12., 30., 36.) 12.51 >>> # Or, @@ -53,8 +53,8 @@ def ms2hms(millisecs): """ Converts milliseconds to integer hour, minute, seconds. - Example - ------- + Examples + -------- >>> ms2hms(1e3 * 60) (0.0, 1.0, 0.0) @@ -82,22 +82,21 @@ def julian(y, m=0, d=0, h=0, mi=0, s=0, noon=False): If you want Julian days to start and end at noon set `noon` to True. INPUT: - y = year (e.g., 1979) component - m = month (1-12) component - d = day (1-31) component of Gregorian date - - hour = hours (0-23) - min = minutes (0-59) - sec = decimal seconds - or - h = decimal hours (assumed 0 if absent) + y : year (e.g., 1979) component + m : month (1-12) component + d : day (1-31) component of Gregorian date + hour : hours (0-23) + min : minutes (0-59) + sec : decimal seconds or + h : decimal hours (assumed 0 if absent) OUTPUT: - j = decimal Julian day number + j : decimal Julian day number + last revised 1/3/96 by Rich Signell (rsignell@usgs.gov) - Example - ------- + Examples + -------- >>> julian(1968, 5, 23, 0) array([2440000.]) @@ -128,8 +127,8 @@ def jdrps2jdmat(jd): Convert Signell's Julian days to Matlab's Serial day matlab's serial date = 1 at 0000 UTC, 1-Jan-0000. - Example - ------- + Examples + -------- >>> jdrps2jdmat(2440000) array([718941.]) @@ -142,8 +141,8 @@ def jdmat2jdrps(jdmat): Convert Matlab's Serial Day to Signell's Julian days matlab's serial date = 1 at 0000 UTC, 1-Jan-0000. - Example - ------- + Examples + -------- >>> jdmat2jdrps(718941) array([2440000.]) @@ -161,18 +160,18 @@ def gregorian(jd, noon=False): INPUT: jd = decimal Julian days - OUTPUT: gtime = six column Gregorian time matrix, where each row is - [yyyy mo da hr mi sec]. - yyyy = year (e.g., 1979) - mo = month (1-12) - da = day (1-31) - hr = hour (0-23) - mi = minute (0-59) - sec = decimal seconds - example: [1990 12 12 0 0 0] is midnight on Dec 12, 1990. - - Example - ------- + OUTPUT: gtime = six column Gregorian time matrix, where each row is: + [yyyy mo da hr mi sec]. + yyyy = year (e.g., 1979) + mo = month (1-12) + da = day (1-31) + hr = hour (0-23) + mi = minute (0-59) + sec = decimal seconds + example: [1990 12 12 0 0 0] is midnight on Dec 12, 1990. + + Examples + -------- >>> gregorian(2440000) array([[1968., 5., 23., 0., 0., 0.]]) @@ -227,8 +226,8 @@ def s2hms(secs): Converts seconds to integer hour,minute,seconds Usage: hour, min, sec = s2hms(secs) - Example - ------- + Examples + -------- >>> s2hms(3600 + 60 + 1) (1.0, 1.0, 1) @@ -309,10 +308,11 @@ def z0toCn(z0, H): C = Chezy "C" (non-dimensional) n = Manning's "n" (non-dimensional) - Example: - C, n = z0toCn(0.003, np.arange(2, 200)) - finds vectors C and n corresponding to a z0=0.003 and - a range of water depths from 2--200 meters + Examples + -------- + >>> # finds vectors C and n corresponding to a z0=0.003 + >>> # and a range of water depths from 2--200 meters. + >>> C, n = z0toCn(0.003, np.arange(2, 200)) """ diff --git a/oceans/RPSstuff/__init__.py b/oceans/RPSstuff/__init__.py deleted file mode 100644 index 06711d1..0000000 --- a/oceans/RPSstuff/__init__.py +++ /dev/null @@ -1,38 +0,0 @@ -""" -Miscellaneous tools from Rich Signell's RPSstuff (matlab) -========================================================= - -""" - -from .RPSstuff import ( - angled, - coast2bln, - fixcoast, - gregorian, - h2hms, - hms2h, - jdmat2jdrps, - jdrps2jdmat, - julian, - ms2hms, - near, - s2hms, - ss2, -) - - -__all__ = [ - angled, - coast2bln, - fixcoast, - gregorian, - h2hms, - hms2h, - jdmat2jdrps, - jdrps2jdmat, - julian, - ms2hms, - near, - s2hms, - ss2, -] diff --git a/oceans/__init__.py b/oceans/__init__.py index 11384ed..0a9a203 100644 --- a/oceans/__init__.py +++ b/oceans/__init__.py @@ -1,25 +1,3 @@ -from . import ( - RPSstuff, - colormaps, - datasets, - filters, - ocfis, - plotting, - sw_extras, -) - - -__all__ = [ - RPSstuff, - colormaps, - datasets, - filters, - ocfis, - plotting, - sw_extras, -] - - from ._version import get_versions # noqa __version__ = get_versions()['version'] del get_versions diff --git a/oceans/colormaps/cmap_data/cbathy.dat b/oceans/cmap_data/cbathy.dat similarity index 100% rename from oceans/colormaps/cmap_data/cbathy.dat rename to oceans/cmap_data/cbathy.dat diff --git a/oceans/colormaps/cmap_data/coolavhrrmap.dat b/oceans/cmap_data/coolavhrrmap.dat similarity index 100% rename from oceans/colormaps/cmap_data/coolavhrrmap.dat rename to oceans/cmap_data/coolavhrrmap.dat diff --git a/oceans/colormaps/cmap_data/ctopo.dat b/oceans/cmap_data/ctopo.dat similarity index 100% rename from oceans/colormaps/cmap_data/ctopo.dat rename to oceans/cmap_data/ctopo.dat diff --git a/oceans/colormaps/cmap_data/odv.dat b/oceans/cmap_data/odv.dat similarity index 100% rename from oceans/colormaps/cmap_data/odv.dat rename to oceans/cmap_data/odv.dat diff --git a/oceans/colormaps/cmap_data/redblue_dark.dat b/oceans/cmap_data/redblue_dark.dat similarity index 100% rename from oceans/colormaps/cmap_data/redblue_dark.dat rename to oceans/cmap_data/redblue_dark.dat diff --git a/oceans/colormaps/cmap_data/redblue_light.dat b/oceans/cmap_data/redblue_light.dat similarity index 100% rename from oceans/colormaps/cmap_data/redblue_light.dat rename to oceans/cmap_data/redblue_light.dat diff --git a/oceans/colormaps/cmap_data/redgreen.dat b/oceans/cmap_data/redgreen.dat similarity index 100% rename from oceans/colormaps/cmap_data/redgreen.dat rename to oceans/cmap_data/redgreen.dat diff --git a/oceans/colormaps/cmap_data/rscolmap.dat b/oceans/cmap_data/rscolmap.dat similarity index 100% rename from oceans/colormaps/cmap_data/rscolmap.dat rename to oceans/cmap_data/rscolmap.dat diff --git a/oceans/colormaps/colormaps.py b/oceans/colormaps.py similarity index 96% rename from oceans/colormaps/colormaps.py rename to oceans/colormaps.py index b4ba5a1..8212bb8 100644 --- a/oceans/colormaps/colormaps.py +++ b/oceans/colormaps.py @@ -18,7 +18,7 @@ def __init__(self, **kw): def get_color(color): """ - http://stackoverflow.com/questions/10254207/color-and-line-writing-using-matplotlib + https://stackoverflow.com/questions/10254207/color-and-line-writing-using-matplotlib """ for hue in range(color): @@ -73,7 +73,7 @@ def zebra_cm(a=4, m=0.5, n=256): References ---------- - [1] Hooker, S. B. et al, Detecting Dipole Ring Separatrices with Zebra + Hooker, S. B. et al, Detecting Dipole Ring Separatrices with Zebra Palettes, IEEE Transactions on Geosciences and Remote Sensing, vol. 33, 1306-1312, 1995 diff --git a/oceans/colormaps/__init__.py b/oceans/colormaps/__init__.py deleted file mode 100644 index d0b4d49..0000000 --- a/oceans/colormaps/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -from .colormaps import cm, get_color - -__all__ = [ - cm, - get_color, -] diff --git a/oceans/datasets/datasets.py b/oceans/datasets.py similarity index 75% rename from oceans/datasets/datasets.py rename to oceans/datasets.py index aea59a5..8adf416 100644 --- a/oceans/datasets/datasets.py +++ b/oceans/datasets.py @@ -4,8 +4,7 @@ import numpy as np -from ..RPSstuff import near -from ..ocfis import get_profile, wrap_lon180 +from oceans.ocfis import get_profile, wrap_lon180 def _woa_variable(variable): @@ -340,112 +339,6 @@ def _get_indices(bbox, lons, lats): return imin, imax+1, jmin, jmax+1 -def get_gebco15(x, y, topofile='gebco15-40s_30-52w_30seg.nc'): - """ - Usage - ----- - H, D, Xo, Yo = get_gebco15(x, y, topofile='gebco/gebco_08_30seg.nc') - - Description - ----------- - Finds the depth of points of coordinates 'x','y' using GEBCO data set. - - Parameters - ---------- - x : 1D array - Array containing longitudes of the points of unknown depth. - - y : 1D array - Array containing latitudes of the points of unknown depth. - - topofile : string, optional - String containing path to the GEBCO netCDF file. - - Returns - ------- - H : 1D array - Array containing depths of points closest to the input X, Y - coordinates. - - X : 1D array - Array of horizontal distance associated with array 'H'. - - D : 1D array - Array containing distances (in km) from the input X, Y - coordinates to the data points. - - Xo : 1D array - Array containing longitudes of the data points. - - Yo : 1D array - Array containing latitudes of the data points. - - NOTES - ------- - This function reads the entire netCDF file before extracting the wanted - data. Therefore, it does not handle the full GEBCO dataset (1.8 GB) - efficiently. - - TODO - ------- - Make it possible to work with the full gebco dataset, by extracting only - the wanted indexes. - - Code History - --------------------------------------- - Author of the original Matlab code (ftopo.m, ETOPO2 dataset): - Marcelo Andrioni - December 2008: Modification performed by Cesar Rocha - to handle ETOPO1 dataset. - July 2012: Python Translation and modifications performed by André Palóczy - Filho - to handle GEBCO dataset (30 arc seconds resolution). - - """ - from seawater import dist - - x, y = list(map(np.asanyarray, (x, y))) - - # Opening netCDF file and extracting data. - grid = Dataset(topofile) - yyr = grid.variables['y_range'][:] - xxr = grid.variables['x_range'][:] - spacing = grid.variables['spacing'][:] - dx, dy = spacing[0], spacing[1] - - # Creating lon and lat 1D arrays. - xx = np.arange(xxr[0], xxr[1], dx) - xx = xx + dx / 2 - yy = np.arange(yyr[0], yyr[1], dy) - yy = yy + dy / 2 - h = grid.variables['z'][:] - grid.close() - - # Retrieving nearest point for each input coordinate. - A = np.asanyarray([]) - xx, yy = np.meshgrid(xx, yy) - ni, nj = xx.shape[0], yy.shape[1] - h = np.reshape(h, (ni, nj)) - h = np.flipud(h) - Xo = A.copy() - Yo = A.copy() - H = A.copy() - D = A.copy() - for I in range(x.size): - ix = near(xx[0, :], x[I]) - iy = near(yy[:, 0], y[I]) - H = np.append(H, h[iy, ix]) - # Calculating distance between input and GEBCO points. - D = np.append(D, dist([x[I], xx[0, ix]], [y[I], yy[iy, 0]], - units='km')[0]) - Xo = np.append(Xo, xx[0, ix]) - Yo = np.append(Yo, yy[iy, 0]) - # Calculating distance axis. - X = np.append(0, np.cumsum(dist(Xo, Yo, units='km')[0])) - - return H, X, D, Xo, Yo - - if __name__ == '__main__': import doctest doctest.testmod() diff --git a/oceans/datasets/__init__.py b/oceans/datasets/__init__.py deleted file mode 100644 index 521efea..0000000 --- a/oceans/datasets/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -from .datasets import ( - etopo_subset, - get_depth, - get_isobath, - woa_profile, - woa_subset, -) - - -__all__ = [ - 'etopo_subset', - 'get_depth', - 'get_isobath', - 'woa_profile', - 'woa_subset', - 'get_gebco15', - ] diff --git a/oceans/filters/filters.py b/oceans/filters.py similarity index 85% rename from oceans/filters/filters.py rename to oceans/filters.py index 175296b..5f16f91 100644 --- a/oceans/filters/filters.py +++ b/oceans/filters.py @@ -73,7 +73,7 @@ def smoo1(datain, window_len=11, window='hanning'): Notes ----- - original from: http://www.scipy.org/Cookbook/SignalSmooth + original from: https://scipy-cookbook.readthedocs.io/items/SignalSmooth.html This method is based on the convolution of a scaled window with the signal. The signal is prepared by introducing reflected copies of the signal (with the window size) in both ends so that transient parts are minimized in the @@ -141,56 +141,31 @@ def smoo1(datain, window_len=11, window='hanning'): def smoo2(A, hei, wid, kind='hann', badflag=-9999, beta=14): """ - Usage - ----- - As = smoo2(A, hei, wid, kind='hann', badflag=-9999, beta=14) - - Description - ----------- Calculates the smoothed array 'As' from the original array 'A' using the specified window of type 'kind' and shape ('hei', 'wid'). + Usage: + As = smoo2(A, hei, wid, kind='hann', badflag=-9999, beta=14) + Parameters ---------- - A : 2D array - Array to be smoothed. - - hei : integer - Window height. Must be odd and greater than or equal to 3. - - wid : integer - Window width. Must be odd and greater than or equal to 3. - - kind : string, optional - One of the window types available in the numpy module: - - hann (default) : Gaussian-like. The weight decreases toward the - ends. Its end-points are zeroed. - hamming : Similar to the hann window. Its end-points are - not zeroed, therefore it is discontinuous at - the edges, and may produce artifacts. - blackman : Similar to the hann and hamming windows, with - sharper ends. - bartlett : Triangular-like. Its end-points are zeroed. - kaiser : Flexible shape. Takes the optional parameter - "beta" as a shape parameter. For beta=0, the - window is rectangular. As beta increases, the - window gets narrower. - - Refer to Numpy for details about each window type. - + A : 2D array + Array to be smoothed. + hei : integer + Window height. Must be odd and greater than or equal to 3. + wid : integer + Window width. Must be odd and greater than or equal to 3. + kind : string, optional + Refer to Numpy for details about each window type. badflag : float, optional - The bad data flag. Elements of the input array 'A' holding this - value are ignored. - - beta : float, optional - Shape parameter for the kaiser window. For windows other than - the kaiser window, this parameter does nothing. + The bad data flag. Elements of the input array 'A' holding this value are ignored. + beta : float, optional + Shape parameter for the kaiser window. Returns ------- - As : 2D array - The smoothed array. + As : 2D array + The smoothed array. André Palóczy Filho (paloczy@gmail.com) April 2012 @@ -285,40 +260,23 @@ def smoo2(A, hei, wid, kind='hann', badflag=-9999, beta=14): def weim(x, N, kind='hann', badflag=-9999, beta=14): """ - Usage - ----- - xs = weim(x, N, kind='hann', badflag=-9999, beta=14) - - Description - ----------- Calculates the smoothed array 'xs' from the original array 'x' using the specified window of type 'kind' and size 'N'. 'N' must be an odd number. + Usage: + xs = weim(x, N, kind='hann', badflag=-9999, beta=14) + + Parameters ---------- - x : 1D array - Array to be smoothed. - - N : integer - Window size. Must be odd. - - kind : string, optional - One of the window types available in the numpy module: - - hann (default) : Gaussian-like. The weight decreases toward the - ends. Its end-points are zeroed. - hamming : Similar to the hann window. Its end-points are - not zeroed, therefore it is discontinuous at the - edges, and may produce undesired artifacts. - blackman : Similar to the hann and hamming windows, with - sharper ends. - bartlett : Triangular-like. Its end-points are zeroed. - kaiser : Flexible shape. Takes the optional parameter - "beta" as a shape parameter. For beta=0, the - window is rectangular. As beta increases, the - window gets narrower. - - Refer to the numpy functions for details about each window type. + x : 1D array + Array to be smoothed. + + N : integer + Window size. Must be odd. + + kind : string, optional + Refer to Numpy for details about each window type. badflag : float, optional The bad data flag. Elements of the input array 'A' holding this @@ -456,10 +414,6 @@ def medfilt1(x, L=3): >>> ax = plt.subplot(212) >>> lims2 = ax.set_ylim([min(y1min, y2min), max(y1max, y2max)]) - Notes - ----- - Based on: http://staff.washington.edu/bdjwww/medfilt.py - """ xin = np.atleast_1d(np.asanyarray(x)) diff --git a/oceans/filters/__init__.py b/oceans/filters/__init__.py deleted file mode 100644 index a07e7fa..0000000 --- a/oceans/filters/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -from .filters import ( - fft_lowpass, - lanc, - md_trenberth, - medfilt1, - pl33tn, - smoo1, - smoo2, - weim, -) - -__all__ = [ - fft_lowpass, - lanc, - md_trenberth, - medfilt1, - pl33tn, - smoo1, - smoo2, - weim, -] diff --git a/oceans/ocfis/ocfis.py b/oceans/ocfis.py similarity index 97% rename from oceans/ocfis/ocfis.py rename to oceans/ocfis.py index b5dbc00..cbc7afd 100644 --- a/oceans/ocfis/ocfis.py +++ b/oceans/ocfis.py @@ -98,7 +98,7 @@ def del_eta_del_x(U, f, g, balance='geostrophic', R=None): Calculate :mat: `\frac{\partial \eta} {\partial x}` for different force balances - Parameters: + Parameters ---------- U : array_like velocity magnitude [m/s] @@ -148,7 +148,7 @@ def mld(SA, CT, p, criterion='pdvar'): 'density' : computed based on the constant potential density difference criterion, pd[0] - pd[mld] = 0.125 in sigma units. - `pdvar` : computed based on variable potential density criterion + 'pdvar' : computed based on variable potential density criterion pd[0] - pd[mld] = var(T[0], S[0]), where var is a variable potential density difference which corresponds to constant temperature difference of 0.5 degree C. @@ -162,7 +162,7 @@ def mld(SA, CT, p, criterion='pdvar'): References ---------- - .. [1] Monterey, G., and S. Levitus, 1997: Seasonal variability of mixed + Monterey, G., and S. Levitus, 1997: Seasonal variability of mixed layer depth for the World Ocean. NOAA Atlas, NESDIS 14, 100 pp. Washington, D.C. @@ -250,7 +250,7 @@ def pcaben(u, v): ... print('Flatness: {}'.format(flatness)) Notes: - http://pubs.usgs.gov/of/2002/of02-217/m-files/pcaben.m + https://pubs.usgs.gov/of/2002/of02-217/m-files/pcaben.m """ @@ -316,7 +316,7 @@ def spec_rot(u, v): References ---------- - .. [1] J. Gonella Deep Sea Res., 833-846, 1972. + J. Gonella Deep Sea Res., 833-846, 1972. """ @@ -599,8 +599,11 @@ def despike(self, n=3, recursive=False): def pol2cart(theta, radius, units='deg'): """ Convert from polar to Cartesian coordinates - **usage**: - x, y = pol2cart(theta, radius, units='deg'). + + Examples + -------- + >>> pol2cart(0, 1, units='deg') + (1.0, 0.0) """ if units in ['deg', 'degs']: @@ -614,8 +617,8 @@ def cart2pol(x, y): """ Convert from Cartesian to polar coordinates. - Example - ------- + Examples + -------- >>> x = [+0, -0.5] >>> y = [+1, +0.5] >>> cart2pol(x, y) @@ -696,10 +699,6 @@ def get_profile(x, y, f, xi, yi, mode='nearest', order=3): >>> get_profile(x, y, f, xi, yi, order=3) array([17606, 15096, 18540]) - Notes - ----- - http://mail.scipy.org/pipermail/scipy-user/2011-June/029857.html - """ from scipy.ndimage import map_coordinates @@ -738,7 +737,7 @@ def strip_mask(arr, fill_value=np.NaN): def shiftdim(x, n=None): """ - Matlab's shiftdim in python. + Matlab-like shiftdim in python. Examples -------- @@ -756,10 +755,6 @@ def shiftdim(x, n=None): >>> c.shape == a.shape True - Notes - ----- - http://www.python-it.org/forum/index.php?topic=4688.0 - """ def no_leading_ones(shape): diff --git a/oceans/ocfis/__init__.py b/oceans/ocfis/__init__.py deleted file mode 100644 index d64e5a2..0000000 --- a/oceans/ocfis/__init__.py +++ /dev/null @@ -1,50 +0,0 @@ -from .ocfis import ( - alphanum_key, - bin_dates, - binave, - binavg, - cart2pol, - complex_demodulation, - del_eta_del_x, - despike, - get_profile, - lagcorr, - mld, - pcaben, - pol2cart, - series_spline, - shiftdim, - spdir2uv, - spec_rot, - strip_mask, - uv2spdir, - wrap_lon180, - wrap_lon360, -) -from .synop import scaloa - - -__all__ = [ - alphanum_key, - bin_dates, - binave, - binavg, - cart2pol, - complex_demodulation, - del_eta_del_x, - despike, - get_profile, - lagcorr, - mld, - pcaben, - pol2cart, - scaloa, - series_spline, - shiftdim, - spdir2uv, - spec_rot, - strip_mask, - uv2spdir, - wrap_lon180, - wrap_lon360, -] diff --git a/oceans/plotting/plotting.py b/oceans/plotting.py similarity index 99% rename from oceans/plotting/plotting.py rename to oceans/plotting.py index 6dc935b..f62e1a0 100644 --- a/oceans/plotting/plotting.py +++ b/oceans/plotting.py @@ -209,7 +209,7 @@ class EditPoints(object): >>> _ = ax.set_title('Click and drag a point to move it') >>> _ = ax.axis([-2, 2, -2, 2]) - Based on http://matplotlib.org/examples/event_handling/poly_editor.html + Based on https://matplotlib.org/examples/event_handling/poly_editor.html """ epsilon = 5 # Maximum pixel distance to count as a point hit. diff --git a/oceans/plotting/__init__.py b/oceans/plotting/__init__.py deleted file mode 100644 index bbf59f0..0000000 --- a/oceans/plotting/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -from .plotting import ( - EditPoints, - compass, - get_pointsxy, - landmask, - level_colormap, - stick_plot, -) - -__all__ = [ - EditPoints, - compass, - get_pointsxy, - landmask, - level_colormap, - stick_plot, -] diff --git a/oceans/sandbox/__init__.py b/oceans/sandbox/__init__.py deleted file mode 100644 index 3892228..0000000 --- a/oceans/sandbox/__init__.py +++ /dev/null @@ -1,11 +0,0 @@ -from .lines import ( - LineCurvature2D, - LineNormals2D, - inverse3, -) - -__all__ = [ - LineCurvature2D, - LineNormals2D, - inverse3, -] diff --git a/oceans/sw_extras/__init__.py b/oceans/sw_extras/__init__.py deleted file mode 100644 index b2f5726..0000000 --- a/oceans/sw_extras/__init__.py +++ /dev/null @@ -1,47 +0,0 @@ -from .gamma_GP_from_SP_pt import gamma_GP_from_SP_pt -from .sw_extras import ( - N, - cor_beta, - cph, - cr_depth, - inertial_period, - kdpar, - photic_depth, - psu2ppt, - richnumb, - shear, - sigma_t, - sigmatheta, - soundspeed, - spice, - strat_period, - tcond, - visc, - zmld_boyer, - zmld_so, -) -from .waves import Waves - -__all__ = [ - N, - Waves, - cor_beta, - cph, - cr_depth, - gamma_GP_from_SP_pt, - inertial_period, - kdpar, - photic_depth, - psu2ppt, - richnumb, - shear, - sigma_t, - sigmatheta, - soundspeed, - spice, - strat_period, - tcond, - visc, - zmld_boyer, - zmld_so, -] diff --git a/oceans/sw_extras/gamma_GP_from_SP_pt.py b/oceans/sw_extras/gamma_GP_from_SP_pt.py index 058af80..836f702 100644 --- a/oceans/sw_extras/gamma_GP_from_SP_pt.py +++ b/oceans/sw_extras/gamma_GP_from_SP_pt.py @@ -6,7 +6,7 @@ def in_polygon(xp, yp, polygon, transform=None, radius=0.0): Check is points `xp` and `yp` are inside the `polygon`. Polygon is a `matplotlib.path.Path` object. - http://stackoverflow.com/questions/21328854/shapely-and-matplotlib-point-in-polygon-not-accurate-with-geolocation + https://stackoverflow.com/questions/21328854/shapely-and-matplotlib-point-in-polygon-not-accurate-with-geolocation Examples -------- @@ -238,7 +238,7 @@ def gamma_GP_from_SP_pt(SP, pt, p, lon, lat): Examples -------- - >>> from oceans.sw_extras import gamma_GP_from_SP_pt + >>> from oceans.sw_extras.gamma_GP_from_SP_pt import gamma_GP_from_SP_pt >>> SP = [35.066, 35.086, 35.089, 35.078, 35.025, 34.851, 34.696, 34.572, ... 34.531, 34.509, 34.496, 34.452, 34.458, 34.456, 34.488, 34.536, ... 34.579, 34.612, 34.642, 34.657, 34.685, 34.707, 34.72, 34.729] diff --git a/oceans/sw_extras/sw_extras.py b/oceans/sw_extras/sw_extras.py index 8d2a4b3..7c4da22 100644 --- a/oceans/sw_extras/sw_extras.py +++ b/oceans/sw_extras/sw_extras.py @@ -1,11 +1,3 @@ -""" -Extra seawater functions -======================== - -""" - -from __future__ import (absolute_import, division, print_function) - from copy import copy import numpy as np @@ -41,7 +33,7 @@ def sigma_t(s, t, p): -------- >>> # Data from UNESCO Tech. Paper in Marine Sci. No. 44, p22. >>> from seawater.library import T90conv - >>> from oceans import sw_extras as swe + >>> import oceans.sw_extras.sw_extras as swe >>> s = [0, 0, 0, 0, 35, 35, 35, 35] >>> t = T90conv([0, 0, 30, 30, 0, 0, 30, 30]) >>> p = [0, 10000, 0, 10000, 0, 10000, 0, 10000] @@ -51,12 +43,12 @@ def sigma_t(s, t, p): References ---------- - .. [1] Fofonoff, P. and Millard, R.C. Jr UNESCO 1983. Algorithms for + Fofonoff, P. and Millard, R.C. Jr UNESCO 1983. Algorithms for computation of fundamental properties of seawater. UNESCO Tech. Pap. in Mar. Sci., No. 44, 53 pp. Eqn.(31) p.39. http://www.scor-int.org/Publications.htm - .. [2] Millero, F.J., Chen, C.T., Bradshaw, A., and Schleicher, K. A new + Millero, F.J., Chen, C.T., Bradshaw, A., and Schleicher, K. A new high pressure equation of state for seawater. Deap-Sea Research., 1980, Vol27A, pp255-264. doi:10.1016/0198-0149(80)90016-3 @@ -93,7 +85,7 @@ def sigmatheta(s, t, p, pr=0): -------- >>> # Data from UNESCO Tech. Paper in Marine Sci. No. 44, p22. >>> from seawater.library import T90conv - >>> from oceans import sw_extras as swe + >>> import oceans.sw_extras.sw_extras as swe >>> s = [0, 0, 0, 0, 35, 35, 35, 35] >>> t = T90conv([0, 0, 30, 30, 0, 0, 30, 30]) >>> p = [0, 10000, 0, 10000, 0, 10000, 0, 10000] @@ -103,12 +95,12 @@ def sigmatheta(s, t, p, pr=0): References ---------- - .. [1] Fofonoff, P. and Millard, R.C. Jr UNESCO 1983. Algorithms for + Fofonoff, P. and Millard, R.C. Jr UNESCO 1983. Algorithms for computation of fundamental properties of seawater. UNESCO Tech. Pap. in Mar. Sci., No. 44, 53 pp. Eqn.(31) p.39. http://www.scor-int.org/Publications.htm - .. [2] Millero, F.J., Chen, C.T., Bradshaw, A., and Schleicher, K. A new + Millero, F.J., Chen, C.T., Bradshaw, A., and Schleicher, K. A new high pressure equation of state for seawater. Deap-Sea Research., 1980, Vol27A, pp255-264. doi:10.1016/0198-0149(80)90016-3 @@ -140,7 +132,7 @@ def N(bvfr2): Examples -------- >>> import numpy as np - >>> from oceans import sw_extras as swe + >>> import oceans.sw_extras.sw_extras as swe >>> s = np.array([[0, 0, 0], [15, 15, 15], [30, 30, 30],[35,35,35]]) >>> t = np.repeat(15, s.size).reshape(s.shape) >>> p = [[0], [250], [500], [1000]] @@ -153,10 +145,10 @@ def N(bvfr2): References ---------- - .. [1] A.E. Gill 1982. p.54 eqn 3.7.15 "Atmosphere-Ocean Dynamics" + A.E. Gill 1982. p.54 eqn 3.7.15 "Atmosphere-Ocean Dynamics" Academic Press: New York. ISBN: 0-12-283522-0 - .. [2] Jackett, David R., Trevor J. Mcdougall, 1995: Minimal Adjustment of + Jackett, David R., Trevor J. Mcdougall, 1995: Minimal Adjustment of Hydrographic Profiles to Achieve Static Stability. J. Atmos. Oceanic Technol., 12, 381-389. doi: 10.1175/1520-0426(1995)012<0381:MAOHPT>2.0.CO;2 @@ -182,7 +174,7 @@ def cph(bvfr2): Examples -------- >>> import numpy as np - >>> from oceans import sw_extras as swe + >>> import oceans.sw_extras.sw_extras as swe >>> s = np.array([[0, 0, 0], [15, 15, 15], [30, 30, 30],[35,35,35]]) >>> t = np.repeat(15, s.size).reshape(s.shape) >>> p = [[0], [250], [500], [1000]] @@ -194,7 +186,7 @@ def cph(bvfr2): References ---------- - .. [1] A.E. Gill 1982. p.54 eqn 3.7.15 "Atmosphere-Ocean Dynamics" + A.E. Gill 1982. p.54 eqn 3.7.15 "Atmosphere-Ocean Dynamics" Academic Press: New York. ISBN: 0-12-283522-0 """ @@ -230,7 +222,7 @@ def shear(z, u, v=0): Examples -------- - >>> from oceans import sw_extras as swe + >>> import oceans.sw_extras.sw_extras as swe >>> z = [[0], [250], [500], [1000]] >>> u = [[0.5, 0.5, 0.5], [0.15, 0.15, 0.15], ... [0.03, 0.03, .03], [0.,0.,0.]] @@ -284,7 +276,7 @@ def richnumb(bvfr2, S2): TODO: check the example and add real values >>> import numpy as np >>> import seawater as sw - >>> from oceans import sw_extras as swe + >>> import oceans.sw_extras.sw_extras as swe >>> s = np.array([[0, 0, 0], [15, 15, 15], [30, 30, 30],[ 35, 35, 35]]) >>> t = np.repeat(15, s.size).reshape(s.shape) >>> p = [[0], [250], [500], [1000]] @@ -330,16 +322,16 @@ def cor_beta(lat): Examples -------- - >>> from oceans import sw_extras as swe + >>> import oceans.sw_extras.sw_extras as swe >>> swe.cor_beta(0) 2.2891225867210798e-11 References ---------- - .. [1] S. Pond & G.Pickard 2nd Edition 1986 Introductory Dynamical + S. Pond & G.Pickard 2nd Edition 1986 Introductory Dynamical Oceanography Pergamon Press Sydney. ISBN 0-08-028728-X - .. [2] A.E. Gill 1982. p.54 eqn 3.7.15 "Atmosphere-Ocean Dynamics" + A.E. Gill 1982. p.54 eqn 3.7.15 "Atmosphere-Ocean Dynamics" Academic Press: New York. ISBN: 0-12-283522-0 """ @@ -366,7 +358,7 @@ def inertial_period(lat): Examples -------- - >>> from oceans import sw_extras as swe + >>> import oceans.sw_extras.sw_extras as swe >>> lat = 30. >>> swe.inertial_period(lat)/3600 23.93484986278565 @@ -397,7 +389,7 @@ def strat_period(N): -------- >>> import numpy as np >>> import seawater as sw - >>> from oceans import sw_extras as swe + >>> import oceans.sw_extras.sw_extras as swe >>> s = np.array([[0, 0, 0], [15, 15, 15], [30, 30, 30],[35,35,35]]) >>> t = np.repeat(15, s.size).reshape(s.shape) >>> p = [[0], [250], [500], [1000]] @@ -436,7 +428,7 @@ def visc(s, t, p): Examples -------- - >>> from oceans import sw_extras as swe + >>> import oceans.sw_extras.sw_extras as swe >>> swe.visc(40., 40., 1000.) 8.200192496633804e-07 @@ -475,14 +467,14 @@ def tcond(s, t, p): Examples -------- - >>> from oceans import sw_extras as swe + >>> import oceans.sw_extras.sw_extras as swe >>> swe.tcond(35, 20, 0) 0.5972445569999999 References ---------- - .. [1] Caldwell's DSR 21:131-137 (1974) eq. 9 - .. [2] Catelli et al.'s DSR 21:311-3179(1974) eq. 5 + Caldwell's DSR 21:131-137 (1974) eq. 9 + Catelli et al.'s DSR 21:311-3179(1974) eq. 5 Modifications: Original 1998/01/19 - Ayal Anis 1998 @@ -535,13 +527,13 @@ def spice(s, t, p): Examples -------- - >>> from oceans import sw_extras as swe + >>> import oceans.sw_extras.sw_extras as swe >>> swe.spice(33, 15, 0) array(0.54458641) References ---------- - .. [1] A state variable for characterizing water masses and their + A state variable for characterizing water masses and their diffusive stability: spiciness. Prog. in Oceanography Volume 54, 2002, Pages 493-501. diff --git a/oceans/sw_extras/waves.py b/oceans/sw_extras/waves.py index 7484c0e..207724b 100644 --- a/oceans/sw_extras/waves.py +++ b/oceans/sw_extras/waves.py @@ -36,7 +36,7 @@ class Waves(object): Examples -------- - >>> from oceans.sw_extras import Waves + >>> from oceans.sw_extras.waves import Waves >>> wav = Waves(h=10, T=5, L=None) >>> print("ho/Lo = %s" % wav.hoLo) ho/Lo = 0.2561951195588007 diff --git a/oceans/ocfis/synop.py b/oceans/synop.py similarity index 100% rename from oceans/ocfis/synop.py rename to oceans/synop.py diff --git a/requirements-dev.txt b/requirements-dev.txt index 65e4366..ec02f5d 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,4 +1,5 @@ cartopy +doctr flake8 flake8-builtins flake8-comprehensions @@ -7,7 +8,9 @@ flake8-mutable flake8-print flake8-quotes iris +nbsphinx netcdf4 pandas pytest scipy +sphinx