diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..5e25f1e --- /dev/null +++ b/.flake8 @@ -0,0 +1,5 @@ +[flake8] +ignore = C901, E203, E266, E501, W503, B905 +max-line-length = 88 +max-complexity = 18 +select = B,C,E,F,W,T4,B9 diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 0000000..386b7fe --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,3 @@ +# Migrate code style to Black +6dcff756be4bb836fcb3845fdc5fc78e678a9db8 +3a887ce1521f96f8499d3531d5b52c1ad7af14d1 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 3c0ad60..6e968a1 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -26,7 +26,7 @@ jobs: if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository - + runs-on: ubuntu-latest steps: @@ -36,5 +36,8 @@ jobs: - name: Install dependencies run: pip install nox + - name: Check for lint + run: nox -s lint + - name: Build documentation run: nox -s build-docs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d28e3f9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,135 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +pip-wheel-metadata/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +.python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# DS_Store +*.DS_Store + +# backup files +*.bak diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..7d45453 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,48 @@ +repos: +- repo: https://github.com/psf/black + rev: 23.1.0 + hooks: + - id: black + name: black + description: "Black: The uncompromising Python code formatter" + entry: black + language: python + language_version: python3 + minimum_pre_commit_version: 2.9.2 + require_serial: true + types_or: [python, pyi] + +- repo: https://github.com/pycqa/flake8 + rev: 6.0.0 + hooks: + - id: flake8 + additional_dependencies: + - flake8-bugbear + - flake8-comprehensions + - flake8-simplify + +- repo: https://github.com/asottile/pyupgrade + rev: v3.3.1 + hooks: + - id: pyupgrade + args: [--py39-plus] + +- repo: https://github.com/PyCQA/isort + rev: 5.12.0 + hooks: + - id: isort + files: \.py$ + +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: check-builtin-literals + - id: check-added-large-files + - id: check-case-conflict + - id: check-toml + - id: check-yaml + - id: debug-statements + - id: end-of-file-fixer + - id: forbid-new-submodules + - id: mixed-line-ending + - id: trailing-whitespace diff --git a/LICENSE b/LICENSE index ce0308d..0f18cdf 100644 --- a/LICENSE +++ b/LICENSE @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file +SOFTWARE. diff --git a/docs/source/bmi.best_practices.rst b/docs/source/bmi.best_practices.rst index 5737310..60cc95e 100644 --- a/docs/source/bmi.best_practices.rst +++ b/docs/source/bmi.best_practices.rst @@ -30,7 +30,7 @@ here are some tips to help when writing a BMI for a model. standardized names makes it easier for a framework (or a human) to match input and output variables between models. -* Don't change the variable names for exchange items +* Don't change the variable names for exchange items you currently use within your model to :term:`Standard Names`. Instead, find a `matching`_ Standard Name for each variable and then diff --git a/docs/source/bmi.getter_setter.rst b/docs/source/bmi.getter_setter.rst index 4bfa28e..e3eb1c4 100644 --- a/docs/source/bmi.getter_setter.rst +++ b/docs/source/bmi.getter_setter.rst @@ -13,7 +13,7 @@ so getters are called to get current values. A *setter* is a function called to change/overwrite a variable in a model's state. A setter may impose restrictions on how a -state variable can be changed or check the new data for validity. +state variable can be changed or check the new data for validity. .. _get_value: diff --git a/docs/source/bmi.grid_funcs.rst b/docs/source/bmi.grid_funcs.rst index 341c5ef..df9fc08 100644 --- a/docs/source/bmi.grid_funcs.rst +++ b/docs/source/bmi.grid_funcs.rst @@ -3,7 +3,7 @@ Model grid functions -------------------- -The functions in this section describe :ref:`model grids `. +The functions in this section describe :ref:`model grids `. In the BMI, every :term:`exchange item` is defined on a grid, and is referenced by a :term:`grid identifier` @@ -395,7 +395,7 @@ Get the number of :term:`faces ` in the grid. Get the edge-node connectivity. For each edge, connectivity is given as node at edge tail, followed by -node at edge head. The total length of the array is +node at edge head. The total length of the array is 2 * :ref:`get_grid_edge_count`. **Implementation notes** @@ -451,7 +451,7 @@ Get the face-node connectivity. For each face, the nodes (listed in a counter-clockwise direction) that form the boundary of the face. -For a grid of quadrilaterals, +For a grid of quadrilaterals, the total length of the array is 4 * :ref:`get_grid_face_count`. More generally, the length of the array is the sum of the values of diff --git a/docs/source/bmi.info_funcs.rst b/docs/source/bmi.info_funcs.rst index 67e76a4..74f4ba9 100644 --- a/docs/source/bmi.info_funcs.rst +++ b/docs/source/bmi.info_funcs.rst @@ -4,7 +4,7 @@ Model information functions --------------------------- These functions supply the model name -and the model's :term:`exchange items ` -- +and the model's :term:`exchange items ` -- the variables that the model can use from and provide to other models that have a BMI. diff --git a/docs/source/bmi.spec.rst b/docs/source/bmi.spec.rst index 40f82f7..7511a94 100644 --- a/docs/source/bmi.spec.rst +++ b/docs/source/bmi.spec.rst @@ -24,7 +24,7 @@ grouped by functional category. :widths: 30, 70 ============================== ========================================= - Function Description + Function Description ============================== ========================================= :ref:`initialize` Perform startup tasks for the model. :ref:`update` Advance model state by one time step. diff --git a/docs/source/bmi.var_funcs.rst b/docs/source/bmi.var_funcs.rst index 110f887..2cdb601 100644 --- a/docs/source/bmi.var_funcs.rst +++ b/docs/source/bmi.var_funcs.rst @@ -7,7 +7,7 @@ These BMI functions provide information about a particular input or output variable. They must accommodate any variable returned from the :ref:`get_input_var_names` or :ref:`get_output_var_names` functions -- -the variable name is used as an argument in each function. +the variable name is used as an argument in each function. Based on the information returned, type or unit conversions can be applied when necessary. diff --git a/docs/source/conf.py b/docs/source/conf.py index 6e4196c..b42834c 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # bmi documentation build configuration file, created by # sphinx-quickstart on Tue Jan 3 13:30:36 2017. @@ -12,57 +11,54 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import sys -import os -import shlex # 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. -#sys.path.insert(0, os.path.abspath('.')) +# sys.path.insert(0, os.path.abspath('.')) # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. -#needs_sphinx = '1.0' +# 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.intersphinx', - 'sphinx.ext.todo', - 'sphinx.ext.imgmath', - 'sphinx.ext.viewcode', + "sphinx.ext.intersphinx", + "sphinx.ext.todo", + "sphinx.ext.imgmath", + "sphinx.ext.viewcode", ] # Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] +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' +source_suffix = ".rst" # The encoding of source files. -#source_encoding = 'utf-8-sig' +# source_encoding = 'utf-8-sig' # The master toctree document. -master_doc = 'index' +master_doc = "index" # General information about the project. -project = u'bmi' -copyright = u'2021, Community Surface Dynamics Modeling System' -author = u'Community Surface Dynamics Modeling System' +project = "bmi" +copyright = "2021, Community Surface Dynamics Modeling System" +author = "Community Surface Dynamics Modeling System" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. -version = '2.0' +version = "2.0" # The full version, including alpha/beta/rc tags. -release = '2.0' +release = "2.0" # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -73,46 +69,46 @@ # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: -#today = '' +# today = '' # Else, today_fmt is used as the format for a strftime call. -#today_fmt = '%B %d, %Y' +# today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = [ - 'bmi.spec.rst', - 'bmi.control_funcs.rst', - 'bmi.info_funcs.rst', - 'bmi.var_funcs.rst', - 'bmi.time_funcs.rst', - 'bmi.getter_setter.rst', - 'bmi.grid_funcs.rst', - 'bmi.metadata_funcs.rst', + "bmi.spec.rst", + "bmi.control_funcs.rst", + "bmi.info_funcs.rst", + "bmi.var_funcs.rst", + "bmi.time_funcs.rst", + "bmi.getter_setter.rst", + "bmi.grid_funcs.rst", + "bmi.metadata_funcs.rst", ] # The reST default role (used for this markup: `text`) to use for all # documents. -#default_role = None +# default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. -#add_function_parentheses = True +# add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). -#add_module_names = True +# add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. -#show_authors = False +# show_authors = False # The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' +pygments_style = "sphinx" # A list of ignored prefixes for module index sorting. -#modindex_common_prefix = [] +# modindex_common_prefix = [] # If true, keep warnings as "system message" paragraphs in the built documents. -#keep_warnings = False +# keep_warnings = False # If true, `todo` and `todoList` produce output, else they produce nothing. todo_include_todos = True @@ -122,22 +118,22 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = 'alabaster' +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 = {} +# html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. -#html_theme_path = [] +# html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". -#html_title = None +# html_title = None # A shorter title for the navigation bar. Default is the same as html_title. -#html_short_title = None +# html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. @@ -146,25 +142,25 @@ # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. -#html_favicon = None +# html_favicon = None # 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'] +html_static_path = ["_static"] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied # directly to the root of the documentation. -#html_extra_path = [] +# html_extra_path = [] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. -#html_last_updated_fmt = '%b %d, %Y' +# html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. -#html_use_smartypants = True +# html_use_smartypants = True # Custom sidebar templates, maps document names to template names. html_sidebars = { @@ -181,112 +177,111 @@ "searchbox.html", "localtoc.html", "sourcelink.html", - ] + ], } # Additional templates that should be rendered to pages, maps page names to # template names. -#html_additional_pages = {} +# html_additional_pages = {} # If false, no module index is generated. -#html_domain_indices = True +# html_domain_indices = True # If false, no index is generated. -#html_use_index = True +# html_use_index = True # If true, the index is split into individual pages for each letter. -#html_split_index = False +# html_split_index = False # If true, links to the reST sources are added to the pages. -#html_show_sourcelink = True +# html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -#html_show_sphinx = True +# html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -#html_show_copyright = True +# html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. -#html_use_opensearch = '' +# html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). -#html_file_suffix = None +# html_file_suffix = None # Language to be used for generating the HTML full-text search index. # Sphinx supports the following languages: # 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' # 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr' -#html_search_language = 'en' +# html_search_language = 'en' # A dictionary with options for the search language support, empty by default. # Now only 'ja' uses this config value -#html_search_options = {'type': 'default'} +# html_search_options = {'type': 'default'} # The name of a javascript file (relative to the configuration directory) that # implements a search results scorer. If empty, the default will be used. -#html_search_scorer = 'scorer.js' +# html_search_scorer = 'scorer.js' # Output file base name for HTML help builder. -htmlhelp_basename = 'bmidoc' +htmlhelp_basename = "bmidoc" # -- 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', + # 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]). +# author, documentclass [howto, manual, or own class]). latex_documents = [ - (master_doc, 'bmi.tex', u'BMI Documentation', - u'Community Surface Dynamics Modeling System', 'manual'), + ( + master_doc, + "bmi.tex", + "BMI Documentation", + "Community Surface Dynamics Modeling System", + "manual", + ), ] # The name of an image file (relative to this directory) to place at the top of # the title page. -#latex_logo = None +# latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. -#latex_use_parts = False +# latex_use_parts = False # If true, show page references after internal links. -#latex_show_pagerefs = False +# latex_show_pagerefs = False # If true, show URL addresses after external links. -#latex_show_urls = False +# latex_show_urls = False # Documents to append as an appendix to all manuals. -#latex_appendices = [] +# latex_appendices = [] # If false, no module index is generated. -#latex_domain_indices = True +# latex_domain_indices = True # -- 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, 'bmi', u'BMI Documentation', - [author], 1) -] +man_pages = [(master_doc, "bmi", "BMI Documentation", [author], 1)] # If true, show URL addresses after external links. -#man_show_urls = False +# man_show_urls = False # -- Options for Texinfo output ------------------------------------------- @@ -295,23 +290,29 @@ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - (master_doc, 'bmi', u'BMI Documentation', - author, 'bmi', 'One line description of project.', - 'Miscellaneous'), + ( + master_doc, + "bmi", + "BMI Documentation", + author, + "bmi", + "One line description of project.", + "Miscellaneous", + ), ] # Documents to append as an appendix to all manuals. -#texinfo_appendices = [] +# texinfo_appendices = [] # If false, no module index is generated. -#texinfo_domain_indices = True +# texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. -#texinfo_show_urls = 'footnote' +# texinfo_show_urls = 'footnote' # If true, do not generate a @detailmenu in the "Top" node's menu. -#texinfo_no_detailmenu = False +# texinfo_no_detailmenu = False # Example configuration for intersphinx: refer to the Python standard library. -intersphinx_mapping = {'python': ('https://docs.python.org/3', None)} +intersphinx_mapping = {"python": ("https://docs.python.org/3", None)} diff --git a/docs/source/council.rst b/docs/source/council.rst index 65e0512..350f517 100644 --- a/docs/source/council.rst +++ b/docs/source/council.rst @@ -1,2 +1,17 @@ Steering Council ================ + +The current members of the BMI Council are: + +* Ryan Cabell (NCAR) +* Niels Drost (eScience Center) +* Joe Hughes (USGS) +* Rolf Hut (TU Delft) +* Eric Hutton (CSDMS) +* Bert Jagers (Deltares) +* Allen Lee (CoMSES Net) +* Rich McDonald (USGS) +* Fred Ogden (NOAA) +* Scott Peckham (University of Colorado and NOAA) +* Mark Piper (CSDMS) +* Greg Tucker (University of Colorado and CSDMS) diff --git a/docs/source/csdms.rst b/docs/source/csdms.rst index 2f539be..7e90588 100644 --- a/docs/source/csdms.rst +++ b/docs/source/csdms.rst @@ -4,7 +4,7 @@ BMI-based tools: *babelizer* and *pymt* ======================================= A model that provides the BMI functions can be converted -to a plug-and-play component +to a plug-and-play component that runs in the CSDMS `Python Modeling Toolkit`_ (*pymt*). This conversion process can be done automatically with the CSDMS `Babelizer`_, which generates diff --git a/docs/source/governance.rst b/docs/source/governance.rst index 5be1e9a..e6e7fb1 100644 --- a/docs/source/governance.rst +++ b/docs/source/governance.rst @@ -310,7 +310,7 @@ Institutional Partner benefits are: * Ability to influence the Project through the participation of their Council Member. -A list of current Institutional Partners is maintained at the page +A list of current Institutional Partners is maintained at the page `Institutional Partners`_. Document history diff --git a/docs/source/images/visualize_grids.py b/docs/source/images/visualize_grids.py index 28e09a0..9a4f92b 100644 --- a/docs/source/images/visualize_grids.py +++ b/docs/source/images/visualize_grids.py @@ -4,11 +4,10 @@ This example is based on the matplotlib demo of a PathPatch object, https://matplotlib.org/examples/shapes_and_collections/path_patch_demo.html. """ -import matplotlib.path as mpath import matplotlib.patches as mpatches +import matplotlib.path as mpath import matplotlib.pyplot as plt - # Pairs of grid points; the output from get_grid_x and get_grid_y x = [0, 1, 2, 1, 3, 4] y = [3, 1, 2, 4, 0, 3] @@ -34,48 +33,104 @@ ] codes, verts = zip(*path_data) path = Path(verts, codes) -patch = mpatches.PathPatch(path, facecolor='gray', alpha=0.25) +patch = mpatches.PathPatch(path, facecolor="gray", alpha=0.25) ax.add_patch(patch) # plot control points and connecting lines vx, vy = zip(*path.vertices) -line, = ax.plot(vx, vy, 'go-') +(line,) = ax.plot(vx, vy, "go-") -plt.text(4.15, 1.8, 'nodes', color='r', fontsize=12, va='center') -plt.text(4.15, 1.5, 'edges', color='b', style='italic', fontsize=12, va='center') -plt.text(4.15, 1.2, 'faces', weight='bold', fontsize=12, va='center') +plt.text(4.15, 1.8, "nodes", color="r", fontsize=12, va="center") +plt.text(4.15, 1.5, "edges", color="b", style="italic", fontsize=12, va="center") +plt.text(4.15, 1.2, "faces", weight="bold", fontsize=12, va="center") # Nodes -for i in range(len(x)-2): - plt.text(x[i]-0.2, y[i], str(i), color='r', fontsize=12) -plt.text(x[4]+0.1, y[4], '4', color='r', fontsize=12) -plt.text(x[5], y[5]+0.1, '5', color='r', fontsize=12) +for i in range(len(x) - 2): + plt.text(x[i] - 0.2, y[i], str(i), color="r", fontsize=12) +plt.text(x[4] + 0.1, y[4], "4", color="r", fontsize=12) +plt.text(x[5], y[5] + 0.1, "5", color="r", fontsize=12) # Edges -plt.text(0.5*(x[0]+x[1])+0.05, 0.5*(y[0]+y[1]), '0', color='b', style='italic', fontsize=12) -plt.text(0.5*(x[1]+x[2])-0.15, 0.5*(y[1]+y[2]), '1', color='b', style='italic', fontsize=12) -plt.text(0.5*(x[2]+x[3])+0.05, 0.5*(y[2]+y[3]), '2', color='b', style='italic', fontsize=12) -plt.text(0.5*(x[3]+x[0]), 0.5*(y[3]+y[0])-0.15, '3', color='b', style='italic', fontsize=12) -plt.text(0.5*(x[1]+x[4]), 0.5*(y[1]+y[4])+0.05, '4', color='b', style='italic', fontsize=12) -plt.text(0.5*(x[4]+x[5])-0.15, 0.5*(y[4]+y[5]), '5', color='b', style='italic', fontsize=12) -plt.text(0.5*(x[5]+x[2]), 0.5*(y[5]+y[2])-0.15, '6', color='b', style='italic', fontsize=12) -plt.text(0.5*(x[5]+x[3]), 0.5*(y[5]+y[3])+0.05, '7', color='b', style='italic', fontsize=12) +plt.text( + 0.5 * (x[0] + x[1]) + 0.05, + 0.5 * (y[0] + y[1]), + "0", + color="b", + style="italic", + fontsize=12, +) +plt.text( + 0.5 * (x[1] + x[2]) - 0.15, + 0.5 * (y[1] + y[2]), + "1", + color="b", + style="italic", + fontsize=12, +) +plt.text( + 0.5 * (x[2] + x[3]) + 0.05, + 0.5 * (y[2] + y[3]), + "2", + color="b", + style="italic", + fontsize=12, +) +plt.text( + 0.5 * (x[3] + x[0]), + 0.5 * (y[3] + y[0]) - 0.15, + "3", + color="b", + style="italic", + fontsize=12, +) +plt.text( + 0.5 * (x[1] + x[4]), + 0.5 * (y[1] + y[4]) + 0.05, + "4", + color="b", + style="italic", + fontsize=12, +) +plt.text( + 0.5 * (x[4] + x[5]) - 0.15, + 0.5 * (y[4] + y[5]), + "5", + color="b", + style="italic", + fontsize=12, +) +plt.text( + 0.5 * (x[5] + x[2]), + 0.5 * (y[5] + y[2]) - 0.15, + "6", + color="b", + style="italic", + fontsize=12, +) +plt.text( + 0.5 * (x[5] + x[3]), + 0.5 * (y[5] + y[3]) + 0.05, + "7", + color="b", + style="italic", + fontsize=12, +) # Faces -plt.text(0.9, 2.5, '0', weight='bold', fontsize=12) -plt.text(2.5, 1.3, '1', weight='bold', fontsize=12) -plt.text(2.3, 2.9, '2', weight='bold', fontsize=12) +plt.text(0.9, 2.5, "0", weight="bold", fontsize=12) +plt.text(2.5, 1.3, "1", weight="bold", fontsize=12) +plt.text(2.3, 2.9, "2", weight="bold", fontsize=12) ax.grid(alpha=0.5) -ax.axis('equal') -ax.set_xlabel('x') -ax.set_ylabel('y') -ax.set_xticks(list(range(-1,6))) -ax.set_yticks(list(range(-1,6))) +ax.axis("equal") +ax.set_xlabel("x") +ax.set_ylabel("y") +ax.set_xticks(list(range(-1, 6))) +ax.set_yticks(list(range(-1, 6))) show = False if show is True: plt.show() else: - plt.savefig('mesh_unstructured.png', dpi=300) + plt.savefig("mesh_unstructured.png", dpi=300) plt.close() diff --git a/docs/source/index.rst b/docs/source/index.rst index d4fcf56..0f91351 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -56,8 +56,8 @@ in which the BMI is implemented. ======== ============= ============== ====================== C `bmi.h`_ `bmi-c`_ `bmi-example-c`_ C++ `bmi.hxx`_ `bmi-cxx`_ `bmi-example-cxx`_ - Fortran `bmi.f90`_ `bmi-fortran`_ `bmi-example-fortran`_ - Java `bmi.java`_ `bmi-java`_ `bmi-example-java`_ + Fortran `bmi.f90`_ `bmi-fortran`_ `bmi-example-fortran`_ + Java `bmi.java`_ `bmi-java`_ `bmi-example-java`_ Python `bmi.py`_ `bmi-python`_ `bmi-example-python`_ ======== ============= ============== ====================== @@ -72,7 +72,7 @@ for two languages, Javascript and Julia. ========== ============= ============ ===================== Language Specification Repository Example ========== ============= ============ ===================== - Javascript `bmi.js`_ `bmi-js`_ `bmi-example-js`_ + Javascript `bmi.js`_ `bmi-js`_ `bmi-example-js`_ Julia `bmi.jl`_ `bmi-julia`_ `bmi-example-julia`_ ========== ============= ============ ===================== diff --git a/docs/source/model_grids.rst b/docs/source/model_grids.rst index b1cfc27..cbe9657 100644 --- a/docs/source/model_grids.rst +++ b/docs/source/model_grids.rst @@ -184,9 +184,9 @@ are given by coordinates x = [0, 1, 2, 1, 3, 4] y = [3, 1, 2, 4, 0, 3] -These will be the outputs of the :ref:`get_grid_x` and +These will be the outputs of the :ref:`get_grid_x` and :ref:`get_grid_y` functions, respectively. -The nodes are indexed, so +The nodes are indexed, so node 0 is at *(x, y) = (0, 3)*, node 1 is at *(x, y) = (1, 1)*, etc. @@ -194,7 +194,7 @@ As with the grid nodes, the grid :term:`edges ` and :term:`faces ` are indexed. In the figure, the edges are depicted in blue italics, -while the faces are boldfaced. +while the faces are boldfaced. The outputs from :ref:`get_grid_node_count`, :ref:`get_grid_edge_count`, and :ref:`get_grid_face_count` are: diff --git a/noxfile.py b/noxfile.py index 5db560a..17614ff 100644 --- a/noxfile.py +++ b/noxfile.py @@ -7,6 +7,13 @@ ROOT = pathlib.Path(__file__).parent +@nox.session +def lint(session: nox.Session) -> None: + """Look for lint.""" + session.install("pre-commit") + session.run("pre-commit", "run", "--all-files") + + @nox.session(name="build-docs") def build_docs(session: nox.Session) -> None: """Build the docs.""" diff --git a/paper/paper.md b/paper/paper.md index 2487241..1e9e17b 100644 --- a/paper/paper.md +++ b/paper/paper.md @@ -34,7 +34,7 @@ bibliography: paper.bib Component modeling is a research technique in which new models are constructed by coupling the inputs and outputs -of simpler existing models. +of simpler existing models. Component modeling traces its roots to component-based software engineering, where a software system is constructed from a number @@ -96,7 +96,7 @@ and an example implementation are listed in Table 1 below. Detailed instructions for building the language specification and example are given within each repository. -\ +\ **Table 1:** Repositories containing BMI language specifications and examples.