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

Migrate RAVEN GIS utilities and fix the documentation #68

Merged
merged 48 commits into from
Mar 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
d7c60e6
backport gis utilities from RAVEN and refactor gis.py to geoserver.py
Zeitsperre Mar 2, 2021
26e37b3
backport gis utilities from RAVEN and refactor gis.py to geoserver.py
Zeitsperre Mar 2, 2021
edb55e8
Fix missing Point import
Zeitsperre Mar 2, 2021
8095ac3
Adjusted tests and functions to work closer to intended purposes
Zeitsperre Mar 2, 2021
c6c6750
Docstring typos, cleaner exceptions, and other small fixes
Zeitsperre Mar 2, 2021
19e0a40
use pytest.importorskip
Zeitsperre Mar 3, 2021
d215363
Add marginally-working hydro_routing functions, fix some field format…
Zeitsperre Mar 3, 2021
7d0b72b
Working version of upstream basin identification for hydro_routing pr…
Zeitsperre Mar 3, 2021
4e10ac9
docstring fixes, remove unneeded notes, use f-strings
Zeitsperre Mar 4, 2021
27c576a
Refactoring of ravenpy.utils into analysis, chekcs, geo, and io; upda…
Zeitsperre Mar 4, 2021
a72eaa8
implement tmp_path for io-based tests, move warning message to module…
Zeitsperre Mar 4, 2021
4374ea7
remove an empty return
Zeitsperre Mar 4, 2021
1f48d86
reduce circular imports
Zeitsperre Mar 4, 2021
40dc2df
Fix the Docs (#70)
Zeitsperre Mar 5, 2021
8fa00dd
Merge branch 'master' into raven_gis_ports
Zeitsperre Mar 5, 2021
6c91852
re-run pre-commit checks, comment out unused objects, make nbstripout…
Zeitsperre Mar 5, 2021
b4c2121
Add a FIXME
Zeitsperre Mar 5, 2021
9fe3e30
Removed unused libraries, formatting of docstrings, re-add modules
Zeitsperre Mar 5, 2021
8f4be9a
Remove xarray from environment-rtd.yml?
Zeitsperre Mar 5, 2021
99519ac
Re-enable xarray and NetCDF4 from environment-rtd.yml
Zeitsperre Mar 5, 2021
175e283
Re-enable xarray and NetCDF4 from environment-rtd.yml. mock click.
Zeitsperre Mar 5, 2021
f1d08c3
extract grid_weight_params to __init__.py, use extracted values for c…
Zeitsperre Mar 5, 2021
fe79749
Move outside imports inside click command
Zeitsperre Mar 5, 2021
03554bb
remove modules?
Zeitsperre Mar 5, 2021
208cef1
Make dev_requirements include gis_requirements, rename test_utils.py …
Zeitsperre Mar 6, 2021
4638ffb
Add sphinxcontrib-napoleon to environment-rtd.yml, and modules in TOC
cjauvin Mar 6, 2021
9712050
Fix test emulator Lievre
cjauvin Mar 6, 2021
a00c5d0
Put back createDimension and createVariable calls in aggreg script
cjauvin Mar 6, 2021
a17e199
Replaced unused vars by wildcards in aggreg script for flake8
cjauvin Mar 6, 2021
0d8cc3c
Disable climpred logging for test
cjauvin Mar 6, 2021
28cad4e
Some cosmetic changes to the docs (utility scripts in particular)
cjauvin Mar 6, 2021
04f10ba
Add docs/modules.rst
cjauvin Mar 6, 2021
53ce6a8
Add docs/ravenpy.rst
cjauvin Mar 6, 2021
346aa5d
Fix a test output
Zeitsperre Mar 8, 2021
2fdac34
Add a Hydro Routing example notebook
Zeitsperre Mar 8, 2021
576c8bd
Add sphinx-apidoc generated files (because RTD cannot do it)
cjauvin Mar 8, 2021
b84ea29
Add the Hydro Routing example notebook to the docs
Zeitsperre Mar 8, 2021
f4aa4f7
Add module-level flavour text
Zeitsperre Mar 8, 2021
12b6f3c
Add generic WFS tests and reduce persistent tempfile creation
Zeitsperre Mar 8, 2021
947c8eb
Update installation procedures
Zeitsperre Mar 8, 2021
61085c2
Fix a typo
Zeitsperre Mar 8, 2021
2049c7e
Update setuptools
Zeitsperre Mar 8, 2021
dcee9c6
reviewed hydro routing notebook
huard Mar 9, 2021
e3c9f0a
Slight modification to hydro_routing notebook
Zeitsperre Mar 9, 2021
f8c1e16
Adjust imports for tests with GIS dependencies
Zeitsperre Mar 9, 2021
efe8448
Pin geopandas above 0.9.0
Zeitsperre Mar 9, 2021
8cbeff2
Pyproj pinned to 3.0.0+
Zeitsperre Mar 9, 2021
b34e1a5
Update the installation process to be two-step for python then C depe…
Zeitsperre Mar 9, 2021
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
2 changes: 1 addition & 1 deletion .cruft.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@
}
},
"directory": null
}
}
6 changes: 0 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,3 @@ ENV/

# Download and compile site for Raven and Ostrich binaries
external_deps

# Generated by Sphinx
modules.rst
ravenpy.models.rst
ravenpy.rst
ravenpy.utilities.rst
57 changes: 57 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
default_language_version:
python: python3

