Skip to content

Commit

Permalink
readme add
Browse files Browse the repository at this point in the history
  • Loading branch information
st-te committed Mar 21, 2024
1 parent acbe461 commit d0f999c
Show file tree
Hide file tree
Showing 3 changed files with 141 additions and 10 deletions.
28 changes: 18 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
# Introduction
# Rivercatch
![Continuous Integration build in GitHub Actions](https://github.com/<st-te>/python-intermediate-catchment/workflows/CI/badge.svg?branch=main)

This is a template software project repository used by the Earth Science focused [Intermediate Research Software Development Skills In Python](https://carpentries-incubator.github.io/python-intermediate-development-earth-sciences) course.
RiverCatch is a data management system written in Python that manages measurement data collected in river catchment surveys and campaigns.

## Purpose
## Main Features
Here are some key features of Inflam:

This repository is intended to be used as a code template which is copied by learners at [Intermediate Research Software Development Skills In Python](https://carpentries-incubator.github.io/python-intermediate-development-earth-sciences) workshops.
This can be done using the `Use this template` button towards the top right of this repo's GitHub page.
- Provide basic statistical analyses of data
- Ability to work on measurement data in Comma-Separated Value (CSV) format
- Generate plots of measurement data
- Analytical functions and views can be easily extended based on its Model-View-Controller architecture

This software project is not finished, is currently failing to run and contains some code style issues. It is used as a starting point for the course - issues will be fixed and code will be added in a number of places during the course by learners in their own copies of the repository, as course topics are introduced.
## Prerequisites
RiverCatch requires the following Python packages:

## Tests
- [NumPy](https://www.numpy.org/) - makes use of NumPy's statistical functions
- [Pandas](https://pandas.pydata.org/) - makes use of Panda's dataframes
- [GeoPandas](https://geopandas.org/) - makes use of GeoPanda's spatial operations
- [Matplotlib](https://matplotlib.org/stable/index.html) - uses Matplotlib to generate statistical plots

Several tests have been implemented already, some of which are currently failing.
These failing tests set out the requirements for the additional code to be implemented during the workshop.
The following optional packages are required to run RiverCatch's unit tests:

The tests should be run using `pytest`, which will be introduced during the workshop.
- [pytest](https://docs.pytest.org/en/stable/) - RiverCatch's unit tests are written using pytest
- [pytest-cov](https://pypi.org/project/pytest-cov/) - Adds test coverage stats to unit testing
82 changes: 82 additions & 0 deletions examples.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import pandas.testing as pdt\n",
"from catchment.models import daily_mean\n",
"import datetime\n",
"import pytest"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [],
"source": [
"test_input = pd.DataFrame(\n",
" data=[[1.0, 2.0],\n",
" [3.0, 4.0],\n",
" [5.0, 6.0]],\n",
" index=[pd.to_datetime('2000-01-01 01:00'),\n",
" pd.to_datetime('2000-01-01 02:00'),\n",
" pd.to_datetime('2000-01-01 03:00')],\n",
" columns=['A', 'B']\n",
")\n",
"test_result = pd.DataFrame(\n",
" data=[[3.0, 4.0]],\n",
" index=[datetime.date(2000, 1, 1)],\n",
" columns=['A', 'B']\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [],
"source": [
"test_output = pd.DataFrame(\n",
" data=[[3.0, 3.0]],\n",
" index=[datetime.date(2000, 1, 1)],\n",
" columns=['A', 'B'] \n",
")"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [],
"source": [
"pdt.assert_frame_equal(daily_mean(test_input), test_result)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "venv",
"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.9.6"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
41 changes: 41 additions & 0 deletions mypy_tutorial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
from typing import Union

flag : bool = True

def greet(name : str) -> None:
"""Say hello to everyone"""
print("Hi " + name)

greet("Manchester")
greet("Steven")

def myAbs(x : float) -> float:
"""Take the absolute of the floating-point input"""
if x < 0:
return (-x)
else:
return (x)


myAbs(12)

def greetAll(names : list[str]) -> None:
for name in names:
greet(name)

greetAll(["Alice", "John", "Joe"])

#greetAll([12, 12])

some_data : tuple[int, bool, str] = (41, True, "Manchester")
#some_other_data : tuple[int, bool, str] = (41, 232132, "Manchester")

def myDiv(x : float, y : float) -> Union[float, None]:
if y != 0: return x/y
else: return None


myDict : dict[str, Union[float, str]] = {"temp": 273.0, "units": "Kelvin"}

#reveal_type(len)

0 comments on commit d0f999c

Please sign in to comment.