Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/auto-update-bulletin-a.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This workflow will install Python dependencies and get the latest bulletin-A file

name: Auto-Update Bulletin-A files
name: Update Bulletin-A

on:
schedule:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/auto-update-files.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This workflow will install Python dependencies and update the time and EOP files

name: Auto-Update Files
name: Update Data

on:
schedule:
Expand Down
14 changes: 11 additions & 3 deletions .github/workflows/python-request.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# 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 on pull request
name: pytest Build

on:
pull_request:
Expand Down Expand Up @@ -42,11 +42,19 @@ jobs:
run: |
# install the package in editable mode
pip install --no-deps --editable .
pixi run --environment dev pytest -n 0 --cov=./ --cov-report=xml \
pixi run --environment dev pytest -n 0 --cov=timescale \
--junitxml=pytest.xml --cov-report=xml \
--username=${{ secrets.EARTHDATA_USERNAME }} \
--password=${{ secrets.EARTHDATA_PASSWORD }}
- name: Create coverage comment
uses: MishaKav/pytest-coverage-comment@main
with:
pytest-xml-coverage-path: coverage.xml
junitxml-path: pytest.xml
unique-id-for-comment: ${{ matrix.os }}
title: Coverage for Python on ${{ matrix.os }}
- name: Archive code coverage results
uses: actions/upload-artifact@v4
with:
name: code-coverage-report-${{ matrix.os }}
path: ./coverage.xml
path: coverage.xml
18 changes: 18 additions & 0 deletions .github/workflows/ruff-format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Ruff Format

on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches:
- main

jobs:
ruff-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Format and annotate PR
uses: astral-sh/ruff-action@v3
with:
version: "latest"
args: "format --check --diff"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*.gz
*.iso
*.jar
*.mat
*.rar
*.tar
*.zip
Expand Down Expand Up @@ -46,6 +47,8 @@ pythonenv*/
venv/
*build-commands.txt
setup-miniconda-patched-environment.yml
pytest.xml
coverage.xml
# OS generated files #
######################
.DS_Store
Expand Down
7 changes: 6 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,10 @@ prune .github*
prune doc*
prune run*
prune test*
exclude *.cfg
exclude *.cff
exclude *.md
exclude *.yml
exclude pixi.lock
exclude .gitattributes
exclude .gitignore
exclude .zenodo.json
40 changes: 33 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,40 @@
# timescale

