Skip to content

Commit e6536be

Browse files
authored
Merge pull request #300 from NCAR/main
v2.6.0
2 parents 67c7f05 + 67769dd commit e6536be

25 files changed

+5230
-4831
lines changed

.github/workflows/CI_Tests.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,28 @@ jobs:
2929
- name: Install this package
3030
run: pip install -e '.[dev]'
3131

32-
- name: Run pytest
33-
run: pytest
32+
- name: Install gnuplot
33+
if: runner.os == 'Linux'
34+
run: sudo apt-get install gnuplot
35+
36+
- name: Install gnuplot
37+
if: runner.os == 'macOS'
38+
run: brew install gnuplot
39+
40+
- name: Install gnuplot
41+
if: runner.os == 'Windows'
42+
run: choco install gnuplot
43+
44+
- name: Run tests and generate coverage reports
45+
run: pytest --cov src/
3446

47+
- name: Upload coverage reports to codecov
48+
if: runner.os == 'Linux'
49+
uses: codecov/codecov-action@v5
50+
with:
51+
token: ${{ secrets.CODECOV_TOKEN }}
52+
files: coverage.info
53+
3554
- name: Run the smoke tests
3655
run: |
3756
music_box -c src/acom_music_box/examples/configs/analytical/my_config.json -o output.csv

.github/workflows/pep8_autoformat.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: autopep8
1616
uses: peter-evans/autopep8@v2
1717
with:
18-
args: --recursive --in-place --aggressive --aggressive --max-line-length 180 .
18+
args: --recursive --in-place --aggressive --max-line-length 180 --indent-size=4 .
1919

2020
- name: Check for changes
2121
id: check-changes
@@ -28,7 +28,7 @@ jobs:
2828
run: |
2929
git config --global user.name "GitHub Actions"
3030
git config --global user.email "actions@github.com"
31-
git commit -am "Auto-format code using Clang-Format" || echo "No changes to commit"
31+
git commit -am "Auto-format code using pep8" || echo "No changes to commit"
3232
3333
- name: Push changes to main-autopep8 branch
3434
if: steps.check-changes.outcome != 'success'
@@ -42,4 +42,4 @@ jobs:
4242
commit-message: "Auto-format code using autopep8"
4343
title: "Auto-format code by autopep8"
4444
body: "This is an auto-generated PR with fixes by autopep8."
45-
branch: main-autopep8
45+
branch: main-autopep8

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@ __pycache__/
99
*.pyc
1010
dist
1111

12-
.vscode/
12+
.vscode/
13+
.coverage
14+
src/acom_music_box/examples/configs/ts1/initial_config.json

CITATION.cff

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cff-version: 1.2.0
22
message: If you use this software, please cite it as below.
33
title: MusicBox
4-
version: v2.5.5
4+
version: v2.6.0
55
authors:
66
- family-names: Dawson
77
given-names: Matthew
@@ -19,5 +19,7 @@ authors:
1919
given-names: Brendan
2020
- family-names: Drews
2121
given-names: Carl
22+
- family-names: Kiran
23+
given-names: Aditya
2224
license: Apache-2.0
2325
url: "https://github.com/NCAR/music-box"

README.md

Lines changed: 63 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@ MusicBox: A MUSICA model for boxes and columns.
66

77
[![License](https://img.shields.io/github/license/NCAR/music-box.svg)](https://github.com/NCAR/music-box/blob/main/LICENSE)
88
[![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)
9+
[![codecov](https://codecov.io/github/NCAR/music-box/graph/badge.svg?token=OR7JEQJSRQ)](https://codecov.io/github/NCAR/music-box)
910
[![PyPI version](https://badge.fury.io/py/acom-music-box.svg)](https://badge.fury.io/py/acom-music-box)
11+
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.14008358.svg)](https://doi.org/10.5281/zenodo.14008358)
1012

11-
Copyright (C) 2020 National Center for Atmospheric Research
13+
14+
Copyright (C) 2020 National Science Foundation - National Center for Atmospheric Research
1215

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

36+
Output can be saved to a csv file and printed to the terminal.
37+
38+
```
39+
music_box -e Chapman -o output.csv
40+
```
41+
42+
Output can be saved to a csv file and the terminal output can be suppressed by specifying the `--output-format`
43+
44+
```
45+
music_box --output-format csv -e Chapman -o output.csv
46+
```
47+
48+
Output can be saved to a file as netcdf file when `--output-format` netcdf is passed
49+
50+
```
51+
music_box --output-format netcdf -e Chapman -o output.nc
52+
```
53+
54+
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
55+
56+
```
57+
music_box --output-format csv -e Chapman
58+
```
59+
60+
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
61+
62+
```
63+
music_box --output-format netcdf -e Chapman
64+
```
65+
3366
You can also run your own configuration
3467

3568
```
3669
music_box -c my_config.json
3770
```
3871

39-
Output can be saved to a file
72+
## Plotting
73+
Some basic plots can be made to show concentrations throughout the simulation
74+
75+
### matplotlib
4076

4177
```
42-
music_box -e Chapman -o output.csv
78+
music_box -e Chapman -o output.csv --plot O1D
79+
```
80+
81+
You can also make multiple plots by specifying groupings of species
82+
83+
```
84+
music_box -e TS1 --plot O3 --plot PAN,HF
85+
```
86+
87+
Note that the windows may overlap each other
88+
89+
By default all plot units are in `mol m-3`. You can see a list of unit options to specify with `--plot-output-unit`
90+
91+
```
92+
music_box -h
93+
```
94+
95+
It is used like this
96+
97+
```
98+
music_box -e TS1 --output-format csv --plot O3 --plot-output-unit "ppb"
4399
```
44100

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

47105
```
48-
music_box -e Chapman -o output.csv --color-output --plot CONC.O1D
106+
music_box -e Chapman -o output.csv --plot O1D --plot-tool gnuplot
49107
```
50108

51109
# Development and Contributing

docs/source/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

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

2020
suffix = os.getenv("SWITCHER_SUFFIX", "")
2121
release = f'{version}{suffix}'

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ classifiers = ["License :: OSI Approved :: Apache Software License"]
2121
dynamic = ["version", "description"]
2222

2323
dependencies = [
24-
"musica==0.8.1",
24+
"musica==0.9.0",
2525
"xarray",
2626
"colorlog",
2727
"pandas",
@@ -41,5 +41,6 @@ waccmToMusicBox = "acom_music_box.tools.waccmToMusicBox:main"
4141
[project.optional-dependencies]
4242
dev = [
4343
"pytest",
44-
"pytest-mock"
44+
"pytest-mock",
45+
"pytest-cov"
4546
]

src/acom_music_box/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
This package contains modules for handling various aspects of a music box,
55
including species, products, reactants, reactions, and more.
66
"""
7-
__version__ = "2.5.5"
7+
__version__ = "2.6.0"
88

99
from .utils import convert_time, convert_pressure, convert_temperature, convert_concentration
1010
from .model_options import BoxModelOptions
@@ -13,3 +13,5 @@
1313
from .evolving_conditions import EvolvingConditions
1414
from .music_box import MusicBox
1515
from .examples import Examples
16+
from .data_output import DataOutput
17+
from .plot_output import PlotOutput

0 commit comments

Comments
 (0)