Skip to content

Commit 4cd7384

Browse files
Merge pull request #26 from NCAR/docs
Updates to docs
2 parents f30ae6b + 76ced93 commit 4cd7384

File tree

11 files changed

+84
-59
lines changed

11 files changed

+84
-59
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,6 @@ dmypy.json
127127

128128
# Pyre type checker
129129
.pyre/
130+
131+
# Version
132+
bridgescaler/_version.py

.readthedocs.yaml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ version: 2
99
build:
1010
os: ubuntu-22.04
1111
tools:
12-
python: "mambaforge-22.9"
12+
python: "3.12"
13+
1314
# You can also specify other tool versions:
1415
# nodejs: "19"
1516
# rust: "1.64"
1617
# golang: "1.19"
1718

18-
conda:
19-
environment: environment.yml
19+
2020
# Build documentation in the "docs/" directory with Sphinx
2121
sphinx:
2222
configuration: doc/source/conf.py
@@ -29,6 +29,7 @@ sphinx:
2929
# Optional but recommended, declare the Python requirements required
3030
# to build your documentation
3131
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
32-
# python:
33-
# install:
34-
# - requirements: docs/requirements.txt
32+
python:
33+
install:
34+
- method: "pip"
35+
path: "."

bridgescaler/VERSION

Lines changed: 0 additions & 1 deletion
This file was deleted.

bridgescaler/tests/deep_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@ def test_deep_quantile_transformer():
7272
x_telephone = dqs.inverse_transform(x_transformed)
7373
reg_qs = QuantileTransformer(n_quantiles=1000, subsample=dim * dim * n_ex)
7474
def flatten_to_2D(X):
75-
return np.reshape(X, newshape=(X.shape[0] * X.shape[1] * X.shape[2], X.shape[-1]))
75+
return np.reshape(X, (X.shape[0] * X.shape[1] * X.shape[2], X.shape[-1]))
7676

7777
x_flat = flatten_to_2D(x)
7878
x_scaled = reg_qs.fit_transform(x_flat)
79-
x_tel_2 = np.reshape(reg_qs.inverse_transform(x_scaled), newshape=(x.shape[0], x.shape[1], x.shape[2], x.shape[3]))
79+
x_tel_2 = np.reshape(reg_qs.inverse_transform(x_scaled), (x.shape[0], x.shape[1], x.shape[2], x.shape[3]))
8080
full_diff = np.abs(x - x_telephone).ravel()
8181
reg_diff = np.abs(x_tel_2 - x).ravel()
8282
assert x_transformed.shape == x.shape, "Shape mismatch"

doc/source/conf.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from importlib.metadata import version as get_version
12
# Configuration file for the Sphinx documentation builder.
23
#
34
# For the full list of built-in configuration values, see the documentation:
@@ -9,12 +10,13 @@
910
project = 'bridgescaler'
1011
copyright = '2024, University Corporation for Atmopsheric Research'
1112
author = 'David John Gagne'
12-
release = '0.8.0'
13+
release = get_version("bridgescaler")
14+
version = ".".join(release.split(".")[:3])
1315

1416
# -- General configuration ---------------------------------------------------
1517
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
1618

17-
extensions = ['sphinx.ext.napoleon']
19+
extensions = ['sphinx.ext.napoleon', 'autoapi.extension', 'myst_parser']
1820

1921
templates_path = ['_templates']
2022
exclude_patterns = []
@@ -26,4 +28,5 @@
2628

2729
html_theme = 'sphinx_book_theme'
2830
html_static_path = ['_static']
31+
autoapi_dirs = ["../../bridgescaler",]
2932
html_logo = "_static/bridgescaler_logo.png"

doc/source/distributed.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,14 @@ a pandas DataFrame for easy loading and combining later.
4646
.. code-block:: python
4747
4848
import pandas as pd
49-
from bridgescaler import print_scaler, read_scaler
49+
from bridgescaler import save_scaler, print_scaler, read_scaler, load_scaler
5050
scaler_list = [dss_1, dss_2]
51+
52+
# Save and load single scalers
53+
save_scaler(dss_1, "scaler.json")
54+
loaded_scaler = load_scaler("scaler.json")
55+
56+
# Save and load multiple scalers
5157
df = pd.DataFrame({"scalers": [print_scaler(s) for s in scaler_list]})
5258
df.to_parquet("scalers.parquet")
5359
df_new = pd.read_parquet("scalers.parquet")

doc/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ distributed scaling of data for pre-processing of AI and ML models.
1717
distributed.rst
1818
distributed_tensor.rst
1919
group.rst
20-
modules.rst
20+
2121

2222

2323

doc/source/modules.rst

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

pyproject.toml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
[build-system]
2+
requires = ["setuptools", "setuptools-scm"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "bridgescaler"
7+
description = "Tool to automagically save scikit-learn scaler properties to a portable, readable format."
8+
readme = "README.md"
9+
authors = [{name = "David John Gagne", email = "dgagne@ucar.edu"}]
10+
dynamic = ["version"]
11+
license = {text = "MIT"}
12+
keywords = ["machine learning"]
13+
classifiers = [
14+
"Programming Language :: Python",
15+
"Programming Language :: Python :: 3.8",
16+
"Programming Language :: Python :: 3.9",
17+
"Programming Language :: Python :: 3.10",
18+
"Programming Language :: Python :: 3.11",
19+
"Programming Language :: Python :: 3.12",
20+
"Programming Language :: Python :: 3.13",
21+
22+
23+
]
24+
dependencies = [
25+
"scikit-learn>=1.0",
26+
"numpy<2.4",
27+
"pandas<3",
28+
"crick",
29+
"scipy",
30+
"xarray",
31+
"numba",
32+
"sphinx",
33+
"sphinx-book-theme",
34+
"sphinx-autoapi",
35+
"setuptools_scm",
36+
"setuptools",
37+
"myst_parser"
38+
]
39+
requires-python = ">=3.7"
40+
41+
[project.urls]
42+
Homepage = "https://github.com/NCAR/bridgescaler"
43+
44+
[tool.setuptools]
45+
packages = ["bridgescaler"]
46+
include-package-data = true
47+
zip-safe = true
48+
49+
[tool.setuptools_scm]
50+
version_file = "bridgescaler/_version.py"

requirements.txt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1-
pandas
2-
numpy<2.0
1+
pandas<3
2+
numpy<2.4
33
scikit-learn>=1.0
44
crick
55
xarray
6-
scipy>=1.11.0
6+
scipy
77
numba
8+
sphinx
9+
sphinx-book-theme
10+
setuptools_scm
11+
setuptools
12+
sphinx-autoapi
13+
myst_parser

0 commit comments

Comments
 (0)