diff --git a/kamodo/kamodo.py b/kamodo/kamodo.py index b04f31b..3958cee 100644 --- a/kamodo/kamodo.py +++ b/kamodo/kamodo.py @@ -1527,7 +1527,7 @@ def plot(self, *variables, plot_partial={}, **figures): (10, 20, 50, 250)) # match coordinate arrays # define and kamodofy interpolating function - rgi = RegularGridInterpolator((t, lon, lat, ht), variable, bounds_error = False, fill_value=np.NaN) + rgi = RegularGridInterpolator((t, lon, lat, ht), variable, bounds_error = False, fill_value=np.nan) @kamodofy(units='m/s', data=variable) def interpolator(xvec): diff --git a/kamodo/rpc/proto.py b/kamodo/rpc/proto.py index 84315cf..4cd3856 100644 --- a/kamodo/rpc/proto.py +++ b/kamodo/rpc/proto.py @@ -140,7 +140,7 @@ def to_rpc_literal(value): elif isinstance(value, float): # python standard float is C double which = 'float64' - value = float(value) # cast np.float as float + value = float(value) # cast numpy float as Python float elif isinstance(value, str): which = 'text' elif isinstance(value, list): diff --git a/kamodo/util.py b/kamodo/util.py index 1fdc166..1b67e6a 100644 --- a/kamodo/util.py +++ b/kamodo/util.py @@ -18,7 +18,8 @@ import pandas as pd import sympy from decorator import decorate -from numpy.distutils.exec_command import exec_command +import shlex +import subprocess from scipy.integrate import solve_ivp from sympy import Add, Mul, Pow, Tuple, sympify from sympy import Function @@ -135,11 +136,14 @@ def compile_fortran(source, module_name, extra_args='', folder='./'): fortran_file.write(source) fortran_file.flush() - args = ' -c -m {} {} {}'.format(module_name, fortran_file.name, - extra_args) - command = 'cd "{}" && "{}" -c "import numpy.f2py as f2py;f2py.main()" {}'.format( - folder, sys.executable, args) - status, output = exec_command(command) + f2py_args = ["-c", "-m", module_name, fortran_file.name] + if extra_args: + f2py_args.extend(shlex.split(extra_args)) + cmd = [sys.executable, "-c", "import numpy.f2py as f2py;f2py.main()"] + f2py_args + command = " ".join(shlex.quote(a) for a in cmd) + result = subprocess.run(cmd, capture_output=True, text=True, cwd=folder) + status = result.returncode + output = result.stdout + result.stderr return status, output, command