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=[] )