Skip to content

Commit 64237a3

Browse files
Merge branch 'master' into fix_setting_copy
2 parents d4862f7 + 91694c1 commit 64237a3

20 files changed

+139
-2049
lines changed

.github/workflows/pypi.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ jobs:
1313
packages:
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v3
16+
- uses: actions/checkout@v4
1717

1818
- name: Set up Python
19-
uses: actions/setup-python@v3
19+
uses: actions/setup-python@v5
2020
with:
2121
python-version: "3.x"
2222

.github/workflows/test.yml

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,45 @@ on:
77
tags: "*"
88

99
jobs:
10-
test:
10+
linting:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v2
13+
- uses: actions/checkout@v4
1414

1515
- name: Setup Python
16-
uses: actions/setup-python@v1
16+
uses: actions/setup-python@v5
1717
with:
1818
python-version: 3.11
1919

2020
- name: Install dependencies with pip
2121
run: |
2222
python -m pip install -e .[dev]
2323
24-
- run: isort --recursive --diff .
25-
- run: black --check --diff .
26-
- run: flake8
27-
- run: mypy
28-
- run: pytest --cov --cov-fail-under=50
24+
- uses: pre-commit/action@v3.0.1
25+
test_converter:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v4
29+
30+
- name: Setup Python
31+
uses: actions/setup-python@v5
32+
with:
33+
python-version: 3.11
34+
35+
- name: Install dependencies with pip
36+
run: |
37+
python -m pip install -e .[dev]
38+
39+
- name: Run conversion tests
40+
run: pytest
41+
- name: Run coverage tests
42+
run: pytest --cov --cov-fail-under=50
2943
test_plotting:
3044
runs-on: ubuntu-latest
3145
steps:
32-
- uses: actions/checkout@v2
46+
- uses: actions/checkout@v4
3347
- name: Setup Python
34-
uses: actions/setup-python@v1
48+
uses: actions/setup-python@v5
3549
with:
3650
python-version: 3.11
3751
- name: Install dependencies with pip

.github/workflows/validate_metadata.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
validate:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@v3
9+
- uses: actions/checkout@v4
1010
- name: Validate JSON
1111
uses: walbo/validate-json@v1.1.0
1212
with:

.pre-commit-config.yaml

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,30 @@
11
# See https://pre-commit.com/ for usage and config
22
repos:
33
- repo: https://github.com/PyCQA/isort
4-
rev: 5.12.0
4+
rev: 5.13.2
55
hooks:
66
- id: isort
77
name: isort
88
entry: isort
99
types: [python]
1010
- repo: https://github.com/psf/black
11-
rev: 23.3.0
11+
rev: 24.8.0
1212
hooks:
1313
- id: black
1414
name: black
1515
entry: black
1616
types: [python]
17-
- repo: https://github.com/PyCQA/flake8
18-
rev: 6.0.0
17+
- repo: https://github.com/astral-sh/ruff-pre-commit
18+
rev: v0.6.4
1919
hooks:
20-
- id: flake8
21-
name: flake8
22-
entry: flake8
23-
types: [python]
24-
exclude: setup.py
20+
- id: ruff
21+
args: [ --fix ]
22+
- id: ruff-format
2523
- repo: https://github.com/pre-commit/mirrors-mypy
26-
rev: v1.1.1
24+
rev: v1.11.2
2725
hooks:
2826
- id: mypy
2927
name: mypy
3028
entry: mypy
3129
types: [python]
3230
require_serial: true
33-
- repo: local
34-
hooks:
35-
- id: pytest
36-
name: pytest
37-
language: system
38-
entry: pytest
39-
types: [python]
40-
pass_filenames: false
41-
42-
- id: pytest-cov
43-
name: pytest
44-
language: system
45-
stages: [push]
46-
entry: pytest --cov --cov-fail-under=50
47-
types: [python]
48-
pass_filenames: false

CHANGELOG.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ unreleased
77

88
* Add zenodo release information (:pr:`24`) `Hauke Schulz`_.
99
* Fix warning about seeting copy of a slice of a DataFrame (:pr:`28`) `Marius Rixen`_.
10+
* Update infrastructure to use pyproject.toml with pdm and ruff (:pr:`29`) `Hauke Schulz`_.
1011

1112

1213
0.0.5 (2023-10-19)

