Skip to content

Commit

Permalink
Documentation cleanup (#538)
Browse files Browse the repository at this point in the history
Co-authored-by: Bryn Pickering <17178478+brynpickering@users.noreply.github.com>
  • Loading branch information
sjpfenninger and brynpickering committed Jan 26, 2024
1 parent bbd303e commit c6a0e6a
Show file tree
Hide file tree
Showing 156 changed files with 3,970 additions and 100,168 deletions.
42 changes: 42 additions & 0 deletions .github/ISSUE_TEMPLATE/BUG-REPORT.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Bug Report
description: Report a bug that leads to Calliope not working as expected.
labels: [bug]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
- type: textarea
id: what-happened
attributes:
label: What happened?
description: Also tell us what you expected to happen.
placeholder: Tell us what you see!
value: "Something unexpected happened!"
validations:
required: true
- type: checkboxes
id: operating-systems
attributes:
label: Which operating systems have you used?
description: You may select more than one.
options:
- label: macOS
- label: Windows
- label: Linux
validations:
required: true
- type: textarea
id: version
attributes:
label: Version
description: What version of Calliope are you using?
placeholder: v0.1.0
- type: textarea
id: logs
attributes:
label: Relevant log output
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
render: Shell
validations:
required: false
53 changes: 53 additions & 0 deletions .github/ISSUE_TEMPLATE/DOCS.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Report a documentation issue
description: Missing, incorrect, or confusing information in our docs? Report a documentation issue
labels:
- documentation
body:
- type: textarea
id: description
attributes:
label: Description
description: >-
Please describe the inconsistency or issue you have found in
[our documentation](https://calliope.readthedocs.io)
or indicate where you feel there is a need for improvement. Furthermore,
explain the severity of the issue, i.e., its impact on you and potentially
other users.
validations:
required: true

- type: textarea
id: related-links
attributes:
label: Related links
description: >-
Please list all links to the sections of [our documentation](https://calliope.readthedocs.io)
that are impacted by the issue you described above. If applicable,
add screenshots. Additionally, list links to possibly related open
and closed [issues](https://github.com/calliope-project/calliope/issues)
and [discussions](https://github.com/calliope-project/calliope/discussions)
you encountered when searching our issue tracker.
value: |
-
-
...
validations:
required: true

- type: textarea
id: version
attributes:
label: Version
description: Which version of the documentation are you referring to?
placeholder: v0.7.0
validations:
required: true

- type: textarea
id: proposed-change
attributes:
label: Proposed change
description: >-
This field is optional. You may provide an improvement proposal for our
documentation by describing your suggestion in the text field below or
creating a pull request after reporting this issue referencing the issue.
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE/FEATURE-REQUEST.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Feature Request
description: Suggest an idea for Calliope.
labels: [enhancement]
body:
- type: markdown
attributes:
value: |
Thanks for letting us know about your idea!
- type: textarea
id: description
attributes:
label: What can be improved?
placeholder: Tell us what you would like to see!
value: "Calliope should be more memory efficient!"
validations:
required: true
- type: textarea
id: version
attributes:
label: Version
description: What version of Calliope are you using?
placeholder: v0.1.0
validations:
required: true
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: true
2 changes: 1 addition & 1 deletion .github/issue_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ If reporting an error when running Calliope on the command line, please re-run y

Then post the full output from the debug run.

If reporting an error when running Calliope interactively in a Python session, please include a full traceback.
If reporting an error when running Calliope in a Python session, please include a full traceback.

## Steps to reproduce the problem

Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ coverage.xml

# Project-specific
dist/
doc/_build/
doc/_static/notebooks/*.html
.ipynb_checkpoints
outputs/
site/
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ build:
python: mambaforge-4.10
jobs:
post_create_environment:
- mamba install python=3.12 coin-or-cbc --file requirements/docs.txt
- mamba install python=3.12 coin-or-cbc --file requirements/dev.txt
- pip install --no-deps .
- python -m ipykernel install --user --name calliope_docs_build

Expand Down
16 changes: 8 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## 0.7.0 (dev)

v0.7 includes a major change to how Calliope internally operates. Most of this affects the user only marginally. We group changes into those that are primarily user-facing and relevant for all Calliope users, and those that are primarily internal, and relevant only for Calliope developers.
v0.7 includes a major change to how Calliope internally operates. Along with this, there are multiple changes to how Calliope models are defined and configured. This requires adapting models to work with 0.7. We group changes into those that are primarily user-facing and relevant for all Calliope users, and those that are primarily internal, and relevant only for Calliope developers.

### User-facing changes

Expand All @@ -16,6 +16,8 @@ This enables un-indexed parameters to be defined, as well as those indexed over
|new| parameter dimensions at the `tech` or `node` level can be enhanced using the new `parameter` definition syntax.
For instance, `flow_cap` can be defined per `carrier`.

|new| Shadow prices obtained from a dual LP problem can be read by using `model.backend.shadow_prices.get("constraint_name")`

|changed| |backwards-incompatible| `file=/df=` parameter values as references to timeseries data is replaced with loading tabular data at the top-level using the `data_sources` key.

|changed| Automatically derived transmission link distances default to kilometres, with the configuration option (`config.init.distance_unit`) to switch to the old default of distances in metres.
Expand Down Expand Up @@ -77,15 +79,13 @@ An API will be created in due course to allow the user to add their own checks t

|changed| When a model is loaded into an active session, configuration dictionaries are stored as dictionaries instead of seralised YAML strings in the model data attributes dictionary. Serialisation and de-serialisation only occur on saving and loading from NetCDF, respectively.



## 0.6.10 (2023-01-18)

|changed| |backwards-incompatible| Updated to Numpy v1.23, Pandas v1.5, Pyomo v6.4, Ruamel.yaml v0.17, Scikit-learn v1.2, Xarray v2022.3, GLPK v5. This enables Calliope to be installed on Apple Silicon devices, but changes the result of algorithmic timeseries clustering. `In scikit-learn version 0.24.0, the method of random sampling for K-Means clustering was changed <https://scikit-learn.org/0.24/whats_new/v0.24.html#changed-models>`_. This change will lead to different optimisation results if using `K-Means clustering <https://calliope.readthedocs.io/en/v0.6.10/user/advanced_features.html#time-resolution-adjustment>`_ in your model.
|changed| |backwards-incompatible| Updated to Numpy v1.23, Pandas v1.5, Pyomo v6.4, Ruamel.yaml v0.17, Scikit-learn v1.2, Xarray v2022.3, GLPK v5. This enables Calliope to be installed on Apple Silicon devices, but changes the result of algorithmic timeseries clustering. [In scikit-learn version 0.24.0, the method of random sampling for K-Means clustering was changed](https://scikit-learn.org/0.24/whats_new/v0.24.html#changed-models). This change will lead to different optimisation results if using [K-Means clustering](https://calliope.readthedocs.io/en/v0.6.10/user/advanced_features.html#time-resolution-adjustment) in your model.

|changed| |backwards-incompatible| Removed support for Python version 3.7 since some updated dependencies are not available in this version.

|changed| Installation instructions for developers have changed since we no longer duplicate pinned packages between the development/testing requirements file (`requirements.yml`) and the package requirements file (`requirements.txt`). See `the documentation <https://calliope.readthedocs.io/en/v0.6.10/user/installation.html>`_ for updated instructions.
|changed| Installation instructions for developers have changed since we no longer duplicate pinned packages between the development/testing requirements file (`requirements.yml`) and the package requirements file (`requirements.txt`). See [the documentation](https://calliope.readthedocs.io/en/v0.6.10/user/installation.html) for updated instructions.

|fixed| Set ordering in the model dataset is consistent before and after optimising a model with clustered timeseries. Previously, the link between clusters and timesteps would become mixed following optimisation, so running `model.run(force_rerun=True)` would yield a different result.

Expand Down Expand Up @@ -201,7 +201,7 @@ An API will be created in due course to allow the user to add their own checks t

|changed| All model defaults have been moved to `defaults.yaml`, removing the need for `model.yaml`. A default location, link and group constraint have been added to `defaults.yaml` to validate input model keys.

|changed| |backwards-incompatible| Revised internal logging and warning structure. Less critical warnings during model checks are now logged directly to the INFO log level, which is displayed by default in the CLI, and can be enabled interactively by calling `calliope.set_log_verbosity()` without any options. The `calliope.set_log_level` function has been renamed to `calliope.set_log_verbosity` and includes the ability to easily turn on and off the display of solver output.
|changed| |backwards-incompatible| Revised internal logging and warning structure. Less critical warnings during model checks are now logged directly to the INFO log level, which is displayed by default in the CLI, and can be enabled when running in Python by calling `calliope.set_log_verbosity()` without any options. The `calliope.set_log_level` function has been renamed to `calliope.set_log_verbosity` and includes the ability to easily turn on and off the display of solver output.

|changed| All group constraint values are parameters so they can be updated in the backend model

Expand Down Expand Up @@ -436,7 +436,7 @@ Version 0.6.0 is an almost complete rewrite of most of Calliope's internals. See

|new| |backwards-incompatible| Better coordinate definitions in metadata. Location coordinates are now specified by a dictionary with either lat/lon (for geographic coordinates) or x/y (for generic Cartesian coordinates), e.g. ``{lat: 40, lon: -2}`` or ``{x: 0, y: 1}``. For geographic coordinates, the ``map_boundary`` definition for plotting was also updated in accordance. See the built-in example models for details.

|new| Unidirectional transmission links are now possible. See the `documentation on transmission links <https://calliope.readthedocs.io/en/v0.5.1/user/configuration.html#transmission-links>`_.
|new| Unidirectional transmission links are now possible. See the [documentation on transmission links](https://calliope.readthedocs.io/en/v0.5.1/user/configuration.html#transmission-links).

### Other changes

Expand Down Expand Up @@ -479,7 +479,7 @@ Version 0.6.0 is an almost complete rewrite of most of Calliope's internals. See

|new| Added new methods to deal with time resolution: clustering, resampling, and heuristic timestep selection

|changed| |backwards-incompatible| Major change to solution data structure. Model solution is now returned as a single `xarray DataSet <https://docs.xarray.dev/en/v0.8.2/data-structures.html#dataset>`_ instead of multiple pandas DataFrames and Panels. Instead of as a generic HDF5 file, complete solutions can be saved as a NetCDF4 file via xarray's NetCDF functionality.
|changed| |backwards-incompatible| Major change to solution data structure. Model solution is now returned as a single [xarray DataSet](https://docs.xarray.dev/en/v0.8.2/data-structures.html#dataset) instead of multiple pandas DataFrames and Panels. Instead of as a generic HDF5 file, complete solutions can be saved as a NetCDF4 file via xarray's NetCDF functionality.

While the recommended way to save and process model results is by NetCDF4, CSV saving functionality has now been upgraded for more flexibility. Each variable is saved as a separate CSV file with a single value column and as many index columns as required.

Expand Down
79 changes: 1 addition & 78 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,80 +1,3 @@
# How to contribute

We're really glad you're reading this, because we need volunteer developers to help this project come to fruition.

Some of the resources to look at if you're interested in contributing:

* [Join us on Gitter to chat!](https://app.gitter.im/#/room/#calliope-project_calliope:gitter.im)
* Look at our [milestones](https://github.com/calliope-project/calliope/milestones) and [projects](https://github.com/calliope-project/calliope/projects) on GitHub for an idea on where development is headed
* Look at [open issues tagged with "help wanted"](https://github.com/calliope-project/calliope/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) and ["good first issue"](https://github.com/calliope-project/calliope/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22)
* Look at the [development guide in our documentation](http://calliope.readthedocs.io/en/stable/user/develop.html)

## Licensing

By contributing to Calliope, e.g. through opening a pull request or submitting a patch, you represent that your contributions are your own original work and that you have the right to license them, and you agree that your contributions are licensed under the Apache 2.0 license.

## Submitting bug reports

[Open an issue on GitHub](https://github.com/calliope-project/calliope/issues/new) to report bugs or other problems.

If reporting an error when running Calliope on the command line, please re-run your command with the ``--debug`` option, e.g.:

``calliope run my_model.yaml --debug``

Then post the full output from the debug run as part of your GitHub issues.

If reporting an error when running Calliope interactively in a Python session, please include a full traceback in your issue.

## Submitting changes

Look at the [development guide in our documentation](http://calliope.readthedocs.io/en/stable/user/develop.html) for information on how to get set up for development.

To contribute changes:

1. Fork the project on GitHub
2. Create a feature branch to work on in your fork (``git checkout -b new-fix-or-feature``)
3. Add your name to the ``AUTHORS`` file
4. Commit your changes to the feature branch after running black to format your code (formatting is automatic if the ``pre-commit`` hooks have been installed; see [below](#coding-conventions) for more info)
5. Push the branch to GitHub (``git push origin new-fix-or-feature``)
6. On GitHub, create a new [pull request](https://github.com/calliope-project/calliope/pull/new/main) from the feature branch

Our [development guide](http://calliope.readthedocs.io/en/stable/user/develop.html) gives a more detailed description of each step, if you're new to working with GitHub.

### Pull requests

Before submitting a pull request, check whether you have:

* Added your changes to ``changelog.rst``
* Added or updated documentation for your changes
* Added tests if you implemented new functionality

When opening a pull request, please provide a clear summary of your changes!

### Commit messages

Please try to write clear commit messages. One-line messages are fine for small changes, but bigger changes should look like this:

A brief summary of the commit

A paragraph or bullet-point list describing what changed and its impact,
covering as many lines as needed.

## Testing

We have existing test coverage for the key functionality of Calliope.

All tests are in the ``tests`` directory and use [pytest](https://docs.pytest.org/en/latest/).

Our test coverage is not perfect and an easy way to contribute code is to work on better tests.

## Coding conventions

Start reading our code and you'll get the hang of it.

We mostly follow the official [Style Guide for Python Code (PEP8)](https://www.python.org/dev/peps/pep-0008/).

We have chosen to use the uncompromising code formatter, [`black`](https://github.com/psf/black/). If run from the root directory of this repo, `pyproject.toml` should ensure the line lengths are restricted to 88. The philosophy behind using black is to have uniform style throughout the project dictated by code. Since `black` is designed to minimise diffs, and make patches more human readable, this also makes code reviews more efficient. To make this a smooth experience, you should add a black formatting script to your git pre-commit hooks before creating a PR. We provide a quick and easy way to set this up as part of the [development guide in our documentation](http://calliope.readthedocs.io/en/stable/user/develop.html#installing-a-development-version).

## Attribution

The layout and content of this document is partially based on the [OpenGovernment project's contribution guidelines](https://github.com/opengovernment/opengovernment/blob/master/CONTRIBUTING.md).
Please see our [guide for contributing](https://calliope.readthedocs.io/en/latest/contributing/) in the documentation!
23 changes: 0 additions & 23 deletions Makefile

This file was deleted.

13 changes: 2 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Chat on Gitter](https://img.shields.io/gitter/room/calliope-project/calliope.svg)](https://app.gitter.im/#/room/#calliope-project_calliope:gitter.im)
[![GitHub Discussions](https://img.shields.io/github/discussions/calliope-project/calliope)](https://github.com/calliope-project/calliope/discussions)
[![Main branch build status](https://github.com/calliope-project/calliope/actions/workflows/commit-ci.yml/badge.svg?branch=main)](https://github.com/calliope-project/calliope/actions/workflows/commit-ci.yml)
[![Documentation build status](https://img.shields.io/readthedocs/calliope.svg?version=latest)](https://readthedocs.org/projects/calliope/builds/)
[![Test coverage](https://codecov.io/gh/calliope-project/calliope/graph/badge.svg?token=UM542yaYrh)](https://codecov.io/gh/calliope-project/calliope)
Expand Down Expand Up @@ -53,16 +53,7 @@ Documentation is available on [Read the Docs](https://calliope.readthedocs.io/en

## Contributing

To contribute changes:

1. Fork the project on GitHub
2. Create a feature branch to work on in your fork (`git checkout -b new-feature`)
3. Add your name to the AUTHORS file
4. Commit your changes to the feature branch
5. Push the branch to GitHub (`git push origin my-new-feature`)
6. On GitHub, create a new pull request from the feature branch

See our [contribution guidelines](https://github.com/calliope-project/calliope/blob/main/CONTRIBUTING.md) for more information -- and [join us on Gitter](https://app.gitter.im/#/room/#calliope-project_calliope:gitter.im) to ask questions or discuss code.
See our documentation for more on how to [contribute to Calliope](http://calliope.readthedocs.io/en/latest/contributing/).

## What's new

Expand Down

0 comments on commit c6a0e6a

Please sign in to comment.