Skip to content

Commit 047ba89

Browse files
authored
Merge pull request #1 from silvxlabs/initial-release
Add code for initial release
2 parents 8787780 + 92e14cc commit 047ba89

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+60840
-0
lines changed

.flake8

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[flake8]
2+
ignore =
3+
# E501: line too long (we rely on black for this)
4+
E501,
5+
# Whitespace before ':'. flake8 is wrong when inside slice expressions.
6+
E203,
7+
# Line break before binary operator. flake8 is wrong and goes against PEP8.
8+
W503,

.github/workflows/pre-commit.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Linting and Formatting
2+
3+
on:
4+
pull_request:
5+
branches: [ main ]
6+
7+
jobs:
8+
pre-commit:
9+
name: Run pre-commit
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-python@v4
14+
with:
15+
cache: pip
16+
- uses: pre-commit/[email protected]

.github/workflows/release.yml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
name: Release Workflow
2+
3+
on:
4+
release:
5+
types: [ published ]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
upload-to-test-pypi:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
- name: Set up Python
18+
uses: actions/setup-python@v4
19+
with:
20+
python-version: '3.x'
21+
cache: pip
22+
- name: Install dependencies
23+
run: |
24+
python -m pip install --upgrade pip
25+
pip install setuptools wheel twine
26+
- name: Build package
27+
run: |
28+
python setup.py sdist bdist_wheel
29+
- name: Upload to Test PyPi
30+
env:
31+
TWINE_USERNAME: __token__
32+
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
33+
run: |
34+
twine upload --repository testpypi dist/*
35+
36+
test-on-test-pypi:
37+
needs: upload-to-test-pypi
38+
runs-on: ubuntu-latest
39+
40+
steps:
41+
- name: Checkout repository
42+
uses: actions/checkout@v4
43+
- name: Set up Python
44+
uses: actions/setup-python@v4
45+
with:
46+
python-version: '3.x'
47+
cache: pip
48+
- name: Install package from Test PyPi
49+
run: |
50+
python -m pip install --upgrade pip
51+
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple nsvb
52+
- name: Install test dependencies
53+
run: |
54+
pip install -r pytest
55+
- name: Run pytest
56+
env:
57+
TEST_ENV: test_pypi
58+
run: |
59+
pytest
60+
61+
upload-to-pypi:
62+
needs: test-on-test-pypi
63+
runs-on: ubuntu-latest
64+
65+
steps:
66+
- name: Checkout repository
67+
uses: actions/checkout@v4
68+
- name: Set up Python
69+
uses: actions/setup-python@v4
70+
with:
71+
python-version: '3.x'
72+
cache: pip
73+
- name: Install dependencies
74+
run: |
75+
python -m pip install --upgrade pip
76+
pip install setuptools wheel twine
77+
- name: Build and publish
78+
env:
79+
TWINE_USERNAME: __token__
80+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
81+
run: |
82+
python setup.py sdist bdist_wheel
83+
twine upload dist/*
84+
85+
test-on-pypi:
86+
needs: upload-to-pypi
87+
runs-on: ubuntu-latest
88+
89+
steps:
90+
- name: Checkout repository
91+
uses: actions/checkout@v4
92+
- name: Set up Python
93+
uses: actions/setup-python@v4
94+
with:
95+
python-version: '3.x'
96+
cache: pip
97+
- name: Install package from PyPi
98+
run: |
99+
python -m pip install --upgrade pip
100+
pip install nsvb
101+
- name: Install test dependencies
102+
run: |
103+
pip install -r pytest
104+
- name: Run pytest
105+
env:
106+
TEST_ENV: pypi
107+
run: |
108+
pytest

.pre-commit-config.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.6.0
4+
hooks:
5+
- id: check-yaml
6+
- id: end-of-file-fixer
7+
- id: trailing-whitespace
8+
- id: requirements-txt-fixer
9+
10+
- repo: https://github.com/psf/black-pre-commit-mirror
11+
rev: 24.4.2
12+
hooks:
13+
- id: black
14+
- id: black-jupyter
15+
16+
- repo: https://github.com/PyCQA/flake8
17+
rev: 7.0.0
18+
hooks:
19+
- id: flake8

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,15 @@
11
# nsvb
22
National Scale Volume and Biomass Estimators
3+
4+
## Introduction
5+
6+
Welcome to the NSVB library. NSVB provides a faithful implementation of the National Scale Volume and Biomass Estimators
7+
published by the Forest Service.
8+
9+
## Installation
10+
11+
nsvb is available on PyPI and can be installed using pip:
12+
13+
```bash
14+
pip install nsvb
15+
```

nsvb/__init__.py

Whitespace-only changes.

nsvb/data/REF_SPECIES.csv

Lines changed: 2678 additions & 0 deletions
Large diffs are not rendered by default.

nsvb/data/Table S10a_fia_wood_c_frac_live.csv.csv

Lines changed: 2677 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Decay code,S/H,C fraction
2+
1,Hardwood,47
3+
2,Hardwood,47.3
4+
3,Hardwood,48.1
5+
4,Hardwood,48
6+
5,Hardwood,47.2
7+
1,Softwood,50.1
8+
2,Softwood,50.4
9+
3,Softwood,50.6
10+
4,Softwood,52
11+
5,Softwood,52.7
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
Division,HWD Y/N,Mean CR,Nobs
2+
132,N,43.9,"5,367"
3+
132,Y,41.6,"1,562"
4+
133,N,49.6,"4,285"
5+
133,Y,41.5,"1,411"
6+
211,N,42.6,"52,714"
7+
211,Y,39.2,"83,502"
8+
212,N,48,"156,144"
9+
212,Y,38.6,"228,860"
10+
221,N,42.2,"21,434"
11+
221,Y,38.5,"122,979"
12+
222,N,44.5,"13,614"
13+
222,Y,38.8,"81,313"
14+
223,N,42.8,"22,202"
15+
223,Y,38.5,"125,995"
16+
231,N,34.8,"174,639"
17+
231,Y,37.4,"234,992"
18+
232,N,33.1,"216,742"
19+
232,Y,35.8,"211,115"
20+
234,N,40.6,"6,069"
21+
234,Y,38.9,"25,984"
22+
242,N,48.2,"10,902"
23+
242,Y,35.6,"4,083"
24+
251,N,62.1,"2,142"
25+
251,Y,38.5,"34,100"
26+
255,N,43.1,"3,679"
27+
255,Y,36.6,"20,560"
28+
261,N,38.9,"1,499"
29+
261,Y,40.2,"2,480"
30+
262,N,28.8,11
31+
262,Y,40,206
32+
263,N,40.3,"10,068"
33+
263,Y,38.1,"8,704"
34+
313,N,65.7,"44,620"
35+
313,Y,46.9,"9,077"
36+
315,N,74.2,"2,335"
37+
315,Y,43.6,748
38+
321,N,63.1,"1,412"
39+
321,Y,63.8,"4,460"
40+
322,N,64.8,"4,646"
41+
322,Y,56.5,641
42+
331,N,56.3,"16,593"
43+
331,Y,41.2,"3,095"
44+
332,N,56.4,"2,083"
45+
332,Y,38.9,"5,611"
46+
341,N,68.5,"30,965"
47+
341,Y,39.9,"6,351"
48+
342,N,65.6,"11,752"
49+
342,Y,40.2,"1,908"
50+
411,N,29.5,"2,295"
51+
411,Y,28.1,"1,685"
52+
Islan,Y,28.7,"15,796"
53+
M132,N,45.9,"7,650"
54+
M132,Y,42.4,"2,336"
55+
M133,N,55.8,"1,529"
56+
M133,Y,44.9,331
57+
M134,N,58.7,202
58+
M134,Y,52.4,18
59+
M211,N,41.2,"65,999"
60+
M211,Y,39,"80,199"
61+
M221,N,42.2,"22,131"
62+
M221,Y,37.6,"141,153"
63+
M223,N,44.3,"2,347"
64+
M223,Y,40.3,"11,917"
65+
M231,N,36.4,"13,990"
66+
M231,Y,41.4,"15,235"
67+
M241,N,42.7,"47,844"
68+
M241,Y,44,"1,879"
69+
M242,N,50.4,"265,277"
70+
M242,Y,37.8,"20,220"
71+
M261,N,48.6,"103,581"
72+
M261,Y,40.7,"41,928"
73+
M262,N,61.7,"1,372"
74+
M262,Y,41.1,"2,735"
75+
M313,N,56.7,"35,229"
76+
M313,Y,53.3,"7,155"
77+
M331,N,56.1,"127,949"
78+
M331,Y,37.2,"34,084"
79+
M332,N,53.6,"135,411"
80+
M332,Y,43.5,"1,596"
81+
M333,N,48.8,"103,777"
82+
M333,Y,38.9,"1,994"
83+
M334,N,49.8,"8,682"
84+
M334,Y,47.9,"1,310"
85+
M341,N,66.6,"37,068"
86+
M341,Y,40.9,"11,353"
87+
UNDEFINED,N,46.8,"1,806,092"
88+
UNDEFINED,Y,38,"1,614,286"

0 commit comments

Comments
 (0)