Skip to content

Commit

Permalink
Merge pull request #31 from MetOffice/develop
Browse files Browse the repository at this point in the history
Merge Develop v1.0 to Master
  • Loading branch information
hsteptoe authored Mar 15, 2019
2 parents ff53130 + 9ff043b commit 23bc586
Show file tree
Hide file tree
Showing 30 changed files with 5,108 additions and 6,024 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
.ipynb_checkpoints/
notebooks/.ipynb_checkpoints/
/data/stash_select
*.pyc
253 changes: 253 additions & 0 deletions CONTRIBUTING.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,253 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# PyPRECIS Notebook Style Guide\n",
"\n",
"Thanks for showing the enthusiasm to help develop the PyPRECIS notebooks. Please use this style guide as a reference when creating or modifying content...\n",
"\n",
"## Worksheet Title\n",
"\n",
"All worksheets should start with a title formatted as a level 1 heading:\n",
"\n",
"```md\n",
"# Worksheet ?: All Worksheets Should Have a Clear Title\n",
"```\n",
"\n",
"Worksheet titles should be followed with a short description of the worksheet.\n",
"\n",
"## Learning Aims\n",
"\n",
"This followed by a list of 3 to 4 learning aims for the worksheet. We use the HTML `div class=\"alert alert-block alert-warning\"` to colour this is a nice way:\n",
"\n",
"```md\n",
"<div class=\"alert alert-block alert-warning\">\n",
"<b>By the end of this worksheet you should be able to:</b><br> \n",
"- Identify and list the names of PRECIS output data in PP format using standard Linux commands.<br>\n",
"- Use basic Iris commands to load data files, and view Iris cubes. <br>\n",
"- Use Iris commands to remove the model rim, select data variables and save the output as NetCDF files.\n",
"</div>\n",
"```\n",
"\n",
"When rendered, it looks like this:\n",
"\n",
"<div class=\"alert alert-block alert-warning\">\n",
"<b>By the end of this worksheet you should be able to:</b><br> \n",
"- Identify and list the names of PRECIS output data in PP format using standard Linux commands.<br>\n",
"- Use basic Iris commands to load data files, and view Iris cubes. <br>\n",
"- Use Iris commands to remove the model rim, select data variables and save the output as NetCDF files.\n",
"</div>\n",
"\n",
"Remember to start each learning aim with a verb. Keep them short and to the point. If you have more than 3 to 4 learning aims, consider whether there is too much content in the workbook.\n",
"\n",
"## Notes\n",
"\n",
"You may wish to use a Note box to draw the learners attention to particular actions or points to note. Note boxes are created using `div class=\"alert alert-block alert-info\"`\n",
"\n",
"```md\n",
"<div class=\"alert alert-block alert-info\">\n",
"<b>Note:</b> In the boxes where there is code or where you are asked to type code, click in the box, then press <kbd>Ctrl</kbd> + <kbd>Enter</kbd> to run the code. <br>\n",
"<b>Note:</b> An percentage sign <code>%</code> is needed to run some commands on the shell. It is noted where this is needed.<br>\n",
"<b>Note:</b> A hash <code>#</code> denotes a comment; anything written after this character does not affect the command being run. <br>\n",
"</div>\n",
"```\n",
"\n",
"Which looks like:\n",
"\n",
"<div class=\"alert alert-block alert-info\">\n",
"<b>Note:</b> In the boxes where there is code or where you are asked to type code, click in the box, then press <kbd>Ctrl</kbd> + <kbd>Enter</kbd> to run the code. <br>\n",
"<b>Note:</b> An percentage sign <code>%</code> is needed to run some commands on the shell. It is noted where this is needed.<br>\n",
"<b>Note:</b> A hash <code>#</code> denotes a comment; anything written after this character does not affect the command being run. <br>\n",
"</div>\n",
"\n",
"## Contents\n",
"\n",
"Immediately following the Learning Aims (or Note box if used) add a list of contents.\n",
"\n",
"```md\n",
"## Contents\n",
"### [1.1: Data locations and file names](#1.1) \n",
"### ...additional headings\n",
"```\n",
"\n",
"Items in the contents list are formatted as level 3 headings. Note the `[Link Name](Link location)` syntax. Each subsequent heading in the notebook needs to have a `id` tag associated with it for the links to work. These are formatted like this:\n",
"\n",
"```md\n",
"<a id='1.1'></a>\n",
"## 1.1 Data locations and file names\n",
"```\n",
"\n",
"Remember that the `id` string must match the link location otherwise the link won't work. Remember to update both the link title numbering and the link id numbering if you are reordering content.\n",
"\n",
"## Section Headings\n",
"\n",
"To help users navigate round the document use section headings to break the content into sections. As detailed above, each section heading needs to have an `id` tag associated with it to build the Contents links.\n",
"\n",
"If you want to further subdivide each section, use bold letters with a parentheses:\n",
"\n",
"```md\n",
"**a)** Ordinary section text continues...\n",
"```\n",
"\n",
"## General Formatting\n",
"\n",
"Use links to point learners to additional learning resources. These follow the standard markdown style: `[Link text](Link location)`, eg.\n",
"\n",
"```md\n",
"[Iris](http://scitools.org.uk/iris/docs/latest/index.html)\n",
"```\n",
"\n",
"gives\n",
"\n",
"[Iris](http://scitools.org.uk/iris/docs/latest/index.html)\n",
"\n",
"Format key commands using bold back-ticks: \n",
"\n",
"```md\n",
"**`cd`**\n",
"```\n",
"\n",
"Where certain keyboard combinations are necessary to execute commands, use the `<kbd>` html formatting.\n",
"\n",
"\n",
"```md\n",
"<kbd>Ctrl</kbd> + <kbd>Enter</kbd>\n",
"```\n",
"\n",
"which gives:\n",
"\n",
"<kbd>Ctrl</kbd> + <kbd>Enter</kbd>\n",
"\n",
"Code blocks are entered in new notebook cells, with the `Code` style. Remember, all python should be **Python 3**."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"# This is a code block\n",
"# Make sure you include comments with your code to help explain what you are doing\n",
"\n",
"# Leave space if you want learners to complete portions of code\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<div class=\"alert alert-block alert-info\">\n",
"<b>Note:</b> Remember you can use additional Note blocks at any time to highlight important points!\n",
"</div>\n",
"\n",
"If you want to add pictures, place image files in the `/notebooks/img` folder. Use html image formatting tags to control the position of the image in the rendered notebook cell:\n",
"\n",
"```md\n",
"<p><img src=\"notebooks/img/python_and_iris.png\" alt=\"python + iris logo\" style=\"float: center; height: 100px;\"/></p>\n",
"```\n",
"\n",
"gives\n",
"\n",
"<p><img src=\"notebooks/img/python_and_iris.png\" alt=\"python + iris logo\" style=\"float: center; height: 100px;\"/></p>\n",
"\n",
"Images can also be places in Note and Question blocks in the same manner. See Worksheet 1 for an example.\n",
"\n",
"## Questions\n",
"\n",
"Asking questions is a key part of the learning process. Questions blocks use the `div class=\"alert alert-block alert-success\"` style, and should be visually separated from the main text using horizontal rules above and below the question section:\n",
"\n",
"```md\n",
"---\n",
"<div class=\"alert alert-block alert-success\">\n",
"<b>Question:</b> How many pp files are in this directory, in total?\n",
"<br>How many of these pp files contain the string 'sep'; relating to September? What command do you need to use to find this out?\n",
"</div>\n",
"\n",
"<b>Answer</b>: \n",
"<br>*Total number of pp files: \n",
"<br>Number of September pp files:\n",
"<br>Command used to find number of september pp files:*\n",
"\n",
"---\n",
"```\n",
"\n",
"This renders as:\n",
"\n",
"---\n",
"<div class=\"alert alert-block alert-success\">\n",
"<b>Question:</b> How many pp files are in this directory, in total?\n",
"<br>How many of these pp files contain the string 'sep'; relating to September? What command do you need to use to find this out?\n",
"</div>\n",
"\n",
"<b>Answer</b>: \n",
"<br>*Total number of pp files: \n",
"<br>Number of September pp files:\n",
"<br>Command used to find number of september pp files:*\n",
"\n",
"---\n",
"\n",
"Make sure to put your _answer_ section in a different notebook cell from the _question_ section to avoid learners accidently editing the question blocks. Questions may also include code blocks. Remember to use a horizonal rule `---` to show where the question section starts and stops.\n",
"\n",
"## Worksheet footer\n",
"\n",
"At the end of the worksheet, summarise the content using a `div class=\"alert alert-block alert-warning\"`\n",
"\n",
"```md\n",
"<center>\n",
"<div class=\"alert alert-block alert-warning\">\n",
"<b>This completes worksheet 1.</b> <br>You have created pre-processed files (rim removed, individual variables, concenated over time, in NetCDF format). <br>\n",
"In worksheet 2, you will begin to analyse these files.\n",
"</div>\n",
"</center>\n",
"```\n",
"\n",
"<center>\n",
"<div class=\"alert alert-block alert-warning\">\n",
"<b>This completes worksheet 1.</b> <br>You have created pre-processed files (rim removed, individual variables, concenated over time, in NetCDF format). <br>\n",
"In worksheet 2, you will begin to analyse these files.\n",
"</div>\n",
"</center>\n",
"\n",
"Finally, a copyright statement and the Met Office logo should be added to all notebooks:\n",
"\n",
"```md\n",
"<p><img src=\"img/MO_MASTER_black_mono_for_light_backg_RBG.png\" alt=\"python + iris logo\" style=\"float: center; height: 100px;\"/></p>\n",
"<center>© Crown Copyright 2019, Met Office</center>\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<p><img src=\"notebooks/img/MO_MASTER_black_mono_for_light_backg_RBG.png\" alt=\"Met Office logo\" style=\"float: center; height: 100px;\"/></p>\n",
"<center>© Crown Copyright 2019, Met Office</center>"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.8"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
69 changes: 55 additions & 14 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,70 @@
# Contributing Guidelines

