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

up-to-date with pandas #8

Merged
merged 13 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
65 changes: 65 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Build

on: [push, pull_request]

jobs:
test:

runs-on: ubuntu-latest
strategy:
matrix:
python_version: ['3.8', '3.9', '3.10']

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python_version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install hatch
hatch env create
- name: Lint and typecheck
run: |
hatch run lint-check
- name: Test
run: |
hatch run test-cov-xml
- uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
verbose: true

release:
runs-on: ubuntu-latest
needs: test
if: startsWith(github.ref, 'refs/tags/')

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
shell: bash
run: |
python -m pip install --upgrade pip
pip install hatch
- name: Build and publish on PyPI
env:
HATCH_INDEX_USER: ${{ secrets.HATCH_INDEX_USER }}
HATCH_INDEX_AUTH: ${{ secrets.HATCH_INDEX_AUTH }}
run: |
hatch build
hatch publish
- name: Create release
uses: ncipollo/release-action@v1
with:
draft: true
body: ${{ github.event.head_commit.message }}
artifacts: dist/*.whl,dist/*.tar.gz
token: ${{ secrets.GITHUB_TOKEN }}
56 changes: 56 additions & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Build documentation

on:
push:
branches:
- main

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true

# Default to bash
defaults:
run:
shell: bash

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install hatch
hatch env create
- name: Build
run: hatch run docs-build
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: ./site

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
33 changes: 33 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python testing

on:
push:
branches: [ dev ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest
if [ -f requirements_tests.txt ]; then pip install -r requirements_tests.txt; fi
- name: Test with pytest
run: |
pytest
29 changes: 0 additions & 29 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ETo - A Python package for calculating reference evapotranspiration

The ETo package contains a class and associated functions to calculate reference evapotranspiration (ETo) using the `UN-FAO 56 paper <http://www.fao.org/docrep/X0490E/X0490E00.htm>`_. Additional functions have been added to calculate historic ETo or potential evapotranspiration (PET) for comparison purposes.

A parameter estimation function has also been added to the base class to convert most any variety of metereological parameter inputs to the necessary parameters needed to calculate ETo.
A parameter estimation function has also been added to the base class to convert most any variety of meterological parameter inputs to the necessary parameters needed to calculate ETo.

Documentation
--------------
Expand Down
12 changes: 0 additions & 12 deletions ci/travis/35-defaults.yaml

This file was deleted.

12 changes: 0 additions & 12 deletions ci/travis/36-defaults.yaml

This file was deleted.

12 changes: 0 additions & 12 deletions ci/travis/37-defaults.yaml

This file was deleted.

6 changes: 3 additions & 3 deletions conda/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% set name = "ETo" %}
{% set version = "1.1.0" %}
{% set sha256 = "1c13f17a480d9c0fbf15001ec0beb4ec88b1417899194670a586603c566174c0" %}
{% set version = "1.1.1" %}
# {% set sha256 = "1c13f17a480d9c0fbf15001ec0beb4ec88b1417899194670a586603c566174c0" %}

# sha256 is the prefered checksum -- you can get it for a file with:
# `openssl sha256 <file name>`.
Expand All @@ -17,7 +17,7 @@ source:
# If getting the source from GitHub remove the line above
# uncomment the line below and modify as needed
# url: https://github.com/simplejson/{{ name }}/archive/{{ version }}.tar.gz
sha256: {{ sha256 }}
# sha256: {{ sha256 }}

build:
# Uncomment the following line if the package is pure python and the recipe is exactly the same for all platforms.
Expand Down
2 changes: 2 additions & 0 deletions eto/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from eto.core import ETo
import eto.datasets
import eto.methods

__version__ = '1.1.1'
7 changes: 3 additions & 4 deletions eto/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __init__(self, df=None, freq='D', z_msl=None, lat=None, lon=None, TZ_lon=Non
def tsreg(ts, freq=None, interp=False, maxgap=None):
"""
Function to regularize a time series object (pandas).
The first three indeces must be regular for freq=None!!!
The first three indexes must be regular for freq=None!!!

Parameters
----------
Expand All @@ -43,13 +43,12 @@ def tsreg(ts, freq=None, interp=False, maxgap=None):
Either specify the known frequency of the data or use None and
determine the frequency from the first three indices.
interp : str
Interpolation method.
Interpolation method fro the pandas interpolate method.

Returns
-------
DataFrame
"""

if freq is None:
freq = pd.infer_freq(ts.index[:3])
ts1 = ts.resample(freq).mean()
Expand All @@ -58,9 +57,9 @@ def tsreg(ts, freq=None, interp=False, maxgap=None):

return ts1


### Add in the ETo methods and other functions
ETo.param_est = param_est
ETo.eto_fao = eto_fao
ETo.eto_hargreaves = hargreaves
ETo.copy = copy

4 changes: 2 additions & 2 deletions eto/datasets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
__all__ = ['available', 'get_path']

_module_path = os.path.dirname(__file__)
_available_csv = {p.split('.')[0]: p for p in os.listdir(_module_path) if p.endswith('.csv')}
_available_csv = {p.split('.')[0]: p for p in os.listdir(_module_path) if p.endswith('.csv.zip')}
available = list(_available_csv.keys())


Expand All @@ -23,5 +23,5 @@ def get_path(dataset):
return os.path.abspath(
os.path.join(_module_path, _available_csv[dataset]))
else:
msg = "The dataset '{data}' is not available".format(data=dataset)
msg = f"The dataset '{dataset}' is not available"
raise ValueError(msg)
Loading
Loading