From 4872b4750fb0eb689f704e3b151682d2b01c1993 Mon Sep 17 00:00:00 2001 From: "Angeline G. Burrell" Date: Tue, 12 May 2026 10:02:50 -0400 Subject: [PATCH 1/7] DOC: added AI policy Added an AI policy rejecting the use of AI. --- CONTRIBUTING.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 5d04921d..7c3caa71 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -88,3 +88,17 @@ To run a subset of tests from the test directory for a specific environment:: To run all the tests for a specific environment:: python -m unittest discover + +Use of 'AI' +----------- + +This project is human centered and developers do not use Artificial Inteligence +(AI) tools such as large language models in its creation or maintenance. +The purpose of this tool is to improve high-latitude science, and thus values +interactions with scientists and scientific programmers. Code generated by a +large language model or similar technology, such as Anthropic’s Claude, +GitHub/Microsoft’s Copilot, OpenAI’s ChatGPT, Facebook/Meta’s Code Llama et al., +is not compliant with the covenants and representations of OCBpy’s Contributor’s +Agreement, and is thus not acceptable as code for OCBpy. + + From 4ab3a82772b160eb742206d238085f7626da5ad2 Mon Sep 17 00:00:00 2001 From: "Angeline G. Burrell" Date: Tue, 12 May 2026 10:03:06 -0400 Subject: [PATCH 2/7] DOC: updated pull request template Added a check asserting AI is not used. --- .github/pull_request_template.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 1537b560..c326d966 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -38,6 +38,7 @@ import ocbpy - [ ] Make sure you are merging into the ``develop`` (not ``main``) branch - [ ] My commits are formatted appropriately (following the SciPy/NumPy style) - [ ] My code follows the style guidelines of this project +- [ ] I assert that I have not used AI in the development of this pull request - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation From 648e8982e153737b93f8045e8b93fe8ef20810d0 Mon Sep 17 00:00:00 2001 From: "Angeline G. Burrell" Date: Tue, 12 May 2026 10:03:20 -0400 Subject: [PATCH 3/7] DOC: updated changelog Added the AI policy update to the changelog. --- Changelog.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/Changelog.rst b/Changelog.rst index 14351ac6..f81937a9 100644 --- a/Changelog.rst +++ b/Changelog.rst @@ -7,6 +7,7 @@ Summary of all changes made since the first stable release ------------------ * ENH: Added the Gussenhoven (1983) model for the EAB * ENH: Added the CH-Aurora-2014 model for the OCB and EAB +* ENH: Added an AI usage policy (no AI use allowed) * DEP: Removed support for older versions of `zenodo_get` * MAINT: Added support for Python 3.14 * MAINT: Updated GitHub CI actions From 62e6dc21d50f8170d151d8b739c9fb6555228622 Mon Sep 17 00:00:00 2001 From: "Angeline G. Burrell" Date: Wed, 13 May 2026 13:09:59 -0400 Subject: [PATCH 4/7] MAINT: updated `zenodo_get` download checks Updated download checks to use checksum (available again). Removed old output checks, which are now redundant, and instead use hashlib to perform the the md5 checksum evaluation. This should be more resilient to future `zenodo_get` updates. --- Changelog.rst | 3 +- ocbpy/boundaries/dmsp_ssj_files.py | 62 ++++++++++++++---------------- 2 files changed, 31 insertions(+), 34 deletions(-) diff --git a/Changelog.rst b/Changelog.rst index f81937a9..f63db94a 100644 --- a/Changelog.rst +++ b/Changelog.rst @@ -8,7 +8,8 @@ Summary of all changes made since the first stable release * ENH: Added the Gussenhoven (1983) model for the EAB * ENH: Added the CH-Aurora-2014 model for the OCB and EAB * ENH: Added an AI usage policy (no AI use allowed) -* DEP: Removed support for older versions of `zenodo_get` +* DEP: Removed support for older versions of `zenodo_get`, updated download + checks to account for breaking changes made in the newer versions * MAINT: Added support for Python 3.14 * MAINT: Updated GitHub CI actions * MAINT: Updated numpy usage diff --git a/ocbpy/boundaries/dmsp_ssj_files.py b/ocbpy/boundaries/dmsp_ssj_files.py index e556fc2a..52ca5299 100644 --- a/ocbpy/boundaries/dmsp_ssj_files.py +++ b/ocbpy/boundaries/dmsp_ssj_files.py @@ -25,10 +25,9 @@ """ import datetime as dt -from io import StringIO +import hashlib import numpy as np import os -import sys import zipfile import aacgmv2 @@ -108,45 +107,42 @@ def fetch_ssj_boundary_files(stime=None, etime=None, out_dir=None, if not os.path.isdir(out_dir): raise ValueError("can't find the output directory") - # Download the zenodo archive, capturing the output - zenodo_io = StringIO() - sys.stdout = zenodo_io - sys.stderr = zenodo_io - + # Download the zenodo archive zenodo_get.download(doi=doi, output_dir=out_dir) - zenodo_checksum = None - # Parse the output and retrieve files from the zip archive - sys.stdout = sys.__stdout__ - sys.stderr = sys.__stderr__ - zen_msg = zenodo_io.getvalue() - zen_split = zen_msg.split() + # Get the checksum file (does not download) + zenodo_get.download(doi=doi, output_dir=out_dir, md5=True) + zenodo_checksum = os.path.join(out_dir, "md5sums.txt") - if zen_msg.find('Checksum is correct') < 0 and zen_msg.find( - 'already downloaded correctly') < 0: - raise IOError('Bad checksum: {:s}'.format(zen_msg)) + # Verify the checksum and retrieve the zip archive name + if os.path.isfile(zenodo_checksum): + with open(zenodo_checksum, 'r') as zcheck: + csum, zip_name = zcheck.read().split() - # Remove the checksum file if the download problem wasn't found there - if zenodo_checksum is not None: - os.remove(zenodo_checksum) + # Set the archive name + archive_name = os.path.join(out_dir, zip_name) - # Get the archive name from the output - try: - link_ind = zen_split.index('Link:') + 1 + if not os.path.isfile(archive_name): + raise IOError( + 'error downloading archive to output dir: {:}'.format( + archive_name)) - # If the archive is already available, message may differ - zip_name = os.path.split(zen_split[link_ind]) - while zip_name[-1].find(".zip") <= 0: - zip_name = os.path.split(zip_name[0]) + # Get the archive checkshum + with open(os.path.join(out_dir, archive_name), 'rb') as afile: + asum = hashlib.md5(afile.read()).hexdigest() - # Set the archive name - archive_name = os.path.join(out_dir, zip_name[-1]) - except (ValueError, IndexError): - raise IOError('unable to identify zenodo archive: {:}'.format(zen_msg)) + zen_msg = "Checksum is correct" if asum == csum else "Corrupted data" + else: + zen_msg = "Checksum file not created" - if not os.path.isfile(archive_name): - raise IOError('error downloading archive to output dir: {:}'.format( - archive_name)) + # Remove the checksum file + if zenodo_checksum is not None: + os.remove(zenodo_checksum) + + # Evaluate checksum output + if zen_msg.find('Checksum is correct') < 0 and zen_msg.find( + 'already downloaded correctly') < 0: + raise IOError('Bad checksum: {:s}'.format(zen_msg)) # Access the zip archive with zipfile.ZipFile(archive_name, 'r') as zref: From da02ef7482f0f22ce74ff78440956b7c882f5d62 Mon Sep 17 00:00:00 2001 From: "Angeline G. Burrell" Date: Wed, 13 May 2026 14:34:28 -0400 Subject: [PATCH 5/7] BUG: debug statement See if coveralls works when all tests pass. --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1a07e83d..7b73b967 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,7 +14,7 @@ jobs: matrix: os: ["ubuntu-latest", "macos-latest", "windows-latest"] python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] - install-extras: ["base", "pysat_instruments", "dmsp_ssj"] + install-extras: ["base", "dmsp_ssj"] # , "pysat_instruments"] name: Python ${{ matrix.python-version }} on ${{ matrix.os }} with ${{ matrix.install-extras }} runs-on: ${{ matrix.os }} From 8a379aeb2ba0a1c695d7fe15c59bc050dfacbde9 Mon Sep 17 00:00:00 2001 From: "Angeline G. Burrell" Date: Thu, 14 May 2026 16:55:03 -0400 Subject: [PATCH 6/7] BUG: fix coveralls implementation Debug with help from coveralls! --- .github/workflows/main.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7b73b967..d24f861e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -53,7 +53,6 @@ jobs: - name: Coveralls Parallel uses: coverallsapp/github-action@v2 with: - github-token: ${{ secrets.GITHUB_TOKEN }} flag-name: run=${{ join(matrix.*, '-') }} parallel: true format: cobertura @@ -65,9 +64,7 @@ jobs: runs-on: "ubuntu-latest" steps: - name: Coveralls Finished - env: - COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} - COVERALLS_PARALLEL: true - run: | - curl -sL https://coveralls.io/coveralls-linux.tar.gz | tar -xz - ./coveralls done --build-number ${{ github.run_number }} + uses: coverallsapp/github-action@v2 + with: + parallel-finished: true + carryforward: "all" From fc591361cd6d672b74cecfded84b640dbc1fbc28 Mon Sep 17 00:00:00 2001 From: "Angeline G. Burrell" Date: Thu, 14 May 2026 17:34:37 -0400 Subject: [PATCH 7/7] BUG: re-add pysat Re-add the pysat tests, for the use case in which they are expected to pass. --- .github/workflows/main.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d24f861e..eaa5e41a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,7 +14,12 @@ jobs: matrix: os: ["ubuntu-latest", "macos-latest", "windows-latest"] python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] - install-extras: ["base", "dmsp_ssj"] # , "pysat_instruments"] + install-extras: ["base", "dmsp_ssj"] + include: + # Pysat test for only pysat-passing Python version + - python-version: "3.10" + os: "ubuntu-latest" + install-extras: "pysat-instrument" name: Python ${{ matrix.python-version }} on ${{ matrix.os }} with ${{ matrix.install-extras }} runs-on: ${{ matrix.os }} @@ -50,7 +55,7 @@ jobs: coverage report coverage xml --rcfile=pyproject.toml - - name: Coveralls Parallel + - name: Coveralls Parallel uses: coverallsapp/github-action@v2 with: flag-name: run=${{ join(matrix.*, '-') }}