[![License](https://img.shields.io/github/license/pyTMD/timescale)](https://github.com/pyTMD/timescale/blob/main/LICENSE)
[![Documentation Status](https://readthedocs.org/projects/timescale/badge/?version=latest)](https://timescale.readthedocs.io/en/latest/?badge=latest)
[![PyPI](https://img.shields.io/pypi/v/timescale.svg)](https://pypi.python.org/pypi/timescale/)
[![conda-forge](https://img.shields.io/conda/vn/conda-forge/timescale)](https://anaconda.org/conda-forge/timescale)
[![commits-since](https://img.shields.io/github/commits-since/pyTMD/timescale/latest)](https://github.com/pyTMD/timescale/releases/latest)
[![zenodo](https://zenodo.org/badge/DOI/10.5281/zenodo.5555395.svg)](https://doi.org/10.5281/zenodo.5555395)

Python tools for time and astronomical calculations

## About

<table>
<tr>
<td><b>Version:</b></td>
<td>
<a href="https://pypi.python.org/pypi/timescale/" alt="PyPI"><img src="https://img.shields.io/pypi/v/timescale.svg"></a>
<a href="https://anaconda.org/conda-forge/timescale" alt="conda-forge"><img src="https://img.shields.io/conda/vn/conda-forge/timescale"></a>
<a href="https://github.com/pyTMD/timescale/releases/latest" alt="commits-since"><img src="https://img.shields.io/github/commits-since/pyTMD/timescale/latest"></a>
</td>
</tr>
<tr>
<td><b>Citation:</b></td>
<td>
<a href="https://doi.org/10.5281/zenodo.8284224" alt="zenodo"><img src="https://zenodo.org/badge/DOI/10.5281/zenodo.8284224.svg"></a>
</td>
</tr>
<tr>
<td><b>Tests:</b></td>
<td>
<a href="https://timescale.readthedocs.io/en/latest/?badge=latest" alt="Documentation Status"><img src="https://readthedocs.org/projects/timescale/badge/?version=latest"></a>
<a href="https://github.com/pyTMD/timescale/actions/workflows/python-request.yml" alt="Build"><img src="https://github.com/pyTMD/timescale/actions/workflows/python-request.yml/badge.svg"></a>
<a href="https://github.com/pyTMD/timescale/actions/workflows/ruff-format.yml" alt="Ruff"><img src="https://github.com/pyTMD/timescale/actions/workflows/ruff-format.yml/badge.svg"></a>
</td>
</tr>
<tr>
<td><b>License:</b></td>
<td>
<a href="https://github.com/pyTMD/timescale/blob/main/LICENSE" alt="License"><img src="https://img.shields.io/github/license/pyTMD/timescale"></a>
</td>
</tr>
</table>

For more information: see the documentation at [timescale.readthedocs.io](https://timescale.readthedocs.io/)

## Installation
Expand Down
4 changes: 2 additions & 2 deletions pixi.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 32 additions & 13 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,15 @@ keywords = [

authors = [
{name = "Tyler Sutterley"},
{name = "Karen Alley"},
{name = "Kelly Brunt"},
{name = "Susan Howard"},
{name = "Laurie Padman"},
{name = "Matt Siegfried"},
{email = "tsutterl@uw.edu"}
]
maintainers = [{ name = "timescale contributors" }]
maintainers = [
{ name = "timescale contributors" }
]
license = {file = "LICENSE"}
readme = {file = "README.md", content-type = "text/markdown"}

requires-python = "~=3.6"
requires-python = "~=3.9"
dependencies = [
"lxml",
"numpy",
Expand All @@ -42,13 +39,12 @@ classifiers=[
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Topic :: Scientific/Engineering :: Physics",
]

Expand Down Expand Up @@ -83,8 +79,7 @@ source = [
"test",
]
omit = [
"setup.py",
"conf.py",
"doc/*",
]

[tool.coverage.report]
Expand All @@ -94,13 +89,37 @@ precision = 2
[tool.ruff]
line-length = 80
indent-width = 4
exclude = [
".git",
".pixi",
"build",
"doc",
"run",
"test",
]

[tool.ruff.lint]
select = [
# Pyflakes
"F",
# pyupgrade
"UP",
# flake8-bugbear
"B",
# flake8-simplify
"SIM",
# isort
"I",
# ruff-specific
"RUF",
]

[tool.ruff.lint.pydocstyle]
convention = "numpy"

[tool.ruff.format]
quote-style = "single"
indent-style = "space"
line-ending = "auto"
docstring-code-format = false

[tool.pixi.workspace]
Expand Down
33 changes: 21 additions & 12 deletions timescale/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,48 +6,57 @@

Documentation is available at https://timescale.readthedocs.io
"""

import timescale.eop
import timescale.time
import timescale.utilities
import timescale.version


# shortcut wrapper functions for timescale.time.Timescale methods
# delta time
def from_deltatime(*args, **kwargs):
"""Wrapper for ``timescale.time.Timescale().from_deltatime``
"""
"""Wrapper for ``timescale.time.Timescale().from_deltatime``"""
return timescale.time.Timescale.from_deltatime(*args, **kwargs)


# Julian dates
def from_julian(ut1, **kwargs):
return timescale.time.Timescale(ut1 - 2400000.5)


# Besselian years
def from_besselian(B, **kwargs):
"""Wrapper for creating a ``Timescale`` object from Besselian years
"""
"""Wrapper for creating a ``Timescale`` object from Besselian years"""
# convert Besselian year to MJD
MJD = 15019.81352 + (B - 1900.0) * 365.242198781
return timescale.time.Timescale(MJD)


# calendar dates
def from_calendar(*args, **kwargs):
"""Wrapper for ``timescale.time.Timescale().from_calendar``
"""
"""Wrapper for ``timescale.time.Timescale().from_calendar``"""
return timescale.time.Timescale.from_calendar(*args, **kwargs)


# datetime arrays
def from_datetime(*args, **kwargs):
"""Wrapper for ``timescale.time.Timescale().from_datetime``
"""
"""Wrapper for ``timescale.time.Timescale().from_datetime``"""
return timescale.time.Timescale.from_datetime(*args, **kwargs)


# range of dates
def from_range(start, end, *args, **kwargs):
"""Wrapper for creating a ``Timescale`` object from a range of dates
"""
"""Wrapper for creating a ``Timescale`` object from a range of dates"""
d = timescale.time.date_range(start, end, *args, **kwargs)
return timescale.time.Timescale.from_datetime(d)


# list of timescale objects
def from_list(*args, **kwargs):
"""Wrapper for ``timescale.time.Timescale().from_list``
"""
"""Wrapper for ``timescale.time.Timescale().from_list``"""
return timescale.time.Timescale.from_list(*args, **kwargs)


# get version information
__version__ = timescale.version.version
Loading