From fa15fac24c84493cff1ad6676d10224d6a19d557 Mon Sep 17 00:00:00 2001 From: muchojp <61620767+muchojp@users.noreply.github.com> Date: Fri, 9 Oct 2020 09:20:36 +0900 Subject: [PATCH 1/8] Update constants.py Replace from numpy.asscalar to item() because numpy.asscalar causes FutureWarning. Deprecated since numpy version 1.16: Deprecated, use numpy.ndarray.item() instead. --- src/wrf/constants.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wrf/constants.py b/src/wrf/constants.py index 47821ef..1128855 100755 --- a/src/wrf/constants.py +++ b/src/wrf/constants.py @@ -16,7 +16,7 @@ class Constants(object): for key, val in viewitems(wrf_constants.__dict__): - setattr(Constants, key.upper(), np.asscalar(val)) + setattr(Constants, key.upper(), val.item()) OMP_SCHED_STATIC = omp_constants.fomp_sched_static OMP_SCHED_DYNAMIC = omp_constants.fomp_sched_dynamic From 9402254bb42da4dd89064328e5ce160d7262408e Mon Sep 17 00:00:00 2001 From: muchojp <61620767+muchojp@users.noreply.github.com> Date: Fri, 9 Oct 2020 09:26:00 +0900 Subject: [PATCH 2/8] Update decorators.py Because of the change in the structure of the "collections" module, I change a bit. --- src/wrf/decorators.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wrf/decorators.py b/src/wrf/decorators.py index 806fbf5..2ff4dec 100644 --- a/src/wrf/decorators.py +++ b/src/wrf/decorators.py @@ -1,6 +1,7 @@ from __future__ import (absolute_import, division, print_function) -from collections import Iterable, OrderedDict +from collections import OrderedDict +from collections.abc import Iterable import wrapt import numpy as np From c1aa5facaf6973cfa544b425cd21982500a68dfa Mon Sep 17 00:00:00 2001 From: muchojp <61620767+muchojp@users.noreply.github.com> Date: Fri, 9 Oct 2020 09:28:37 +0900 Subject: [PATCH 3/8] Update latlonutils.py To avoid FutureWarning, Function "Iterable" should import from collections.abc. --- src/wrf/latlonutils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wrf/latlonutils.py b/src/wrf/latlonutils.py index 22191af..0a66030 100644 --- a/src/wrf/latlonutils.py +++ b/src/wrf/latlonutils.py @@ -1,6 +1,6 @@ from __future__ import (absolute_import, division, print_function) -from collections import Iterable +from collections.abc import Iterable import numpy as np From c263d7cbc71389906e4ea9b9afc6e2db85080d46 Mon Sep 17 00:00:00 2001 From: muchojp <61620767+muchojp@users.noreply.github.com> Date: Fri, 9 Oct 2020 09:31:32 +0900 Subject: [PATCH 4/8] Update util.py To avoid FutureWarning, function "Iterable" and "Mapping" should be imported from collections.abc. --- src/wrf/util.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wrf/util.py b/src/wrf/util.py index d8f6567..40229c7 100644 --- a/src/wrf/util.py +++ b/src/wrf/util.py @@ -3,7 +3,8 @@ from __future__ import (absolute_import, division, print_function) import os from sys import version_info from copy import copy -from collections import Iterable, Mapping, OrderedDict +from collections import OrderedDict +from collections.abc import Iterable, Mapping from itertools import product, tee from types import GeneratorType import datetime as dt From c6f4737d75d6e28a3d1aaf620df11df5a88f5986 Mon Sep 17 00:00:00 2001 From: Orhan Eroglu <32553057+erogluorhan@users.noreply.github.com> Date: Thu, 15 Jul 2021 23:10:38 -0600 Subject: [PATCH 5/8] Restructuring repo (#150) * Restructured folders and env files and some docs in regards * Additional refactoring to file names * Github actions configured fully * Corrected ubuntu vs win64 bug in CI * Windows build fix * Trying to fix Windows build tests * Continue fixing windows build tests * ANother fixing attempt on windows build tests * Stil attempting to fix * Another attempt to fix * Little correction in config * Still trying to get windows build tests done * Maybe this time * try a different windows build bat * Another attempt * Trying vs2015 installation * again * Gave up windows build tests * Remove CircleCI config * Corrected env namein docs * Sorted env files alphabetically --- .circleci/conda_env.yml | 12 ---- .circleci/config.yml | 99 ------------------------------- .github/workflows/ci.yml | 56 +++++++++++++++++ osx.yml => build_envs/Darwin.yml | 21 +++---- linux.yml => build_envs/Linux.yml | 21 +++---- win64.yml => build_envs/Win64.yml | 20 ++++--- doc/source/contrib.rst | 8 +-- testenv2.yml | 22 ------- testenv3.yml | 22 ------- 9 files changed, 93 insertions(+), 188 deletions(-) delete mode 100644 .circleci/conda_env.yml delete mode 100644 .circleci/config.yml create mode 100644 .github/workflows/ci.yml rename osx.yml => build_envs/Darwin.yml (89%) rename linux.yml => build_envs/Linux.yml (89%) rename win64.yml => build_envs/Win64.yml (85%) delete mode 100644 testenv2.yml delete mode 100644 testenv3.yml diff --git a/.circleci/conda_env.yml b/.circleci/conda_env.yml deleted file mode 100644 index 4df7936..0000000 --- a/.circleci/conda_env.yml +++ /dev/null @@ -1,12 +0,0 @@ -name: wrf-python -channels: - - conda-forge -dependencies: - - gcc_linux-64 - - gfortran_linux-64 - - setuptools - - python - - numpy - - wrapt - - xarray - - netcdf4 diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 469988b..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,99 +0,0 @@ -# Python CircleCI 2.0 configuration file -# -# Check https://circleci.com/docs/2.0/language-python/ for more details -# -version: 2 -jobs: - lint: - docker: - - image: circleci/python:3.6.1 - - working_directory: ~/repo - - steps: - - checkout - - run: - name: install pycodestyle - command: | - sudo pip install pycodestyle - - run: - name: run pycodestyle - command: | - pycodestyle src test - - build: - docker: - # specify the version you desire here - # use `-browsers` prefix for selenium tests, e.g. `3.6.1-browsers` - - image: circleci/python:3.6.1 - - # Specify service dependencies here if necessary - # CircleCI maintains a library of pre-built images - # documented at https://circleci.com/docs/2.0/circleci-images/ - # - image: circleci/postgres:9.4 - - working_directory: ~/repo - - steps: - - checkout - - # Download and cache dependencies - - restore_cache: - keys: - - v1-dependencies-{{ checksum ".circleci/conda_env.yml" }} - - - run: - name: install conda and dependencies - command: | - test -d ~/miniconda3 && exit 0 - echo "Installing a fresh version of Miniconda." - MINICONDA_URL="https://repo.continuum.io/miniconda" - MINICONDA_FILE="Miniconda3-latest-Linux-x86_64.sh" - curl -L -O "${MINICONDA_URL}/${MINICONDA_FILE}" - bash $MINICONDA_FILE -b - source ~/miniconda3/bin/activate root - conda env create -f .circleci/conda_env.yml - - - save_cache: - paths: - - ~/miniconda3 - key: v1-dependencies-{{ checksum ".circleci/conda_env.yml" }} - - - run: - name: build wrf-python - command: | - source ~/miniconda3/bin/activate wrf-python - unset FFLAGS - unset LDFLAGS - unset CFLAGS - cd fortran/build_help - $FC -o sizes -fopenmp omp_sizes.f90 - LD_LIBRARY_PATH=~/miniconda3/envs/wrf-python/lib python sub_sizes.py - cd .. - $FC -E ompgen.F90 -fopenmp -cpp -o omp.f90 - cd .. - 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 - - - # run tests! - # this example uses Django's built-in test-runner - # other common Python testing frameworks include pytest and nose - # https://pytest.org - # https://nose.readthedocs.io - - run: - name: run tests - command: | - source ~/miniconda3/bin/activate wrf-python - cd test/ci_tests - python utests.py - - - store_artifacts: - path: test-reports - destination: test-reports -workflows: - version: 2 - build_and_lint: - jobs: - - build - - lint diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..8f51670 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,56 @@ +name: CI +on: + push: + pull_request: + workflow_dispatch: + # 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: + run: + shell: bash -l {0} + + strategy: + fail-fast: false + matrix: + os: [ "ubuntu-latest", "macos-latest"] + python-version: [ "3.6", "3.7", "3.8", "3.9" ] + + steps: + - name: Cancel previous runs + uses: styfle/cancel-workflow-action@0.9.0 + with: + access_token: ${{ github.token }} + - name: Checkout + uses: actions/checkout@v2 + with: + token: ${{ github.token }} + - name: Conda setup + uses: conda-incubator/setup-miniconda@v2 + 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 + - name: Build WRF-Python + run: | + cd build_scripts + ./gnu_omp.sh + cd .. + - name: Run tests + run: | + cd test/ci_tests + python utests.py diff --git a/osx.yml b/build_envs/Darwin.yml similarity index 89% rename from osx.yml rename to build_envs/Darwin.yml index a9190d0..044292e 100644 --- a/osx.yml +++ b/build_envs/Darwin.yml @@ -1,20 +1,21 @@ # Create full conda environment for development, including some useful tools -name: develop +name: wrf_python_build channels: - conda-forge dependencies: - python=3 - - wrapt - - numpy + - basemap + - cartopy + - clang_osx-64 + - gfortran_osx-64 + - jupyter - matplotlib - netcdf4 - - xarray - - jupyter + - numpy + - pycodestyle + - setuptools - sphinx - sphinx_rtd_theme - - pycodestyle - - cartopy - - basemap - - clang_osx-64 - - gfortran_osx-64 + - wrapt + - xarray diff --git a/linux.yml b/build_envs/Linux.yml similarity index 89% rename from linux.yml rename to build_envs/Linux.yml index 85df06d..60af2aa 100644 --- a/linux.yml +++ b/build_envs/Linux.yml @@ -1,20 +1,21 @@ # Create full conda environment for development, including some useful tools -name: develop +name: wrf_python_build channels: - conda-forge dependencies: - python=3 - - wrapt - - numpy + - basemap + - cartopy + - gcc_linux-64 + - gfortran_linux-64 + - jupyter - matplotlib - netcdf4 - - xarray - - jupyter + - numpy + - pycodestyle + - setuptools - sphinx - sphinx_rtd_theme - - pycodestyle - - cartopy - - basemap - - gcc_linux-64 - - gfortran_linux-64 + - wrapt + - xarray diff --git a/win64.yml b/build_envs/Win64.yml similarity index 85% rename from win64.yml rename to build_envs/Win64.yml index 7c68e41..e9bb70a 100644 --- a/win64.yml +++ b/build_envs/Win64.yml @@ -1,19 +1,21 @@ # Create full conda environment for development, including some useful tools -name: develop +name: wrf_python_build channels: - conda-forge + - msys2 dependencies: - python=3 - - wrapt - - numpy + - basemap + - cartopy + - jupyter + - m2w64-toolchain - matplotlib - netcdf4 - - xarray - - jupyter + - numpy + - pycodestyle + - setuptools - sphinx - sphinx_rtd_theme - - pycodestyle - - cartopy - - basemap - - m2w64-toolchain + - wrapt + - xarray diff --git a/doc/source/contrib.rst b/doc/source/contrib.rst index e1f1d44..3b2e0ed 100644 --- a/doc/source/contrib.rst +++ b/doc/source/contrib.rst @@ -301,19 +301,19 @@ contributing is: .. code:: - conda env create -f osx.yml + conda env create -f build_envs/Darwin.yml Linux: .. code:: - conda env create -f linux.yml + conda env create -f build_envs/Linux.yml Win64: .. code:: - conda env create -f win64.yml + conda env create -f build_envs/Win64.yml Note: For Win64, you will also need VS2015 installed on your system. @@ -321,7 +321,7 @@ contributing is: .. code:: - conda activate develop + conda activate wrf_python_build - CD to the build_scripts directory. diff --git a/testenv2.yml b/testenv2.yml deleted file mode 100644 index a3ef85c..0000000 --- a/testenv2.yml +++ /dev/null @@ -1,22 +0,0 @@ -# Create full conda environment for development, including some useful tools -name: testenv2 -channels: - - conda-forge -dependencies: - - python=2 - - wrapt - - numpy - - matplotlib - - netcdf4 - - xarray - - jupyter - - sphinx - - sphinx_rtd_theme - - pycodestyle - - cartopy - - basemap - - clang_osx-64 - - gfortran_osx-64 - - pynio - - ncl - \ No newline at end of file diff --git a/testenv3.yml b/testenv3.yml deleted file mode 100644 index 356bd53..0000000 --- a/testenv3.yml +++ /dev/null @@ -1,22 +0,0 @@ -# Create full conda environment for development, including some useful tools -name: testenv3 -channels: - - conda-forge -dependencies: - - python=3 - - wrapt - - numpy - - matplotlib - - netcdf4 - - xarray - - jupyter - - sphinx - - sphinx_rtd_theme - - pycodestyle - - cartopy - - basemap - - clang_osx-64 - - gfortran_osx-64 - - pynio - - ncl - \ No newline at end of file From 31882eefb45dfb8e063de2ccda76ae3067d0fe0f Mon Sep 17 00:00:00 2001 From: erogluorhan Date: Thu, 15 Jul 2021 23:38:17 -0600 Subject: [PATCH 6/8] Modified meta.yml and removed unnecessary meta.yaml files --- conda_recipe/meta.yaml | 9 ++++-- conda_recipe/meta.yaml.develop | 56 -------------------------------- conda_recipe/meta.yaml.release | 58 ---------------------------------- 3 files changed, 7 insertions(+), 116 deletions(-) delete mode 100644 conda_recipe/meta.yaml.develop delete mode 100644 conda_recipe/meta.yaml.release diff --git a/conda_recipe/meta.yaml b/conda_recipe/meta.yaml index 495ed7e..060b824 100644 --- a/conda_recipe/meta.yaml +++ b/conda_recipe/meta.yaml @@ -1,12 +1,17 @@ -{% set version = "1.3.2.5" %} +{% set version = "1.3.2.6" %} package: name: wrf-python version: {{ version }} source: +# for develop git_url: https://github.com/NCAR/wrf-python - git_branch: develop + 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 diff --git a/conda_recipe/meta.yaml.develop b/conda_recipe/meta.yaml.develop deleted file mode 100644 index 6c19b2a..0000000 --- a/conda_recipe/meta.yaml.develop +++ /dev/null @@ -1,56 +0,0 @@ -{% set version = "1.3.2.5" %} - -package: - name: wrf-python - version: {{ version }} - -source: - git_url: https://github.com/NCAR/wrf-python - git_branch: develop - -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 \ No newline at end of file diff --git a/conda_recipe/meta.yaml.release b/conda_recipe/meta.yaml.release deleted file mode 100644 index f7a957c..0000000 --- a/conda_recipe/meta.yaml.release +++ /dev/null @@ -1,58 +0,0 @@ -{% set version = "1.3.2.5" %} - -package: - name: wrf-python - version: {{ version }} - -source: - 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 - \ No newline at end of file From 37307a164cb0b5daaf22354e6c33b05e458bf2a7 Mon Sep 17 00:00:00 2001 From: erogluorhan Date: Thu, 15 Jul 2021 23:49:23 -0600 Subject: [PATCH 7/8] Corrected constants numpy item --- src/wrf/constants.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wrf/constants.py b/src/wrf/constants.py index 1128855..518e88d 100755 --- a/src/wrf/constants.py +++ b/src/wrf/constants.py @@ -16,7 +16,7 @@ class Constants(object): for key, val in viewitems(wrf_constants.__dict__): - setattr(Constants, key.upper(), val.item()) + setattr(Constants, key.upper(), val) OMP_SCHED_STATIC = omp_constants.fomp_sched_static OMP_SCHED_DYNAMIC = omp_constants.fomp_sched_dynamic From 10f76e72c6f460c4ddf2d677f93802be0b9ccece Mon Sep 17 00:00:00 2001 From: erogluorhan Date: Fri, 16 Jul 2021 00:00:07 -0600 Subject: [PATCH 8/8] Numpy item use --- src/wrf/constants.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wrf/constants.py b/src/wrf/constants.py index 518e88d..d660c62 100755 --- a/src/wrf/constants.py +++ b/src/wrf/constants.py @@ -16,7 +16,7 @@ class Constants(object): for key, val in viewitems(wrf_constants.__dict__): - setattr(Constants, key.upper(), val) + setattr(Constants, key.upper(), np.array(val).item()) OMP_SCHED_STATIC = omp_constants.fomp_sched_static OMP_SCHED_DYNAMIC = omp_constants.fomp_sched_dynamic