rpn-to-gemlam Package Development

Licensed under the Apache License, Version 2.0 Python Version Git on GitHub The uncompromising Python code formatter Documentation Status Issue Tracker

rpn-to-gemlam is a tool for generating atmospheric forcing files for the SalishSeaCast NEMO model from the ECCC 2007-2014 archival GEMLAM files produced by the experimental phase of the HRPDS model.

Python Versions

Python Version

The rpn-to-gemlam package is developed and tested using Python 3.7. The package uses some Python language features that are not available in versions prior to 3.6, in particular:

Getting the Code

Git on GitHub

Clone the code and documentation repository, and the tools repository from Bitbucket with:

$ git clone git@github.com:SalishSeaCast/rpn-to-gemlam.git
$ git clone git@github.com:SalishSeaCast/tools.git

or

$ git clone https://github.com/SalishSeaCast/rpn-to-gemlam.git
$ git clone https://github.com/SalishSeaCast/tools.git

if you don’t have ssh key authentication set up on GitHub.

Development Environment

Setting up an isolated development environment using Conda is recommended. Assuming that you have Anaconda Python Distribution or Miniconda3 installed, you can create and activate an environment called rpn-to-gemlam that will have all of the Python packages necessary for development, testing, and building the documentation with the commands:

$ cd rpn-to-gemlam
$ conda env create -f env/environment-dev.yaml
$ conda activate rpn-to-gemlam
(rpn-to-gemlam)$ python3 -m  pip install --editable ../tools/SalishSeaTools
(rpn-to-gemlam)$ python3 -m  pip install --editable .

The --editable option in the pip install command above installs the rpn_to_gemlam package from the cloned repo via symlinks so that the installed rpn_to_gemlam package will be automatically updated as the repo evolves.

To deactivate the environment use:

(rpn-to-gemlam)$ conda deactivate

Coding Style

The uncompromising Python code formatter

The NEMO_Nowcast package uses the black code formatting tool to maintain a coding style that is very close to PEP 8.

black is installed as part of the Development Environment setup.

To run black on the entire code-base use:

$ cd NEMO_Nowcast
$ conda activate nemo-nowcast
(nemo-nowcast)$ black ./

in the repository root directory. The output looks something like:

reformatted /media/doug/warehouse/MEOPAR/rpn-to-gemlam/docs/conf.py
All done! ✨ 🍰 ✨
1 file reformatted, 3 files left unchanged.

Documentation

Documentation Status

The :rpn-to-gemlam documentation is written in reStructuredText and converted to HTML using Sphinx.

If you have write access to the repository on Bitbucket, whenever you push changes to Bitbucket the documentation is automatically re-built and rendered at https://rpn-to-gemlam.readthedocs.io/en/latest/.

Additions, improvements, and corrections to these docs are always welcome.

The quickest way to fix typos, etc. on existing pages is to use the Edit on GitHub link in the upper right corner of the page to get to the online editor for the page on GitHub.

For more substantial work, and to add new pages, follow the instructions in the Development Environment section above. In the development environment you can build the docs locally instead of having to push commits to Bitbucket to trigger a build on readthedocs.org and wait for it to complete. Below are instructions that explain how to:

  • build the docs with your changes, and preview them in Firefox

  • check the docs for broken links

Building and Previewing the Documentation

Building the documentation is driven by the docs/Makefile. With your rpn-to-gemlam environment activated, use:

(rpn-to-gemlam)$ cd rpn-to-gemlam/docs/
(rpn-to-gemlam) docs$ make clean html

to do a clean build of the documentation. The output looks something like:

Removing everything under '_build'...
Running Sphinx v1.8.5
making output directory...
loading intersphinx inventory from https://docs.python.org/objects.inv...
intersphinx inventory has moved: https://docs.python.org/objects.inv -> https://docs.python.org/3/objects.inv
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 2 source files that are out of date
updating environment: 2 added, 0 changed, 0 removed
reading sources... [100%] pkg_development
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] pkg_development
generating indices... genindex
writing additional pages... search
copying static files... done
copying extra files... done
dumping search index in English (code: en) ... done
dumping object inventory... done
build succeeded.

The HTML rendering of the docs ends up in docs/_build/html/. You can open the index.html file in that directory tree in your browser to preview the results of the build. To preview in Firefox from the command-line you can do:

(rpn-to-gemlam) docs$ firefox _build/html/index.html

If you have write access to the repository on Bitbucket, whenever you push changes to Bitbucket the documentation is automatically re-built and rendered at https://rpn-to-gemlam.readthedocs.io/en/latest/.

Version Control Repository

Git on GitHub

The rpn-to-gemlam code and documentation source files are available in the rpn-to-gemlam Git repository at https://github.com/SalishSeaCast/rpn-to-gemlam.

Issue Tracker

Issue Tracker

Development tasks, bug reports, and enhancement ideas are recorded and managed in the issue tracker at https://github.com/SalishSeaCast/rpn-to-gemlam/issues.

License

Licensed under the Apache License, Version 2.0

The code and documentation of the rpn-to-gemlam tool for generating SalishSeaCast NEMO atmospheric forcing files from ECCC RPN files are copyright 2019-2020 by the Salish Sea MEOPAR Project Contributors and The University of British Columbia.

They are licensed under the Apache License, Version 2.0. https://www.apache.org/licenses/LICENSE-2.0 Please see the LICENSE file for details of the license.