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

pyproject.toml for builds, using setuptools_scm for versioning #37

Merged
merged 8 commits into from
Jan 30, 2024
Merged
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: 0 additions & 2 deletions .coveragerc

This file was deleted.

7 changes: 3 additions & 4 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -16,7 +16,6 @@ jobs:
matrix:
python-version: ["3.9", "3.10", "3.11"]
env: [
'-r requirements.txt .[test]',
'--upgrade --upgrade-strategy=eager .[test]'
]

@@ -28,8 +27,8 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install ${{ matrix.env }}
run: |
python -m pip install --upgrade pip wheel
pip install ${{ matrix.env }}
python -m pip install --progress-bar off --upgrade pip
python -m pip install --progress-bar off ${{ matrix.env }}
- name: Test with pytest ${{ matrix.env }}
run: |
pytest
python -m pytest
4 changes: 1 addition & 3 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
include versioneer.py
include pvdeg/_version.py
include pvdeg/data/*
include LICENSE
include *.md
graft DataLibrary
30 changes: 13 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -50,28 +50,24 @@ It takes a minute to load the environment.

### Locally

You can also run the tutorial locally with
[miniconda](https://docs.conda.io/en/latest/miniconda.html) by following thes
steps:

1. Install [miniconda](https://docs.conda.io/en/latest/miniconda.html).

1. Clone the repository:
You can also run the tutorial locally in a virtual environment, i.e., `venv` or
[miniconda](https://docs.conda.io/en/latest/miniconda.html).

1. Create and activate a new environment, e.g., on Mac/Linux terminal with `venv`:
```
git clone https://github.com/NREL/PVDegradationTools.git
python -m venv pvdeg
. pvdeg/bin/activate
```

1. Create the environment and install the requirements. The repository includes
a `requirements.txt` file that contains a list the packages needed to run
this tutorial. To install them using conda run:

or with `conda`:
```
conda create -n pvdeg jupyter -c pvlib --file requirements.txt
conda create -n pvdeg
conda activate pvdeg
```

or you can install it with `pip install pvdeg` as explained in the installation instructions into the environment.
1. Install `pvdeg` into the new environment with `pip`:
```
python -m pip install pvdeg
```

1. Start a Jupyter session:

@@ -98,9 +94,9 @@ Install with:

pip install pvdeg

For developer installation, download the repository, navigate to the folder location and install as:
For developer installation, clone the repository, navigate to the folder location and install as:

pip install -e .
pip install -e .[all]


License
11 changes: 11 additions & 0 deletions contributors/markcampanelli.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
2024-01-09

I hereby agree to the terms of the Contributors License Agreement,
version 1.0, with MD5 checksum 46ea45f996295bdb0652333d516a6d0a.

I furthermore declare that I am authorized and able to make this
agreement and sign this declaration.

Signed,

Mark Campanelli https://github.com/markcampanelli
25 changes: 19 additions & 6 deletions docs/sphinx/source/_autosummary/pvdeg.collection.rst
Original file line number Diff line number Diff line change
@@ -3,17 +3,30 @@

.. automodule:: pvdeg.collection












.. rubric:: Functions

.. autosummary::

calculate_jsc_from_tau_cp
calculate_jsc_from_tau_iqe
collection_probability
generation_current













25 changes: 19 additions & 6 deletions docs/sphinx/source/_autosummary/pvdeg.degradation.rst
Original file line number Diff line number Diff line change
@@ -3,18 +3,31 @@

.. automodule:: pvdeg.degradation












.. rubric:: Functions

.. autosummary::

IwaArrhenius
IwaVantHoff
arrhenius_deg
degradation
vantHoff_deg













23 changes: 18 additions & 5 deletions docs/sphinx/source/_autosummary/pvdeg.design.rst
Original file line number Diff line number Diff line change
@@ -3,15 +3,28 @@

.. automodule:: pvdeg.design







.. rubric:: Functions

.. autosummary::

edge_seal_ingress_rate
edge_seal_width












.. rubric:: Functions

.. autosummary::

edge_seal_ingress_rate
edge_seal_width
21 changes: 17 additions & 4 deletions docs/sphinx/source/_autosummary/pvdeg.fatigue.rst
Original file line number Diff line number Diff line change
@@ -3,14 +3,27 @@

.. automodule:: pvdeg.fatigue







.. rubric:: Functions

.. autosummary::

solder_fatigue












.. rubric:: Functions

.. autosummary::

solder_fatigue
26 changes: 19 additions & 7 deletions docs/sphinx/source/_autosummary/pvdeg.humidity.rst
Original file line number Diff line number Diff line change
@@ -3,16 +3,16 @@

.. automodule:: pvdeg.humidity












.. rubric:: Functions

.. autosummary::

Ce_numba
back_encap
backsheet
@@ -21,5 +21,17 @@
front_encap
module
psat
run_module
surface_outside













25 changes: 19 additions & 6 deletions docs/sphinx/source/_autosummary/pvdeg.letid.rst
Original file line number Diff line number Diff line change
@@ -3,16 +3,16 @@

.. automodule:: pvdeg.letid












.. rubric:: Functions

.. autosummary::

calc_device_params
calc_dn
calc_energy_loss
@@ -30,3 +30,16 @@
j0_gray
k_ij
tau_now













23 changes: 18 additions & 5 deletions docs/sphinx/source/_autosummary/pvdeg.spectral.rst
Original file line number Diff line number Diff line change
@@ -3,15 +3,28 @@

.. automodule:: pvdeg.spectral







.. rubric:: Functions

.. autosummary::

poa_irradiance
solar_position












.. rubric:: Functions

.. autosummary::

poa_irradiance
solar_position
24 changes: 18 additions & 6 deletions docs/sphinx/source/_autosummary/pvdeg.standards.rst
Original file line number Diff line number Diff line change
@@ -3,16 +3,28 @@

.. automodule:: pvdeg.standards







.. rubric:: Functions

.. autosummary::

eff_gap
standoff












.. rubric:: Functions

.. autosummary::

calc_standoff
eff_gap
run_calc_standoff
23 changes: 18 additions & 5 deletions docs/sphinx/source/_autosummary/pvdeg.temperature.rst
Original file line number Diff line number Diff line change
@@ -3,15 +3,28 @@

.. automodule:: pvdeg.temperature







.. rubric:: Functions

.. autosummary::

cell
module












.. rubric:: Functions

.. autosummary::

cell
module
25 changes: 19 additions & 6 deletions docs/sphinx/source/_autosummary/pvdeg.utilities.rst
Original file line number Diff line number Diff line change
@@ -3,20 +3,33 @@

.. automodule:: pvdeg.utilities












.. rubric:: Functions

.. autosummary::

convert_tmy
get_kinetics
gid_downsampling
meta_as_dict
quantile_df
ts_gid_df
write_gids













28 changes: 22 additions & 6 deletions docs/sphinx/source/_autosummary/pvdeg.weather.rst
Original file line number Diff line number Diff line change
@@ -3,18 +3,34 @@

.. automodule:: pvdeg.weather












.. rubric:: Functions

.. autosummary::

get
get_NSRDB
get_NSRDB_fnames
ini_h5_geospatial
is_leap_year
read
read_h5
repeat_annual_time_series













5 changes: 3 additions & 2 deletions docs/sphinx/source/conf.py
Original file line number Diff line number Diff line change
@@ -15,14 +15,15 @@

sys.path.insert(0, os.path.abspath("../../.."))

import pvdeg


# -- Project information -----------------------------------------------------

project = 'pvdeg'
copyright = '2023, NREL'
author = 'Alliance for Sustainable Energy, LLC'

import pvdeg
version = pvdeg.__version__


# -- General configuration ---------------------------------------------------
4 changes: 2 additions & 2 deletions pvdeg/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from importlib.metadata import version
import logging

from .config import *
@@ -16,9 +17,8 @@
from . import temperature
from . import utilities
from . import weather
from . import _version

__version__ = _version.get_versions()["version"]
__version__ = version('pvdeg')

logger = logging.getLogger(__name__)
logger.addHandler(logging.NullHandler())
556 changes: 0 additions & 556 deletions pvdeg/_version.py

This file was deleted.

11 changes: 6 additions & 5 deletions pvdeg/design.py
Original file line number Diff line number Diff line change
@@ -48,7 +48,7 @@ def edge_seal_width(weather_df, meta, k=None, years=25, from_dew_point=False):
Parameters
----------
weather_df : pd.DataFrame
must be datetime indexed and contain at least temp_air, Dew Point
must be datetime indexed and contain at least temp_air, temp_dew
meta : dict
location meta-data (from weather file)
k: float
@@ -58,7 +58,7 @@ def edge_seal_width(weather_df, meta, k=None, years=25, from_dew_point=False):
years : integer, default = 25
Integer number of years under water ingress
from_dew_point : boolean, optional
If true, will compute the edge seal width from Dew Point instead of dry bulb air temp
If true, will compute the edge seal width from temp_dew instead of dry bulb air temp
Returns
----------
@@ -67,12 +67,13 @@ def edge_seal_width(weather_df, meta, k=None, years=25, from_dew_point=False):
"""

if from_dew_point:
temp_col = "Dew Point"
# "Dew Point" fallback handles key-name bug in pvlib < v0.10.3.
temp = weather_df.get("temp_dew", weather_df.get("Dew Point"))
else:
temp_col = "temp_air"
temp = weather_df["temp_air"]

if k is None:
psat, avg_psat = humidity.psat(weather_df[temp_col])
psat, avg_psat = humidity.psat(temp)
k = edge_seal_ingress_rate(avg_psat)

width = k * (years * 365.25 * 24) ** 0.5
5 changes: 3 additions & 2 deletions pvdeg/humidity.py
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@ def _ambient(weather_df):
-----------
weather_df : pd.DataFrame
Datetime-indexed weather dataframe which contains (at minimum) Ambient temperature
('temp_air') and dew point ('Dew Point') in units [C]
('temp_air') and dew point ('temp_dew') in units [C]
Returns:
--------
@@ -39,7 +39,8 @@ def _ambient(weather_df):
ambient relative humidity [%]
"""
temp_air = weather_df["temp_air"]
dew_point = weather_df["Dew Point"]
# "Dew Point" fallback handles key-name bug in pvlib < v0.10.3.
dew_point = weather_df.get("temp_dew", weather_df.get("Dew Point"))

num = np.exp(17.625 * dew_point / (243.04 + dew_point))
den = np.exp(17.625 * temp_air / (243.04 + temp_air))
26 changes: 11 additions & 15 deletions pvdeg_tutorials/README.md
Original file line number Diff line number Diff line change
@@ -16,28 +16,24 @@ It takes a minute to load the environment.

### Locally

You can also run the tutorial locally with
[miniconda](https://docs.conda.io/en/latest/miniconda.html) by following thes
steps:

1. Install [miniconda](https://docs.conda.io/en/latest/miniconda.html).

1. Clone the repository:
You can also run the tutorial locally in a virtual environment, i.e., `venv` or
[miniconda](https://docs.conda.io/en/latest/miniconda.html).

1. Create and activate a new environment, e.g., on Mac/Linux terminal with `venv`:
```
git clone https://github.com/NREL/PVDegradationTools.git
python -m venv pvdeg
. pvdeg/bin/activate
```

1. Create the environment and install the requirements. The repository includes
a `requirements.txt` file that contains a list the packages needed to run
this tutorial. To install them using conda run:

or with `conda`:
```
conda create -n pvdeg jupyter -c conda-forge --file requirements.txt
conda create -n pvdeg
conda activate pvdeg
```

or you can install it with `pip install pvdeg` as explained in the installation instructions into the environment.
1. Install `pvdeg` into the new environment with `pip`:
```
python -m pip install pvdeg
```

1. Start a Jupyter session:

89 changes: 89 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
[build-system]

requires = ["setuptools>=64", "setuptools_scm>=8"]
build-backend = "setuptools.build_meta"

[project]
name = "pvdeg"
description = "Pvdeg is a python library that supports the calculation of degradation related parameters for photovoltaic (PV) modules."
authors = [{name = "Pvdeg Python Developers", email = "Michael.Kempe@nrel.gov"}]
maintainers = [{email = "Silvana.Ovaitt@nrel.gov"}]
license = {text = "BSD-3"}
readme = "README.md"
requires-python = ">=3.9.0, <3.12"
classifiers = [
"Development Status :: 4 - Beta",
"Operating System :: OS Independent",
"Intended Audience :: Science/Research",
"Programming Language :: Python :: 3",
"Topic :: Scientific/Engineering",
]
keywords = [
"photovoltaic",
"solar",
"degradation",
"analysis",
"performance",
"module",
"PV",
]
dependencies = [
"NREL-rex",
"cartopy",
"dask",
"dask-jobqueue",
"h5netcdf",
"h5py",
"jupyterlab",
"matplotlib",
"netCDF4",
"notebook",
"numba",
"numpy",
"openpyxl",
"pandas",
"photovoltaic",
"pvlib",
"python-dateutil",
"pytz",
"scipy",
"tables",
"tqdm",
"xarray",
]
dynamic = ["version"]

[project.optional-dependencies]
docs = [
"readthedocs-sphinx-search>=0.3.1,<0.4",
"sphinx>=7.2.6,<8",
"sphinx_rtd_theme>=2.0.0,<3",
]
test = [
"coverage",
"pytest",
]
all = [
"pvdeg[docs,test]",
]

[project.entry-points.pvdeg]
console_scripts = "pvdeg.cli:cli"

[project.urls]
Homepage = "https://github.com/NREL/PVDegradationTools"
"Bug Tracker" = "https://github.com/NREL/PVDegradationTools/issues"
Documentation = "https://pvdegradationtools.readthedocs.io/"
"Source Code" = "https://github.com/NREL/PVDegradationTools"

[tool.setuptools.packages.find]
include = ["pvdeg"]

[tool.setuptools_scm]

[tool.pytest.ini_options]
testpaths = "tests"
addopts = [
"-p no:warnings",
"--verbose",
]
3 changes: 0 additions & 3 deletions pytest.ini

This file was deleted.

22 changes: 0 additions & 22 deletions requirements.txt

This file was deleted.

24 changes: 0 additions & 24 deletions setup.cfg

This file was deleted.

111 changes: 0 additions & 111 deletions setup.py

This file was deleted.

Binary file modified tests/data/h5_pytest.h5
Binary file not shown.
3 changes: 2 additions & 1 deletion tests/test_design.py
Original file line number Diff line number Diff line change
@@ -9,7 +9,8 @@
def test_edge_seal_ingress_rate():
# test calculation for constant k

psat, avg_psat = humidity.psat(PSM["Dew Point"])
# "Dew Point" fallback handles key-name bug in pvlib < v0.10.3.
psat, avg_psat = humidity.psat(PSM.get("temp_dew", PSM.get("Dew Point")))
k = design.edge_seal_ingress_rate(avg_psat=avg_psat)
assert k == pytest.approx(0.00096, abs=0.000005)

1,885 changes: 0 additions & 1,885 deletions versioneer.py

This file was deleted.