Please take note of the following guidelines when contributing to the PyPRECIS repository:
You'd like to help? Great! :tada:

* Please do **not** make changes to the `master` branch. The `master` branch is reserved for files and code that has been fully tested and reviewed. If you think something is ready to be pushed to the `master` branch please check with Saeed or Hamish first.
* The `develop` branch contains the latest holistic version of the `PyPRECIS` repository. Please branch off `develop` to fix a particular issue or add a new feature.
* Please use the following tokens at the start of a new branch name to help sign-post and group branches:
[Clone your own local copy](https://help.github.com/en/articles/cloning-a-repository) of this repositry run the following in your terminal:

```shell
git clone [email protected]:MetOffice/PyPRECIS.git
```
new Branch adding new code/files that don't exist in the repo.
fix Branch modifying code/files that already exist in the repo.
junk Throwaway branch created to experiment

Consider [creating a conda environment](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html) from the PyPRECIS dependencies specified in the `environment.yml` file:
```shell
conda env create -f environment.yml
```
Git can pattern match branches to to give you an overview of all (e.g. fix) branches:
```
Remember to activate your new environment:
```shell
conda activate pyprecis-environment
```

:exclamation: *Note: As of v1.0 we are unable to provison the model data necessary for reproducing the full PyPRECIS learning environment via github due to it's substanation size. Contact the PRECIS team for more information.*

## Before you start...
Read through the current issues to see what you can help with. If you have your own ideas for improvements, please start a new issues so we can track and discuss your improvement. You must create a new branch for any changes you make.

**Please take note of the following guidelines when contributing to the PyPRECIS repository.**

* Please do **not** make changes to the `master` branch. The `master` branch is reserved for files and code that has been fully tested and reviewed. Only the core PyPRECIS developers can/should push to the `master` branch.

* The `develop` branch contains the latest holistic version of the `PyPRECIS` repository. Please branch off `develop` to fix a particular issue or add a new feature.
* Please use the following tokens at the start of a new branch name to help sign-post and group branches:

Name | Description
---- | -----------
new | Branch adding new code/files that don't exist in the repo
fix | Branch modifying code/files that already exist in the repo.
junk | Throwaway branch created to experiment

* Git can pattern match branches to to give you an overview of all (e.g. fix) branches:
```shell
git branch --list "fix/*"
```
* Use a forward slash to separate the token from the branch name. For example:
```
new/Worksheet5
fix/worksheet2aUnits
new/Wks10
fix/Wks2_units
```
* When you think your branch is ready to be merged into `develop`, open a new pull request.
## Signposting
* **Issues** are tracked and discussed under the Issues tab. Please use issues to disucss proposed changes or capture improvements needed to work towards the next milestone. Issues or improvements that contribute to the next milestone to be captured in thr Wiki tab.
* **Pull requests** show branches that are currently under review. New pull requests are created in reponse to branch fixes identified and recorded in the Issues tab.
* **Wiki** is used for summarising update aims for future versions of the notebooks, and to record speculative improvements that cannot be action in the current milestone.
Other more general points to note:
* **Avoid long descriptive names.** Long branch names can be very helpful when you are looking at a list of branches. But it can get in the way when looking at decorated one-line logs as the branch names can eat up most of the single line and abbreviate the visible part of the log.
* **Avoid long descriptive names.** Long branch names can be very helpful when you are looking at a list of branches but it can get in the way when looking at decorated one-line logs as the branch names can eat up most of the single line and abbreviate the visible part of the log.
* **Do not use bare numbers.** Do not use use bare numbers (or hex numbers) as part of your branch naming scheme.
**If in doubt, please contact Saeed Sadri ([email protected]) or Hamish Steptoe ([email protected]) if you
have questions**
## CONTRIBUTING.ipynb
The `CONTRIBUTING.ipyn` file contains the worksheet style guide. Please consult this for information on formatting the new and ammended worksheets in a consistent style.
**If in doubt, please contact the PRECIS team ([email protected]) if you
have questions.**
<h5 align="center">
<img src="notebooks/img/MO_MASTER_black_mono_for_light_backg_RBG.png" width="200" alt="Met Office"> <br>
&copy; British Crown Copyright 2018 - 2019, Met Office
</h5>
Loading

0 comments on commit 23bc586

Please sign in to comment.