Skip to content

Commit

Permalink
Merge pull request #300 from NCAR/main
Browse files Browse the repository at this point in the history
v2.6.0
  • Loading branch information
K20shores authored Jan 6, 2025
2 parents ad8cd99 + 8db4180 commit 7eff337
Show file tree
Hide file tree
Showing 25 changed files with 5,230 additions and 4,831 deletions.
23 changes: 21 additions & 2 deletions .github/workflows/CI_Tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,28 @@ jobs:
- name: Install this package
run: pip install -e '.[dev]'

- name: Run pytest
run: pytest
- name: Install gnuplot
if: runner.os == 'Linux'
run: sudo apt-get install gnuplot

- name: Install gnuplot
if: runner.os == 'macOS'
run: brew install gnuplot

- name: Install gnuplot
if: runner.os == 'Windows'
run: choco install gnuplot

- name: Run tests and generate coverage reports
run: pytest --cov src/

- name: Upload coverage reports to codecov
if: runner.os == 'Linux'
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.info

- name: Run the smoke tests
run: |
music_box -c src/acom_music_box/examples/configs/analytical/my_config.json -o output.csv
Expand Down
6 changes: 3 additions & 3 deletions .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 --max-line-length 180 .
args: --recursive --in-place --aggressive --max-line-length 180 --indent-size=4 .

- name: Check for changes
id: check-changes
Expand All @@ -28,7 +28,7 @@ jobs:
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
git commit -am "Auto-format code using Clang-Format" || echo "No changes to commit"
git commit -am "Auto-format code using pep8" || echo "No changes to commit"
- name: Push changes to main-autopep8 branch
if: steps.check-changes.outcome != 'success'
Expand All @@ -42,4 +42,4 @@ jobs:
commit-message: "Auto-format code using autopep8"
title: "Auto-format code by autopep8"
body: "This is an auto-generated PR with fixes by autopep8."
branch: main-autopep8
branch: main-autopep8
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ __pycache__/
*.pyc
dist

.vscode/
.vscode/
.coverage
src/acom_music_box/examples/configs/ts1/initial_config.json
4 changes: 3 additions & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cff-version: 1.2.0
message: If you use this software, please cite it as below.
title: MusicBox
version: v2.5.5
version: v2.6.0
authors:
- family-names: Dawson
given-names: Matthew
Expand All @@ -19,5 +19,7 @@ authors:
given-names: Brendan
- family-names: Drews
given-names: Carl
- family-names: Kiran
given-names: Aditya
license: Apache-2.0
url: "https://github.com/NCAR/music-box"
68 changes: 63 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ 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)
[![codecov](https://codecov.io/github/NCAR/music-box/graph/badge.svg?token=OR7JEQJSRQ)](https://codecov.io/github/NCAR/music-box)
[![PyPI version](https://badge.fury.io/py/acom-music-box.svg)](https://badge.fury.io/py/acom-music-box)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.14008358.svg)](https://doi.org/10.5281/zenodo.14008358)

Copyright (C) 2020 National Center for Atmospheric Research

Copyright (C) 2020 National Science Foundation - National Center for Atmospheric Research

# Installation
```
Expand All @@ -30,22 +33,77 @@ Run an example. Notice that the output, in csv format, is printed to the termina
music_box -e Chapman
```

Output can be saved to a csv file and printed to the terminal.

```
music_box -e Chapman -o output.csv
```

Output can be saved to a csv file and the terminal output can be suppressed by specifying the `--output-format`

```
music_box --output-format csv -e Chapman -o output.csv
```

Output can be saved to a file as netcdf file when `--output-format` netcdf is passed

```
music_box --output-format netcdf -e Chapman -o output.nc
```

Output can be saved to a file in csv format when a filename is not specified. In this case a timestamped csv file is made

```
music_box --output-format csv -e Chapman
```

Output can be saved to a file in netcdf format when a filename is not specified. In this case a timestamped netcdf file is made

```
music_box --output-format netcdf -e Chapman
```

You can also run your own configuration

```
music_box -c my_config.json
```

Output can be saved to a file
## Plotting
Some basic plots can be made to show concentrations throughout the simulation

### matplotlib

```
music_box -e Chapman -o output.csv
music_box -e Chapman -o output.csv --plot O1D
```

You can also make multiple plots by specifying groupings of species

```
music_box -e TS1 --plot O3 --plot PAN,HF
```

Note that the windows may overlap each other

By default all plot units are in `mol m-3`. You can see a list of unit options to specify with `--plot-output-unit`

```
music_box -h
```

It is used like this

```
music_box -e TS1 --output-format csv --plot O3 --plot-output-unit "ppb"
```

And, if you have gnuplot installed, some basic plots can be made to show some resulting concentrations
### gnuplot
If you want ascii plots (maybe you're running over ssh and can't view a graphical window), you can set
the plot tool to gnuplo (`--plot-tool gnuplot`) to view some output

```
music_box -e Chapman -o output.csv --color-output --plot CONC.O1D
music_box -e Chapman -o output.csv --plot O1D --plot-tool gnuplot
```

# Development and Contributing
Expand Down
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

version = acom_music_box.__version__
project = f'Music Box ({version})'
copyright = f'2024-{datetime.datetime.now().year}, NCAR/UCAR'
author = 'NCAR/UCAR'
copyright = f'2024-{datetime.datetime.now().year}, NSF-NCAR/UCAR'
author = 'NSF-NCAR/UCAR'

suffix = os.getenv("SWITCHER_SUFFIX", "")
release = f'{version}{suffix}'
Expand Down
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ classifiers = ["License :: OSI Approved :: Apache Software License"]
dynamic = ["version", "description"]

dependencies = [
"musica==0.8.1",
"musica==0.9.0",
"xarray",
"colorlog",
"pandas",
Expand All @@ -41,5 +41,6 @@ waccmToMusicBox = "acom_music_box.tools.waccmToMusicBox:main"
[project.optional-dependencies]
dev = [
"pytest",
"pytest-mock"
"pytest-mock",
"pytest-cov"
]
4 changes: 3 additions & 1 deletion src/acom_music_box/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
This package contains modules for handling various aspects of a music box,
including species, products, reactants, reactions, and more.
"""
__version__ = "2.5.5"
__version__ = "2.6.0"

from .utils import convert_time, convert_pressure, convert_temperature, convert_concentration
from .model_options import BoxModelOptions
Expand All @@ -13,3 +13,5 @@
from .evolving_conditions import EvolvingConditions
from .music_box import MusicBox
from .examples import Examples
from .data_output import DataOutput
from .plot_output import PlotOutput
Loading

0 comments on commit 7eff337

Please sign in to comment.