Skip to content
Open
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
17 changes: 7 additions & 10 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,24 @@

name: Build Packages

on:
push:
branches: [ "main", "dev" ]
pull_request:
branches: [ "main", "dev" ]
on: [push, pull_request]

jobs:
make-wheels:
name: Build wheels on ${{ matrix.os }} (compiler ${{ matrix.compiler-version }})
name: Build wheels for ${{ matrix.python }} on ${{ matrix.os }} (compiler ${{ matrix.compiler-version }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python: ['cp310', 'cp311', 'cp312', 'cp313', 'cp314']
include:
- os: ubuntu-latest
compiler: gcc
compiler-version: 15
- os: windows-latest
compiler: gcc
compiler-version: 13
compiler-version: 15

steps:
- name: Fortran Setup
Expand All @@ -47,8 +45,7 @@ jobs:
- name: Build wheels
uses: pypa/[email protected]
env:
# Build for Python 3.10–3.13, 64-bit only
CIBW_BUILD: cp310-* cp311-* cp312-* cp313-* cp314-*
CIBW_BUILD: ${{ matrix.python }}-*
CIBW_SKIP: "*-win32 *-manylinux_i686 *-musllinux*"
CIBW_ARCHS_LINUX: x86_64
CIBW_ARCHS_WINDOWS: AMD64
Expand All @@ -73,7 +70,7 @@ jobs:
- name: Store wheels
uses: actions/upload-artifact@v7
with:
name: pyfvs-${{ matrix.os }}-wheels
name: pyfvs-${{ matrix.os }}-${{ matrix.python }}-wheels
path: dist/*.whl
if-no-files-found: warn
overwrite: true
Expand Down
106 changes: 97 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

Python wrappers and utilities for using the Forest Vegetation Simulator

``` Text
```Text
_____ ______ __ __ _____
| __ \ | ____|\ \ / / / ____|
| |__) | _ _ | |__ \ \ / / | (____
Expand All @@ -34,7 +34,9 @@ Python wrappers and utilities for using the Forest Vegetation Simulator

- [![Monthly Downloads](https://pepy.tech/badge/PyFVS/month)](https://pepy.tech/project/PyFVS)

The PyFVS [FVS source code](https://github.com/forest-modeling/ForestVegetationSimulator/tree/open-dev) is forked from the [USFS FVS GitHub](https://github.com/USDAForestService/ForestVegetationSimulator) repository, [open-dev](https://github.com/USDAForestService/ForestVegetationSimulator/tree/open-dev) branch
PyFVS wraps a [fork](https://github.com/forest-modeling/ForestVegetationSimulator) of the official [FVS code](https://github.com/USDAForestService/ForestVegetationSimulator) with minimal, non-core, modifications.

PyFVS currently supports Windows and Linux using the GCC family of compilers.

## Documentation

Expand All @@ -43,20 +45,52 @@ Check out the AI generated documentation [wiki](https://deepwiki.com/forest-mode
## Features

- FVS Class
- FVS Step API - Iterate projection cycles
- Initialize inventory trees from arrays
- Access to all FVS internal arrays and variables

- Keywords - Object based FVS keyword file generation
- FVS Step API
- Growth cycle interation
- Within-cycle blocking callbacks for fine-grained inspection and sub-model interaction
- Initialize inventory trees from arrays and dataframes
- Runtime interaction with FVS internal arrays and variables
- Facilitates out-of-core event logic
- Sub-cycle analysis of model components and data

- Keyword Generator:
- Object oriented FVS keyword file generation
- Automates keyword file formatting and runtime handling

- Command line interface

Documentation forthcoming
## Variants

Not all FVS variants are currently implement. More will be added as time allows.

- PN - Pacific Northwest Coast
- WC - Westside Cascades
- SO - South Central Oregon and Northeast California
- OP - ORGANON Pacific Northwest
- OC - ORGANON Southwest
- EC - East Cascades
- CA - Inland California and Southern Cascades
- NC - Klamath Mountains (Northern California)
- BM - Blue Mountains
- IE - Inland Empire (Northern Idaho)
- CI - Central Idaho
- AK - Alaska
- WS - Western Sierra Nevada

## Parity with Official Binaries

PyFVS is designed to be consistent with the official FVS
binaries. Before a release all variants are run through a series
of unit test to ensure functionality and equivalence with
official FVS binaries.

- Variant specific unit tests from official FVS releases
- Additional unit tests for specific functionality

## Usage

**NOTE:** The PyFVS API is beta. Names and arguments may change as
features evolve. Deprecation warnings will be raise when possible.
features evolve. Deprecation warnings will be raised when possible.
However, there is guarantee of backward compatibility.

### Command Line
Expand Down Expand Up @@ -107,3 +141,57 @@ f.run()
# Print the summary table
print(f.summary)
```

### Development

Clone the 'dev' branch, including all submodules
```bash
git clone --branch dev --recurse-submodules https://github.com/forest-modeling/PyFVS.git
```

For local development a Pixi environment is included in `pyproject.toml`.

```bash
# Install Pixi on Linux
curl -fsSL https://pixi.sh/install.sh | sh
```

```powershell
# Install Pixi on Windows
powershell -ExecutionPolicy Bypass -c "irm -useb https://pixi.sh/install.ps1 | iex"
```

Initialize the environment in the root of the project
```bash
pixi init --pyproject
```
```bash
pixi shell
```

#### Local Development Build
The Pixi environment includes GCC and GFortran compilers from Conda-Forge. Use the included Pixi task to install PyFVS in the
current environment in development mode. Pass an optional comma separated list of lower case variant abbreviations to restrict the build to target variants. Additionally, an optional build mode can be passed, debug or release.

```bash
pixi run dev "pn,wc" debug
```

Development mode in Pixi is consistent with Pip. Additionally,
PyFVS is built with Meson and Meson-Python. Changes to source files, Python
or Fortran, will trigger a recompile on the next import.
Alternatively, you can trigger a build by calling the dev task
again.

#### Run Tests

```bash
pixi run test
```

#### Build Wheels
Wheel files for the current system will be placed in the dist folder along with an sdist source archive.

```bash
pixi run build "pn,wc"
```
2 changes: 1 addition & 1 deletion meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ option('fvsvariants', type: 'array',
# value: ['pn',],
# value: ['ws',],
description: 'FVS variants to build'
)
)
Loading