repos:
- repo: https://github.com/asottile/pyupgrade
rev: v2.10.0
hooks:
- id: pyupgrade
language_version: python3
- repo: https://github.com/kynan/nbstripout
rev: 0.3.9
hooks:
- id: nbstripout
language_version: python3
files: ".ipynb"
args: ["--keep-output"]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
hooks:
- id: trailing-whitespace
language_version: python3
exclude: .rvc|.rvh|.rvi|.rvp|.rvt|.tpl|.txt
- id: end-of-file-fixer
language_version: python3
exclude: .ipynb|.rvc|.rvh|.rvi|.rvp|.rvt|.tpl|.txt
- id: check-yaml
language_version: python3
- id: debug-statements
language_version: python3
- repo: https://github.com/ambv/black
rev: 20.8b1
hooks:
- id: black
language_version: python3
args: ["--target-version", "py36"]
- repo: https://github.com/pycqa/flake8
rev: 3.8.4
hooks:
- id: flake8
language_version: python3
args: ['--config=setup.cfg']
- repo: https://github.com/timothycrosley/isort
rev: 5.7.0
hooks:
- id: isort
language_version: python3
args: ['--profile', 'black', '--filter-files']
- repo: https://github.com/pycqa/pydocstyle
rev: 5.1.1
hooks:
- id: pydocstyle
language_version: python3
args: ['--convention=numpy', '--match="(?!test_).*\.py"']
- repo: meta
hooks:
- id: check-hooks-apply
- id: check-useless-excludes
1 change: 0 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ 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.

4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ coverage: ## check code coverage quickly with the default Python
$(BROWSER) htmlcov/index.html

docs: ## generate Sphinx HTML documentation, including API docs
rm -f docs/ravenpy.rst
rm -f docs/modules.rst
# Warning: as the sphinx-apidoc is NOT being run on the RTD server the workaround we have
# is to commit the (currently 5) rst files it generates.
sphinx-apidoc -o docs/ ravenpy
$(MAKE) -C docs clean
$(MAKE) -C docs html
Expand Down
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)" -W $(SPHINXOPTS) $(O)
105 changes: 56 additions & 49 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
import os
import sys

sys.path.insert(0, os.path.abspath('..'))
sys.path.insert(0, os.path.abspath(".."))

import ravenpy
import ravenpy # noqa

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

Expand All @@ -32,44 +32,57 @@

# 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.autosummary',
'sphinx.ext.viewcode',
'numpydoc',
'nbsphinx',
'sphinx_click']
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.viewcode",
"sphinx.ext.napoleon",
"nbsphinx",
"sphinx_click",
]

autosummary_generate = True
nbsphinx_execute = "auto"

# To avoid having to install these and burst memory limit on ReadTheDocs.
autodoc_mock_imports = [
'affine',
'clisops',
'dataclasses', # needed for python3.6
'fiona',
'gdal',
'osgeo',
'geopandas',
'lxml',
'owslib',
'pyproj',
'rasterio',
'rioxarray',
'shapely'
"affine",
"cftime",
"click",
"climpred",
"clisops",
"fiona",
"gdal",
"netCDF4",
"osgeo",
"geopandas",
"lxml",
"owslib",
"pandas",
"pyproj",
"rasterio",
"rioxarray",
"scipy",
"shapely",
"statsmodels",
"xarray",
"xclim",
]

# 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"

# General information about the project.
project = 'RavenPy'
project = "RavenPy"
copyright = "2020, David Huard"
author = "David Huard"

Expand All @@ -92,26 +105,26 @@
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['_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"

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False

# Suppress "WARNING: unknown mimetype for ..." when building EPUB.
suppress_warnings = ['epub.unknown_project_files']
suppress_warnings = ["epub.unknown_project_files"]

# Avoid "configuration.rst:4:duplicate label configuration, other instance in configuration.rst"
autosectionlabel_prefix_document = True
autosectionlabel_prefix_document = False

# -- 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 @@ -122,28 +135,25 @@
# 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 = list() # "_static"

# -- Options for HTMLHelp output ---------------------------------------

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

# -- 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',
Expand All @@ -153,31 +163,28 @@
# (source start file, target name, title, author, documentclass
# [howto, manual, or own class]).
latex_documents = [
(master_doc, 'ravenpy.tex',
'RavenPy Documentation',
'David Huard', 'manual'),
(master_doc, "ravenpy.tex", "RavenPy Documentation", "David Huard", "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, 'ravenpy',
'RavenPy Documentation',
[author], 1)
]
man_pages = [(master_doc, "ravenpy", "RavenPy 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, 'ravenpy',
'RavenPy Documentation',
author,
'ravenpy',
'One line description of project.',
'Miscellaneous'),
(
master_doc,
"ravenpy",
"RavenPy Documentation",
author,
"ravenpy",
"One line description of project.",
"Miscellaneous",
),
]
11 changes: 8 additions & 3 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,22 @@ RavenPy downloads and compiles the most recent version of the Raven, and offers

.. toctree::
:maxdepth: 1
:caption: Scripts
:caption: Utility Scripts

scripts


.. toctree::
:maxdepth: 1
:caption: API
:caption: User API

user_api

.. toctree::
:maxdepth: 1
:caption: All Modules

modules


Credits
=======
Expand Down
Loading