From cfeb38b2022f4830cf7d76b00d3ae98e50e10627 Mon Sep 17 00:00:00 2001 From: Katelyn FitzGerald <7872563+kafitzgerald@users.noreply.github.com> Date: Fri, 16 Jun 2023 10:11:52 -0600 Subject: [PATCH 01/69] avoid numpy version with bug per issue #207 --- build_envs/Darwin.yml | 2 +- build_envs/Linux.yml | 2 +- build_envs/Win64.yml | 2 +- requirements.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build_envs/Darwin.yml b/build_envs/Darwin.yml index 044292e..3ea338f 100644 --- a/build_envs/Darwin.yml +++ b/build_envs/Darwin.yml @@ -11,7 +11,7 @@ dependencies: - jupyter - matplotlib - netcdf4 - - numpy + - numpy!=1.24.3 - pycodestyle - setuptools - sphinx diff --git a/build_envs/Linux.yml b/build_envs/Linux.yml index 60af2aa..f0609d8 100644 --- a/build_envs/Linux.yml +++ b/build_envs/Linux.yml @@ -11,7 +11,7 @@ dependencies: - jupyter - matplotlib - netcdf4 - - numpy + - numpy!=1.24.3 - pycodestyle - setuptools - sphinx diff --git a/build_envs/Win64.yml b/build_envs/Win64.yml index e9bb70a..82b3ea0 100644 --- a/build_envs/Win64.yml +++ b/build_envs/Win64.yml @@ -11,7 +11,7 @@ dependencies: - m2w64-toolchain - matplotlib - netcdf4 - - numpy + - numpy!=1.24.3 - pycodestyle - setuptools - sphinx diff --git a/requirements.txt b/requirements.txt index 7c07c82..e9cbcfa 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ basemap -numpy>=1.11 +numpy >=1.11, !=1.24.3 setuptools wrapt xarray From 1cb86000ffd41b7756b4a6ba86a9d91c435d70b3 Mon Sep 17 00:00:00 2001 From: Katelyn FitzGerald <7872563+kafitzgerald@users.noreply.github.com> Date: Fri, 16 Jun 2023 10:24:34 -0600 Subject: [PATCH 02/69] remove conda_recipe dir and contents since this now lives in the feedstock repo --- conda_recipe/LICENSE | 32 ---------------------- conda_recipe/bld.bat | 19 ------------- conda_recipe/build.sh | 22 --------------- conda_recipe/meta.yaml | 62 ------------------------------------------ 4 files changed, 135 deletions(-) delete mode 100644 conda_recipe/LICENSE delete mode 100644 conda_recipe/bld.bat delete mode 100644 conda_recipe/build.sh delete mode 100644 conda_recipe/meta.yaml diff --git a/conda_recipe/LICENSE b/conda_recipe/LICENSE deleted file mode 100644 index 376dd79..0000000 --- a/conda_recipe/LICENSE +++ /dev/null @@ -1,32 +0,0 @@ -PLEASE READ THIS SOFTWARE LICENSE ("LICENSE") CAREFULLY BEFORE USING THE -SOFTWARE. BY USING THE SOFTWARE, YOU ARE AGREEING TO BE BOUND BY ALL OF THE -TERMS OF THIS LICENSE. IF YOU DO NOT AGREE TO THE TERMS OF THIS LICENSE, -DO NOT USE THE SOFTWARE. - -Copyright © 2016 the University Corporation for Atmospheric Research ("UCAR"). -All rights reserved. Developed by NCAR's Computational and Information Systems -Laboratory, UCAR, www2.cisl.ucar.edu. - -Redistribution and use of the Software in source and binary forms, with or -without modification, is permitted provided that the following conditions -are met: - -- Neither the names of NCAR's Computational and Information Systems Laboratory, - the University Corporation for Atmospheric Research, nor the names of its - sponsors or contributors may be used to endorse or promote products derived - from this Software without specific prior written permission. - -- Redistributions of source code must retain the above copyright notices, this - list of conditions, and the disclaimer below. - -- Redistributions in binary form must reproduce the above copyright notice, this - list of conditions, and the disclaimer below in the documentation and/or other - materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING, BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE. diff --git a/conda_recipe/bld.bat b/conda_recipe/bld.bat deleted file mode 100644 index d4a4a3f..0000000 --- a/conda_recipe/bld.bat +++ /dev/null @@ -1,19 +0,0 @@ -cd fortran\build_help -CALL gfortran -o sizes -fopenmp omp_sizes.f90 -CALL python sub_sizes.py - -cd .. -CALL gfortran -E ompgen.F90 -cpp -fopenmp -o omp.f90 -REM Wildcards not working on Windows for some reason -CALL f2py -m _wrffortran -h wrffortran.pyf --overwrite-signature wrf_constants.f90 wrf_testfunc.f90 wrf_user.f90 rip_cape.f90 wrf_cloud_fracf.f90 wrf_fctt.f90 wrf_user_dbz.f90 wrf_relhl.f90 calc_uh.f90 wrf_user_latlon_routines.f90 wrf_pvo.f90 eqthecalc.f90 wrf_rip_phys_routines.f90 wrf_pw.f90 wrf_vinterp.f90 wrf_wind.f90 omp.f90 -cd .. - -IF %ARCH% == 64 ( - CALL %PYTHON% setup.py config_fc --f90flags="-O2 -mtune=generic -fopenmp" build_ext --libraries="gomp" build --compiler=msvc --fcompiler=gnu95 -) ELSE ( - CALL %PYTHON% setup.py config_fc --f90flags="-O2 -mtune=generic -fopenmp -mincoming-stack-boundary=2" build_ext --libraries="gomp" build --compiler=msvc --fcompiler=gnu95 -) - -CALL %PYTHON% setup.py install --single-version-externally-managed --record=record.txt - - diff --git a/conda_recipe/build.sh b/conda_recipe/build.sh deleted file mode 100644 index feace2b..0000000 --- a/conda_recipe/build.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -cd fortran/build_help -if [ `uname` == Darwin ]; then - gfortran -o sizes -fopenmp omp_sizes.f90 -Wl,-rpath,${CONDA_PREFIX}/lib -else - gfortran -o sizes -fopenmp omp_sizes.f90 -fi -python sub_sizes.py - -cd .. -gfortran -E ompgen.F90 -fopenmp -cpp -o omp.f90 -f2py *.f90 -m _wrffortran -h wrffortran.pyf --overwrite-signature -cd .. - -if [ `uname` == Darwin ]; then - LDFLAGS="$LDFLAGS -undefined dynamic_lookup -bundle" -fi - -$PYTHON setup.py config_fc --f90flags="-mtune=generic -fopenmp" build_ext --libraries="gomp" build - -$PYTHON setup.py install --single-version-externally-managed --record=record.txt diff --git a/conda_recipe/meta.yaml b/conda_recipe/meta.yaml deleted file mode 100644 index f373955..0000000 --- a/conda_recipe/meta.yaml +++ /dev/null @@ -1,62 +0,0 @@ -{% set version = "1.3.4.1" %} - -package: - name: wrf-python - version: {{ version }} - -source: -# for develop - git_url: https://github.com/NCAR/wrf-python - git_branch: develop -# for release -# fn: wrf-python-{{ version }}.tar.gz -# url: https://github.com/NCAR/wrf-python/archive/{{ version }}.tar.gz -# sha256: 9ca11366ed9a0d5e83e576ac80ce36be4748ba8a06752dac077277acec5e46d9 - -build: - number: 0 - detect_binary_files_with_prefix: true - -requirements: - build: - - setuptools - - python - - numpy 1.11.* # [unix] - - numpy 1.14.* # [win] - - wrapt - - m2w64-toolchain # [win] - - gcc # [unix] - run: - - setuptools - - numpy >=1.11 # [unix] - - numpy >=1.14 # [win] - - python - - wrapt - - m2w64-gcc-libs # [win] - - libgfortran # [unix] - - libgcc # [unix] - - xarray - -test: - requires: - - setuptools - - netcdf4 - - xarray - source_files: - - test/ci_tests - imports: - - wrf - commands: - - cd test/ci_tests && python utests.py - -about: - home: https://github.com/NCAR/wrf-python - license: "UCAR" - license_file: '{{ environ["RECIPE_DIR"] }}/LICENSE' - summary: "Diagnostic and interpolation routines for WRF-ARW data." - -extra: - recipe-maintainers: - - michaelavs - - erogluorhan - From 1f3d23d28598beaa458a01d207e5e80660f94b8f Mon Sep 17 00:00:00 2001 From: Katelyn FitzGerald <7872563+kafitzgerald@users.noreply.github.com> Date: Fri, 2 Feb 2024 14:00:29 -0700 Subject: [PATCH 03/69] CI updates and add Python 3.11 remove Python 3.7 and 3.8 (#213) * add Python 3.11 * update CI and add back in nightly testing * add dependabot * add macOS M1 build to CI and remove numpy version exclude * fix typo * fix conda for M1 * clean up CI conda envs * update environment files and references in contributing guidelines * add Windows to CI * try the another Windows build script * try the another Windows build script * try using old windows env * fix typo * fix typo * remove windows from CI --- .github/dependabot.yml | 7 ++++ .github/workflows/ci.yml | 35 +++++++++---------- .readthedocs.yml | 21 +++++++++++ build_envs/environment.yml | 20 +++++++++++ build_envs/platform-specific/README.md | 3 ++ .../linux.yml} | 4 +-- build_envs/platform-specific/macos_arm64.yml | 21 +++++++++++ .../macos_x64.yml} | 4 +-- .../windows.yml} | 4 +-- doc/source/contrib.rst | 21 ++--------- setup.py | 6 ++-- 11 files changed, 101 insertions(+), 45 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .readthedocs.yml create mode 100644 build_envs/environment.yml create mode 100644 build_envs/platform-specific/README.md rename build_envs/{Linux.yml => platform-specific/linux.yml} (91%) create mode 100644 build_envs/platform-specific/macos_arm64.yml rename build_envs/{Darwin.yml => platform-specific/macos_x64.yml} (91%) rename build_envs/{Win64.yml => platform-specific/windows.yml} (91%) diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..bad6ba3 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +version: 2 +updates: + - package-ecosystem: 'github-actions' + directory: '/' + schedule: + # Check for updates once a week + interval: 'weekly' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dc83483..a5d721e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,13 +3,11 @@ on: push: pull_request: workflow_dispatch: - # schedule: - # - cron: '0 0 * * *' # Daily “At 00:00” + schedule: + - cron: '0 0 * * *' # Daily “At 00:00” jobs: test: - # if: | - # github.repository == 'NCAR/wrf-python' name: Python (${{ matrix.python-version }}, ${{ matrix.os }}) runs-on: ${{ matrix.os }} defaults: @@ -19,32 +17,33 @@ jobs: strategy: fail-fast: false matrix: - os: [ "ubuntu-latest", "macos-latest"] - python-version: [ "3.7", "3.8", "3.9", "3.10" ] + os: [ "ubuntu-latest", "macos-latest", "macos-14" ] + python-version: [ "3.9", "3.10", "3.11" ] steps: - name: Cancel previous runs - uses: styfle/cancel-workflow-action@0.9.1 + uses: styfle/cancel-workflow-action@0.11.0 with: access_token: ${{ github.token }} - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: token: ${{ github.token }} - name: Conda setup uses: conda-incubator/setup-miniconda@v2 + if: matrix.os != 'macos-14' with: - activate-environment: wrf_python_build python-version: ${{ matrix.python-version }} - channels: conda-forge, ncar - - name: Conda install (Darwin) - if: matrix.os == 'macos-latest' - run: | - conda env update --file build_envs/Darwin.yml --prune - - name: Conda install (Linux) - if: matrix.os == 'ubuntu-latest' - run: | - conda env update --file build_envs/Linux.yml --prune + channels: conda-forge + environment-file: build_envs/environment.yml + - name: Conda setup (macOS M1) + uses: conda-incubator/setup-miniconda@v2 + if: matrix.os == 'macos-14' + with: + installer-url: https://github.com/conda-forge/miniforge/releases/download/23.11.0-0/Mambaforge-23.11.0-0-MacOSX-arm64.sh + python-version: ${{ matrix.python-version }} + channels: conda-forge + environment-file: build_envs/environment.yml - name: Build WRF-Python run: | cd build_scripts diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 0000000..d059c2c --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1,21 @@ +# .readthedocs.yml +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + +build: + os: "ubuntu-20.04" + tools: + python: "mambaforge-4.10" + jobs: + post_create_environment: + - python -m pip install --no-cache-dir . + +# Build documentation in the docs/ directory with Sphinx +sphinx: + configuration: doc/source/conf.py + +conda: + environment: build_envs/environment.yml diff --git a/build_envs/environment.yml b/build_envs/environment.yml new file mode 100644 index 0000000..8b46c24 --- /dev/null +++ b/build_envs/environment.yml @@ -0,0 +1,20 @@ +# Create full conda environment for development, including some useful tools +name: wrf_python_build +channels: + - conda-forge +dependencies: + - python>=3.9, <3.12 + - compilers + - basemap + - cartopy + - jupyter + - matplotlib + - netcdf4 + - numpy + - pycodestyle + - setuptools + - sphinx + - sphinx_rtd_theme + - wrapt + - xarray + diff --git a/build_envs/platform-specific/README.md b/build_envs/platform-specific/README.md new file mode 100644 index 0000000..de69662 --- /dev/null +++ b/build_envs/platform-specific/README.md @@ -0,0 +1,3 @@ +These platform specific environment files are included here for reference only and not actively tested or maintained. + +We have moved to a single environment file (../environment.yml) for all platforms. diff --git a/build_envs/Linux.yml b/build_envs/platform-specific/linux.yml similarity index 91% rename from build_envs/Linux.yml rename to build_envs/platform-specific/linux.yml index f0609d8..c348960 100644 --- a/build_envs/Linux.yml +++ b/build_envs/platform-specific/linux.yml @@ -3,7 +3,7 @@ name: wrf_python_build channels: - conda-forge dependencies: - - python=3 + - python<3.12 - basemap - cartopy - gcc_linux-64 @@ -11,7 +11,7 @@ dependencies: - jupyter - matplotlib - netcdf4 - - numpy!=1.24.3 + - numpy - pycodestyle - setuptools - sphinx diff --git a/build_envs/platform-specific/macos_arm64.yml b/build_envs/platform-specific/macos_arm64.yml new file mode 100644 index 0000000..2e475f0 --- /dev/null +++ b/build_envs/platform-specific/macos_arm64.yml @@ -0,0 +1,21 @@ +# Create full conda environment for development, including some useful tools +name: wrf_python_build +channels: + - conda-forge +dependencies: + - python<3.12 + - basemap + - cartopy + - clang_osx-arm64 + - gfortran_osx-arm64 + - jupyter + - matplotlib + - netcdf4 + - numpy + - pycodestyle + - setuptools + - sphinx + - sphinx_rtd_theme + - wrapt + - xarray + diff --git a/build_envs/Darwin.yml b/build_envs/platform-specific/macos_x64.yml similarity index 91% rename from build_envs/Darwin.yml rename to build_envs/platform-specific/macos_x64.yml index 3ea338f..2415ebe 100644 --- a/build_envs/Darwin.yml +++ b/build_envs/platform-specific/macos_x64.yml @@ -3,7 +3,7 @@ name: wrf_python_build channels: - conda-forge dependencies: - - python=3 + - python<3.12 - basemap - cartopy - clang_osx-64 @@ -11,7 +11,7 @@ dependencies: - jupyter - matplotlib - netcdf4 - - numpy!=1.24.3 + - numpy - pycodestyle - setuptools - sphinx diff --git a/build_envs/Win64.yml b/build_envs/platform-specific/windows.yml similarity index 91% rename from build_envs/Win64.yml rename to build_envs/platform-specific/windows.yml index 82b3ea0..1053db0 100644 --- a/build_envs/Win64.yml +++ b/build_envs/platform-specific/windows.yml @@ -4,14 +4,14 @@ channels: - conda-forge - msys2 dependencies: - - python=3 + - python<3.12 - basemap - cartopy - jupyter - m2w64-toolchain - matplotlib - netcdf4 - - numpy!=1.24.3 + - numpy - pycodestyle - setuptools - sphinx diff --git a/doc/source/contrib.rst b/doc/source/contrib.rst index 0f96d18..d11fa76 100644 --- a/doc/source/contrib.rst +++ b/doc/source/contrib.rst @@ -294,28 +294,13 @@ contributing is: git remote add ncar https://github.com/ncar/wrf-python.git -- To create the development environment, you'll need to run the appropriate - command below for your operating system. - - OSX: - - .. code:: - - conda env create -f build_envs/Darwin.yml - - Linux: - - .. code:: - - conda env create -f build_envs/Linux.yml - - Win64: +- To create the development environment, you'll need to run the command below: .. code:: - conda env create -f build_envs/Win64.yml + conda env create -f build_envs/environment.yml - Note: For Win64, you will also need VS2015 installed on your system. + Note: For Windows, you will also need Visual Studio installed on your system. - Activate your conda environment. diff --git a/setup.py b/setup.py index 3dbeaf3..9c38c9a 100755 --- a/setup.py +++ b/setup.py @@ -103,9 +103,9 @@ "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Programming Language :: Fortran", - "Programming Language :: Python :: 3.7", - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "Topic :: Scientific/Engineering :: Atmospheric Science", "Topic :: Software Development", "Operating System :: POSIX", From 331e426d44bef062003f928e8d8b24e942e45fa2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 2 Feb 2024 21:01:36 +0000 Subject: [PATCH 04/69] Bump styfle/cancel-workflow-action from 0.11.0 to 0.12.1 Bumps [styfle/cancel-workflow-action](https://github.com/styfle/cancel-workflow-action) from 0.11.0 to 0.12.1. - [Release notes](https://github.com/styfle/cancel-workflow-action/releases) - [Commits](https://github.com/styfle/cancel-workflow-action/compare/0.11.0...0.12.1) --- updated-dependencies: - dependency-name: styfle/cancel-workflow-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a5d721e..6a594a4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ jobs: steps: - name: Cancel previous runs - uses: styfle/cancel-workflow-action@0.11.0 + uses: styfle/cancel-workflow-action@0.12.1 with: access_token: ${{ github.token }} - name: Checkout From 540a684ee9017390bc0300b422af82590c2ec177 Mon Sep 17 00:00:00 2001 From: Katelyn FitzGerald <7872563+kafitzgerald@users.noreply.github.com> Date: Fri, 2 Feb 2024 14:43:03 -0700 Subject: [PATCH 05/69] Update ci.yml configuration for pushes --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a5d721e..f8ca706 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,9 @@ name: CI on: push: + branches: + - main + - develop pull_request: workflow_dispatch: schedule: From adb8f16d7a97340c363168606f8789440a316428 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 3 Feb 2024 00:15:50 +0000 Subject: [PATCH 06/69] Bump conda-incubator/setup-miniconda from 2 to 3 Bumps [conda-incubator/setup-miniconda](https://github.com/conda-incubator/setup-miniconda) from 2 to 3. - [Release notes](https://github.com/conda-incubator/setup-miniconda/releases) - [Changelog](https://github.com/conda-incubator/setup-miniconda/blob/main/CHANGELOG.md) - [Commits](https://github.com/conda-incubator/setup-miniconda/compare/v2...v3) --- updated-dependencies: - dependency-name: conda-incubator/setup-miniconda dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6a594a4..b3a60e1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,14 +30,14 @@ jobs: with: token: ${{ github.token }} - name: Conda setup - uses: conda-incubator/setup-miniconda@v2 + uses: conda-incubator/setup-miniconda@v3 if: matrix.os != 'macos-14' with: python-version: ${{ matrix.python-version }} channels: conda-forge environment-file: build_envs/environment.yml - name: Conda setup (macOS M1) - uses: conda-incubator/setup-miniconda@v2 + uses: conda-incubator/setup-miniconda@v3 if: matrix.os == 'macos-14' with: installer-url: https://github.com/conda-forge/miniforge/releases/download/23.11.0-0/Mambaforge-23.11.0-0-MacOSX-arm64.sh From cc0cc9bccba9b9462256d37d48c532e2156514ee Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 3 Feb 2024 01:01:33 +0000 Subject: [PATCH 07/69] Bump pypa/gh-action-pypi-publish from 1.5.0 to 1.8.11 Bumps [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) from 1.5.0 to 1.8.11. - [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases) - [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/v1.5.0...v1.8.11) --- updated-dependencies: - dependency-name: pypa/gh-action-pypi-publish dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/pypi.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pypi.yaml b/.github/workflows/pypi.yaml index 1322433..a09c4f1 100644 --- a/.github/workflows/pypi.yaml +++ b/.github/workflows/pypi.yaml @@ -46,7 +46,7 @@ jobs: run: | python -m twine check dist/* - name: Publish package to PyPI - uses: pypa/gh-action-pypi-publish@v1.5.0 + uses: pypa/gh-action-pypi-publish@v1.8.11 with: user: __token__ password: ${{ secrets.PYPI_WRF_PYTHON }} From 8f575de3a949b335f914d058f61c91c65db8bb89 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 3 Feb 2024 02:24:48 +0000 Subject: [PATCH 08/69] Bump actions/checkout from 3 to 4 Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yml | 2 +- .github/workflows/pypi.yaml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b3a60e1..9a2571a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,7 @@ jobs: with: access_token: ${{ github.token }} - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: token: ${{ github.token }} - name: Conda setup diff --git a/.github/workflows/pypi.yaml b/.github/workflows/pypi.yaml index a09c4f1..efc9dd5 100644 --- a/.github/workflows/pypi.yaml +++ b/.github/workflows/pypi.yaml @@ -8,7 +8,7 @@ jobs: if: github.repository == 'NCAR/wrf-python' runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v3 with: @@ -29,7 +29,7 @@ jobs: if: startsWith(github.ref, 'refs/tags') runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v3 with: From c401144f4d7ce1bb913e3aa15ddd2db0a2d3782d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 3 Feb 2024 04:11:11 +0000 Subject: [PATCH 09/69] Bump actions/setup-python from 3 to 5 Bumps [actions/setup-python](https://github.com/actions/setup-python) from 3 to 5. - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/v3...v5) --- updated-dependencies: - dependency-name: actions/setup-python dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/pypi.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pypi.yaml b/.github/workflows/pypi.yaml index efc9dd5..6f8a2fb 100644 --- a/.github/workflows/pypi.yaml +++ b/.github/workflows/pypi.yaml @@ -10,7 +10,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v3 + uses: actions/setup-python@v5 with: python-version: '3.x' - name: Install dependencies @@ -31,7 +31,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v3 + uses: actions/setup-python@v5 with: python-version: '3.x' - name: Install dependencies From 5e8088395214516e1a3d7c8f037be2102d9dc86e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Mar 2024 20:46:42 +0000 Subject: [PATCH 10/69] Bump pypa/gh-action-pypi-publish from 1.8.11 to 1.8.12 Bumps [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) from 1.8.11 to 1.8.12. - [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases) - [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/v1.8.11...v1.8.12) --- updated-dependencies: - dependency-name: pypa/gh-action-pypi-publish dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/pypi.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pypi.yaml b/.github/workflows/pypi.yaml index 6f8a2fb..7166a3e 100644 --- a/.github/workflows/pypi.yaml +++ b/.github/workflows/pypi.yaml @@ -46,7 +46,7 @@ jobs: run: | python -m twine check dist/* - name: Publish package to PyPI - uses: pypa/gh-action-pypi-publish@v1.8.11 + uses: pypa/gh-action-pypi-publish@v1.8.12 with: user: __token__ password: ${{ secrets.PYPI_WRF_PYTHON }} From a3873b784e4c66e1e33fc0e3a21a6b4799783c59 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Mar 2024 20:35:09 +0000 Subject: [PATCH 11/69] Bump pypa/gh-action-pypi-publish from 1.8.12 to 1.8.14 Bumps [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) from 1.8.12 to 1.8.14. - [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases) - [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/v1.8.12...v1.8.14) --- updated-dependencies: - dependency-name: pypa/gh-action-pypi-publish dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/pypi.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pypi.yaml b/.github/workflows/pypi.yaml index 7166a3e..f85b6ce 100644 --- a/.github/workflows/pypi.yaml +++ b/.github/workflows/pypi.yaml @@ -46,7 +46,7 @@ jobs: run: | python -m twine check dist/* - name: Publish package to PyPI - uses: pypa/gh-action-pypi-publish@v1.8.12 + uses: pypa/gh-action-pypi-publish@v1.8.14 with: user: __token__ password: ${{ secrets.PYPI_WRF_PYTHON }} From c89e1aa200336b908a04d8c352d286ba3e234656 Mon Sep 17 00:00:00 2001 From: Mathias Hauser Date: Wed, 17 Apr 2024 15:07:34 +0200 Subject: [PATCH 12/69] update mentions of py3.7 --- doc/source/installation.rst | 2 +- doc/source/tutorials/wrf_workshop_2019.rst | 5 ++--- setup.py | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/doc/source/installation.rst b/doc/source/installation.rst index 4088af2..c35c7fc 100644 --- a/doc/source/installation.rst +++ b/doc/source/installation.rst @@ -4,7 +4,7 @@ Installation Required Dependencies ---------------------- - - Python 2.7, 3.4, or 3.5+ + - Python 3.9+ - numpy (1.11 or later; 1.14 required to build on Windows) - wrapt (1.10 or later) - setuptools (38.0 or later) diff --git a/doc/source/tutorials/wrf_workshop_2019.rst b/doc/source/tutorials/wrf_workshop_2019.rst index d2a1925..bd63d78 100644 --- a/doc/source/tutorials/wrf_workshop_2019.rst +++ b/doc/source/tutorials/wrf_workshop_2019.rst @@ -81,8 +81,7 @@ For Linux: Step 2: Download Miniconda ---------------------------- -For this tutorial, you will need to download and install Miniconda. We are -going to use Python 3.7, but it will also work with Python 2.7. +For this tutorial, you will need to download and install Miniconda. Please use the appropriate link below to download Miniconda for your operating system. @@ -230,7 +229,7 @@ Follow the instructions below to create the tutorial_2019 environment. Type or copy this command in to your command terminal:: - conda create -n tutorial_2019 python=3.7 matplotlib cartopy netcdf4 jupyter git ffmpeg wrf-python + conda create -n tutorial_2019 python=3.11 matplotlib cartopy netcdf4 jupyter git ffmpeg wrf-python Type "y" when prompted. It will take several minutes to install everything. diff --git a/setup.py b/setup.py index 9c38c9a..a62a06a 100755 --- a/setup.py +++ b/setup.py @@ -96,7 +96,7 @@ "plotting", "plots", "meteorology", "nwp", "numerical weather prediction", "diagnostic", "science", "numpy"], - python_requires='>=3.7', + python_requires='>=3.9', install_requires=requirements, classifiers=["Development Status :: 5 - Production/Stable", "Intended Audience :: Science/Research", From d323dc0984a5cc9c0e962a634b5bf7c396b7e248 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Thu, 23 May 2024 16:10:08 -0400 Subject: [PATCH 13/69] BLD: Initial try at pyproject.toml I think I got every key from setup.py. The main difference is if the READTHEDOCS environment variable is set: I don't know how to change the dependencies based on that. On the other hand, given 3.8 is close to or past EOL, I suspect 3.3 is relatively uncommon, and the RTD install, without the unneeded bits, could be accomplished with pip install --no-deps. --- pyproject.toml | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..b5e8154 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,53 @@ +[build-system] +requires = ["setuptools", "numpy"] +build-backend = "setuptools.build_meta" + +[project] +name = "wrf-python" +authors = ["Bill Ladwig"] +maintainers = [ + { name = "GeoCAT", email = "geocat@ucar.edu" }, +] +description = "Diagnostic and interpolation routines for WRF-ARW data." +readme = "README.md" +requires-python = ">=3.7, <3.12" +keywords = [ + "python", "wrf-python", "wrf", "forecast", "model", + "weather research and forecasting", "interpolation", + "plotting", "plots", "meteorology", "nwp", + "numerical weather prediction", "diagnostic", + "science", "numpy" +] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Science/Research", + "Intended Audience :: Developers", + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Fortran", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Topic :: Scientific/Engineering :: Atmospheric Science", + "Topic :: Software Development", + "Operating System :: POSIX", + "Operating System :: Unix", + "Operating System :: MacOS", + "Operating System :: Microsoft :: Windows" +] +license = { text = "Apache-2.0", file = "LICENSE" } +dynamic = [ "version", "dependencies" ] + +[project.urls] +Repository = "https://github.com/NCAR/wrf-python" +Documentation = "https://wrf-python.rtfd.org" + +[tool.setuptools] +package-data = { "wrf" = ["data/psadilookup.dat"]} +platforms = ["any"] + +[tool.setuptools.packages.find] +where = ["src"] + +[tool.setuptools.dynamic] +version = { attr = "wrf.version.__version__" } +dependencies = { file = "requirements.txt" } From 8322c424885faad29ec16ad432284ca6aa72e280 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Thu, 23 May 2024 22:58:33 -0400 Subject: [PATCH 14/69] BLD,BUG: Fix pyproject.toml configuration and remove setup.py duplicates. numpy.distutils recommends setuptools<60, but that breaks pyproject.toml configuration. I like this way better. Still needs setup.py for the fortran module and for the Cheyenne configuration. --- pyproject.toml | 6 +++-- setup.py | 62 +------------------------------------------------- 2 files changed, 5 insertions(+), 63 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b5e8154..cebbf73 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,9 @@ build-backend = "setuptools.build_meta" [project] name = "wrf-python" -authors = ["Bill Ladwig"] +authors = [ + { name = "Bill Ladwig" } +] maintainers = [ { name = "GeoCAT", email = "geocat@ucar.edu" }, ] @@ -34,7 +36,7 @@ classifiers = [ "Operating System :: MacOS", "Operating System :: Microsoft :: Windows" ] -license = { text = "Apache-2.0", file = "LICENSE" } +license = { text = "Apache-2.0" } dynamic = [ "version", "dependencies" ] [project.urls] diff --git a/setup.py b/setup.py index 9c38c9a..8fd210c 100755 --- a/setup.py +++ b/setup.py @@ -1,18 +1,7 @@ import os -import sys import setuptools import socket -# Bootstrap a numpy installation before trying to import it. -import importlib -try: - numpy_module = importlib.util.find_spec('numpy') - if numpy_module is None: - raise ModuleNotFoundError -except (ImportError, ModuleNotFoundError): - import subprocess - subprocess.call([sys.executable, '-m', 'pip', 'install', 'numpy']) - if not socket.gethostname().startswith("cheyenne"): import numpy.distutils.core else: @@ -53,18 +42,10 @@ "fortran/omp.f90"] ) -#Note: __version__ will be set in the version.py script loaded below -__version__ = None -with open("src/wrf/version.py") as f: - exec(f.read()) - on_rtd = os.environ.get("READTHEDOCS", None) == "True" # on_rtd=True if on_rtd: - if sys.version_info < (3, 3): - requirements = ["mock"] # for python2 and python < 3.3 - else: - requirements = [] # for >= python3.3 + requirements = ["mock; python_version < 3.3"] ext_modules = [] else: @@ -72,51 +53,10 @@ with open("requirements.txt") as f2: requirements = f2.read().strip().splitlines() - # if sys.version_info < (3,3): - # requirements.append("mock") ext_modules = [ext1] numpy.distutils.core.setup( - name='wrf-python', - author="Bill Ladwig", - maintainer="GeoCAT", - maintainer_email="geocat@ucar.edu", - description="Diagnostic and interpolation routines for WRF-ARW data.", - long_description=("A collection of diagnostic and interpolation " - "routines to be used with WRF-ARW data.\n\n" - "GitHub Repository:\n\n" - "https://github.com/NCAR/wrf-python\n\n" - "Documentation:\n\n" - "https://wrf-python.rtfd.org\n"), - url="https://github.com/NCAR/wrf-python", - version=__version__, - package_dir={"": "src"}, - keywords=["python", "wrf-python", "wrf", "forecast", "model", - "weather research and forecasting", "interpolation", - "plotting", "plots", "meteorology", "nwp", - "numerical weather prediction", "diagnostic", - "science", "numpy"], - python_requires='>=3.7', install_requires=requirements, - classifiers=["Development Status :: 5 - Production/Stable", - "Intended Audience :: Science/Research", - "Intended Audience :: Developers", - "License :: OSI Approved :: Apache Software License", - "Programming Language :: Fortran", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Topic :: Scientific/Engineering :: Atmospheric Science", - "Topic :: Software Development", - "Operating System :: POSIX", - "Operating System :: Unix", - "Operating System :: MacOS", - "Operating System :: Microsoft :: Windows"], - platforms=["any"], - license="Apache License 2.0", - packages=setuptools.find_packages("src"), ext_modules=ext_modules, - download_url="https://python.org/pypi/wrf-python", - package_data={"wrf": ["data/psadilookup.dat"]}, scripts=[] ) From 5c169ebf1a2fe8a5440f1712cd31f9e234c8af11 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Fri, 24 May 2024 06:53:01 -0400 Subject: [PATCH 15/69] FIX: Require a setuptools version that understands the configuration. setuptools<60 just gets confused, and has no idea what the project name is. I just inverted that requirement: not sure if setuptools needs to be more recent still. --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index cebbf73..b5f078c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["setuptools", "numpy"] +requires = ["setuptools>=60", "numpy"] build-backend = "setuptools.build_meta" [project] From ca51e704690200aaf3e79544e1cc4975bff6a663 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Fri, 24 May 2024 11:08:53 -0400 Subject: [PATCH 16/69] BLD: Start working on a CMake build. Works decently as a standalone builder/installer. Need to work on packaging for python. Scikit-build-core says it's a good option. --- CMakeLists.txt | 162 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..e8aae2d --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,162 @@ +### setup project ### +cmake_minimum_required(VERSION 3.18) + +project(wrf-python + VERSION 1.3.4.1 + DESCRIPTION "Utilities for reading WRF output" + LANGUAGES C Fortran + ) + +# Safety net +if(PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR) + message( + FATAL_ERROR + "In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there.\n" + ) +endif() + +# set(FindPython_DIR "/usr/share/cmake-${CMAKE_VERSION}/Modules") +# Ensure scikit-build modules +if (NOT SKBUILD) + find_package(Python 3.8 REQUIRED COMPONENTS Development.Module NumPy) + # Kanged --> https://github.com/Kitware/torch_liberator/blob/master/CMakeLists.txt + # If skbuild is not the driver; include its utilities in CMAKE_MODULE_PATH + execute_process( + COMMAND "${PYTHON_EXECUTABLE}" + -c "import os, skbuild; print(os.path.dirname(skbuild.__file__))" + OUTPUT_VARIABLE SKBLD_DIR + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + list(APPEND CMAKE_MODULE_PATH "${SKBLD_DIR}/resources/cmake") + message(STATUS "Looking in ${SKBLD_DIR}/resources/cmake for CMake modules") +endif() + +# scikit-build style includes +# find_package(PythonExtensions REQUIRED) # for ${PYTHON_EXTENSION_MODULE_SUFFIX} +# Python_SOABI + +# Grab the variables from a local Python installation +# NumPy headers +# F2PY headers +execute_process( + COMMAND "${PYTHON_EXECUTABLE}" + -c "import numpy.f2py; print(numpy.f2py.get_include())" + OUTPUT_VARIABLE F2PY_INCLUDE_DIR + OUTPUT_STRIP_TRAILING_WHITESPACE +) + +# Prepping the module +set(f2py_module_name "_wrffortran") +set(fortran_src_files + "${CMAKE_SOURCE_DIR}/fortran/wrf_constants.f90" + "${CMAKE_SOURCE_DIR}/fortran/wrf_testfunc.f90" + "${CMAKE_SOURCE_DIR}/fortran/wrf_user.f90" + "${CMAKE_SOURCE_DIR}/fortran/rip_cape.f90" + "${CMAKE_SOURCE_DIR}/fortran/wrf_cloud_fracf.f90" + "${CMAKE_SOURCE_DIR}/fortran/wrf_fctt.f90" + "${CMAKE_SOURCE_DIR}/fortran/wrf_user_dbz.f90" + "${CMAKE_SOURCE_DIR}/fortran/wrf_relhl.f90" + "${CMAKE_SOURCE_DIR}/fortran/calc_uh.f90" + "${CMAKE_SOURCE_DIR}/fortran/wrf_user_latlon_routines.f90" + "${CMAKE_SOURCE_DIR}/fortran/wrf_pvo.f90" + "${CMAKE_SOURCE_DIR}/fortran/eqthecalc.f90" + "${CMAKE_SOURCE_DIR}/fortran/wrf_rip_phys_routines.f90" + "${CMAKE_SOURCE_DIR}/fortran/wrf_pw.f90" + "${CMAKE_SOURCE_DIR}/fortran/wrf_vinterp.f90" + "${CMAKE_SOURCE_DIR}/fortran/wrf_wind.f90" + "${CMAKE_SOURCE_DIR}/fortran/omp.f90") +set(python_src_files + "${CMAKE_SOURCE_DIR}/src/wrf/__init__.py" + "${CMAKE_SOURCE_DIR}/src/wrf/api.py" + "${CMAKE_SOURCE_DIR}/src/wrf/cache.py" + "${CMAKE_SOURCE_DIR}/src/wrf/computation.py" + "${CMAKE_SOURCE_DIR}/src/wrf/config.py" + "${CMAKE_SOURCE_DIR}/src/wrf/constants.py" + "${CMAKE_SOURCE_DIR}/src/wrf/contrib.py" + "${CMAKE_SOURCE_DIR}/src/wrf/coordpair.py" + "${CMAKE_SOURCE_DIR}/src/wrf/decorators.py" + "${CMAKE_SOURCE_DIR}/src/wrf/destag.py" + "${CMAKE_SOURCE_DIR}/src/wrf/extension.py" + "${CMAKE_SOURCE_DIR}/src/wrf/g_cape.py" + "${CMAKE_SOURCE_DIR}/src/wrf/g_cloudfrac.py" + "${CMAKE_SOURCE_DIR}/src/wrf/g_ctt.py" + "${CMAKE_SOURCE_DIR}/src/wrf/g_dbz.py" + "${CMAKE_SOURCE_DIR}/src/wrf/g_dewpoint.py" + "${CMAKE_SOURCE_DIR}/src/wrf/g_geoht.py" + "${CMAKE_SOURCE_DIR}/src/wrf/g_helicity.py" + "${CMAKE_SOURCE_DIR}/src/wrf/g_latlon.py" + "${CMAKE_SOURCE_DIR}/src/wrf/g_omega.py" + "${CMAKE_SOURCE_DIR}/src/wrf/g_precip.py" + "${CMAKE_SOURCE_DIR}/src/wrf/g_pressure.py" + "${CMAKE_SOURCE_DIR}/src/wrf/g_pw.py" + "${CMAKE_SOURCE_DIR}/src/wrf/g_rh.py" + "${CMAKE_SOURCE_DIR}/src/wrf/g_slp.py" + "${CMAKE_SOURCE_DIR}/src/wrf/g_temp.py" + "${CMAKE_SOURCE_DIR}/src/wrf/g_terrain.py" + "${CMAKE_SOURCE_DIR}/src/wrf/g_times.py" + "${CMAKE_SOURCE_DIR}/src/wrf/g_uvmet.py" + "${CMAKE_SOURCE_DIR}/src/wrf/g_vorticity.py" + "${CMAKE_SOURCE_DIR}/src/wrf/g_wind.py" + "${CMAKE_SOURCE_DIR}/src/wrf/geobnds.py" + "${CMAKE_SOURCE_DIR}/src/wrf/interp.py" + "${CMAKE_SOURCE_DIR}/src/wrf/interputils.py" + "${CMAKE_SOURCE_DIR}/src/wrf/latlonutils.py" + "${CMAKE_SOURCE_DIR}/src/wrf/metadecorators.py" + "${CMAKE_SOURCE_DIR}/src/wrf/projection.py" + "${CMAKE_SOURCE_DIR}/src/wrf/projutils.py" + "${CMAKE_SOURCE_DIR}/src/wrf/py3compat.py" + "${CMAKE_SOURCE_DIR}/src/wrf/routines.py" + "${CMAKE_SOURCE_DIR}/src/wrf/specialdec.py" + "${CMAKE_SOURCE_DIR}/src/wrf/units.py" + "${CMAKE_SOURCE_DIR}/src/wrf/util.py" + "${CMAKE_SOURCE_DIR}/src/wrf/version.py" +) +set(f2py_module_c "${f2py_module_name}module.c") + +# Target for enforcing dependencies +add_custom_target(genpyf + DEPENDS "${fortran_src_files}" +) +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${f2py_module_c}" + COMMAND ${PYTHON_EXECUTABLE} -m "numpy.f2py" + -m "${f2py_module_name}" + --lower # Important + ${fortran_src_files} + DEPENDS "${fortran_src_files}" # Fortran source +) + +Python_add_library(${f2py_module_name} MODULE + "${f2py_module_c}" + "${f2py_module_name}-f2pywrappers.f" + "${f2py_module_name}-f2pywrappers2.f90" + "${F2PY_INCLUDE_DIR}/fortranobject.c" + "${fortran_src_files}") + +target_include_directories(${f2py_module_name} PUBLIC + ${F2PY_INCLUDE_DIR} + ${Python_NumPy_INCLUDE_DIRS} + ${Python_INCLUDE_DIRS}) +set_target_properties(${f2py_module_name} PROPERTIES SUFFIX ".${Python_SOABI}${CMAKE_SHARED_LIBRARY_SUFFIX}") +set_target_properties(${f2py_module_name} PROPERTIES PREFIX "") + +# Linker fixes +if (UNIX) + if (APPLE) + set_target_properties(${f2py_module_name} PROPERTIES + LINK_FLAGS '-Wl,-dylib,-undefined,dynamic_lookup') + else() + set_target_properties(${f2py_module_name} PROPERTIES + LINK_FLAGS '-Wl,--allow-shlib-undefined') + endif() +endif() + +add_dependencies(${f2py_module_name} genpyf) + +string(REGEX REPLACE "^/(usr/(local/)?)?" "" Python_SITEARCH_INSTALL ${Python_SITEARCH}) +string(REGEX REPLACE "^/(usr/(local/)?)?" "" Python_SITELIB_INSTALL ${Python_SITELIB}) +# string(SUBSTRING ${Python_SITEARCH} 1 -1 Python_SITEARCH_INSTALL) +# string(SUBSTRING ${Python_SITELIB} 1 -1 Python_SITELIB_INSTALL) + +install(TARGETS ${f2py_module_name} DESTINATION "${Python_SITEARCH_INSTALL}/wrf/") +install(FILES ${python_src_files} DESTINATION "${Python_SITELIB_INSTALL}/wrf/") From e88a5bd3f78a726bbc3dd7fcf9a8d33cd6704980 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Fri, 24 May 2024 17:57:21 -0400 Subject: [PATCH 17/69] BLD: Initial Scikit-build attempt. I should delete setup.py before too much longer, shouldn't I. --- CMakeLists.txt | 19 +++++++++++-------- pyproject.toml | 21 +++++++++++++++++++-- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e8aae2d..4763d59 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,9 @@ ### setup project ### +# https://numpy.org/doc/stable/f2py/buildtools/skbuild.html cmake_minimum_required(VERSION 3.18) -project(wrf-python - VERSION 1.3.4.1 +project(${SKBUILD_PROJECT_NAME} + VERSION ${SKBUILD_PROJECT_VERSION} DESCRIPTION "Utilities for reading WRF output" LANGUAGES C Fortran ) @@ -15,10 +16,11 @@ if(PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR) ) endif() -# set(FindPython_DIR "/usr/share/cmake-${CMAKE_VERSION}/Modules") +find_package(Python 3.8 REQUIRED COMPONENTS Development.Module NumPy) +find_package(OpenMP COMPONENTS Fortran) + # Ensure scikit-build modules if (NOT SKBUILD) - find_package(Python 3.8 REQUIRED COMPONENTS Development.Module NumPy) # Kanged --> https://github.com/Kitware/torch_liberator/blob/master/CMakeLists.txt # If skbuild is not the driver; include its utilities in CMAKE_MODULE_PATH execute_process( @@ -31,10 +33,6 @@ if (NOT SKBUILD) message(STATUS "Looking in ${SKBLD_DIR}/resources/cmake for CMake modules") endif() -# scikit-build style includes -# find_package(PythonExtensions REQUIRED) # for ${PYTHON_EXTENSION_MODULE_SUFFIX} -# Python_SOABI - # Grab the variables from a local Python installation # NumPy headers # F2PY headers @@ -119,6 +117,8 @@ add_custom_target(genpyf ) add_custom_command( OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${f2py_module_c}" + "${CMAKE_CURRENT_BINARY_DIR}/${f2py_module_name}-f2pywrappers.f" + "${CMAKE_CURRENT_BINARY_DIR}/${f2py_module_name}-f2pywrappers2.f90" COMMAND ${PYTHON_EXECUTABLE} -m "numpy.f2py" -m "${f2py_module_name}" --lower # Important @@ -140,6 +140,9 @@ target_include_directories(${f2py_module_name} PUBLIC set_target_properties(${f2py_module_name} PROPERTIES SUFFIX ".${Python_SOABI}${CMAKE_SHARED_LIBRARY_SUFFIX}") set_target_properties(${f2py_module_name} PROPERTIES PREFIX "") +# https://scikit-build-core.readthedocs.io/en/latest/getting_started.html +target_link_libraries(${f2py_module_name} PRIVATE Python::NumPy) + # Linker fixes if (UNIX) if (APPLE) diff --git a/pyproject.toml b/pyproject.toml index b5f078c..28b8eed 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [build-system] -requires = ["setuptools>=60", "numpy"] -build-backend = "setuptools.build_meta" +requires = ["scikit-build-core", "numpy"] +build-backend = "scikit_build_core.build" [project] name = "wrf-python" @@ -53,3 +53,20 @@ where = ["src"] [tool.setuptools.dynamic] version = { attr = "wrf.version.__version__" } dependencies = { file = "requirements.txt" } + +[tool.scikit-build] +cmake.verbose = true +logging.level = "INFO" +minimum-version = "0.8" +cmake.version = ">=3.18" +wheel.packages = ["src/wrf"] +sdist.include = ["fortran/omp.f90"] + +# To avoid stripping installed libraries +# Packages often want to do their own stripping +# SKBUILD_INSTALL_STRIP: "false" +# install.strip = false + +[tool.scikit-build.metadata.version] +provider = "scikit_build_core.metadata.regex" +input = "src/wrf/version.py" From d18ecf5e80f1917c9623365e5d8ab84534e6410b Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Fri, 24 May 2024 17:59:09 -0400 Subject: [PATCH 18/69] STY: Remove execute permissions from python modules. Pretty sure none of them are designed to be used that way. Also it kept CMake from trying to execute them with sh. --- src/wrf/__init__.py | 0 src/wrf/constants.py | 0 src/wrf/destag.py | 0 src/wrf/extension.py | 0 src/wrf/g_cape.py | 0 src/wrf/g_dbz.py | 0 src/wrf/g_dewpoint.py | 0 src/wrf/g_geoht.py | 0 src/wrf/g_helicity.py | 0 src/wrf/g_latlon.py | 0 src/wrf/g_omega.py | 0 src/wrf/g_precip.py | 0 src/wrf/g_pressure.py | 0 src/wrf/g_pw.py | 0 src/wrf/g_rh.py | 0 src/wrf/g_slp.py | 0 src/wrf/g_temp.py | 0 src/wrf/g_terrain.py | 0 src/wrf/g_times.py | 0 src/wrf/g_uvmet.py | 0 src/wrf/g_vorticity.py | 0 src/wrf/g_wind.py | 0 src/wrf/interp.py | 0 src/wrf/units.py | 0 24 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 src/wrf/__init__.py mode change 100755 => 100644 src/wrf/constants.py mode change 100755 => 100644 src/wrf/destag.py mode change 100755 => 100644 src/wrf/extension.py mode change 100755 => 100644 src/wrf/g_cape.py mode change 100755 => 100644 src/wrf/g_dbz.py mode change 100755 => 100644 src/wrf/g_dewpoint.py mode change 100755 => 100644 src/wrf/g_geoht.py mode change 100755 => 100644 src/wrf/g_helicity.py mode change 100755 => 100644 src/wrf/g_latlon.py mode change 100755 => 100644 src/wrf/g_omega.py mode change 100755 => 100644 src/wrf/g_precip.py mode change 100755 => 100644 src/wrf/g_pressure.py mode change 100755 => 100644 src/wrf/g_pw.py mode change 100755 => 100644 src/wrf/g_rh.py mode change 100755 => 100644 src/wrf/g_slp.py mode change 100755 => 100644 src/wrf/g_temp.py mode change 100755 => 100644 src/wrf/g_terrain.py mode change 100755 => 100644 src/wrf/g_times.py mode change 100755 => 100644 src/wrf/g_uvmet.py mode change 100755 => 100644 src/wrf/g_vorticity.py mode change 100755 => 100644 src/wrf/g_wind.py mode change 100755 => 100644 src/wrf/interp.py mode change 100755 => 100644 src/wrf/units.py diff --git a/src/wrf/__init__.py b/src/wrf/__init__.py old mode 100755 new mode 100644 diff --git a/src/wrf/constants.py b/src/wrf/constants.py old mode 100755 new mode 100644 diff --git a/src/wrf/destag.py b/src/wrf/destag.py old mode 100755 new mode 100644 diff --git a/src/wrf/extension.py b/src/wrf/extension.py old mode 100755 new mode 100644 diff --git a/src/wrf/g_cape.py b/src/wrf/g_cape.py old mode 100755 new mode 100644 diff --git a/src/wrf/g_dbz.py b/src/wrf/g_dbz.py old mode 100755 new mode 100644 diff --git a/src/wrf/g_dewpoint.py b/src/wrf/g_dewpoint.py old mode 100755 new mode 100644 diff --git a/src/wrf/g_geoht.py b/src/wrf/g_geoht.py old mode 100755 new mode 100644 diff --git a/src/wrf/g_helicity.py b/src/wrf/g_helicity.py old mode 100755 new mode 100644 diff --git a/src/wrf/g_latlon.py b/src/wrf/g_latlon.py old mode 100755 new mode 100644 diff --git a/src/wrf/g_omega.py b/src/wrf/g_omega.py old mode 100755 new mode 100644 diff --git a/src/wrf/g_precip.py b/src/wrf/g_precip.py old mode 100755 new mode 100644 diff --git a/src/wrf/g_pressure.py b/src/wrf/g_pressure.py old mode 100755 new mode 100644 diff --git a/src/wrf/g_pw.py b/src/wrf/g_pw.py old mode 100755 new mode 100644 diff --git a/src/wrf/g_rh.py b/src/wrf/g_rh.py old mode 100755 new mode 100644 diff --git a/src/wrf/g_slp.py b/src/wrf/g_slp.py old mode 100755 new mode 100644 diff --git a/src/wrf/g_temp.py b/src/wrf/g_temp.py old mode 100755 new mode 100644 diff --git a/src/wrf/g_terrain.py b/src/wrf/g_terrain.py old mode 100755 new mode 100644 diff --git a/src/wrf/g_times.py b/src/wrf/g_times.py old mode 100755 new mode 100644 diff --git a/src/wrf/g_uvmet.py b/src/wrf/g_uvmet.py old mode 100755 new mode 100644 diff --git a/src/wrf/g_vorticity.py b/src/wrf/g_vorticity.py old mode 100755 new mode 100644 diff --git a/src/wrf/g_wind.py b/src/wrf/g_wind.py old mode 100755 new mode 100644 diff --git a/src/wrf/interp.py b/src/wrf/interp.py old mode 100755 new mode 100644 diff --git a/src/wrf/units.py b/src/wrf/units.py old mode 100755 new mode 100644 From 4686af492a19f28307667f6b32a42e44cabd52c0 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Fri, 24 May 2024 19:27:57 -0400 Subject: [PATCH 19/69] BLD: First attempt at OpenMP. Can't test locally. Debating testing in my repo or draft PR. --- CMakeLists.txt | 42 +++++++++++++++++++++++++++++++-- fortran/build_help/sub_sizes.py | 3 +++ pyproject.toml | 1 - 3 files changed, 43 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4763d59..16eceb8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,6 @@ if(PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR) endif() find_package(Python 3.8 REQUIRED COMPONENTS Development.Module NumPy) -find_package(OpenMP COMPONENTS Fortran) # Ensure scikit-build modules if (NOT SKBUILD) @@ -43,6 +42,42 @@ execute_process( OUTPUT_STRIP_TRAILING_WHITESPACE ) +find_package(OpenMP COMPONENTS Fortran) +set_source_files_properties(fortran/ompgen.F90 PROPERTIES Fortran_PREPROCESS ON) +# TODO: Figure out the conditionals for running the C Preprocessor on Fortran files +# I think the main thing to be changed is -E -cpp +# Intel is -fpp -save-temps or /fpp on Windows +# or call fpp instead of the fortran compiler to get it to stop after preprocessing +if (${OpenMP_Fortran_FOUND}) + # This would probably be cleaner if I shoved it in the subdirectory + file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/fortran") + add_executable(sizes "${CMAKE_SOURCE_DIR}/fortran/build_help/omp_sizes.f90") + target_link_libraries(sizes PRIVATE OpenMP::OpenMP_Fortran) + add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/fortran/ompgen.F90" + DEPENDS "${CMAKE_SOURCE_DIR}/fortran/ompgen.F90.template" + ${CMAKE_SOURCE_DIR}/fortran/build_help/sub_sizes.py + sizes + COMMAND + ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/fortran/build_help/sub_sizes.py + ${CMAKE_SOURCE_DIR}/fortran/ompgen.F90.template + ${CMAKE_CURRENT_BINARY_DIR}/fortran/ompgen.F90 + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" + ) + add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/fortran/omp.f90" + DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/fortran/ompgen.F90" + COMMAND ${CMAKE_Fortran_COMPILER} -E "${CMAKE_CURRENT_BINARY_DIR}/fortran/ompgen.F90" + -o "${CMAKE_CURRENT_BINARY_DIR}/fortran/omp.f90" ${OpenMP_Fortran_FLAGS} -cpp + ) +else() + add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/fortran/omp.f90" + DEPENDS "${CMAKE_SOURCE_DIR}/fortran/ompgen.F90" + COMMAND ${CMAKE_Fortran_COMPILER} -E fortran/ompgen.F90 -o fortran/omp.f90 -cpp + ) +endif() + # Prepping the module set(f2py_module_name "_wrffortran") set(fortran_src_files @@ -62,7 +97,7 @@ set(fortran_src_files "${CMAKE_SOURCE_DIR}/fortran/wrf_pw.f90" "${CMAKE_SOURCE_DIR}/fortran/wrf_vinterp.f90" "${CMAKE_SOURCE_DIR}/fortran/wrf_wind.f90" - "${CMAKE_SOURCE_DIR}/fortran/omp.f90") + "${CMAKE_CURRENT_BINARY_DIR}/fortran/omp.f90") set(python_src_files "${CMAKE_SOURCE_DIR}/src/wrf/__init__.py" "${CMAKE_SOURCE_DIR}/src/wrf/api.py" @@ -142,6 +177,9 @@ set_target_properties(${f2py_module_name} PROPERTIES PREFIX "") # https://scikit-build-core.readthedocs.io/en/latest/getting_started.html target_link_libraries(${f2py_module_name} PRIVATE Python::NumPy) +if (${OpenMP_Fortran_FOUND}) + target_link_libraries(${f2py_module_name} PRIVATE OpenMP::OpenMP_Fortran) +endif() # Linker fixes if (UNIX) diff --git a/fortran/build_help/sub_sizes.py b/fortran/build_help/sub_sizes.py index d69b6e8..bb91eb6 100644 --- a/fortran/build_help/sub_sizes.py +++ b/fortran/build_help/sub_sizes.py @@ -41,6 +41,9 @@ def main(): ompgen_temp_path = os.path.join("..", "ompgen.F90.template") ompgen_out_path = os.path.join("..", "ompgen.F90") + if len(sys.argv) == 3: + ompgen_temp_path = sys.argv[1] + ompgen_out_path = sys.argv[2] with open(ompgen_temp_path, "r") as ompgen_in: ompgen_template = Template(ompgen_in.read()) diff --git a/pyproject.toml b/pyproject.toml index 28b8eed..b07900f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -60,7 +60,6 @@ logging.level = "INFO" minimum-version = "0.8" cmake.version = ">=3.18" wheel.packages = ["src/wrf"] -sdist.include = ["fortran/omp.f90"] # To avoid stripping installed libraries # Packages often want to do their own stripping From ad35d875db34d82d654628d2700659eb045d9a61 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Sat, 25 May 2024 11:54:18 -0400 Subject: [PATCH 20/69] CI: Update CI for CMake build, and add 3.12 --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4f40dfd..0d66986 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: fail-fast: false matrix: os: [ "ubuntu-latest", "macos-latest", "macos-14" ] - python-version: [ "3.9", "3.10", "3.11" ] + python-version: [ "3.9", "3.10", "3.11", "3.12" ] steps: - name: Cancel previous runs @@ -49,9 +49,9 @@ jobs: environment-file: build_envs/environment.yml - name: Build WRF-Python run: | - cd build_scripts - ./gnu_omp.sh - cd .. + python -m pip install build + python -m build . + python -m pip install dist/wrf*.whl - name: Run tests run: | cd test/ci_tests From 937e16411636178c94b3e473f98e2e429e0243eb Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Sat, 25 May 2024 12:07:24 -0400 Subject: [PATCH 21/69] CI: Check the installed package. It's not working, and I'd like to know why. --- .github/workflows/ci.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0d66986..7f7b3d9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,6 +52,15 @@ jobs: python -m pip install build python -m build . python -m pip install dist/wrf*.whl + - name: Check import + run: | + python -m pip show wrf-python + python -m pip show --files wrf-python + installed_files="$(python -m pip show --files wrf-python | grep -v :)" + ls -l ${installed_files} + file ${installed_files} + ldd ${installed_files} + python -vvv -d -c "import wrf" - name: Run tests run: | cd test/ci_tests From ddcf9eb5266dd3f13eb3ef5392837bcdae552d57 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Sat, 25 May 2024 12:25:56 -0400 Subject: [PATCH 22/69] CI: Fix Python 3.12 install and package install check --- .github/workflows/ci.yml | 3 ++- build_envs/environment.yml | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7f7b3d9..85f2881 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,7 +56,8 @@ jobs: run: | python -m pip show wrf-python python -m pip show --files wrf-python - installed_files="$(python -m pip show --files wrf-python | grep -v :)" + prefix="$(python -m pip show --files six | grep Location: | cut -f2 -d' ')" + installed_files="$(python -m pip show --files wrf-python | sed -E -e "/\\w+:/ d" -e "/^\s+/ s|^ |${prefix}/|g")" ls -l ${installed_files} file ${installed_files} ldd ${installed_files} diff --git a/build_envs/environment.yml b/build_envs/environment.yml index 8b46c24..853e9fb 100644 --- a/build_envs/environment.yml +++ b/build_envs/environment.yml @@ -3,7 +3,7 @@ name: wrf_python_build channels: - conda-forge dependencies: - - python>=3.9, <3.12 + - python>=3.9, <3.13 - compilers - basemap - cartopy @@ -17,4 +17,5 @@ dependencies: - sphinx_rtd_theme - wrapt - xarray - + - build + - pip From 05657f8dfb79619209317602336aee40907a6af8 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Sat, 25 May 2024 13:11:16 -0400 Subject: [PATCH 23/69] FIX: Try to get checks working. --- .github/workflows/ci.yml | 4 ++-- pyproject.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 85f2881..cb2e57d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,8 +56,8 @@ jobs: run: | python -m pip show wrf-python python -m pip show --files wrf-python - prefix="$(python -m pip show --files six | grep Location: | cut -f2 -d' ')" - installed_files="$(python -m pip show --files wrf-python | sed -E -e "/\\w+:/ d" -e "/^\s+/ s|^ |${prefix}/|g")" + prefix="$(python -m pip show --files wrf-python | grep Location: | cut -f2 -d" ")" + installed_files="$(python -m pip show --files wrf-python | sed -E -e "/\\w+:/ d" -e "/^\s+/ s|^\s+|${prefix}/|g")" ls -l ${installed_files} file ${installed_files} ldd ${installed_files} diff --git a/pyproject.toml b/pyproject.toml index b07900f..4e653d3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,7 +12,7 @@ maintainers = [ ] description = "Diagnostic and interpolation routines for WRF-ARW data." readme = "README.md" -requires-python = ">=3.7, <3.12" +requires-python = ">=3.7, <3.13" keywords = [ "python", "wrf-python", "wrf", "forecast", "model", "weather research and forecasting", "interpolation", From 0df03d8dce5e7b106655de6f522f24aed3121660 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Sat, 25 May 2024 14:18:50 -0400 Subject: [PATCH 24/69] BLD: Let skbuild handle install dirs when available. Only use my versions when skbuild isn't around. --- CMakeLists.txt | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 16eceb8..52c37e9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -194,10 +194,15 @@ endif() add_dependencies(${f2py_module_name} genpyf) -string(REGEX REPLACE "^/(usr/(local/)?)?" "" Python_SITEARCH_INSTALL ${Python_SITEARCH}) -string(REGEX REPLACE "^/(usr/(local/)?)?" "" Python_SITELIB_INSTALL ${Python_SITELIB}) -# string(SUBSTRING ${Python_SITEARCH} 1 -1 Python_SITEARCH_INSTALL) -# string(SUBSTRING ${Python_SITELIB} 1 -1 Python_SITELIB_INSTALL) +if (NOT SKBUILD) + string(REGEX REPLACE "^/(usr/(local/)?)?" "" Python_SITEARCH_INSTALL ${Python_SITEARCH}) + string(REGEX REPLACE "^/(usr/(local/)?)?" "" Python_SITELIB_INSTALL ${Python_SITELIB}) + # string(SUBSTRING ${Python_SITEARCH} 1 -1 Python_SITEARCH_INSTALL) + # string(SUBSTRING ${Python_SITELIB} 1 -1 Python_SITELIB_INSTALL) -install(TARGETS ${f2py_module_name} DESTINATION "${Python_SITEARCH_INSTALL}/wrf/") -install(FILES ${python_src_files} DESTINATION "${Python_SITELIB_INSTALL}/wrf/") + install(TARGETS ${f2py_module_name} DESTINATION "${Python_SITEARCH_INSTALL}/wrf/") + install(FILES ${python_src_files} DESTINATION "${Python_SITELIB_INSTALL}/wrf/") + install(FILES src/wrf/data/psadilookup.dat DESTINATION "${Python_SITELIB_INSTALL}/wrf") +else() + install(TARGETS ${f2py_module_name] DESTINATION "${SKBUILD_PLATLIB_DIR}") +endif() From 0d38af9005fc592ff2173b24421167bdab7b48fd Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Sat, 25 May 2024 14:25:27 -0400 Subject: [PATCH 25/69] FIX: Fix syntax in CMake variable reference. --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 52c37e9..22b72d4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -204,5 +204,6 @@ if (NOT SKBUILD) install(FILES ${python_src_files} DESTINATION "${Python_SITELIB_INSTALL}/wrf/") install(FILES src/wrf/data/psadilookup.dat DESTINATION "${Python_SITELIB_INSTALL}/wrf") else() - install(TARGETS ${f2py_module_name] DESTINATION "${SKBUILD_PLATLIB_DIR}") + # https://scikit-build-core.readthedocs.io/en/latest/cmakelists.html#install-directories + install(TARGETS ${f2py_module_name} DESTINATION "${SKBUILD_PLATLIB_DIR}") endif() From a962d9f2dc3b8d436090ae4b9d3c4576713661a4 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Sat, 25 May 2024 14:32:49 -0400 Subject: [PATCH 26/69] CI,DBG: Only run ldd on so files. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cb2e57d..0a8f92c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,7 +60,7 @@ jobs: installed_files="$(python -m pip show --files wrf-python | sed -E -e "/\\w+:/ d" -e "/^\s+/ s|^\s+|${prefix}/|g")" ls -l ${installed_files} file ${installed_files} - ldd ${installed_files} + ldd $(echo ${installed_files} | grep -v -e ".py" -e ".dist-info") python -vvv -d -c "import wrf" - name: Run tests run: | From 028ec66f65c15cd4e932567c03cbb232748b164f Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Sat, 25 May 2024 23:50:19 -0400 Subject: [PATCH 27/69] FIX: Ensure grep knows the patterns are fixed strings. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0a8f92c..e1a8118 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,7 +60,7 @@ jobs: installed_files="$(python -m pip show --files wrf-python | sed -E -e "/\\w+:/ d" -e "/^\s+/ s|^\s+|${prefix}/|g")" ls -l ${installed_files} file ${installed_files} - ldd $(echo ${installed_files} | grep -v -e ".py" -e ".dist-info") + ldd $(echo ${installed_files} | grep -F -v -e ".py" -e ".dist-info") python -vvv -d -c "import wrf" - name: Run tests run: | From 3b9abc9bc01599826a4bc121c2ae85b9c4779a72 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Sat, 25 May 2024 23:55:51 -0400 Subject: [PATCH 28/69] CI,DBG: Remove debug section. It's not working, and it doesn't look easy to get working on Mac. Everything should be working now, so let's check. --- .github/workflows/ci.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e1a8118..0d66986 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,16 +52,6 @@ jobs: python -m pip install build python -m build . python -m pip install dist/wrf*.whl - - name: Check import - run: | - python -m pip show wrf-python - python -m pip show --files wrf-python - prefix="$(python -m pip show --files wrf-python | grep Location: | cut -f2 -d" ")" - installed_files="$(python -m pip show --files wrf-python | sed -E -e "/\\w+:/ d" -e "/^\s+/ s|^\s+|${prefix}/|g")" - ls -l ${installed_files} - file ${installed_files} - ldd $(echo ${installed_files} | grep -F -v -e ".py" -e ".dist-info") - python -vvv -d -c "import wrf" - name: Run tests run: | cd test/ci_tests From 894451422c642a33a93963a8e90c74fc54752735 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Sun, 26 May 2024 00:03:07 -0400 Subject: [PATCH 29/69] FIX: Fix install directory for fortran extension module. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 22b72d4..bf6db63 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -205,5 +205,5 @@ if (NOT SKBUILD) install(FILES src/wrf/data/psadilookup.dat DESTINATION "${Python_SITELIB_INSTALL}/wrf") else() # https://scikit-build-core.readthedocs.io/en/latest/cmakelists.html#install-directories - install(TARGETS ${f2py_module_name} DESTINATION "${SKBUILD_PLATLIB_DIR}") + install(TARGETS ${f2py_module_name} DESTINATION "${SKBUILD_PLATLIB_DIR}/wrf/") endif() From dd8ead26d8b959a022ee3fd397905a089f2d4d76 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Sun, 26 May 2024 22:39:36 -0400 Subject: [PATCH 30/69] BLD: Move requirements.txt to pyproject.toml Requirements list on RTD is much shorter than elsewhere, so do not install the extra packages on RTD. The last part of setup.py left is the Cheyenne configuration. --- .readthedocs.yml | 2 +- pyproject.toml | 10 ++++++-- requirements.txt | 5 ---- setup.py | 62 ------------------------------------------------ 4 files changed, 9 insertions(+), 70 deletions(-) delete mode 100644 requirements.txt delete mode 100755 setup.py diff --git a/.readthedocs.yml b/.readthedocs.yml index d059c2c..8cb6480 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -11,7 +11,7 @@ build: python: "mambaforge-4.10" jobs: post_create_environment: - - python -m pip install --no-cache-dir . + - python -m pip install --no-cache-dir --no-deps . # Build documentation in the docs/ directory with Sphinx sphinx: diff --git a/pyproject.toml b/pyproject.toml index 4e653d3..556fa88 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,7 +37,14 @@ classifiers = [ "Operating System :: Microsoft :: Windows" ] license = { text = "Apache-2.0" } -dynamic = [ "version", "dependencies" ] +dynamic = [ "version" ] +dependencies = [ + "basemap", + "numpy >=1.11, !=1.24.3", + "setuptools", + "wrapt", + "xarray" +] [project.urls] Repository = "https://github.com/NCAR/wrf-python" @@ -52,7 +59,6 @@ where = ["src"] [tool.setuptools.dynamic] version = { attr = "wrf.version.__version__" } -dependencies = { file = "requirements.txt" } [tool.scikit-build] cmake.verbose = true diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index e9cbcfa..0000000 --- a/requirements.txt +++ /dev/null @@ -1,5 +0,0 @@ -basemap -numpy >=1.11, !=1.24.3 -setuptools -wrapt -xarray diff --git a/setup.py b/setup.py deleted file mode 100755 index 8fd210c..0000000 --- a/setup.py +++ /dev/null @@ -1,62 +0,0 @@ -import os -import setuptools -import socket - -if not socket.gethostname().startswith("cheyenne"): - import numpy.distutils.core -else: - import chey_intel - import numpy.distutils.core - import numpy.distutils.fcompiler.intel - - numpy.distutils.fcompiler.intel.IntelFCompiler = chey_intel.IntelFCompiler - numpy.distutils.fcompiler.intel.IntelVisualFCompiler = ( - chey_intel.IntelVisualFCompiler) - numpy.distutils.fcompiler.intel.IntelItaniumFCompiler = ( - chey_intel.IntelItaniumFCompiler) - numpy.distutils.fcompiler.intel.IntelItaniumVisualFCompiler = ( - chey_intel.IntelItaniumVisualFCompiler) - numpy.distutils.fcompiler.intel.IntelEM64VisualFCompiler = ( - chey_intel.IntelEM64VisualFCompiler) - numpy.distutils.fcompiler.intel.IntelEM64TFCompiler = ( - chey_intel.IntelEM64TFCompiler) - -ext1 = numpy.distutils.core.Extension( - name="wrf._wrffortran", - sources=["fortran/wrf_constants.f90", - "fortran/wrf_testfunc.f90", - "fortran/wrf_user.f90", - "fortran/rip_cape.f90", - "fortran/wrf_cloud_fracf.f90", - "fortran/wrf_fctt.f90", - "fortran/wrf_user_dbz.f90", - "fortran/wrf_relhl.f90", - "fortran/calc_uh.f90", - "fortran/wrf_user_latlon_routines.f90", - "fortran/wrf_pvo.f90", - "fortran/eqthecalc.f90", - "fortran/wrf_rip_phys_routines.f90", - "fortran/wrf_pw.f90", - "fortran/wrf_vinterp.f90", - "fortran/wrf_wind.f90", - "fortran/omp.f90"] - ) - -on_rtd = os.environ.get("READTHEDOCS", None) == "True" -# on_rtd=True -if on_rtd: - requirements = ["mock; python_version < 3.3"] - ext_modules = [] - -else: - # Place install_requires into the text file "requirements.txt" - with open("requirements.txt") as f2: - requirements = f2.read().strip().splitlines() - - ext_modules = [ext1] - -numpy.distutils.core.setup( - install_requires=requirements, - ext_modules=ext_modules, - scripts=[] -) From 079aecafb57120001d76d3fc79e63115c3044138 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Jun 2024 20:43:46 +0000 Subject: [PATCH 31/69] Bump pypa/gh-action-pypi-publish from 1.8.14 to 1.9.0 Bumps [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) from 1.8.14 to 1.9.0. - [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases) - [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/v1.8.14...v1.9.0) --- updated-dependencies: - dependency-name: pypa/gh-action-pypi-publish dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/pypi.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pypi.yaml b/.github/workflows/pypi.yaml index f85b6ce..74ed5e7 100644 --- a/.github/workflows/pypi.yaml +++ b/.github/workflows/pypi.yaml @@ -46,7 +46,7 @@ jobs: run: | python -m twine check dist/* - name: Publish package to PyPI - uses: pypa/gh-action-pypi-publish@v1.8.14 + uses: pypa/gh-action-pypi-publish@v1.9.0 with: user: __token__ password: ${{ secrets.PYPI_WRF_PYTHON }} From 974532d54fa65b3141230dcff3e3d794b6c70cf4 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Thu, 23 May 2024 10:13:00 -0400 Subject: [PATCH 32/69] PKG: Require python to be old enough for numpy.distutils https://numpy.org/doc/stable/reference/distutils_status_migration.html numpy.distutils will never be on Python 3.12, but the build script makes heavy use of it. Note this requirement in the metadata. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 9c38c9a..1953a2b 100755 --- a/setup.py +++ b/setup.py @@ -96,7 +96,7 @@ "plotting", "plots", "meteorology", "nwp", "numerical weather prediction", "diagnostic", "science", "numpy"], - python_requires='>=3.7', + python_requires='>=3.7, <3.12', install_requires=requirements, classifiers=["Development Status :: 5 - Production/Stable", "Intended Audience :: Science/Research", From e34189e7ffa4e462e916c8561f23615265d9e783 Mon Sep 17 00:00:00 2001 From: Mathias Hauser Date: Tue, 23 Jul 2024 18:25:04 +0200 Subject: [PATCH 33/69] Apply suggestions from code review Co-authored-by: Katelyn FitzGerald <7872563+kafitzgerald@users.noreply.github.com> --- doc/source/tutorials/wrf_workshop_2019.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/source/tutorials/wrf_workshop_2019.rst b/doc/source/tutorials/wrf_workshop_2019.rst index bd63d78..7f697e7 100644 --- a/doc/source/tutorials/wrf_workshop_2019.rst +++ b/doc/source/tutorials/wrf_workshop_2019.rst @@ -81,7 +81,8 @@ For Linux: Step 2: Download Miniconda ---------------------------- -For this tutorial, you will need to download and install Miniconda. +For this tutorial, you will need to download and install Miniconda. We are +going to use Python 3.7, but it will also work with Python 2.7. Please use the appropriate link below to download Miniconda for your operating system. @@ -229,7 +230,7 @@ Follow the instructions below to create the tutorial_2019 environment. Type or copy this command in to your command terminal:: - conda create -n tutorial_2019 python=3.11 matplotlib cartopy netcdf4 jupyter git ffmpeg wrf-python + conda create -n tutorial_2019 python=3.7 matplotlib cartopy netcdf4 jupyter git ffmpeg wrf-python Type "y" when prompted. It will take several minutes to install everything. From b3557c32e1850f82e16a5d362944e50c6ef5f5c5 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Tue, 20 Aug 2024 13:20:46 -0400 Subject: [PATCH 34/69] BLD: Do not expect f2py to produce ${modname}-f2pywrappers2.f90 For some reason this isn't getting written despite every file being .f90 and no file being .f77, so put that in the code. --- CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bf6db63..d85cf43 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -153,7 +153,6 @@ add_custom_target(genpyf add_custom_command( OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${f2py_module_c}" "${CMAKE_CURRENT_BINARY_DIR}/${f2py_module_name}-f2pywrappers.f" - "${CMAKE_CURRENT_BINARY_DIR}/${f2py_module_name}-f2pywrappers2.f90" COMMAND ${PYTHON_EXECUTABLE} -m "numpy.f2py" -m "${f2py_module_name}" --lower # Important @@ -164,7 +163,6 @@ add_custom_command( Python_add_library(${f2py_module_name} MODULE "${f2py_module_c}" "${f2py_module_name}-f2pywrappers.f" - "${f2py_module_name}-f2pywrappers2.f90" "${F2PY_INCLUDE_DIR}/fortranobject.c" "${fortran_src_files}") From 0038273918803531d52505c83b03742e4fc931bc Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Fri, 30 Aug 2024 06:35:27 -0400 Subject: [PATCH 35/69] DOC: Note that this should work on Python 3.12 Update package metadata. --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 556fa88..7a50196 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,6 +29,7 @@ classifiers = [ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Topic :: Scientific/Engineering :: Atmospheric Science", "Topic :: Software Development", "Operating System :: POSIX", From 01f93348bfb4ed83bd838700c9deb0b3c2a55ccc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Sep 2024 20:44:57 +0000 Subject: [PATCH 36/69] Bump pypa/gh-action-pypi-publish from 1.9.0 to 1.10.0 Bumps [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) from 1.9.0 to 1.10.0. - [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases) - [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/v1.9.0...v1.10.0) --- updated-dependencies: - dependency-name: pypa/gh-action-pypi-publish dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/pypi.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pypi.yaml b/.github/workflows/pypi.yaml index 74ed5e7..8381b14 100644 --- a/.github/workflows/pypi.yaml +++ b/.github/workflows/pypi.yaml @@ -46,7 +46,7 @@ jobs: run: | python -m twine check dist/* - name: Publish package to PyPI - uses: pypa/gh-action-pypi-publish@v1.9.0 + uses: pypa/gh-action-pypi-publish@v1.10.0 with: user: __token__ password: ${{ secrets.PYPI_WRF_PYTHON }} From 3d3b1e2cb9da16b12f288c933e589089a8845d01 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Sep 2024 20:19:09 +0000 Subject: [PATCH 37/69] Bump pypa/gh-action-pypi-publish from 1.10.0 to 1.10.1 Bumps [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) from 1.10.0 to 1.10.1. - [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases) - [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/v1.10.0...v1.10.1) --- updated-dependencies: - dependency-name: pypa/gh-action-pypi-publish dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/pypi.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pypi.yaml b/.github/workflows/pypi.yaml index 8381b14..c4c7fad 100644 --- a/.github/workflows/pypi.yaml +++ b/.github/workflows/pypi.yaml @@ -46,7 +46,7 @@ jobs: run: | python -m twine check dist/* - name: Publish package to PyPI - uses: pypa/gh-action-pypi-publish@v1.10.0 + uses: pypa/gh-action-pypi-publish@v1.10.1 with: user: __token__ password: ${{ secrets.PYPI_WRF_PYTHON }} From 9654adaee0621a6cd913cbf0af53db1a7a79adbb Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Wed, 11 Sep 2024 10:20:51 -0400 Subject: [PATCH 38/69] BLD: Pin NumPy<2 Let's see if this allows this to build. I haven't had problems locally with 3.9/1.26 --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 7a50196..b54882e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["scikit-build-core", "numpy"] +requires = ["scikit-build-core", "numpy<2.0"] build-backend = "scikit_build_core.build" [project] @@ -41,7 +41,7 @@ license = { text = "Apache-2.0" } dynamic = [ "version" ] dependencies = [ "basemap", - "numpy >=1.11, !=1.24.3", + "numpy >=1.11, !=1.24.3, <2.0", "setuptools", "wrapt", "xarray" From 7944265c1239192b53ab01c978a2e3f7b031e399 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Fri, 13 Sep 2024 08:31:05 -0400 Subject: [PATCH 39/69] BLD: Make CMake OpenMP linkage public. --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d85cf43..bb3bdbd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,7 +52,7 @@ if (${OpenMP_Fortran_FOUND}) # This would probably be cleaner if I shoved it in the subdirectory file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/fortran") add_executable(sizes "${CMAKE_SOURCE_DIR}/fortran/build_help/omp_sizes.f90") - target_link_libraries(sizes PRIVATE OpenMP::OpenMP_Fortran) + target_link_libraries(sizes PUBLIC OpenMP::OpenMP_Fortran) add_custom_command( OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/fortran/ompgen.F90" DEPENDS "${CMAKE_SOURCE_DIR}/fortran/ompgen.F90.template" @@ -176,7 +176,7 @@ set_target_properties(${f2py_module_name} PROPERTIES PREFIX "") # https://scikit-build-core.readthedocs.io/en/latest/getting_started.html target_link_libraries(${f2py_module_name} PRIVATE Python::NumPy) if (${OpenMP_Fortran_FOUND}) - target_link_libraries(${f2py_module_name} PRIVATE OpenMP::OpenMP_Fortran) + target_link_libraries(${f2py_module_name} PUBLIC OpenMP::OpenMP_Fortran) endif() # Linker fixes From 9f8408877a562b9e103573b858cf8b5877cbca08 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Fri, 13 Sep 2024 08:38:22 -0400 Subject: [PATCH 40/69] BLD: Pin build-time NumPy >=2, unpin run-time numpy --- pyproject.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b54882e..c4f2085 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["scikit-build-core", "numpy<2.0"] +requires = ["scikit-build-core", "numpy>=2.0"] build-backend = "scikit_build_core.build" [project] @@ -41,8 +41,8 @@ license = { text = "Apache-2.0" } dynamic = [ "version" ] dependencies = [ "basemap", - "numpy >=1.11, !=1.24.3, <2.0", - "setuptools", + "numpy >=1.11, !=1.24.3", + "setuptools>=61", "wrapt", "xarray" ] From e41f75e570e514c692fcf1611fdf7d4f80cf4e94 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Sun, 15 Sep 2024 15:57:04 -0400 Subject: [PATCH 41/69] BUG: Fix spelling of Python_EXECUTABLE in CMakeLists.txt --- CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bb3bdbd..abd39fd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,7 @@ if (NOT SKBUILD) # Kanged --> https://github.com/Kitware/torch_liberator/blob/master/CMakeLists.txt # If skbuild is not the driver; include its utilities in CMAKE_MODULE_PATH execute_process( - COMMAND "${PYTHON_EXECUTABLE}" + COMMAND "${Python_EXECUTABLE}" -c "import os, skbuild; print(os.path.dirname(skbuild.__file__))" OUTPUT_VARIABLE SKBLD_DIR OUTPUT_STRIP_TRAILING_WHITESPACE @@ -36,7 +36,7 @@ endif() # NumPy headers # F2PY headers execute_process( - COMMAND "${PYTHON_EXECUTABLE}" + COMMAND "${Python_EXECUTABLE}" -c "import numpy.f2py; print(numpy.f2py.get_include())" OUTPUT_VARIABLE F2PY_INCLUDE_DIR OUTPUT_STRIP_TRAILING_WHITESPACE @@ -59,7 +59,7 @@ if (${OpenMP_Fortran_FOUND}) ${CMAKE_SOURCE_DIR}/fortran/build_help/sub_sizes.py sizes COMMAND - ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/fortran/build_help/sub_sizes.py + ${Python_EXECUTABLE} ${CMAKE_SOURCE_DIR}/fortran/build_help/sub_sizes.py ${CMAKE_SOURCE_DIR}/fortran/ompgen.F90.template ${CMAKE_CURRENT_BINARY_DIR}/fortran/ompgen.F90 WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" @@ -153,7 +153,7 @@ add_custom_target(genpyf add_custom_command( OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${f2py_module_c}" "${CMAKE_CURRENT_BINARY_DIR}/${f2py_module_name}-f2pywrappers.f" - COMMAND ${PYTHON_EXECUTABLE} -m "numpy.f2py" + COMMAND ${Python_EXECUTABLE} -m "numpy.f2py" -m "${f2py_module_name}" --lower # Important ${fortran_src_files} From 379691dc038064e63498ff162968d1f703284323 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Sun, 15 Sep 2024 19:20:46 -0400 Subject: [PATCH 42/69] BUG: Include the f90 wrapper file in the compilation. I think I had it earlier, but deleted it from the link line because I thought the library was fixed-form only, rather than making sure it was available for the link line. --- CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index abd39fd..c2554ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -153,6 +153,7 @@ add_custom_target(genpyf add_custom_command( OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${f2py_module_c}" "${CMAKE_CURRENT_BINARY_DIR}/${f2py_module_name}-f2pywrappers.f" + "${CMAKE_CURRENT_BINARY_DIR}/${f2py_module_name}-f2pywrappers2.f90" COMMAND ${Python_EXECUTABLE} -m "numpy.f2py" -m "${f2py_module_name}" --lower # Important @@ -161,8 +162,9 @@ add_custom_command( ) Python_add_library(${f2py_module_name} MODULE - "${f2py_module_c}" - "${f2py_module_name}-f2pywrappers.f" + "${CMAKE_CURRENT_BINARY_DIR}/${${f2py_module_c}" + "${CMAKE_CURRENT_BINARY_DIR}/${f2py_module_name}-f2pywrappers.f" + "${CMAKE_CURRENT_BINARY_DIR}/${f2py_module_name}-f2pywrappers2.f90" "${F2PY_INCLUDE_DIR}/fortranobject.c" "${fortran_src_files}") From b5fdd5f7f2adcfa4e076566e4056b44ab6c6b206 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Sun, 15 Sep 2024 20:09:54 -0400 Subject: [PATCH 43/69] FIX: Fix syntax in CMakeLists.txt --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c2554ce..b977aa8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -162,7 +162,7 @@ add_custom_command( ) Python_add_library(${f2py_module_name} MODULE - "${CMAKE_CURRENT_BINARY_DIR}/${${f2py_module_c}" + "${CMAKE_CURRENT_BINARY_DIR}/${f2py_module_c}" "${CMAKE_CURRENT_BINARY_DIR}/${f2py_module_name}-f2pywrappers.f" "${CMAKE_CURRENT_BINARY_DIR}/${f2py_module_name}-f2pywrappers2.f90" "${F2PY_INCLUDE_DIR}/fortranobject.c" From 4bde3cfab32b2bbcfba5a65183ef8b85716db0fd Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Mon, 16 Sep 2024 17:47:48 -0400 Subject: [PATCH 44/69] BLD: Pin numpy<1.26.3 Let's see if that's the fix that broke the build --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index c4f2085..05ab39d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["scikit-build-core", "numpy>=2.0"] +requires = ["scikit-build-core", "numpy<1.26.3"] build-backend = "scikit_build_core.build" [project] @@ -41,7 +41,7 @@ license = { text = "Apache-2.0" } dynamic = [ "version" ] dependencies = [ "basemap", - "numpy >=1.11, !=1.24.3", + "numpy >=1.11, !=1.24.3, <2.0", "setuptools>=61", "wrapt", "xarray" From 0eed892fe536d12747e632159021313ad84777e0 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Tue, 17 Sep 2024 10:03:13 -0400 Subject: [PATCH 45/69] ENH: Add a function to module wrf_constants so f2py includes it --- fortran/wrf_constants.f90 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fortran/wrf_constants.f90 b/fortran/wrf_constants.f90 index 0864502..df5bd8d 100644 --- a/fortran/wrf_constants.f90 +++ b/fortran/wrf_constants.f90 @@ -69,6 +69,8 @@ MODULE wrf_constants REAL(KIND=8), PARAMETER :: EXPON = RD*USSALR/G REAL(KIND=8), PARAMETER :: EXPONI = 1./EXPON - + logical function have_wrf_constants() + have_wrf_constants = .true. + end function have_wrf_constants END MODULE wrf_constants From 607cf3039b13cc2f1bc965d166ea5884b05a05b1 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Tue, 17 Sep 2024 10:04:31 -0400 Subject: [PATCH 46/69] ENH: Add a function to module omp_constants so f2py includes it --- fortran/ompgen.F90.template | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fortran/ompgen.F90.template b/fortran/ompgen.F90.template index 00a50d5..4cb1f83 100644 --- a/fortran/ompgen.F90.template +++ b/fortran/ompgen.F90.template @@ -20,6 +20,9 @@ MODULE omp_constants INTEGER(KIND=4), PARAMETER :: fomp_sched_auto = 4 #endif + logical function have_omp_constants() + have_omp_constants = .true. + end function have_omp_constants END MODULE omp_constants From 1c20f4a5bf140e9c20801bd01e45ce66ae601de4 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Tue, 17 Sep 2024 10:10:05 -0400 Subject: [PATCH 47/69] FIX: Fix where in module functions go --- fortran/ompgen.F90.template | 1 + 1 file changed, 1 insertion(+) diff --git a/fortran/ompgen.F90.template b/fortran/ompgen.F90.template index 4cb1f83..9457836 100644 --- a/fortran/ompgen.F90.template +++ b/fortran/ompgen.F90.template @@ -20,6 +20,7 @@ MODULE omp_constants INTEGER(KIND=4), PARAMETER :: fomp_sched_auto = 4 #endif + contains logical function have_omp_constants() have_omp_constants = .true. end function have_omp_constants From ef93ca661575309385d485ccb9784fce42a78c3b Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Tue, 17 Sep 2024 10:10:34 -0400 Subject: [PATCH 48/69] BUG: Fix where in module functions go --- fortran/wrf_constants.f90 | 1 + 1 file changed, 1 insertion(+) diff --git a/fortran/wrf_constants.f90 b/fortran/wrf_constants.f90 index df5bd8d..c1096a6 100644 --- a/fortran/wrf_constants.f90 +++ b/fortran/wrf_constants.f90 @@ -69,6 +69,7 @@ MODULE wrf_constants REAL(KIND=8), PARAMETER :: EXPON = RD*USSALR/G REAL(KIND=8), PARAMETER :: EXPONI = 1./EXPON + contains logical function have_wrf_constants() have_wrf_constants = .true. end function have_wrf_constants From f914a855e63cd9400e915cd1fc4fb2cd99fd4732 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Tue, 17 Sep 2024 10:50:37 -0400 Subject: [PATCH 49/69] ENH: Make have_wrf_constants a subroutine f2py seems to do better with those. --- fortran/wrf_constants.f90 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fortran/wrf_constants.f90 b/fortran/wrf_constants.f90 index c1096a6..d15cca4 100644 --- a/fortran/wrf_constants.f90 +++ b/fortran/wrf_constants.f90 @@ -70,8 +70,9 @@ MODULE wrf_constants REAL(KIND=8), PARAMETER :: EXPONI = 1./EXPON contains - logical function have_wrf_constants() - have_wrf_constants = .true. - end function have_wrf_constants + subroutine have_wrf_constants(a) + logical, intent(out) :: a + a = .true. + end subroutine have_wrf_constants END MODULE wrf_constants From 46cf6b39ba3c95e1397864bf5a1e5f6e5a07911b Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Wed, 18 Sep 2024 09:17:27 -0400 Subject: [PATCH 50/69] BLD: Remove pin on NumPy version --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 05ab39d..4e4e081 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["scikit-build-core", "numpy<1.26.3"] +requires = ["scikit-build-core", "numpy"] build-backend = "scikit_build_core.build" [project] @@ -41,7 +41,7 @@ license = { text = "Apache-2.0" } dynamic = [ "version" ] dependencies = [ "basemap", - "numpy >=1.11, !=1.24.3, <2.0", + "numpy >=1.11, !=1.24.3", "setuptools>=61", "wrapt", "xarray" From 9b712c8e24b6d3f7dd8a505b517e46170e6226e8 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Wed, 18 Sep 2024 09:27:07 -0400 Subject: [PATCH 51/69] CI,DBG: Re-add debug section to CI --- .github/workflows/ci.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0d66986..5022ebe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,3 +56,14 @@ jobs: run: | cd test/ci_tests python utests.py + - name: Check import + if: failure() + run: | + python -m pip show wrf-python + python -m pip show --files wrf-python + prefix="$(python -m pip show --files wrf-python | grep Location: | cut -f2 -d" ")" + installed_files="$(python -m pip show --files wrf-python | sed -E -e "/\\w+:/ d" -e "/^\s+/ s|^\s+|${prefix}/|g")" + ls -l ${installed_files} + file ${installed_files} + ldd $(echo ${installed_files} | grep -F -v -e ".py" -e ".dist-info") + python -vvv -dd -c "import wrf" From faeda9d3b3bfa966b21e29ff9a2345037d22fe14 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Wed, 18 Sep 2024 09:39:11 -0400 Subject: [PATCH 52/69] CI,BUG: Try to fix debug section. --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5022ebe..b0306c4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -62,7 +62,8 @@ jobs: python -m pip show wrf-python python -m pip show --files wrf-python prefix="$(python -m pip show --files wrf-python | grep Location: | cut -f2 -d" ")" - installed_files="$(python -m pip show --files wrf-python | sed -E -e "/\\w+:/ d" -e "/^\s+/ s|^\s+|${prefix}/|g")" + echo "Site-packages directory is ${prefix}" + installed_files="$(python -m pip show --files wrf-python | grep -v -E -e '^[-a-zA-Z]+:'| sed -E -e "/^\s+/ s|^\s+|${prefix}/|g")" ls -l ${installed_files} file ${installed_files} ldd $(echo ${installed_files} | grep -F -v -e ".py" -e ".dist-info") From bb4ff8e8b8d9d2f1ae5fb0859342ffff86312b55 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Wed, 18 Sep 2024 09:43:14 -0400 Subject: [PATCH 53/69] CI,BUG: Try to get ls ${installed_files} working. --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b0306c4..eb00a83 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,7 +63,8 @@ jobs: python -m pip show --files wrf-python prefix="$(python -m pip show --files wrf-python | grep Location: | cut -f2 -d" ")" echo "Site-packages directory is ${prefix}" - installed_files="$(python -m pip show --files wrf-python | grep -v -E -e '^[-a-zA-Z]+:'| sed -E -e "/^\s+/ s|^\s+|${prefix}/|g")" + cd "${prefix}" + installed_files="$(python -m pip show --files wrf-python | grep -v -E -e '^[-a-zA-Z]+:')" ls -l ${installed_files} file ${installed_files} ldd $(echo ${installed_files} | grep -F -v -e ".py" -e ".dist-info") From 80265d68feefac1d7d2a5f1cf3e2c353f4f7a6df Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Wed, 18 Sep 2024 09:47:42 -0400 Subject: [PATCH 54/69] CI,BUG: Don't run ldd until after python import Mac doesn't call it ldd, not sure what it should be. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eb00a83..6d41fe7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -67,5 +67,5 @@ jobs: installed_files="$(python -m pip show --files wrf-python | grep -v -E -e '^[-a-zA-Z]+:')" ls -l ${installed_files} file ${installed_files} - ldd $(echo ${installed_files} | grep -F -v -e ".py" -e ".dist-info") python -vvv -dd -c "import wrf" + ldd $(echo ${installed_files} | grep -F -v -e ".py" -e ".dist-info") From c9573de4121dd4f201012862b3f57583b661966c Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Wed, 18 Sep 2024 09:58:10 -0400 Subject: [PATCH 55/69] BLD,BUG: Try a different suffix for extension modules --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b977aa8..430587f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -172,7 +172,7 @@ target_include_directories(${f2py_module_name} PUBLIC ${F2PY_INCLUDE_DIR} ${Python_NumPy_INCLUDE_DIRS} ${Python_INCLUDE_DIRS}) -set_target_properties(${f2py_module_name} PROPERTIES SUFFIX ".${Python_SOABI}${CMAKE_SHARED_LIBRARY_SUFFIX}") +set_target_properties(${f2py_module_name} PROPERTIES SUFFIX ".${Python_SOABI}${CMAKE_SHARED_MODULE_SUFFIX}") set_target_properties(${f2py_module_name} PROPERTIES PREFIX "") # https://scikit-build-core.readthedocs.io/en/latest/getting_started.html From f9f690fc8e9adc30befb1d220852e028c98d8a49 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Wed, 18 Sep 2024 11:27:41 -0400 Subject: [PATCH 56/69] CI,ENH: conda package build renamed to python-build --- build_envs/environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_envs/environment.yml b/build_envs/environment.yml index 853e9fb..f292805 100644 --- a/build_envs/environment.yml +++ b/build_envs/environment.yml @@ -17,5 +17,5 @@ dependencies: - sphinx_rtd_theme - wrapt - xarray - - build + - python-build - pip From fc2bc1732bb8dca326ce9bd6be95950ae4d0e357 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Mon, 7 Oct 2024 19:00:03 -0400 Subject: [PATCH 57/69] BLD: Add pyproject.toml (#241) * BLD: Initial try at pyproject.toml I think I got every key from setup.py. The main difference is if the READTHEDOCS environment variable is set: I don't know how to change the dependencies based on that. On the other hand, given 3.8 is close to or past EOL, I suspect 3.3 is relatively uncommon, and the RTD install, without the unneeded bits, could be accomplished with pip install --no-deps. * BLD,BUG: Fix pyproject.toml configuration and remove setup.py duplicates. numpy.distutils recommends setuptools<60, but that breaks pyproject.toml configuration. I like this way better. Still needs setup.py for the fortran module and for the Cheyenne configuration. * FIX: Require a setuptools version that understands the configuration. setuptools<60 just gets confused, and has no idea what the project name is. I just inverted that requirement: not sure if setuptools needs to be more recent still. * BLD: Quote version requirement. * BLD: Specify dependencies in pyproject.toml only. Remove requirements.txt. * DOC: Don't install dependencies on RTD The old setup script replaced the dependencies listed in requirements.txt with mock if python was old enough and nothing if python was recent. The package no longer supports python versions that old (<3.3), so installing without dependencies is likely the correct way to handle the RTD configuration. * BLD,BUG: Remove references to requirements, not just definitions Forgot to remove this two or three commits back. * BLD: Let's see if NumPy < 2.0 fixes the error * BLD: Pin setuptools<60 NumPy suggested it, it might help with the distutils failure. * BLD: Pin setuptools<71 Let's see if that change is the one that broke things. * BLD: Add subroutines to f90 modules so f2py adds code for them. If it's just constants used somewhere, f2py drops the module. * BLD: Remove build-time setuptools pin. * BLD: Pin setuptools<70 to get msvccompiler * BLD: Add -fopenmp to LDFLAGS Let's see if this gets Linux compiles working. --------- Co-authored-by: Katelyn FitzGerald <7872563+kafitzgerald@users.noreply.github.com> --- .readthedocs.yml | 2 +- MANIFEST.in | 1 - build_scripts/gnu_omp.sh | 1 + fortran/omp.f90 | 3 ++ fortran/ompgen.F90 | 4 +++ fortran/ompgen.F90.template | 4 +++ fortran/wrf_constants.f90 | 3 ++ pyproject.toml | 61 ++++++++++++++++++++++++++++++++++ requirements.txt | 5 --- setup.py | 66 ------------------------------------- 10 files changed, 77 insertions(+), 73 deletions(-) create mode 100644 pyproject.toml delete mode 100644 requirements.txt diff --git a/.readthedocs.yml b/.readthedocs.yml index d059c2c..8cb6480 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -11,7 +11,7 @@ build: python: "mambaforge-4.10" jobs: post_create_environment: - - python -m pip install --no-cache-dir . + - python -m pip install --no-cache-dir --no-deps . # Build documentation in the docs/ directory with Sphinx sphinx: diff --git a/MANIFEST.in b/MANIFEST.in index 79b786b..44c6fbd 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,6 +1,5 @@ include README.md include LICENSE -include requirements.txt include fortran/*.f90 include fortran/*.pyf diff --git a/build_scripts/gnu_omp.sh b/build_scripts/gnu_omp.sh index 03faa1b..46dded6 100755 --- a/build_scripts/gnu_omp.sh +++ b/build_scripts/gnu_omp.sh @@ -11,6 +11,7 @@ $FC -E ompgen.F90 -fopenmp -cpp -o omp.f90 cd .. python setup.py clean --all +export LDFLAGS=" -fopenmp " python setup.py config_fc --f90flags="-mtune=generic -fopenmp" build_ext --libraries="gomp" build pip install . diff --git a/fortran/omp.f90 b/fortran/omp.f90 index dce6b1d..0480fe6 100644 --- a/fortran/omp.f90 +++ b/fortran/omp.f90 @@ -7,6 +7,9 @@ MODULE omp_constants INTEGER(KIND=fomp_sched_kind), PARAMETER :: fomp_sched_dynamic = 2 INTEGER(KIND=fomp_sched_kind), PARAMETER :: fomp_sched_guided = 3 INTEGER(KIND=fomp_sched_kind), PARAMETER :: fomp_sched_auto = 4 +contains + subroutine have_omp_constants() + end subroutine have_omp_constants END MODULE omp_constants diff --git a/fortran/ompgen.F90 b/fortran/ompgen.F90 index 14fa7d4..4b2920b 100644 --- a/fortran/ompgen.F90 +++ b/fortran/ompgen.F90 @@ -20,6 +20,10 @@ MODULE omp_constants INTEGER(KIND=4), PARAMETER :: fomp_sched_auto = 4 #endif +contains + subroutine have_omp_constants() + end subroutine have_omp_constants + END MODULE omp_constants diff --git a/fortran/ompgen.F90.template b/fortran/ompgen.F90.template index 00a50d5..92be74b 100644 --- a/fortran/ompgen.F90.template +++ b/fortran/ompgen.F90.template @@ -20,6 +20,10 @@ MODULE omp_constants INTEGER(KIND=4), PARAMETER :: fomp_sched_auto = 4 #endif +contains + subroutine have_omp_constants() + end subroutine have_omp_constants + END MODULE omp_constants diff --git a/fortran/wrf_constants.f90 b/fortran/wrf_constants.f90 index 0864502..ebc5667 100644 --- a/fortran/wrf_constants.f90 +++ b/fortran/wrf_constants.f90 @@ -69,6 +69,9 @@ MODULE wrf_constants REAL(KIND=8), PARAMETER :: EXPON = RD*USSALR/G REAL(KIND=8), PARAMETER :: EXPONI = 1./EXPON + contains + subroutine have_wrf_constants() + end subroutine have_wrf_constants END MODULE wrf_constants diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..81dac41 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,61 @@ +[build-system] +requires = ["setuptools>=61, <70", "numpy"] +build-backend = "setuptools.build_meta" + +[project] +name = "wrf-python" +authors = [ + { name = "Bill Ladwig" } +] +maintainers = [ + { name = "GeoCAT", email = "geocat@ucar.edu" }, +] +description = "Diagnostic and interpolation routines for WRF-ARW data." +readme = "README.md" +requires-python = ">=3.7, <3.12" +keywords = [ + "python", "wrf-python", "wrf", "forecast", "model", + "weather research and forecasting", "interpolation", + "plotting", "plots", "meteorology", "nwp", + "numerical weather prediction", "diagnostic", + "science", "numpy" +] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Science/Research", + "Intended Audience :: Developers", + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Fortran", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Topic :: Scientific/Engineering :: Atmospheric Science", + "Topic :: Software Development", + "Operating System :: POSIX", + "Operating System :: Unix", + "Operating System :: MacOS", + "Operating System :: Microsoft :: Windows" +] +license = { text = "Apache-2.0" } +dynamic = [ "version" ] +dependencies = [ + "basemap", + "numpy >=1.11, !=1.24.3", + "setuptools", + "wrapt", + "xarray" +] + +[project.urls] +Repository = "https://github.com/NCAR/wrf-python" +Documentation = "https://wrf-python.rtfd.org" + +[tool.setuptools] +package-data = { "wrf" = ["data/psadilookup.dat"]} +platforms = ["any"] + +[tool.setuptools.packages.find] +where = ["src"] + +[tool.setuptools.dynamic] +version = { attr = "wrf.version.__version__" } diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index e9cbcfa..0000000 --- a/requirements.txt +++ /dev/null @@ -1,5 +0,0 @@ -basemap -numpy >=1.11, !=1.24.3 -setuptools -wrapt -xarray diff --git a/setup.py b/setup.py index 0bbf359..eaa0f91 100755 --- a/setup.py +++ b/setup.py @@ -1,18 +1,7 @@ import os -import sys import setuptools import socket -# Bootstrap a numpy installation before trying to import it. -import importlib -try: - numpy_module = importlib.util.find_spec('numpy') - if numpy_module is None: - raise ModuleNotFoundError -except (ImportError, ModuleNotFoundError): - import subprocess - subprocess.call([sys.executable, '-m', 'pip', 'install', 'numpy']) - if not socket.gethostname().startswith("cheyenne"): import numpy.distutils.core else: @@ -53,70 +42,15 @@ "fortran/omp.f90"] ) -#Note: __version__ will be set in the version.py script loaded below -__version__ = None -with open("src/wrf/version.py") as f: - exec(f.read()) - on_rtd = os.environ.get("READTHEDOCS", None) == "True" # on_rtd=True if on_rtd: - if sys.version_info < (3, 3): - requirements = ["mock"] # for python2 and python < 3.3 - else: - requirements = [] # for >= python3.3 ext_modules = [] else: - # Place install_requires into the text file "requirements.txt" - with open("requirements.txt") as f2: - requirements = f2.read().strip().splitlines() - - # if sys.version_info < (3,3): - # requirements.append("mock") ext_modules = [ext1] numpy.distutils.core.setup( - name='wrf-python', - author="Bill Ladwig", - maintainer="GeoCAT", - maintainer_email="geocat@ucar.edu", - description="Diagnostic and interpolation routines for WRF-ARW data.", - long_description=("A collection of diagnostic and interpolation " - "routines to be used with WRF-ARW data.\n\n" - "GitHub Repository:\n\n" - "https://github.com/NCAR/wrf-python\n\n" - "Documentation:\n\n" - "https://wrf-python.rtfd.org\n"), - url="https://github.com/NCAR/wrf-python", - version=__version__, - package_dir={"": "src"}, - keywords=["python", "wrf-python", "wrf", "forecast", "model", - "weather research and forecasting", "interpolation", - "plotting", "plots", "meteorology", "nwp", - "numerical weather prediction", "diagnostic", - "science", "numpy"], - python_requires='>=3.9, <3.12', - install_requires=requirements, - classifiers=["Development Status :: 5 - Production/Stable", - "Intended Audience :: Science/Research", - "Intended Audience :: Developers", - "License :: OSI Approved :: Apache Software License", - "Programming Language :: Fortran", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Topic :: Scientific/Engineering :: Atmospheric Science", - "Topic :: Software Development", - "Operating System :: POSIX", - "Operating System :: Unix", - "Operating System :: MacOS", - "Operating System :: Microsoft :: Windows"], - platforms=["any"], - license="Apache License 2.0", - packages=setuptools.find_packages("src"), ext_modules=ext_modules, - download_url="https://python.org/pypi/wrf-python", - package_data={"wrf": ["data/psadilookup.dat"]}, scripts=[] ) From f044a390cb17d973a49162c5e1daa507794310b2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 7 Oct 2024 20:21:05 +0000 Subject: [PATCH 58/69] Bump pypa/gh-action-pypi-publish from 1.10.1 to 1.10.3 Bumps [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) from 1.10.1 to 1.10.3. - [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases) - [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/v1.10.1...v1.10.3) --- updated-dependencies: - dependency-name: pypa/gh-action-pypi-publish dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/pypi.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pypi.yaml b/.github/workflows/pypi.yaml index c4c7fad..000bb39 100644 --- a/.github/workflows/pypi.yaml +++ b/.github/workflows/pypi.yaml @@ -46,7 +46,7 @@ jobs: run: | python -m twine check dist/* - name: Publish package to PyPI - uses: pypa/gh-action-pypi-publish@v1.10.1 + uses: pypa/gh-action-pypi-publish@v1.10.3 with: user: __token__ password: ${{ secrets.PYPI_WRF_PYTHON }} From 97643e7d0b0c54087a029e338878020bdcb7aa39 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Wed, 23 Oct 2024 17:44:00 -0400 Subject: [PATCH 59/69] BLD: Update python_version to >=3.9 in pyproject.toml Don't specify Python version in CMakeLists.txt Co-authored-by: Katelyn FitzGerald <7872563+kafitzgerald@users.noreply.github.com> --- CMakeLists.txt | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 430587f..265c22c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,7 @@ if(PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR) ) endif() -find_package(Python 3.8 REQUIRED COMPONENTS Development.Module NumPy) +find_package(Python COMPONENTS Interpreter Development.Module NumPy REQUIRED) # Ensure scikit-build modules if (NOT SKBUILD) diff --git a/pyproject.toml b/pyproject.toml index 4e4e081..5047e19 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,7 +12,7 @@ maintainers = [ ] description = "Diagnostic and interpolation routines for WRF-ARW data." readme = "README.md" -requires-python = ">=3.7, <3.13" +requires-python = ">=3.9, <3.13" keywords = [ "python", "wrf-python", "wrf", "forecast", "model", "weather research and forecasting", "interpolation", From c981cf7ebec12abd320cc638930e21158b65dcd7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 20:33:00 +0000 Subject: [PATCH 60/69] Bump pypa/gh-action-pypi-publish from 1.10.3 to 1.11.0 Bumps [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) from 1.10.3 to 1.11.0. - [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases) - [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/v1.10.3...v1.11.0) --- updated-dependencies: - dependency-name: pypa/gh-action-pypi-publish dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/pypi.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pypi.yaml b/.github/workflows/pypi.yaml index 000bb39..ffb0d14 100644 --- a/.github/workflows/pypi.yaml +++ b/.github/workflows/pypi.yaml @@ -46,7 +46,7 @@ jobs: run: | python -m twine check dist/* - name: Publish package to PyPI - uses: pypa/gh-action-pypi-publish@v1.10.3 + uses: pypa/gh-action-pypi-publish@v1.11.0 with: user: __token__ password: ${{ secrets.PYPI_WRF_PYTHON }} From e55fcc5a4c3cb0138ccea17ea45c89a6ca964c8b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Nov 2024 20:47:28 +0000 Subject: [PATCH 61/69] Bump pypa/gh-action-pypi-publish from 1.11.0 to 1.12.2 Bumps [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) from 1.11.0 to 1.12.2. - [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases) - [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/v1.11.0...v1.12.2) --- updated-dependencies: - dependency-name: pypa/gh-action-pypi-publish dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/pypi.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pypi.yaml b/.github/workflows/pypi.yaml index ffb0d14..90ccbb7 100644 --- a/.github/workflows/pypi.yaml +++ b/.github/workflows/pypi.yaml @@ -46,7 +46,7 @@ jobs: run: | python -m twine check dist/* - name: Publish package to PyPI - uses: pypa/gh-action-pypi-publish@v1.11.0 + uses: pypa/gh-action-pypi-publish@v1.12.2 with: user: __token__ password: ${{ secrets.PYPI_WRF_PYTHON }} From 9e55f3ddb32a36090caddc29a252f8307711c6b7 Mon Sep 17 00:00:00 2001 From: Orhan Eroglu <32553057+erogluorhan@users.noreply.github.com> Date: Fri, 31 Jan 2025 12:30:57 -0700 Subject: [PATCH 62/69] Update CODE_OF_CONDUCT.md --- CODE_OF_CONDUCT.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index b132591..8a8a130 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -40,7 +40,6 @@ Examples of unacceptable behavior include, but are not limited to: beliefs * Publishing others' private information, such as a physical or electronic address, without explicit permission -* Refusing to use the pronouns that someone requests * Alarming, intimidating, threatening, or hostile comments or conduct * Physical or verbal abuse by anyone to anyone, including but not limited to a participant, member of the public, guest, member of any institution or From 6b1f0cd5fc830a50db20ede9a894fe442345972d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 12 Feb 2025 17:48:51 +0000 Subject: [PATCH 63/69] Bump pypa/gh-action-pypi-publish from 1.12.2 to 1.12.4 Bumps [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) from 1.12.2 to 1.12.4. - [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases) - [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/v1.12.2...v1.12.4) --- updated-dependencies: - dependency-name: pypa/gh-action-pypi-publish dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/pypi.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pypi.yaml b/.github/workflows/pypi.yaml index 90ccbb7..9919c74 100644 --- a/.github/workflows/pypi.yaml +++ b/.github/workflows/pypi.yaml @@ -46,7 +46,7 @@ jobs: run: | python -m twine check dist/* - name: Publish package to PyPI - uses: pypa/gh-action-pypi-publish@v1.12.2 + uses: pypa/gh-action-pypi-publish@v1.12.4 with: user: __token__ password: ${{ secrets.PYPI_WRF_PYTHON }} From 6fb884dbc85155b03e453726d6140772dca6397f Mon Sep 17 00:00:00 2001 From: Katelyn FitzGerald <7872563+kafitzgerald@users.noreply.github.com> Date: Fri, 14 Mar 2025 14:05:36 -0600 Subject: [PATCH 64/69] add package for analytics --- build_envs/environment.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/build_envs/environment.yml b/build_envs/environment.yml index f292805..4c646a3 100644 --- a/build_envs/environment.yml +++ b/build_envs/environment.yml @@ -15,6 +15,7 @@ dependencies: - setuptools - sphinx - sphinx_rtd_theme + - sphinxcontrib-googleanalytics - wrapt - xarray - python-build From 124a3a7277dbc98cbaab75ad60ed5856d63b0c27 Mon Sep 17 00:00:00 2001 From: Katelyn FitzGerald <7872563+kafitzgerald@users.noreply.github.com> Date: Fri, 14 Mar 2025 14:09:07 -0600 Subject: [PATCH 65/69] configure analytics --- doc/source/conf.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 26a6073..3c89989 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -75,9 +75,12 @@ def mock_asscalar(val): 'sphinx.ext.napoleon', 'sphinx.ext.autosummary', 'sphinx.ext.intersphinx', - 'sphinx.ext.mathjax' + 'sphinx.ext.mathjax', + 'sphinxcontrib.googleanalytics' ] +googleanalytics_id = 'G-6WSSSBGTH8' + #mathjax_path = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML" intersphinx_mapping = { From 162307b3a6274c5b2ba451a91a5abbc98e3f858c Mon Sep 17 00:00:00 2001 From: Katelyn FitzGerald <7872563+kafitzgerald@users.noreply.github.com> Date: Wed, 2 Apr 2025 16:26:03 -0600 Subject: [PATCH 66/69] Update CODE_OF_CONDUCT.md --- CODE_OF_CONDUCT.md | 180 ++++++++++----------------------------------- 1 file changed, 37 insertions(+), 143 deletions(-) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 8a8a130..8c166f8 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1,181 +1,75 @@ -# Contributor Code of Conduct - -## Related Code of Conduct - -Participant Code of Conduct -[https://www2.fin.ucar.edu/ethics/participant-code-conduct](https://www2.fin.ucar.edu/ethics/participant-code-conduct) +# Code of Conduct ## Our Pledge -We, as contributors and maintainers (participants), of WRF-Python pledge to -make participation in our software project and community a safe, productive, -welcoming and inclusive experience for everyone. All participants are required -to abide by this Code of Conduct. This includes respectful treatment of -everyone regardless of age, body size, disability, ethnicity, gender identity -or expression, level of experience, nationality, political affiliation, -veteran status, pregnancy, genetic information, physical appearance, race, -religion, or sexual orientation, as well as any other characteristic protected -under applicable US federal or state law. +We, as contributors, creators, stewards, and maintainers (collectively referred to as "contributors" below), of WRF-Python pledge to make participation in our software, system or hardware project and community a safe, productive, and welcoming experience for everyone. All contributors are required to abide by this Code of Conduct. This includes respectful treatment of everyone regardless of age, body size, disability, ethnicity, gender identity or expression, level of experience, nationality, political affiliation, veteran status, pregnancy, genetic information, physical appearance, race, religion, or sexual orientation, as well as any other characteristic protected under applicable US federal or state law. ## Our Standards Examples of behaviors that contribute to a positive environment include: -* Using welcoming and inclusive language -* Respectful when offering and gracefully accepting constructive criticism -* Acknowledging the contributions of others -* Focusing on what is best for the community -* Showing empathy towards other community members -* Treating everyone with respect and consideration, valuing a diversity of - views and opinions -* Communicating openly with respect for others, critiquing ideas rather than - individuals +- All contributors are treated with respect and consideration +- Be considerate, respectful, and collaborative +- Communicate openly with respect for others, critiquing ideas rather than individuals and gracefully accepting criticism +- Acknowledging the contributions of others +- Avoid personal attacks directed toward other contributors +- Be mindful of your surroundings and of your fellow contributors +- Alert UCAR staff and suppliers/vendors if you notice a dangerous situation or someone in distress +- Respect the rules and policies of the project and venue Examples of unacceptable behavior include, but are not limited to: -* Harassment, intimidation, or discrimination in any form -* Personal attacks directed toward other participants -* Unwelcome sexual attention or advances -* Inappropriate, negative, derogatory comments and/or attacks on personal - beliefs -* Publishing others' private information, such as a physical or electronic - address, without explicit permission -* Alarming, intimidating, threatening, or hostile comments or conduct -* Physical or verbal abuse by anyone to anyone, including but not limited to a - participant, member of the public, guest, member of any institution or - sponsor -* Comments related to characteristics given in the pledge at the top -* Inappropriate use of nudity and/or sexual images -* Threatening or stalking other participants -* Other conduct which could reasonably be considered inappropriate in a - professional setting +- Harassment, intimidation, or discrimination in any form +- Physical, verbal, or written abuse by anyone to anyone +- Unwelcome sexual attention or advances +- Personal attacks directed at other guests, members, contributors, etc. +- Publishing others’ private information, such as a physical or electronic address, without explicit permission +- Alarming, intimidating, threatening, or hostile comments or conduct +- Inappropriate use of nudity and/or sexual images +- Threatening or stalking anyone, including a contributor +- Other conduct which could reasonably be considered inappropriate in a professional setting ## Scope -This Code of Conduct applies to all spaces managed by the Project whether it -be online or face-to-face. This includes project code, code repository, -associated web pages, documentation, mailing lists, project websites and -wiki pages, issue tracker, meetings, telecons, events, project social media -accounts, and any other forums created by the project team which the community -uses for communication. In addition, violations of this Code of Conduct -outside these spaces may affect a person's ability to participate within them. -Representation of a project may be further defined and clarified by project -maintainers. +This Code of Conduct applies to all spaces managed by the Project whether they be physical, online or face-to-face. This includes project code, code repository, associated web pages, documentation, mailing lists, project websites and wiki pages, issue tracker, meetings, telecons, events, project social media accounts, and any other forums created by the project team which the community uses for communication. In addition, violations of this Code of Conduct outside these spaces may affect a person's ability to participate within them. Representation of a project may be further defined and clarified by project maintainers. ## Community Responsibilities -Everyone in the community is empowered to respond to people who are showing -unacceptable behavior. They can talk to them privately or publicly. Anyone -requested to stop unacceptable behavior is expected to comply immediately. -If the behavior continues concerns may be brought to the project -administrators or to any other party listed in the Reporting section below. +Everyone in the community is empowered to respond to people who are showing unacceptable behavior. They can talk to them privately or publicly. Anyone requested to stop unacceptable behavior is expected to comply immediately. If the behavior continues concerns may be brought to the project administrators or to any other party listed in the Reporting section below. ## Project Administrator Responsibilities -Project Administrators are responsible for clarifying the standards of -acceptable behavior and are encouraged to model appropriate behavior and -provide support when people in the community point out inappropriate behavior. -Project administrator(s) are normally the ones that would be tasked to carry -out the actions in the Consequences section below. +Project administrators are responsible for clarifying the standards of acceptable behavior and are encouraged to model appropriate behavior and provide support when people in the community point out inappropriate behavior. Project administrator(s) are normally the ones that would be tasked to carry out the actions in the Consequences section below. -Project Administrators are also expected to keep this Code of Conduct updated -with the main one housed at UCAR as listed below in the Attribution section. +Project administrators are also expected to keep this Code of Conduct updated with the main one housed at UCAR, as listed below in the Attribution section. ## Reporting -Instances of unacceptable behavior can be brought to the attention of the -project administrator(s) who may take any action as outlined in the -Consequences section below. However, making a report to a project -administrator is not considered an 'official report' to UCAR. +Instances of unacceptable behavior can be brought to the attention of the project administrator(s) who may take any reasonable and necessary action to address and stop the behavior. However, making a report to a project administrator is not considered an ‘official report’ to UCAR. + +Instances of unacceptable behavior may also be reported: +- To [The Chief Human Resources Officer](chro@ucar.edu) who serves as UCAR’s Section 504, Title VI, VII and IX Coordinator; +- Through [UCAR’s Reporting a Concern website](https://www.ucar.edu/who-we-are/ethics); or +- Anonymously through [UCAR’s EthicsPoint Hotline](https://www2.fin.ucar.edu/ethics/anonymous-reporting). -Instances of unacceptable behavior may also be reported directly to UCAR via -UCAR's Harassment Reporting and Complaint Procedure at [https://www2.fin.ucar.edu/procedures/hr/harassment-reporting-and-complaint-procedure](https://www2.fin.ucar.edu/procedures/hr/harassment-reporting-and-complaint-procedure), -or anonymously through UCAR's EthicsPoint Hotline at [https://www2.fin.ucar.edu/ethics/anonymous-reporting](https://www2.fin.ucar.edu/ethics/anonymous-reporting). +Complaints received by UCAR will be handled pursuant to the procedures outlined in [UCAR’s Complaint and Investigations Procedures](https://sundog.ucar.edu/Interact/Pages/Content/Document.aspx?id=5140). Complaints to UCAR will be held as confidential as practicable under the circumstances, and retaliation against a person who initiates a complaint or an inquiry about inappropriate behavior will not be tolerated. -Complaints received by UCAR will be handled pursuant to the procedures -outlined in UCAR's Harassment Reporting and Complaint Procedure. Complaints -to UCAR will be held as confidential as practicable under the circumstances, -and retaliation against a person who initiates a complaint or an inquiry about -inappropriate behavior will not be tolerated. +If you require a reasonable accommodation due to a disability or for assistance as an individual with Limited English Proficiency (LEP), please contact UCAR's [Chief Human Resources Officer](chro@ucar.edu). -Any Contributor can use these reporting methods even if they are not directly -affiliated with UCAR. The Frequently Asked Questions (FAQ) page for reporting -is here: [https://www2.fin.ucar.edu/procedures/hr/reporting-faqs](https://www2.fin.ucar.edu/procedures/hr/reporting-faqs). +Any Contributor can use these reporting methods even if they are not directly affiliated with UCAR. The Frequently Asked Questions (FAQ) page for reporting is [here](https://www2.fin.ucar.edu/procedures/hr/reporting-faqs). ## Consequences -Upon receipt of a complaint, the project administrator(s) may take any action -deemed necessary and appropriate under the circumstances. Such action can -include things such as: removing, editing, or rejecting comments, commits, -code, wiki edits, email, issues, and other contributions that are not aligned -to this Code of Conduct, or banning temporarily or permanently any contributor -for other behaviors that are deemed inappropriate, threatening, offensive, or -harmful. Project Administrators also have the right to report violations to -UCAR HR and/or UCAR's Office of Diversity, Equity and Inclusion (ODEI) as -well as a participant's home institution and/or law enforcement. In the event -an incident is reported to UCAR, UCAR will follow its Harassment Reporting -and Complaint Procedure. +Upon receipt of a complaint, the project administrator(s) may take any action deemed necessary and appropriate under the circumstances. Such action can include things such as: removing, editing, or rejecting comments, commits, code, wiki edits, email, issues, and other contributions that are not aligned to this Code of Conduct, or banning temporarily or permanently any contributor for other behaviors that are deemed inappropriate, threatening, offensive, or harmful. Project administrators also have the right to report violations to UCAR HR as well as to a contributor’s home institution and/or law enforcement. In the event an incident is reported to UCAR, UCAR will follow its Complaint and Investigations Procedure. ## Process for Changes -All UCAR managed projects are required to adopt this Contributor Code of -Conduct. Adoption is assumed even if not expressly stated in the repository. -Projects should fill in sections where prompted with project-specific -information, including, project name, email addresses, adoption date, etc. -There is one section below marked "optional" that may not apply to a given -project. +All UCAR managed projects are required to adopt this Contributor Code of Conduct. Adoption is assumed even if not expressly stated in the repository. Projects should fill in sections where prompted with project-specific information, including, project name and adoption date. -Projects that adopt this Code of Conduct need to stay up to date with -UCAR's Contributor Code of Conduct, linked with a DOI in the "Attribution" -section below. Projects can make limited substantive changes to the Code of -Conduct, however, the changes must be limited in scope and may not contradict -the UCAR Contributor Code of Conduct. +Projects that adopt this Code of Conduct need to stay up to date with UCAR's Contributor Code of Conduct, linked with a DOI in the Attribution section below. Projects can make limited substantive changes to the Code of Conduct, however, the changes must be limited in scope and may not contradict the UCAR Contributor Code of Conduct. ## Attribution -This Code of Conduct was originally adapted from the Contributor Covenant, -version 1.4, available at [Contributor-Covenant](http://contributor-covenant.org/version/1/4). -We then aligned it with the UCAR Participant Code of Conduct, which also -borrows from the American Geophysical Union (AGU) Code of Conduct. The UCAR -Participant Code of Conduct applies to both UCAR employees as well as -participants in activities run by UCAR. We modified the "scope" section with -the django project description, and we added "Publication Ethics" from -the NGEET/FATES project. The original version of this for all software -projects that have strong management from UCAR or UCAR staff is available -on the UCAR website at [*Enter DOI link name*] (the date that it was adopted -by this project was [*Enter date adopted*]). When responding to complaints -UCAR HR and ODEI will do so based on the latest published version. Therefore, -any project-specific changes should follow the Process for Changes section -above. - -## Publication Ethics (optional) - -We aim to create an open development environment where developers can be -confident that all members of the community are publishing any research -on the project in an ethical manner. In particular, writing code is a form of -intellectual contribution, and one should expect that all such intellectual -contributions are respected and given credit in any resulting published work. -To support the community and avoid issues of misconduct related to the above -principle, please respect the following rules: - -* Document the version of the code used in any publication, preferably by - either using a release tag (existing or newly created) if possible, or a - commit hash if not. - -* Do not use code from anywhere other than the central project's development - repository main development branch without discussing with the author(s) of - the modified code your intentions for using the code and receiving their - permission to do so. - -* When using project features that have recently been integrated into the - central Project development repository, be mindful of the contributions - of others and, where the novel features qualitatively affect the results, - involve the author(s) of these features in any resulting manuscripts. - Be particularly aware of the concerns of early career researchers, and - ensure they have sufficient time to lead publications using their - developments. - -* When discussing results arising from older project features that have been -described in the literature or releases, accurately cite the publications -describing those features or releases. +This Code of Conduct was originally adapted from the [Contributor Covenant](http://contributor-covenant.org/version/1/4), version 1.4. We then aligned it with the UCAR Participant Code of Conduct, which also borrows from the American Geophysical Union (AGU) Code of Conduct. The UCAR Participant Code of Conduct applies to both UCAR employees as well as participants in activities run by UCAR. The original version of this for all software projects that have strong management from UCAR or UCAR staff is available on the UCAR website at [https://doi.org/10.5065/6w2c-a132](https://doi.org/10.5065/6w2c-a132). The date that it was adopted by this project was April 2, 2025. When responding to complaints, UCAR HR will do so based on the latest published version. Therefore, any project-specific changes should follow the Process for Changes section above. +As an Equal Employment Opportunity Employer and recipient of federal funds, UCAR complies with Title VI, Title VII, and Title IX of the Civil Rights Act; the Rehabilitation Act of 1973, as amended, and the Age Discrimination in Employment Act of 1975, as amended. See [UCAR’s Nondiscrimination Statement](https://www.ucar.edu/who-we-are/ethics-integrity/codes-conduct/contributors#:~:text=As%20an%20Equal,Nondiscrimination%20Statement.). From ee3edc9f00a8f5bdb866eb6a04e8e947936d3ebd Mon Sep 17 00:00:00 2001 From: Katelyn FitzGerald <7872563+kafitzgerald@users.noreply.github.com> Date: Wed, 2 Apr 2025 17:07:23 -0600 Subject: [PATCH 67/69] Update CODE_OF_CONDUCT.md --- CODE_OF_CONDUCT.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 8c166f8..fb043f2 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -50,13 +50,13 @@ Instances of unacceptable behavior can be brought to the attention of the projec Instances of unacceptable behavior may also be reported: - To [The Chief Human Resources Officer](chro@ucar.edu) who serves as UCAR’s Section 504, Title VI, VII and IX Coordinator; - Through [UCAR’s Reporting a Concern website](https://www.ucar.edu/who-we-are/ethics); or -- Anonymously through [UCAR’s EthicsPoint Hotline](https://www2.fin.ucar.edu/ethics/anonymous-reporting). +- Anonymously through [UCAR’s EthicsPoint Hotline](https://www.ucar.edu/who-we-are/ethics). Complaints received by UCAR will be handled pursuant to the procedures outlined in [UCAR’s Complaint and Investigations Procedures](https://sundog.ucar.edu/Interact/Pages/Content/Document.aspx?id=5140). Complaints to UCAR will be held as confidential as practicable under the circumstances, and retaliation against a person who initiates a complaint or an inquiry about inappropriate behavior will not be tolerated. If you require a reasonable accommodation due to a disability or for assistance as an individual with Limited English Proficiency (LEP), please contact UCAR's [Chief Human Resources Officer](chro@ucar.edu). -Any Contributor can use these reporting methods even if they are not directly affiliated with UCAR. The Frequently Asked Questions (FAQ) page for reporting is [here](https://www2.fin.ucar.edu/procedures/hr/reporting-faqs). +Any Contributor can use these reporting methods even if they are not directly affiliated with UCAR. The Frequently Asked Questions (FAQ) page for reporting is [here](https://www.ucar.edu/who-we-are/ethics). ## Consequences @@ -72,4 +72,4 @@ Projects that adopt this Code of Conduct need to stay up to date with UCAR's Con This Code of Conduct was originally adapted from the [Contributor Covenant](http://contributor-covenant.org/version/1/4), version 1.4. We then aligned it with the UCAR Participant Code of Conduct, which also borrows from the American Geophysical Union (AGU) Code of Conduct. The UCAR Participant Code of Conduct applies to both UCAR employees as well as participants in activities run by UCAR. The original version of this for all software projects that have strong management from UCAR or UCAR staff is available on the UCAR website at [https://doi.org/10.5065/6w2c-a132](https://doi.org/10.5065/6w2c-a132). The date that it was adopted by this project was April 2, 2025. When responding to complaints, UCAR HR will do so based on the latest published version. Therefore, any project-specific changes should follow the Process for Changes section above. -As an Equal Employment Opportunity Employer and recipient of federal funds, UCAR complies with Title VI, Title VII, and Title IX of the Civil Rights Act; the Rehabilitation Act of 1973, as amended, and the Age Discrimination in Employment Act of 1975, as amended. See [UCAR’s Nondiscrimination Statement](https://www.ucar.edu/who-we-are/ethics-integrity/codes-conduct/contributors#:~:text=As%20an%20Equal,Nondiscrimination%20Statement.). +As an Equal Employment Opportunity Employer and recipient of federal funds, UCAR complies with Title VI, Title VII, and Title IX of the Civil Rights Act; the Rehabilitation Act of 1973, as amended, and the Age Discrimination in Employment Act of 1975, as amended. See [UCAR’s Nondiscrimination Statement](https://www.ucar.edu/who-we-are/ethics-integrity/nondiscrimination). From b439dce6953fec8ee97ef44bb6610edb2f011eef Mon Sep 17 00:00:00 2001 From: Katelyn FitzGerald <7872563+kafitzgerald@users.noreply.github.com> Date: Mon, 28 Apr 2025 12:46:20 -0600 Subject: [PATCH 68/69] GitHub Actions workflow updates (#267) * Update ci.yml * Update pypi.yaml --- .github/workflows/ci.yml | 35 +++++++++++------------------------ .github/workflows/pypi.yaml | 18 ++++++++---------- 2 files changed, 19 insertions(+), 34 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6d41fe7..aca255d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,54 +9,41 @@ on: schedule: - cron: '0 0 * * *' # Daily “At 00:00” +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: test: - name: Python (${{ matrix.python-version }}, ${{ matrix.os }}) + name: Python ${{ matrix.python-version }}, ${{ matrix.os }} runs-on: ${{ matrix.os }} defaults: run: shell: bash -l {0} - strategy: fail-fast: false matrix: os: [ "ubuntu-latest", "macos-latest", "macos-14" ] python-version: [ "3.9", "3.10", "3.11", "3.12" ] - steps: - - name: Cancel previous runs - uses: styfle/cancel-workflow-action@0.12.1 - with: - access_token: ${{ github.token }} - - name: Checkout + - name: checkout uses: actions/checkout@v4 + - name: environment setup + uses: conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3.1.1 with: - token: ${{ github.token }} - - name: Conda setup - uses: conda-incubator/setup-miniconda@v3 - if: matrix.os != 'macos-14' - with: - python-version: ${{ matrix.python-version }} - channels: conda-forge - environment-file: build_envs/environment.yml - - name: Conda setup (macOS M1) - uses: conda-incubator/setup-miniconda@v3 - if: matrix.os == 'macos-14' - with: - installer-url: https://github.com/conda-forge/miniforge/releases/download/23.11.0-0/Mambaforge-23.11.0-0-MacOSX-arm64.sh python-version: ${{ matrix.python-version }} channels: conda-forge environment-file: build_envs/environment.yml - - name: Build WRF-Python + - name: build WRF-Python run: | python -m pip install build python -m build . python -m pip install dist/wrf*.whl - - name: Run tests + - name: run tests run: | cd test/ci_tests python utests.py - - name: Check import + - name: check import if: failure() run: | python -m pip show wrf-python diff --git a/.github/workflows/pypi.yaml b/.github/workflows/pypi.yaml index 9919c74..b79509f 100644 --- a/.github/workflows/pypi.yaml +++ b/.github/workflows/pypi.yaml @@ -12,15 +12,14 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: '3.x' + python-version: '3.10' - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install setuptools setuptools-scm wheel twine check-manifest + python -m pip install build twine - name: Build tarball and wheels run: | - python setup.py sdist bdist_wheel - python -m pip wheel . -w dist --no-deps + python -m build - name: Test the artifacts run: | python -m twine check dist/* @@ -33,22 +32,21 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: '3.x' + python-version: '3.10' - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install setuptools setuptools-scm wheel twine check-manifest + python -m pip install build twine - name: Build tarball and wheels run: | - python setup.py sdist bdist_wheel - python -m pip wheel . -w dist --no-deps + python -m build - name: Test the artifacts run: | python -m twine check dist/* - name: Publish package to PyPI - uses: pypa/gh-action-pypi-publish@v1.12.4 + uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4 with: user: __token__ password: ${{ secrets.PYPI_WRF_PYTHON }} skip_existing: true - verbose: true \ No newline at end of file + verbose: true From d48203b4ca41eb61544c9e456fa1bff7607f721b Mon Sep 17 00:00:00 2001 From: Katelyn FitzGerald <7872563+kafitzgerald@users.noreply.github.com> Date: Thu, 15 May 2025 13:06:14 -0600 Subject: [PATCH 69/69] v1.4.0 - release notes and version update (#269) * update release notes * update version number --- doc/source/new.rst | 9 +++++++++ src/wrf/version.py | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/doc/source/new.rst b/doc/source/new.rst index 6e8719d..364af0b 100644 --- a/doc/source/new.rst +++ b/doc/source/new.rst @@ -4,6 +4,15 @@ What's New Releases ------------- +v1.4.0 (May 2025) +^^^^^^^^^^^^^^^^^^^^^^^^^ + +- Release 1.4.0 +- Transition to CMake build using scikit-build-core +- Packaging updates and adoption of pyproject.toml +- Support for Python 3.12 +- Support for macOS ARM architecture + v1.3.2 (February 2019) ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/wrf/version.py b/src/wrf/version.py index b7b278a..3e8d9f9 100644 --- a/src/wrf/version.py +++ b/src/wrf/version.py @@ -1 +1 @@ -__version__ = "1.3.4.1" +__version__ = "1.4.0"