Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion kamodo/kamodo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion kamodo/rpc/proto.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
16 changes: 10 additions & 6 deletions kamodo/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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


Expand Down