Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pre-commit #41

Merged
merged 13 commits into from
Jan 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .github/workflows/label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ on: [pull_request]

jobs:
label:

runs-on: ubuntu-latest

steps:
- uses: actions/labeler@v2
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/labeler@v2
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
34 changes: 34 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v4.1.0"
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-docstring-first
- id: check-yaml

- repo: https://github.com/asottile/pyupgrade
rev: "v2.31.0"
hooks:
- id: pyupgrade
args: [--py36-plus]

- repo: https://github.com/PyCQA/isort
rev: "5.10.1"
hooks:
- id: isort

- repo: https://github.com/psf/black
rev: "21.12b0"
hooks:
- id: black

- repo: https://github.com/PyCQA/flake8
rev: "4.0.1"
hooks:
- id: flake8

- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v2.5.1"
hooks:
- id: prettier
5 changes: 1 addition & 4 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
version: 2


build:
image: latest


# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py


#conda:
# environment: docs/environment.yml

# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.6
# setup_py_install: false
# setup_py_install: false

install:
- requirements: docs/requirements.txt
6 changes: 3 additions & 3 deletions .stickler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ fixers:
review:
fail_on_comments: false
files:
ignore:
- 'docs/**/*'
- 'monet/data/*'
ignore:
- "docs/**/*"
- "monet/data/*"
7 changes: 2 additions & 5 deletions .travis.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
language: python


branches:
only:
- master
- develop
- master
- develop

before_install:
- chmod +x miniconda.sh
Expand All @@ -13,9 +12,7 @@ before_install:
- conda config --set always_yes yes --set changeps1 no
- conda update --yes conda


install:
- conda install -c bbakernoaa monet

# after_success:
# - test $TRAVIS_BRANCH = "master" && conda install conda-build && conda install anaconda-client && bash conda/conda_upload.sh
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## The Model and ObservatioN Evaluation Tool I/O

This is a tool developed at NOAA ARL to handle I/O operations for atmospheric composition for python. It was originally part of the Model and ObservatioN Evaluation Tool (MONET; see Baker and Li (2017)).
This is a tool developed at NOAA ARL to handle I/O operations for atmospheric composition for python. It was originally part of the Model and ObservatioN Evaluation Tool (MONET; see Baker and Li (2017)).

Please refer to the readthedocs page at monetio.readthedocs.io for the documentation.
Please refer to the readthedocs page at monetio.readthedocs.io for the documentation.

Baker, Barry; Pan, Li. 2017. “Overview of the Model and Observation Evaluation Toolkit (MONET) Version 1.0 for Evaluating Atmospheric Transport Models.” Atmosphere 8, no. 11: 210
2 changes: 1 addition & 1 deletion docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ help:
# 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)
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
10 changes: 5 additions & 5 deletions docs/_static/style.css
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
@import url("theme.css");

.wy-side-nav-search>a img.logo,
.wy-side-nav-search .wy-dropdown>a img.logo {
width: 12rem
.wy-side-nav-search > a img.logo,
.wy-side-nav-search .wy-dropdown > a img.logo {
width: 12rem;
}

.wy-side-nav-search {
background-color: #eee;
}

.wy-side-nav-search>div.version {
.wy-side-nav-search > div.version {
display: none;
}

.wy-nav-top {
background-color: #ffffff;
}
}
4 changes: 2 additions & 2 deletions docs/_templates/layout.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
{% extends "!layout.html" %}
{% set css_files = css_files + ["_static/style.css"] %}
{% extends "!layout.html" %} {% set css_files = css_files +
["_static/style.css"] %}
64 changes: 34 additions & 30 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
Expand All @@ -23,18 +22,18 @@ def __getattr__(cls, name):
return MagicMock()


#sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)
sys.path.insert(0, os.path.abspath('../'))
# sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)
sys.path.insert(0, os.path.abspath("../"))
# -- Project information -----------------------------------------------------

project = u'monetio'
copyright = u'2018, Barry Baker'
author = u'Barry Baker'
project = "monetio"
copyright = "2018, Barry Baker"
author = "Barry Baker"

# The short X.Y version
version = u''
version = ""
# The full version, including alpha/beta/rc tags
release = u''
release = ""

# -- General configuration ---------------------------------------------------

Expand All @@ -46,14 +45,16 @@ def __getattr__(cls, name):
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc', 'sphinx.ext.autosummary', 'sphinx.ext.napoleon',
'sphinx.ext.extlinks'
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.napoleon",
"sphinx.ext.extlinks",
]
#exclude_patterns = ['_build', '**.ipynb_checkpoints']
# exclude_patterns = ['_build', '**.ipynb_checkpoints']