pyproject.toml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
[project]
2+
name = "pysonde"
3+
dynamic = ["version"]
4+
description = "Post-processing tool for atmospheric sounding data"
5+
authors = [
6+
{name = "Hauke Schulz", email = "43613877+observingClouds@users.noreply.github.com"},
7+
]
8+
dependencies = [
9+
"cartopy",
10+
"coverage",
11+
"bottleneck",
12+
"dask",
13+
"metpy",
14+
"netCDF4",
15+
"numpy",
16+
"omegaconf",
17+
"pandas",
18+
"Pint",
19+
"Pint-Pandas",
20+
"pint-xarray",
21+
"PyYAML",
22+
"regex",
23+
"tqdm",
24+
"xarray",
25+
]
26+
requires-python = ">=3.9"
27+
readme = "README.md"
28+
license = {text = "MIT"}
29+
classifiers = [
30+
"Development Status :: 3 - Alpha",
31+
"Environment :: Console",
32+
"Intended Audience :: Developers",
33+
"License :: OSI Approved :: MIT License",
34+
"Programming Language :: Python :: 3.10",
35+
"Programming Language :: Python :: 3.11",
36+
"Programming Language :: Python :: 3.12",
37+
"Programming Language :: Python :: 3.9",
38+
]
39+
40+
[project.urls]
41+
Homepage = "https://github.com/observingClouds/pysonde"
42+
43+
[project.optional-dependencies]
44+
dev = [
45+
"black",
46+
"flake8",
47+
"isort",
48+
"mock",
49+
"mypy",
50+
"pre-commit",
51+
"pylint",
52+
"pytest",
53+
"pytest-cov",
54+
"pytest-lazy-fixture",
55+
"yapf",
56+
]
57+
58+
[project.scripts]
59+
sounding_converter = "pysonde.pysonde:main"
60+
sounding_visualize = "pysonde.make_quicklooks_rs41:main"
61+
62+
[build-system]
63+
requires = ["pdm-backend"]
64+
build-backend = "pdm.backend"
65+
66+
[tool.pdm.version]
67+
source = "scm"
68+
69+
[tool.pdm]
70+
distribution = true
71+
72+
[tool.pdm.scripts]
73+
post_install = "pre-commit install"
74+
75+
[tool.mypy]
76+
ignore_missing_imports = true
77+
78+
[tool.ruff]
79+
line-length = 88
80+
81+
[tool.ruff.lint.mccabe]
82+
max-complexity = 18
83+
84+
[tool.isort]
85+
profile = "black"
86+
multi_line_output = 3
87+
include_trailing_comma = true
88+
force_grid_wrap = 0
89+
use_parentheses = true
90+
line_length = 88

pysonde/__init__.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +0,0 @@
1-
# Create __version__ attribute from setup.py information
2-
3-
from ._version import get_versions
4-
5-
__import__("pkg_resources").declare_namespace(__name__)
6-
7-
try:
8-
__version__ = get_versions()["version"]
9-
except (ValueError, ImportError):
10-
__version__ = "--"

pysonde/_dataset_creator.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
ds = create_dataset(cfg)
3535
3636
"""
37+
3738
import logging
3839

3940
import _helpers as h

pysonde/_helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ def set_additional_var_attributes(ds, meta_data_dict, variables):
280280
try:
281281
meta_data_var = meta_data_dict[var_in]["attrs"]
282282
for key, value in meta_data_var.items():
283-
if key not in ["_FillValue", "dtype"] and not ("time" in var_out):
283+
if key not in ["_FillValue", "dtype"] and "time" not in var_out:
284284
ds[var_out].attrs[key] = value
285285
elif (key not in ["_FillValue", "dtype", "units"]) and (
286286
"time" in var_out

pysonde/make_skewT.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"""
44
Plot skew-T diagram of converted soundings
55
"""
6+
67
import argparse
78
import logging
89

pysonde/meteorology_helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ def set_additional_var_attributes(ds, meta_data_dict):
239239
except KeyError:
240240
continue
241241
for key, value in meta_data_var.items():
242-
if key not in ["_FillValue", "dtype"] and not ("time" in var):
242+
if key not in ["_FillValue", "dtype"] and "time" not in var:
243243
ds[var].attrs[key] = value
244244
elif (key not in ["_FillValue", "dtype", "units"]) and ("time" in var):
245245
ds[var].attrs[key] = value

pysonde/pysonde.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
Script to convert sounding files from different sources
66
to netCDF
77
"""
8+
89
import argparse
910
import logging
1011
import sys

pysonde/readers/reader_helpers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
"""Helper functions for the different readers
2-
"""
1+
"""Helper functions for the different readers"""
2+
33
import glob
44
import os
55
import shutil

pysonde/readers/readers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
"""Readers for different sounding formats
2-
"""
1+
"""Readers for different sounding formats"""
2+
33
import datetime as dt
44
import logging
55
import os

pysonde/sounding.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
"""Sounding class
2-
"""
1+
"""Sounding class"""
2+
33
import copy
44
import logging
55
import os

pysonde/thermodynamics.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Thermodynamic functions
33
"""
4+
45
import metpy
56
import metpy.calc as mpcalc
67
import numpy as np

setup.cfg

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)