new packages: py-arm-pyart and dependencies (#32579)

* new packages: py-arm-pyart and dependencies

- py-arm-pyart
- py-cylp
- rsl

* Update var/spack/repos/builtin/packages/py-cylp/package.py

Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>

* Fix dependencies

- xarray is not optional
- pandas is needed
- pylab is needed
  - new package, py-pylab-sdk
- setuptools is needed at run time

* Patch for import of StringIO

* Update var/spack/repos/builtin/packages/py-arm-pyart/package.py

Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>

* Fix call to `StringIO` in patch

Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
This commit is contained in:
Glenn Johnson 2022-09-10 18:02:15 -05:00 committed by GitHub
parent 1427ddaa59
commit 01153b3271
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 187 additions and 0 deletions

View File

@ -0,0 +1,48 @@
diff -ru a/pyart/testing/data/make_small_mdv_ppi.py b/pyart/testing/data/make_small_mdv_ppi.py
--- a/pyart/testing/data/make_small_mdv_ppi.py 2022-07-19 13:06:08.000000000 -0500
+++ b/pyart/testing/data/make_small_mdv_ppi.py 2022-09-10 16:06:38.712279369 -0500
@@ -6,7 +6,10 @@
"""
import struct
-import StringIO
+try:
+ from StringIO import StringIO
+except ImportError:
+ from io import StringIO
import gzip
import pyart
@@ -40,7 +43,7 @@
fdata_str = fdata.astype('uint16').byteswap().tostring()
uncompressed_data_size = len(fdata_str)
-fileobj = StringIO.StringIO()
+fileobj = StringIO()
gzipfile = gzip.GzipFile(fileobj=fileobj, mode='w')
gzipfile.write(fdata_str)
gzipfile.close()
diff -ru a/pyart/testing/data/make_small_mdv_rhi.py b/pyart/testing/data/make_small_mdv_rhi.py
--- a/pyart/testing/data/make_small_mdv_rhi.py 2022-07-19 13:06:08.000000000 -0500
+++ b/pyart/testing/data/make_small_mdv_rhi.py 2022-09-10 16:07:12.775303046 -0500
@@ -6,7 +6,10 @@
"""
import struct
-import StringIO
+try:
+ from StringIO import StringIO
+except ImportError:
+ from io import StringIO
import gzip
import pyart
@@ -39,7 +42,7 @@
fdata_str = fdata.astype('uint16').byteswap().tostring()
uncompressed_data_size = len(fdata_str)
-fileobj = StringIO.StringIO()
+fileobj = StringIO()
gzipfile = gzip.GzipFile(fileobj=fileobj, mode='w')
gzipfile.write(fdata_str)
gzipfile.close()

View File

@ -0,0 +1,71 @@
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import *
class PyArmPyart(PythonPackage):
"""Python ARM Radar Toolkit.
A growing collection of weather radar algorithms and utilities build on top
of the Scientific Python stack and distributed under the 3-Clause BSD
license. Py-ART is used by the Atmospheric Radiation Measurement (ARM)
Climate Research Facility for working with data from a number of
precipitation and cloud radars, but has been designed so that it can be
used by others in the radar and atmospheric communities to examine,
processes, and analyse data from many types of weather radars."""
homepage = "https://github.com/ARM-DOE/pyart"
pypi = "arm_pyart/arm_pyart-1.12.7.tar.gz"
version("1.12.7", sha256="b7b23ecef270c60b017d94603941f0c117de072a10125c5f58c0685d801f9161")
variant("cartopy", description="Plot grids on maps", default=False)
variant("cylp", description="Linear programming solver", default=False)
variant("gdal", description="Output GeoTIFFs from grid objects", default=False)
variant("hdf5", description="Support for HDF5 files", default=False)
variant("rsl", description="Use RSL library", default=False)
variant("wradlib", description="Calculate texture of differential phase field", default=False)
conflicts("~hdf5", when="+wradlib")
conflicts("~gdal", when="+wradlib")
depends_on("python@3.6:3.10", type=("build", "run"))
depends_on("py-setuptools", type=("build", "run"))
depends_on("py-setuptools-scm@6.2:", type="build")
depends_on("py-cython", type="build")
depends_on("py-numpy", type=("build", "run"))
depends_on("py-scipy", type=("build", "run"))
depends_on("py-netcdf4", type=("build", "run"))
depends_on("py-matplotlib", type=("build", "run"))
depends_on("py-pooch", type=("build", "run"))
depends_on("py-cftime", type=("build", "run"))
depends_on("py-fsspec", type=("build", "run"))
depends_on("py-s3fs", type=("build", "run"))
depends_on("py-xarray@0.21.1:", type=("build", "run"))
# These are not listed but needed due to being imported in a python file
depends_on("py-pandas", type="run")
depends_on("py-pylab-sdk", type="run")
# Dependencies for variants
depends_on("py-cartopy", type="run", when="+cartopy")
depends_on("py-cylp", type="run", when="+cylp")
depends_on("gdal+python", type="run", when="+gdal")
depends_on("py-h5py", type="run", when="+hdf5")
depends_on("rsl", type=("build", "run"), when="+rsl")
depends_on("py-wradlib", type="run", when="+wradlib")
patch("StringIO.patch")
def setup_build_environment(self, env):
if "+rsl" in self.spec:
env.set("RSL_PATH", self.spec["rsl"].prefix)
else:
# set RSL_PATH to empty to make sure RSL is not picked up from a
# non-spack install in /usr/local
env.set("RSL_PATH", "")

View File

@ -0,0 +1,27 @@
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import *
class PyCylp(PythonPackage):
"""A Python interface for CLP, CBC, and CGL.
CyLP is a Python interface to COIN-ORs Linear and mixed-integer program
solvers (CLP, CBC, and CGL). CyLPs unique feature is that you can use it
to alter the solution process of the solvers from within Python."""
homepage = "https://github.com/coin-or/cylp"
pypi = "cylp/cylp-0.91.5.tar.gz"
version("0.91.5", sha256="d68ab1dde125be60abf45c8fd9edd24ab880c8144ad881718ddfa01ff6674c77")
depends_on("py-setuptools", type="build")
depends_on("py-cython@:2", type="build")
depends_on("py-numpy@1.5:", type=("build", "run"))
depends_on("py-scipy@0.10.0:", type=("build", "run"))
depends_on("cbc")

View File

@ -0,0 +1,21 @@
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import *
class PyPylabSdk(PythonPackage):
"""A development kit that collects simple utilities."""
homepage = "https://github.com/PyLabCo/pylab-sdk"
pypi = "pylab-sdk/pylab-sdk-1.3.2.tar.gz"
version("1.3.2", sha256="ea53e97fec45ea15f65bd53da6b25dc16a9accf3a7f5decbaa970592d760148d")
depends_on("python@3:", type=("build", "run"))
depends_on("py-setuptools", type="build")
depends_on("py-requests", type=("build", "run"))

View File

@ -0,0 +1,20 @@
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import *
class Rsl(AutotoolsPackage):
"""This library is an object oriented programming environment for writing
software applicable to all RADAR data related to the TRMM GV effort."""
homepage = "https://trmm-fc.gsfc.nasa.gov/trmm_gv/software/rsl/"
url = "https://trmm-fc.gsfc.nasa.gov/trmm_gv/software/rsl/software/rsl-v1.50.tar.gz"
version("1.50", sha256="9e4e3fe45eb1e4aebea63255d4956b00eb69527044a83f182cde1b43510bd342")
depends_on("bzip2")
depends_on("jpeg")
depends_on("zlib")