extlinks = {
'issue': ('https://github.com/noaa-oar-arl/monetio/issues/%s', 'GH'),
'pull': ('https://github.com/noaa-oar-arl/monetio/pull/%s', 'PR'),
"issue": ("https://github.com/noaa-oar-arl/monetio/issues/%s", "GH"),
"pull": ("https://github.com/noaa-oar-arl/monetio/pull/%s", "PR"),
}

autosummary_generate = True
Expand All @@ -63,16 +64,16 @@ def __getattr__(cls, name):
napoleon_use_ivar = False # True

# 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 master toctree document.
master_doc = 'index'
master_doc = "index"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand All @@ -84,17 +85,17 @@ def __getattr__(cls, name):
# 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 = [u'_build', 'Thumbs.db', '.DS_Store']
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = "sphinx"

# -- 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 = 'sphinx_rtd_theme'
html_theme = "sphinx_rtd_theme"

# 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
Expand All @@ -105,7 +106,7 @@ def __getattr__(cls, name):
# 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"]

# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
Expand All @@ -120,10 +121,10 @@ def __getattr__(cls, name):
# -- Options for HTMLHelp output ---------------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = 'monetiodoc'
htmlhelp_basename = "monetiodoc"

html_theme_options = {
'logo_only': True,
"logo_only": True,
}

# Add any paths that contain custom themes here, relative to this directory.
Expand All @@ -146,15 +147,12 @@ def __getattr__(cls, name):
# 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',
Expand All @@ -164,24 +162,30 @@ def __getattr__(cls, name):
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'monetio.tex', u'monetio Documentation', u'Barry Baker',
'manual'),
(master_doc, "monetio.tex", "monetio Documentation", "Barry Baker", "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, 'monetio', u'monetio Documentation', [author], 1)]
man_pages = [(master_doc, "monetio", "monetio 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, 'monetio', u'monetio Documentation', author, 'monetio',
'One line description of project.', 'Miscellaneous'),
(
master_doc,
"monetio",
"monetio Documentation",
author,
"monetio",
"One line description of project.",
"Miscellaneous",
),
]

# -- Extension configuration -------------------------------------------------
12 changes: 4 additions & 8 deletions docs/models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ where pm25 is a :py:class:`~xarray.DataArray` as it is a single variable.
Prep-Chem-Sources
-----------------

A reader and writer was built into
A reader and writer was built into


HYSPLIT
Expand Down Expand Up @@ -250,7 +250,7 @@ To calcluate mass loading

All points with value below or equal to threshold will be returned as 0.
mult is a multiplicative factor applied before the thresholding.
species can be a list of values from the "Species ID" attribute.
species can be a list of values from the "Species ID" attribute.
If it is None then all species will be used.

To find top heights
Expand All @@ -261,11 +261,7 @@ To find top heights

returns xarray DataArray which gives top height of each level which contains mass loading higher
than the given threshold value. mult is a mutiplicative factor applied before thresholding.
height_mult is a multiplicative factor used to convert heights from meters to some other unit.
height_mult is a multiplicative factor used to convert heights from meters to some other unit.
In this example heights are converted to km.
mass_load is a boolean which indicates whether the height should be determined from the mass loading value (True)
or the concentration value (False).




or the concentration value (False).
2 changes: 1 addition & 1 deletion monetio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def dataset_to_monet(dset, lat_name="lat", lon_name="lon", latlon2d=False):


def coards_to_netcdf(dset, lat_name="lat", lon_name="lon"):
from numpy import meshgrid, arange
from numpy import arange, meshgrid

lon = dset[lon_name]
lat = dset[lat_name]
Expand Down
2 changes: 1 addition & 1 deletion monetio/data/sn_bound_10deg.txt

Large diffs are not rendered by default.

Loading