Skip to content

Commit

Permalink
Merge branch 'main' into 130-create-musicbox-configuration-for-ts1cap…
Browse files Browse the repository at this point in the history
…ram-24-reduced-mechanism
  • Loading branch information
K20shores committed Sep 17, 2024
2 parents 7cf67c9 + b49fe13 commit ff91223
Show file tree
Hide file tree
Showing 221 changed files with 10,430 additions and 4,804 deletions.
20 changes: 20 additions & 0 deletions .devcontainer/Dockerfile.codespace
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM fedora:37

RUN dnf -y update \
&& dnf -y install \
git \
gcc \
gcc-c++ \
gnuplot \
netcdf-devel \
python3 \
python3-pip \
python-devel \
tree \
&& dnf clean all

COPY . /workspaces/music-box

WORKDIR /workspaces/music-box

RUN pip3 install -e '.[dev]'
10 changes: 10 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "MusicBox",
"image": "ghcr.io/ncar/music-box:latest",
"extensions": [
"ms-python.python",
],
"settings": {
},
"postCreateCommand": ""
}
34 changes: 26 additions & 8 deletions .github/workflows/CI_Tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,36 @@ jobs:
python-version: '3.9'
cache: 'pip'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Install this package
run: pip install -e .
run: pip install -e '.[dev]'

- name: Run pytest
run: cd tests && pytest
run: pytest

- name: Run the smoke tests
run: |
music_box configFile=tests/configs/analytical_config/my_config.json outputDir=tests/configs/analytical_config
music_box -c src/acom_music_box/examples/configs/analytical/my_config.json -o output.csv
music_box -e Analytical -o output.csv
music_box -e Analytical -o output.csv -vv --color-output
waccmToMusicBox waccmDir="./sample_waccm_data" date="20240904" time="07:00" latitude=3.1 longitude=101.7
- name: Check for config.zip
if: runner.os != 'Windows'
run: |
if [ -f "./config.zip" ]; then
echo "config.zip created successfully"
else
echo "config.zip not found"
exit 1
fi
- name: Check for config.zip (Windows)
if: runner.os == 'Windows'
run: |
if (Test-Path -Path "./config.zip") {
Write-Output "config.zip created successfully"
} else {
Write-Output "config.zip not found"
exit 1
}
shell: pwsh
53 changes: 53 additions & 0 deletions .github/workflows/deploy_codespaces_image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Build and Deploy Docker Image

on:
push:
branches:
- main
tags:
- 'v*.*.*'
workflow_dispatch:

jobs:
build-and-push:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build Docker image
uses: docker/build-push-action@v4
with:
context: .
file: .devcontainer/Dockerfile.codespace
push: false
tags: ghcr.io/ncar/music-box:build-temp

- name: Build and push Docker image (latest)
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v4
with:
context: .
file: .devcontainer/Dockerfile.codespace
push: true
tags: ghcr.io/ncar/music-box:latest

- name: Build and push Docker image (tagged)
if: startsWith(github.ref, 'refs/tags/')
uses: docker/build-push-action@v4
with:
context: .
file: .devcontainer/Dockerfile.codespace
push: true
tags: ghcr.io/ncar/music-box:${{ github.ref_name }}
2 changes: 1 addition & 1 deletion .github/workflows/pep8_autoformat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: autopep8
uses: peter-evans/autopep8@v2
with:
args: --recursive --in-place --aggressive --aggressive .
args: --recursive --in-place --aggressive --aggressive --max-line-length 120 .

- name: Check for changes
id: check-changes
Expand Down
46 changes: 24 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,56 +6,58 @@ MusicBox: A MUSICA model for boxes and columns.

[![License](https://img.shields.io/github/license/NCAR/music-box.svg)](https://github.com/NCAR/music-box/blob/main/LICENSE)
[![CI Status](https://github.com/NCAR/music-box/actions/workflows/CI_Tests.yml/badge.svg)](https://github.com/NCAR/music-box/actions/workflows/CI_Tests.yml)
[![PyPI version](https://badge.fury.io/py/acom_music_box.svg)](https://pypi.org/p/acom_music_box)
[![PyPI version](https://badge.fury.io/py/acom-music-box.svg)](https://badge.fury.io/py/acom-music-box)

Copyright (C) 2020 National Center for Atmospheric Research

# Installation
```
pip install acom_music_box
```

The project is configured to be installed using `pip` by the `pyproject.toml` file.
# Command line tool
MusicBox provides a command line tool that can run configurations as well as some pre-configured examples. Basic plotting can be done if gnuplot is installed.

To install the `music-box` package into a Python environment, run the following command from the root directory:
Checkout the command line options

```
pip install .
music_box -h
```

The package is also available on PyPi and can be installed in any Python environment through:
Run an example. Notice that the output, in csv format, is printed to the terminal.

```
pip install acom_music_box
music_box -e Chapman
```

# Tests

The tests directory contains 4 different tests that can be ran with [PyTest](https://docs.pytest.org/en/8.2.x/). PyTest can be installed by running:
You can also run your own configuration

```
pip install pytest
music_box -c my_config.json
```

After PyTest is intalled, the tests can be ran through the following commands from the root directory:
Output can be saved to a file

```
cd tests
pytest
music_box -e Chapman -o output.csv
```

# Documentation

MusicBox documentation can be built using [Sphinx](https://www.sphinx-doc.org/en/master/). Sphinx can be installed by running:
And, if you have gnuplot installed, some basic plots can be made to show some resulting concentrations

```
pip install sphinx
music_box -e Chapman -o output.csv --color-output --plot CONC.O1D
```

After installing Sphinx, the documentation can be generated by running the following commands in the root directory:
# Development and Contributing

For local development, install `music-box` as an editable installation:

```
cd doc/sphinx_files
make html
pip install -e '.[dev]'
```

Then, open `music-box/doc/sphinx_files/build/html/index.html` in a browser.
## Tests

The documentation includes more detailed instructions for configuring the model, along with developer resources.
```
pytest
```

This file was deleted.

This file was deleted.

Loading

0 comments on commit ff91223

Please sign in to comment.