From 5dd8414efa753cbe3a937201feb339557d1cd443 Mon Sep 17 00:00:00 2001 From: Michaela Sizemore Date: Mon, 28 Feb 2022 11:51:51 -0700 Subject: [PATCH 01/98] Update Mercator projection attributes --- src/wrf/projection.py | 7 ++----- test/test_mercator.py | 0 2 files changed, 2 insertions(+), 5 deletions(-) create mode 100644 test/test_mercator.py diff --git a/src/wrf/projection.py b/src/wrf/projection.py index b2aca20..e169341 100644 --- a/src/wrf/projection.py +++ b/src/wrf/projection.py @@ -76,12 +76,9 @@ def __init__(self, central_longitude=0.0, else: xlimits[0] = -xlimits[0] - self._xlimits = tuple(xlimits) - self._ylimits = tuple(limits[..., 1]) - # Compatibility with cartopy >= 0.17 - self._x_limits = self._xlimits - self._y_limits = self._ylimits + self._x_limits = tuple(xlimits) + self._y_limits = tuple(limits[..., 1]) self._threshold = np.diff(self.x_limits)[0] / 720 diff --git a/test/test_mercator.py b/test/test_mercator.py new file mode 100644 index 0000000..e69de29 From 586ab30b4361688d403b55c8190de6191253c05a Mon Sep 17 00:00:00 2001 From: Michaela Sizemore Date: Thu, 3 Mar 2022 11:58:34 -0700 Subject: [PATCH 02/98] remove empty test_mercator file --- test/test_mercator.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 test/test_mercator.py diff --git a/test/test_mercator.py b/test/test_mercator.py deleted file mode 100644 index e69de29..0000000 From d19e212da22f08d086b085bec06e9d83fcd18c43 Mon Sep 17 00:00:00 2001 From: Michaela Sizemore <43652875+michaelavs@users.noreply.github.com> Date: Wed, 9 Mar 2022 12:15:40 -0700 Subject: [PATCH 03/98] Update Mercator projection attributes (#163) * Update Mercator projection attributes * remove empty test_mercator file --- src/wrf/projection.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/wrf/projection.py b/src/wrf/projection.py index b2aca20..e169341 100644 --- a/src/wrf/projection.py +++ b/src/wrf/projection.py @@ -76,12 +76,9 @@ def __init__(self, central_longitude=0.0, else: xlimits[0] = -xlimits[0] - self._xlimits = tuple(xlimits) - self._ylimits = tuple(limits[..., 1]) - # Compatibility with cartopy >= 0.17 - self._x_limits = self._xlimits - self._y_limits = self._ylimits + self._x_limits = tuple(xlimits) + self._y_limits = tuple(limits[..., 1]) self._threshold = np.diff(self.x_limits)[0] / 720 From b1ca4f40c718c5919e504ae0da357c37a6e3ddaf Mon Sep 17 00:00:00 2001 From: Michaela Sizemore <43652875+michaelavs@users.noreply.github.com> Date: Thu, 10 Mar 2022 11:12:44 -0700 Subject: [PATCH 04/98] CI issues (#164) * CI issues * Add build env path for Linux.yml * other updates to ci file * format more closely to uxarray/comp * Undo some changes, add python version * Revert to previous version for 'Run tests' --- .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 8f51670..dc83483 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,11 +20,11 @@ jobs: fail-fast: false matrix: os: [ "ubuntu-latest", "macos-latest"] - python-version: [ "3.6", "3.7", "3.8", "3.9" ] + python-version: [ "3.7", "3.8", "3.9", "3.10" ] steps: - name: Cancel previous runs - uses: styfle/cancel-workflow-action@0.9.0 + uses: styfle/cancel-workflow-action@0.9.1 with: access_token: ${{ github.token }} - name: Checkout From 222681e8431f0d1a2b23cfc246ba63bce59b4c66 Mon Sep 17 00:00:00 2001 From: michaelavs Date: Fri, 11 Mar 2022 11:50:34 -0700 Subject: [PATCH 05/98] Update version in conda recipe --- conda_recipe/meta.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conda_recipe/meta.yaml b/conda_recipe/meta.yaml index 060b824..6ed2455 100644 --- a/conda_recipe/meta.yaml +++ b/conda_recipe/meta.yaml @@ -1,4 +1,4 @@ -{% set version = "1.3.2.6" %} +{% set version = "1.3.3" %} package: name: wrf-python From 086328fa7bc37121e6c4d10add99f560ea80e394 Mon Sep 17 00:00:00 2001 From: Michaela Sizemore <43652875+michaelavs@users.noreply.github.com> Date: Wed, 16 Mar 2022 12:04:56 -0600 Subject: [PATCH 06/98] Merge Develop Into Main (#165) * proj4 formatting update (#146) * units=hPa is used in /def get_slp():/ * Update Mercator projection attributes (#163) * Update Mercator projection attributes * remove empty test_mercator file * CI issues (#164) * CI issues * Add build env path for Linux.yml * other updates to ci file * format more closely to uxarray/comp * Undo some changes, add python version * Revert to previous version for 'Run tests' * Update version in conda recipe Co-authored-by: Piotr Kasprzyk --- .github/workflows/ci.yml | 4 ++-- conda_recipe/meta.yaml | 2 +- src/wrf/g_slp.py | 2 +- src/wrf/projection.py | 9 +++------ 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8f51670..dc83483 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,11 +20,11 @@ jobs: fail-fast: false matrix: os: [ "ubuntu-latest", "macos-latest"] - python-version: [ "3.6", "3.7", "3.8", "3.9" ] + python-version: [ "3.7", "3.8", "3.9", "3.10" ] steps: - name: Cancel previous runs - uses: styfle/cancel-workflow-action@0.9.0 + uses: styfle/cancel-workflow-action@0.9.1 with: access_token: ${{ github.token }} - name: Checkout diff --git a/conda_recipe/meta.yaml b/conda_recipe/meta.yaml index 060b824..6ed2455 100644 --- a/conda_recipe/meta.yaml +++ b/conda_recipe/meta.yaml @@ -1,4 +1,4 @@ -{% set version = "1.3.2.6" %} +{% set version = "1.3.3" %} package: name: wrf-python diff --git a/src/wrf/g_slp.py b/src/wrf/g_slp.py index f422bed..695b62d 100755 --- a/src/wrf/g_slp.py +++ b/src/wrf/g_slp.py @@ -63,7 +63,7 @@ def get_slp(wrfin, timeidx=0, method="cat", squeeze=True, units (:obj:`str`): The desired units. Refer to the :meth:`getvar` product table for a list of available units for 'slp'. Default - is 'Pa'. + is 'hPa'. Returns: diff --git a/src/wrf/projection.py b/src/wrf/projection.py index 670e67a..e169341 100644 --- a/src/wrf/projection.py +++ b/src/wrf/projection.py @@ -76,12 +76,9 @@ def __init__(self, central_longitude=0.0, else: xlimits[0] = -xlimits[0] - self._xlimits = tuple(xlimits) - self._ylimits = tuple(limits[..., 1]) - # Compatibility with cartopy >= 0.17 - self._x_limits = self._xlimits - self._y_limits = self._ylimits + self._x_limits = tuple(xlimits) + self._y_limits = tuple(limits[..., 1]) self._threshold = np.diff(self.x_limits)[0] / 720 @@ -824,7 +821,7 @@ def _cartopy(self): def _proj4(self): _proj4 = ("+proj=stere +units=m +a={} +b={} " - "+lat0={} +lon_0={} +lat_ts={} +nadgrids=@null".format( + "+lat_0={} +lon_0={} +lat_ts={} +nadgrids=@null".format( Constants.WRF_EARTH_RADIUS, Constants.WRF_EARTH_RADIUS, self._hemi, From 1035812d8e8f38258b96c573cf68c8d494c4ca0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Samm=C3=BCller?= Date: Wed, 6 Apr 2022 11:32:02 +0200 Subject: [PATCH 07/98] Fix handling of config for third party packages --- src/wrf/config.py | 71 ++++++++++++++++++++++++++++------------------- 1 file changed, 42 insertions(+), 29 deletions(-) diff --git a/src/wrf/config.py b/src/wrf/config.py index fa20201..e133304 100644 --- a/src/wrf/config.py +++ b/src/wrf/config.py @@ -10,37 +10,54 @@ _local_config = local() -def _init_local(): +def _try_enable_xarray(): global _local_config - _local_config.xarray_enabled = True - _local_config.cartopy_enabled = True - _local_config.basemap_enabled = True - _local_config.pyngl_enabled = True - _local_config.cache_size = 20 - _local_config.initialized = True - try: from xarray import DataArray except ImportError: _local_config.xarray_enabled = False + +def _try_enable_cartopy(): + global _local_config + _local_config.cartopy_enabled = True try: from cartopy import crs except ImportError: _local_config.cartopy_enabled = False + +def _try_enable_basemap(): + global _local_config + _local_config.basemap_enabled = True try: from mpl_toolkits.basemap import Basemap except ImportError: _local_config.basemap_enabled = False + +def _try_enable_pyngl(): + global _local_config + _local_config.pyngl_enabled = True try: from Ngl import Resources except ImportError: _local_config.pyngl_enabled = False +def _init_local(): + global _local_config + + _try_enable_xarray() + _try_enable_cartopy() + _try_enable_basemap() + _try_enable_pyngl() + + _local_config.cache_size = 20 + _local_config.initialized = True + + # Initialize the main thread's configuration _init_local() @@ -51,11 +68,11 @@ def init_local(): def func_wrapper(wrapped, instance, args, kwargs): global _local_config try: - init = _local_config.init + initialized = _local_config.initialized except AttributeError: _init_local() else: - if not init: + if not initialized: _init_local() return wrapped(*args, **kwargs) @@ -77,17 +94,16 @@ def xarray_enabled(): @init_local() -def disable_xarray(): - """Disable xarray.""" - global _local_config - _local_config.xarray_enabled = False +def enable_xarray(): + """Enable xarray if it is installed.""" + _try_enable_xarray() @init_local() -def enable_xarray(): - """Enable xarray.""" +def disable_xarray(): + """Disable xarray.""" global _local_config - _local_config.xarray_enabled = True + _local_config.xarray_enabled = False @init_local() @@ -105,16 +121,15 @@ def cartopy_enabled(): @init_local() def enable_cartopy(): - """Enable cartopy.""" - global _local_config - _local_config.cartopy_enabled = True + """Enable cartopy if it is installed.""" + _try_enable_cartopy() @init_local() def disable_cartopy(): """Disable cartopy.""" global _local_config - _local_config.cartopy_enabled = True + _local_config.cartopy_enabled = False @init_local() @@ -132,16 +147,15 @@ def basemap_enabled(): @init_local() def enable_basemap(): - """Enable basemap.""" - global _local_config - _local_config.basemap_enabled = True + """Enable basemap if it is installed.""" + _try_enable_basemap() @init_local() def disable_basemap(): """Disable basemap.""" global _local_config - _local_config.basemap_enabled = True + _local_config.basemap_enabled = False @init_local() @@ -159,16 +173,15 @@ def pyngl_enabled(): @init_local() def enable_pyngl(): - """Enable pyngl.""" - global _local_config - _local_config.pyngl_enabled = True + """Enable pyngl if it is installed.""" + _try_enable_pyngl() @init_local() def disable_pyngl(): """Disable pyngl.""" global _local_config - _local_config.pyngl_enabled = True + _local_config.pyngl_enabled = False @init_local() From f06bf9dfa12d6c7f320de7f5b07754e3c5187839 Mon Sep 17 00:00:00 2001 From: michaelavs Date: Fri, 29 Apr 2022 11:20:50 -0600 Subject: [PATCH 08/98] Fix Mercator projection issue --- src/wrf/projection.py | 123 ++++++++++++++++++++++-------------------- 1 file changed, 65 insertions(+), 58 deletions(-) diff --git a/src/wrf/projection.py b/src/wrf/projection.py index e169341..7cf0609 100644 --- a/src/wrf/projection.py +++ b/src/wrf/projection.py @@ -18,69 +18,76 @@ from Ngl import Resources -if cartopy_enabled(): - class MercatorWithLatTS(crs.Mercator): - """A :class:`cartopy.crs.Mercator` subclass that adds support for - a latitude of true scale parameter. - - See Also: - - :class:`cartopy.crs.Mercator` - - """ - def __init__(self, central_longitude=0.0, - latitude_true_scale=0.0, - min_latitude=-80.0, - max_latitude=84.0, - globe=None): - """Initialize a :class:`wrf.MercatorWithLatTS` object. - - Args: - - central_longitude (:obj:`float`, optional): The central - longitude. Default is 0.0. - latitude_true_scale (:obj:`float`, optional): The latitude - of true scale. Default is 0.0. - - min_latitude (:obj:`float`, optional): The maximum southerly - extent of the projection. Default is -80.0. +if cartopy_enabled(): + if cartopy_enabled(): + class MercatorWithLatTS(crs.Mercator): + """A :class:`cartopy.crs.Mercator` subclass that adds support for + a latitude of true scale parameter. - max_latitude (:obj:`float`, optional): The maximum northerly - extent of the projection. Default is 84.0. + See Also: - globe (:class:`cartopy.crs.Globe`, optional): A globe object. - If omitted, a default globe is created. + :class:`cartopy.crs.Mercator` """ - proj4_params = [("proj", "merc"), - ("lon_0", central_longitude), - ("lat_ts", latitude_true_scale), - ("k", 1), - ("units", "m")] - super(crs.Mercator, self).__init__(proj4_params, globe=globe) - - # Calculate limits. - limits = self.transform_points( - crs.Geodetic(), - np.array([-180, 180]) + central_longitude, - np.array([min_latitude, max_latitude])) - - # When using a latitude of true scale, the min/max x-limits get set - # to the same value, so make sure the left one is negative - xlimits = limits[..., 0] - - if math.fabs(xlimits[0] - xlimits[1]) < 1e-6: - if xlimits[0] < 0: - xlimits[1] = -xlimits[1] - else: - xlimits[0] = -xlimits[0] - - # Compatibility with cartopy >= 0.17 - self._x_limits = tuple(xlimits) - self._y_limits = tuple(limits[..., 1]) - - self._threshold = np.diff(self.x_limits)[0] / 720 + def __init__(self, central_longitude=0.0, + latitude_true_scale=0.0, + min_latitude=-80.0, + max_latitude=84.0, + globe=None): + """Initialize a :class:`wrf.MercatorWithLatTS` object. + + Args: + + central_longitude (:obj:`float`, optional): The central + longitude. Default is 0.0. + + latitude_true_scale (:obj:`float`, optional): The latitude + of true scale. Default is 0.0. + + min_latitude (:obj:`float`, optional): The maximum southerly + extent of the projection. Default is -80.0. + + max_latitude (:obj:`float`, optional): The maximum northerly + extent of the projection. Default is 84.0. + + globe (:class:`cartopy.crs.Globe`, optional): A globe object. + If omitted, a default globe is created. + + """ + proj4_params = [("proj", "merc"), + ("lon_0", central_longitude), + ("lat_ts", latitude_true_scale), + ("k", 1), + ("units", "m")] + super(crs.Mercator, self).__init__(proj4_params, globe=globe) + + # Need to have x/y limits defined for the initial hash which + # gets used within transform_points for caching + self._x_limits = self._y_limits = None + + # Calculate limits. + limits = self.transform_points( + crs.Geodetic(), + np.array([-180, 180]) + central_longitude, + np.array([min_latitude, max_latitude])) + + # When using a latitude of true scale, the min/max x-limits get set + # to the same value, so make sure the left one is negative + xlimits = limits[..., 0] + + if math.fabs(xlimits[0] - xlimits[1]) < 1e-6: + if xlimits[0] < 0: + xlimits[1] = -xlimits[1] + else: + xlimits[0] = -xlimits[0] + + # Compatibility with cartopy >= 0.17 + self._x_limits = tuple(xlimits) + self._y_limits = tuple(limits[..., 1]) + + self._threshold = min(np.diff(self.x_limits)[0] / 720, + np.diff(self.y_limits)[0] / 360) def _ismissing(val, islat=True): From 43c40f0579367c5a9ac6ffc9a4d88807ee24e2a8 Mon Sep 17 00:00:00 2001 From: michaelavs Date: Fri, 29 Apr 2022 11:28:50 -0600 Subject: [PATCH 09/98] Fix accidental extra indent and repeated 'if cartopy' --- src/wrf/projection.py | 127 +++++++++++++++++++++--------------------- 1 file changed, 63 insertions(+), 64 deletions(-) diff --git a/src/wrf/projection.py b/src/wrf/projection.py index 7cf0609..f4d55cd 100644 --- a/src/wrf/projection.py +++ b/src/wrf/projection.py @@ -20,74 +20,73 @@ if cartopy_enabled(): - if cartopy_enabled(): - class MercatorWithLatTS(crs.Mercator): - """A :class:`cartopy.crs.Mercator` subclass that adds support for - a latitude of true scale parameter. + class MercatorWithLatTS(crs.Mercator): + """A :class:`cartopy.crs.Mercator` subclass that adds support for + a latitude of true scale parameter. - See Also: + See Also: + + :class:`cartopy.crs.Mercator` + + """ + def __init__(self, central_longitude=0.0, + latitude_true_scale=0.0, + min_latitude=-80.0, + max_latitude=84.0, + globe=None): + """Initialize a :class:`wrf.MercatorWithLatTS` object. + + Args: + + central_longitude (:obj:`float`, optional): The central + longitude. Default is 0.0. + + latitude_true_scale (:obj:`float`, optional): The latitude + of true scale. Default is 0.0. + + min_latitude (:obj:`float`, optional): The maximum southerly + extent of the projection. Default is -80.0. + + max_latitude (:obj:`float`, optional): The maximum northerly + extent of the projection. Default is 84.0. - :class:`cartopy.crs.Mercator` + globe (:class:`cartopy.crs.Globe`, optional): A globe object. + If omitted, a default globe is created. """ - def __init__(self, central_longitude=0.0, - latitude_true_scale=0.0, - min_latitude=-80.0, - max_latitude=84.0, - globe=None): - """Initialize a :class:`wrf.MercatorWithLatTS` object. - - Args: - - central_longitude (:obj:`float`, optional): The central - longitude. Default is 0.0. - - latitude_true_scale (:obj:`float`, optional): The latitude - of true scale. Default is 0.0. - - min_latitude (:obj:`float`, optional): The maximum southerly - extent of the projection. Default is -80.0. - - max_latitude (:obj:`float`, optional): The maximum northerly - extent of the projection. Default is 84.0. - - globe (:class:`cartopy.crs.Globe`, optional): A globe object. - If omitted, a default globe is created. - - """ - proj4_params = [("proj", "merc"), - ("lon_0", central_longitude), - ("lat_ts", latitude_true_scale), - ("k", 1), - ("units", "m")] - super(crs.Mercator, self).__init__(proj4_params, globe=globe) - - # Need to have x/y limits defined for the initial hash which - # gets used within transform_points for caching - self._x_limits = self._y_limits = None - - # Calculate limits. - limits = self.transform_points( - crs.Geodetic(), - np.array([-180, 180]) + central_longitude, - np.array([min_latitude, max_latitude])) - - # When using a latitude of true scale, the min/max x-limits get set - # to the same value, so make sure the left one is negative - xlimits = limits[..., 0] - - if math.fabs(xlimits[0] - xlimits[1]) < 1e-6: - if xlimits[0] < 0: - xlimits[1] = -xlimits[1] - else: - xlimits[0] = -xlimits[0] - - # Compatibility with cartopy >= 0.17 - self._x_limits = tuple(xlimits) - self._y_limits = tuple(limits[..., 1]) - - self._threshold = min(np.diff(self.x_limits)[0] / 720, - np.diff(self.y_limits)[0] / 360) + proj4_params = [("proj", "merc"), + ("lon_0", central_longitude), + ("lat_ts", latitude_true_scale), + ("k", 1), + ("units", "m")] + super(crs.Mercator, self).__init__(proj4_params, globe=globe) + + # Need to have x/y limits defined for the initial hash which + # gets used within transform_points for caching + self._x_limits = self._y_limits = None + + # Calculate limits. + limits = self.transform_points( + crs.Geodetic(), + np.array([-180, 180]) + central_longitude, + np.array([min_latitude, max_latitude])) + + # When using a latitude of true scale, the min/max x-limits get set + # to the same value, so make sure the left one is negative + xlimits = limits[..., 0] + + if math.fabs(xlimits[0] - xlimits[1]) < 1e-6: + if xlimits[0] < 0: + xlimits[1] = -xlimits[1] + else: + xlimits[0] = -xlimits[0] + + # Compatibility with cartopy >= 0.17 + self._x_limits = tuple(xlimits) + self._y_limits = tuple(limits[..., 1]) + + self._threshold = min(np.diff(self.x_limits)[0] / 720, + np.diff(self.y_limits)[0] / 360) def _ismissing(val, islat=True): From feb7e629a1ff9b0ce05dbbe8aa7275e79c6f4e67 Mon Sep 17 00:00:00 2001 From: michaelavs Date: Fri, 29 Apr 2022 14:15:00 -0600 Subject: [PATCH 10/98] Empty push to re-trigger checks From 9d9c24d1698958544627bf95d936c840ac222a96 Mon Sep 17 00:00:00 2001 From: michaelavs Date: Mon, 2 May 2022 09:43:45 -0600 Subject: [PATCH 11/98] Empty to trigger builds From a1be3571a3498822046224fb7289a4abb94d4fc2 Mon Sep 17 00:00:00 2001 From: michaelavs Date: Thu, 5 May 2022 10:41:38 -0600 Subject: [PATCH 12/98] Updates to workflow --- .github/workflows/pypi.yaml | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 .github/workflows/pypi.yaml diff --git a/.github/workflows/pypi.yaml b/.github/workflows/pypi.yaml new file mode 100644 index 0000000..e69de29 From 7addc13dabd02927aee0e291c45960683d15f1bd Mon Sep 17 00:00:00 2001 From: michaelavs Date: Thu, 5 May 2022 10:43:36 -0600 Subject: [PATCH 13/98] Add pypy.yaml to PR --- .github/workflows/pypi.yaml | 54 +++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/.github/workflows/pypi.yaml b/.github/workflows/pypi.yaml index e69de29..ebf0943 100644 --- a/.github/workflows/pypi.yaml +++ b/.github/workflows/pypi.yaml @@ -0,0 +1,54 @@ +name: Upload wrf-python to PyPI +on: + release: + types: + - published +jobs: + test-build: + if: github.repository == 'NCAR/wrf-python' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: '3.x' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install setuptools setuptools-scm wheel twine check-manifest + - name: Build tarball and wheels + run: | + python setup.py sdist bdist_wheel + python -m pip wheel . -w dist --no-deps + - name: Test the artifacts + run: | + python -m twine check dist/* + publish: + needs: test-build + if: startsWith(github.ref, 'refs/tags') + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: '3.x' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install setuptools setuptools-scm wheel twine check-manifest + - name: Build tarball and wheels + run: | + python setup.py sdist bdist_wheel + python -m pip wheel . -w dist --no-deps + - name: Test the artifacts + run: | + python -m twine check dist/* + - name: Publish package to PyPI + uses: pypa/gh-action-pypi-publish@v1.5.0 + with: + user: __token__ + password: ${{ secrets.PYPI_PASSWORD }} + skip_existing: true + verbose: true \ No newline at end of file From 67248057b1fe5c150d59215bfa977e061c83d6c6 Mon Sep 17 00:00:00 2001 From: michaelavs Date: Thu, 5 May 2022 10:49:49 -0600 Subject: [PATCH 14/98] Update token name --- .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 ebf0943..1322433 100644 --- a/.github/workflows/pypi.yaml +++ b/.github/workflows/pypi.yaml @@ -49,6 +49,6 @@ jobs: uses: pypa/gh-action-pypi-publish@v1.5.0 with: user: __token__ - password: ${{ secrets.PYPI_PASSWORD }} + password: ${{ secrets.PYPI_WRF_PYTHON }} skip_existing: true verbose: true \ No newline at end of file From 6c11e52ac4b7fc9062369f9d47a1702d0e3dc1fc Mon Sep 17 00:00:00 2001 From: michaelavs Date: Wed, 11 May 2022 11:00:16 -0600 Subject: [PATCH 15/98] Add/modify setup.py --- setup.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/setup.py b/setup.py index 9304ff4..275c7d5 100755 --- a/setup.py +++ b/setup.py @@ -1,6 +1,7 @@ import os import sys import setuptools +from setuptools import setup import socket # Bootstrap a numpy installation before trying to import it. @@ -72,10 +73,11 @@ # requirements.append("mock") ext_modules = [ext1] - -numpy.distutils.core.setup( +setup( + name='wrf-python', author="Bill Ladwig", - author_email="ladwig@ucar.edu", + 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" @@ -84,29 +86,29 @@ "Documentation:\n\n" "http://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 :: 2.7", - "Programming Language :: Python :: 3.4", - "Programming Language :: Python :: 3.5", - "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', "Topic :: Scientific/Engineering :: Atmospheric Science", "Topic :: Software Development", "Operating System :: POSIX", "Operating System :: Unix", "Operating System :: MacOS", "Operating System :: Microsoft :: Windows"], - name="wrf-python", platforms=["any"], license="Apache License 2.0", version=__version__, @@ -117,3 +119,4 @@ package_data={"wrf": ["data/psadilookup.dat"]}, scripts=[] ) + From 1346cfc8e4f5cf87e120a50bb4826f796fb9ec1d Mon Sep 17 00:00:00 2001 From: michaelavs Date: Wed, 11 May 2022 11:07:31 -0600 Subject: [PATCH 16/98] Remove second instance of 'version' kwarg --- setup.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/setup.py b/setup.py index 275c7d5..dc37cef 100755 --- a/setup.py +++ b/setup.py @@ -111,7 +111,6 @@ "Operating System :: Microsoft :: Windows"], platforms=["any"], license="Apache License 2.0", - version=__version__, packages=setuptools.find_packages("src"), ext_modules=ext_modules, package_dir={"": "src"}, @@ -119,4 +118,3 @@ package_data={"wrf": ["data/psadilookup.dat"]}, scripts=[] ) - From 3e3e74c4e702c030e00cdb257c3bd38bd0c41882 Mon Sep 17 00:00:00 2001 From: michaelavs Date: Wed, 11 May 2022 11:18:56 -0600 Subject: [PATCH 17/98] Remove second instance of 'pakacge_dir' kwarg --- setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.py b/setup.py index dc37cef..4636048 100755 --- a/setup.py +++ b/setup.py @@ -113,7 +113,6 @@ license="Apache License 2.0", packages=setuptools.find_packages("src"), ext_modules=ext_modules, - package_dir={"": "src"}, download_url="http://python.org/pypi/wrf-python", package_data={"wrf": ["data/psadilookup.dat"]}, scripts=[] From 36698d82bd5497e6e3df673216f370edeec91277 Mon Sep 17 00:00:00 2001 From: michaelavs Date: Wed, 11 May 2022 15:58:00 -0600 Subject: [PATCH 18/98] Revert 'setup' and try importlib find_spec --- setup.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 4636048..e24db01 100755 --- a/setup.py +++ b/setup.py @@ -5,9 +5,9 @@ import socket # Bootstrap a numpy installation before trying to import it. -import imp +import importlib try: - imp.find_module('numpy') + importlib.util.find_spec('numpy') except ImportError: import subprocess subprocess.call([sys.executable, '-m', 'pip', 'install', 'numpy']) @@ -73,7 +73,7 @@ # requirements.append("mock") ext_modules = [ext1] -setup( +numpy.distutils.core.setup( name='wrf-python', author="Bill Ladwig", maintainer="GeoCAT", From d9c3966197aff696ce7250f28225e665e2d2c5e7 Mon Sep 17 00:00:00 2001 From: michaelavs Date: Wed, 11 May 2022 16:17:28 -0600 Subject: [PATCH 19/98] Update setup.py, requirements.txt, and version.py --- requirements.txt | 5 ++++- setup.py | 1 - src/wrf/version.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index 67027d4..28b349e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,6 @@ +basemap +cartopy>0.17 numpy>=1.11 -wrapt setuptools +wrapt +xarray diff --git a/setup.py b/setup.py index e24db01..49a3c84 100755 --- a/setup.py +++ b/setup.py @@ -1,7 +1,6 @@ import os import sys import setuptools -from setuptools import setup import socket # Bootstrap a numpy installation before trying to import it. diff --git a/src/wrf/version.py b/src/wrf/version.py index f708a9b..7b1e312 100644 --- a/src/wrf/version.py +++ b/src/wrf/version.py @@ -1 +1 @@ -__version__ = "1.3.2" +__version__ = "1.3.3" From 18f4245d09784bc19b2e7894af3f2047426be9ba Mon Sep 17 00:00:00 2001 From: michaelavs Date: Wed, 11 May 2022 16:19:28 -0600 Subject: [PATCH 20/98] Update LICENSE --- LICENSE | 208 +++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 198 insertions(+), 10 deletions(-) diff --git a/LICENSE b/LICENSE index 525a044..18c9b18 100644 --- a/LICENSE +++ b/LICENSE @@ -1,14 +1,202 @@ -Copyright 2016 University Corporation for Atmospheric Research +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - http://www.apache.org/licenses/LICENSE-2.0 + 1. Definitions. -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2019 University Corporation for Atmospheric Research + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. From b9d79b8e0b21bce0efe4d3534ecce93abeb6e7e2 Mon Sep 17 00:00:00 2001 From: michaelavs Date: Thu, 12 May 2022 09:29:44 -0600 Subject: [PATCH 21/98] Testing changes for rtd build --- requirements.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 28b349e..7c07c82 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,4 @@ basemap -cartopy>0.17 numpy>=1.11 setuptools wrapt From ef8949de6da608e67cbc3e597d215faa6bbdfd6e Mon Sep 17 00:00:00 2001 From: michaelavs Date: Fri, 13 May 2022 14:07:30 -0600 Subject: [PATCH 22/98] Version bump --- conda_recipe/meta.yaml | 2 +- src/wrf/version.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conda_recipe/meta.yaml b/conda_recipe/meta.yaml index 6ed2455..ff84497 100644 --- a/conda_recipe/meta.yaml +++ b/conda_recipe/meta.yaml @@ -1,4 +1,4 @@ -{% set version = "1.3.3" %} +{% set version = "1.3.4" %} package: name: wrf-python diff --git a/src/wrf/version.py b/src/wrf/version.py index 7b1e312..f9e47b6 100644 --- a/src/wrf/version.py +++ b/src/wrf/version.py @@ -1 +1 @@ -__version__ = "1.3.3" +__version__ = "1.3.4" From 2fb22a102171c372ac0ddb2948f513d78c705f3b Mon Sep 17 00:00:00 2001 From: Michaela Sizemore <43652875+michaelavs@users.noreply.github.com> Date: Wed, 18 May 2022 12:03:49 -0600 Subject: [PATCH 23/98] Merge pull request #179 from NCAR/develop (#182) From d70fdf0367f4ccb709563c980d7b62afdd54c203 Mon Sep 17 00:00:00 2001 From: "Bruno P. Kinoshita" Date: Thu, 19 May 2022 19:20:04 +1200 Subject: [PATCH 24/98] Use https for project page --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 49a3c84..fc17abd 100755 --- a/setup.py +++ b/setup.py @@ -83,7 +83,7 @@ "GitHub Repository:\n\n" "https://github.com/NCAR/wrf-python\n\n" "Documentation:\n\n" - "http://wrf-python.rtfd.org\n"), + "https://wrf-python.rtfd.org\n"), url="https://github.com/NCAR/wrf-python", version=__version__, package_dir={"": "src"}, @@ -112,7 +112,7 @@ license="Apache License 2.0", packages=setuptools.find_packages("src"), ext_modules=ext_modules, - download_url="http://python.org/pypi/wrf-python", + download_url="https://python.org/pypi/wrf-python", package_data={"wrf": ["data/psadilookup.dat"]}, scripts=[] ) From 507dac943a5cb86b12a925d91e9f247033d5a0f7 Mon Sep 17 00:00:00 2001 From: "Bruno P. Kinoshita" Date: Thu, 19 May 2022 19:22:34 +1200 Subject: [PATCH 25/98] Declare __version__ and add a comment for other devs --- setup.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup.py b/setup.py index fc17abd..07c3007 100755 --- a/setup.py +++ b/setup.py @@ -51,6 +51,8 @@ "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()) From ac347c73fbc002313fadc53e43106dec23063d16 Mon Sep 17 00:00:00 2001 From: "Bruno P. Kinoshita" Date: Thu, 19 May 2022 19:31:25 +1200 Subject: [PATCH 26/98] Raise an exception so numpy gets installed --- setup.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 07c3007..3dbeaf3 100755 --- a/setup.py +++ b/setup.py @@ -6,8 +6,10 @@ # Bootstrap a numpy installation before trying to import it. import importlib try: - importlib.util.find_spec('numpy') -except ImportError: + 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']) From fad5179c423ceaa08306696f59172cf2b5acd0fa Mon Sep 17 00:00:00 2001 From: michaelavs Date: Thu, 19 May 2022 08:30:45 -0600 Subject: [PATCH 27/98] Version Bump for Patch --- conda_recipe/meta.yaml | 2 +- src/wrf/version.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conda_recipe/meta.yaml b/conda_recipe/meta.yaml index ff84497..f373955 100644 --- a/conda_recipe/meta.yaml +++ b/conda_recipe/meta.yaml @@ -1,4 +1,4 @@ -{% set version = "1.3.4" %} +{% set version = "1.3.4.1" %} package: name: wrf-python diff --git a/src/wrf/version.py b/src/wrf/version.py index f9e47b6..b7b278a 100644 --- a/src/wrf/version.py +++ b/src/wrf/version.py @@ -1 +1 @@ -__version__ = "1.3.4" +__version__ = "1.3.4.1" From 98931ec01da8bc72550896808f5798c1824d9add Mon Sep 17 00:00:00 2001 From: Orhan Eroglu <32553057+erogluorhan@users.noreply.github.com> Date: Wed, 22 Jun 2022 14:33:40 -0600 Subject: [PATCH 28/98] Update citation textx to reflect Zenodo per-version DOI creation (#191) --- CITATION.cff | 7 +++++ README.md | 5 ++-- doc/source/citation.rst | 57 +++++++++++++++++++++++++++++------------ 3 files changed, 49 insertions(+), 20 deletions(-) create mode 100644 CITATION.cff diff --git a/CITATION.cff b/CITATION.cff new file mode 100644 index 0000000..08f040d --- /dev/null +++ b/CITATION.cff @@ -0,0 +1,7 @@ +cff-version: 1.2.0 +message: "If you use this software, please cite it as below." +authors: + - given-names: "Visualization & Analysis Systems Technologies" +title: "Geoscience Community Analysis Toolkit: WRF-Python" +doi: 10.5065/D6W094P1 +url: "https://github.com/NCAR/wrf-python" diff --git a/README.md b/README.md index 3a40651..13f6420 100644 --- a/README.md +++ b/README.md @@ -20,9 +20,8 @@ http://wrf-python.rtfd.org Citation ------------------ - Ladwig, W. (2017). wrf-python (Version x.x.x) [Software]. Boulder, Colorado: UCAR/NCAR. https://doi.org/10.5065/D6W094P1 - -Note: The version number x.x.x should be set to the version of wrf-python that you are using. +If you use this software, please cite it as described at the [WRF-Python - Citation]( +https://wrf-python.readthedocs.io/en/latest/citation.html) page. -------------------- diff --git a/doc/source/citation.rst b/doc/source/citation.rst index 89c35c4..1ad5317 100644 --- a/doc/source/citation.rst +++ b/doc/source/citation.rst @@ -1,26 +1,49 @@ .. _citation: Citation -================= +========== -WRF-Python has a Digital Object Identifier (DOI), which is a persistent -identifier for web-based resources. The wrf-python DOI, when used in URL form, -https://doi.org/10.5065/D6W094P1, provides a persistent link to the wrf-python -Github page. The benefit of DOIs is that they are widely accepted by academic -publishers as citable locators for scholarly objects. +How to cite WRF-Python +----------------------- -If you author a paper that involves data analysis with wrf-python, or -visualizations created with wrf-python, we would like to ask you to please -cite wrf-python. This helps us better understand the impact of the software on -the scientific community, which in turns helps us maintain support for the -effort. +If you use this software, please cite it as described below: -You can cite wrf-python using the following citation: +WRF-Python has a Digital Object Identifier (DOI), which is a persistent identifier for +web-based resources. The benefit of DOIs is that they are widely accepted by academic publishers +as citable locators for scholarly objects. The WRF-Python DOI, when used in URL form, +`https://doi.org/10.5065/D6W094P1 `_, provides a persistent link +to the WRF-Python GitHub repository, and can be used to cite the WRF-Python project as a whole. -.. code-block:: none +In addition, each WRF-Python version is assigned a separate DOI to allow users to access older +releases. This ensures that users are not only able to cite the specific software version through +DOIs but are also able to download & use the corresponding release for reproducibility purposes. - Ladwig, W. (2017). wrf-python (Version x.x.x) [Software]. Boulder, Colorado: UCAR/NCAR. https://doi.org/10.5065/D6W094P1 - -.. note:: +If you would like to cite WRF-Python as a whole (without referring to a specific version), use +the following text: - The version number x.x.x should be set to the version of wrf-python that you are using. \ No newline at end of file +**Visualization & Analysis Systems Technologies. (2017). +Geoscience Community Analysis Toolkit: WRF-Python [Software]. +Boulder, CO: UCAR/NCAR - Computational and Informational System Lab. doi:10.5065/D6W094P1.** + +Instead, if you would like to cite a specific version of WRF-Python, use the following text: + +**Visualization & Analysis Systems Technologies. (Year). +Geoscience Community Analysis Toolkit: WRF-Python (v\) [Software]. +Boulder, CO, USA: UCAR/NCAR - Computational and Informational System Lab. doi:\.** + +In the above citation text, update the year, WRF-Python version, and DOI as appropriate. For +example: + +**Visualization & Analysis Systems Technologies. (2022). +Geoscience Community Analysis Toolkit: WRF-Python (v1.3.4.1) [Software]. +Boulder, CO, USA: UCAR/NCAR - Computational and Informational System Lab. doi:10.5281/zenodo.6685115.** + +Please find DOIs for all the WRF-Python versions `here +`_. + +Please note: The DOI minting service, Zenodo, might be suggesting their own citation text (as +they are the publisher of such DOIs) in their website. We prefer the text we recommend here to be used; +however, either way is acceptable. + +For further information, please refer to +`GeoCAT homepage - Citation `_. From a9543e6716d35637a2e4b03664afc669c1ddb48b Mon Sep 17 00:00:00 2001 From: fedecutraro <31699000+fedecutraro@users.noreply.github.com> Date: Tue, 14 Feb 2023 12:32:59 -0300 Subject: [PATCH 29/98] Add alias for mcape and mcin (#195) * Add alias for mcape and mcin * Empty-Commit to trigger GitHub Actions checks --- src/wrf/routines.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/wrf/routines.py b/src/wrf/routines.py index 3998209..d40b72d 100644 --- a/src/wrf/routines.py +++ b/src/wrf/routines.py @@ -196,6 +196,8 @@ "wdir_uvmet": "uvmet_wdir", "wspd_uvmet10": "uvmet10_wspd", "wdir_uvmet10": "uvmet10_wdir", + "mcape": "cape2d_only", + "mcin": "cin2d_only" } 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 30/98] 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 31/98] 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 32/98] 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 33/98] 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 34/98] 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 35/98] 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 36/98] 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 37/98] 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 38/98] 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 39/98] 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 40/98] 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 41/98] 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 42/98] 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 43/98] 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 44/98] 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 45/98] 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 46/98] 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 47/98] 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 48/98] 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 49/98] 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 50/98] 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 51/98] 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 52/98] 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 53/98] 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 54/98] 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 55/98] 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 56/98] 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 57/98] 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 58/98] 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 59/98] 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 60/98] 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 61/98] 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 62/98] 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 63/98] 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 64/98] 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 65/98] 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 66/98] 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 67/98] 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 68/98] 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 69/98] 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 70/98] 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 71/98] 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 72/98] 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 73/98] 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 74/98] 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 75/98] 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 76/98] 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 77/98] 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 78/98] 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 79/98] 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 80/98] 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 81/98] 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 82/98] 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 83/98] 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 84/98] 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 85/98] 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 86/98] 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 87/98] 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 88/98] 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 89/98] 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 90/98] 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 91/98] 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 92/98] 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 93/98] 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 94/98] 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 95/98] 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 96/98] 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 97/98] 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 98/98] 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"