diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml deleted file mode 100644 index 0f0e51eb..00000000 --- a/.github/workflows/pylint.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Pylint - -on: [push] - -jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.9", "3.10", "3.11"] - steps: - - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install pylint - - name: Analysing the code with pylint - run: | - pylint $(git ls-files '*.py') diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index d858af41..7a13f5ea 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -7,11 +7,11 @@ name: Mark stale issues and pull requests on: schedule: - - cron: '32 22 * * *' + # Job will run at midnight on the 1st of each month (POSIX time syntax) + - cron: '0 0 1 * *' jobs: stale: - runs-on: ubuntu-latest permissions: issues: write @@ -21,7 +21,12 @@ jobs: - uses: actions/stale@v5 with: repo-token: ${{ secrets.GITHUB_TOKEN }} - stale-issue-message: 'Stale issue message' - stale-pr-message: 'Stale pull request message' - stale-issue-label: 'no-issue-activity' - stale-pr-label: 'no-pr-activity' + # Stale issue settings + days-before-issue-stale: 30 + days-before-issue-close: 30 + stale-issue-label: 'stale' + stale-issue-message: 'This issue is stale because it has been open for 30 days with no activity.' + close-issue-message: "This issue was closed because it has been inactive for 30 days since being marked as stale." + # Never mark PRs as stale + days-before-pr-stale: -1 + days-before-pr-close: -1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 87dab86f..25f0ae28 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - Bump pip from 23.2.1 to 23.3 (dependabot suggested this) - Bump pypdf from 3.16.1 to 3.17.0 (dependabot suggested this) - YAML tag `operations_budget` is now `ops_budget_table` in `gcpy/benchmark/config/1yr_tt_benchmark.yml` +- Now require `matplotlib=3.8.0` in `docs/environment_files/environment.yml` (with other pegged versions) +- Now run the `stale` GitHub action at 00:00 UTC on the 1st of each month ### Fixed - CS inquiry functions in `gcpy/cstools.py` now work properly for `xr.Dataset` and `xr.DataArray` objects @@ -25,6 +27,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - `gcpy/file_regrid.py` now creates GCHP files with `DELP_DRY` instead of `DELPDRY` - Fixed bugs in GCHP vs GCHP sections of 1-yr benchmark run scripts to allow comparison of GCHP runs with different grid resolutions - Fixed silent bug in transport tracer benchmark GCC vs GCHP mass tables preventing them from being generated +- Import error in `gcpy/examples/diagnostics/compare_diags.py` +- Added missing `n_cores` to `gcpy/examples/diagnostics/compare_diags.yml` + +### Removed +- Example script `gcpy/examples/plotting/mda8_o3_timeseries.py` +- Removed `Pylint` GitHub action ## [1.4.2] - 2024-01-26 ### Added diff --git a/gcpy/examples/diagnostics/compare_diags.py b/gcpy/examples/diagnostics/compare_diags.py index c80d2660..e225cca3 100755 --- a/gcpy/examples/diagnostics/compare_diags.py +++ b/gcpy/examples/diagnostics/compare_diags.py @@ -11,7 +11,7 @@ import warnings import numpy as np from gcpy.util import add_missing_variables, compare_varnames, \ - dataset_reader, read_config_file + dataset_reader, read_config_file, rename_and_flip_gchp_rst_vars from gcpy.constants import skip_these_vars from gcpy.plot.compare_single_level import compare_single_level from gcpy.plot.compare_zonal_mean import compare_zonal_mean @@ -109,8 +109,8 @@ def read_data(config): # If the data is from a GCHP restart file, rename variables and # flip levels to match the GEOS-Chem Classic naming and level # conventions. Otherwise no changes will be made. - refdata = util.rename_and_flip_gchp_rst_vars(refdata) - devdata = util.rename_and_flip_gchp_rst_vars(devdata) + refdata = rename_and_flip_gchp_rst_vars(refdata) + devdata = rename_and_flip_gchp_rst_vars(devdata) # Define dictionary for return data = { diff --git a/gcpy/examples/diagnostics/compare_diags.yml b/gcpy/examples/diagnostics/compare_diags.yml index 69db1377..2bb4c626 100644 --- a/gcpy/examples/diagnostics/compare_diags.yml +++ b/gcpy/examples/diagnostics/compare_diags.yml @@ -33,3 +33,4 @@ options: filename: '' skip_small_diffs: True small_diff_threshold: 0.0000 + n_cores: -1 diff --git a/gcpy/examples/timeseries/__init__.py b/gcpy/examples/timeseries/__init__.py index 92fd2052..ddc29ae5 100644 --- a/gcpy/examples/timeseries/__init__.py +++ b/gcpy/examples/timeseries/__init__.py @@ -1,6 +1,5 @@ """ GCPy import script """ -from .mda8_o3_timeseries import * from .plot_timeseries import * diff --git a/gcpy/examples/timeseries/mda8_o3_timeseries.py b/gcpy/examples/timeseries/mda8_o3_timeseries.py deleted file mode 100755 index 078469bd..00000000 --- a/gcpy/examples/timeseries/mda8_o3_timeseries.py +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/env python -""" -MDA8 Timeseries Calculations -======================================== - -A common statistic used when constructing standards for air quality -criteria pollutants is to look at the ranked distribution of the -daily maxima of rolling 8-hour averages of a substance, or MDA8 for -short. -""" -# Author: Daniel Rothenberg -# Version: June 1, 2017 -# -# NOTE: Now placed into a function so that we only execute -# these commands when running as a standalone script. -# (Bob Yantosca, 09 Aug 2023) - -import matplotlib.pyplot as plt -import matplotlib.dates as mdates -import pandas as pd -import xarray as xr -plt.style.use(['seaborn-v0_8-talk', 'seaborn-v0_8-ticks']) - - -def main(): - """ - MDA8 O3 timeseries example - """ - - # Read hourly data ### EDIT THIS IF NECESSARY - InFile = 'GEOSChem.Hourly_SfcO3.2017.nc' - ds = xr.open_dataset(InFile) - o3_data = ds['SpeciesConc_O3'] - - # Compute the 8-hour rolling averages for ozone - avg_8hr_o3 = (o3_data.rolling(time=8, min_periods=6).mean()) - - # By default, this takes the last timestamp in a rolling interval; i.e. the - # timestamps correspond to the preceding 8 hours. We want them to refer to - # the proeding 8 hours, so we can adjust them using datetime arithmetic - times_np = avg_8hr_o3.time.values - times_pd = pd.to_datetime(times_np) - pd.Timedelta('8h') - avg_8hr_o3.time.values[:] = times_pd - - # Finally, aggregate by calendar day and compute the maxima of the set of - # 8-hour averages for each day - mda8_o3 = avg_8hr_o3.resample(time='D').max(dim='time') - mda8_o3.name='mda8_o3' - - # Save output to new netCDF file - mda8_o3.to_netcdf( - 'GEOSChem.MDA8_O3.20170.nc', 'w', - format='NETCDF4', - encoding={'lat': {'_FillValue': None}, - 'lon': {'_FillValue': None}, - 'time': {'_FillValue': None}, - 'mda8_o3': {'_FillValue': None}} - ) - - # Select data for one specific location, near Boston - boston_mda8_o3 = mda8_o3.sel(lon=-71., lat=42., method='nearest') - boston_o3 = o3_data.sel(lon=-71., lat=42., method='nearest') - - # Plot both the original (hourly) and MDA* timeseries on the same plot. - fig = plt.figure(figsize=(9, 3)) - ax = fig.add_subplot(111) - boston_o3.plot(ax=ax, color='k') - ax.stem(boston_mda8_o3.time.values, boston_mda8_o3.data, - ':r', markerfmt='ro') - ax.set_ylim(0) - - ax.xaxis.set_major_formatter(mdates.DateFormatter("%h %d")) - for tick in ax.xaxis.get_majorticklabels(): - tick.set_horizontalalignment('center') - - ax.set_xlabel("") - ax.set_ylabel("(MDA8) O$_3$ [ppb]") - - plt.show() - - -# Only execute when running as a standalone script -if __name__ == '__main__': - main()