diff --git a/pyremap/remapper.py b/pyremap/remapper.py index 5cb9364..aa13767 100644 --- a/pyremap/remapper.py +++ b/pyremap/remapper.py @@ -139,7 +139,7 @@ def build_mapping_file(self, method='bilinear', additionalArgs=None, esmf_parallel_exec : {'srun', 'mpirun}, optional The name of the parallel executable to use to launch ESMF tools. - But default, 'mpirun' from the conda environment is used + By default, 'mpirun' from the conda environment is used extrap_method : {'neareststod', 'nearestidavg','creep'}, optional The method used to extrapolate unmapped destination locations @@ -248,14 +248,13 @@ def build_mapping_file(self, method='bilinear', additionalArgs=None, if esmf_parallel_exec is not None: # use the specified parallel executable + parallel_args = esmf_parallel_exec.split(' ') if 'srun' in esmf_parallel_exec: - parallel_args = [esmf_parallel_exec, '-n', - '{}'.format(mpiTasks)] + parallel_args.extend(['-n', '{}'.format(mpiTasks)]) else: # presume mpirun syntax - parallel_args = [esmf_parallel_exec, '-np', - '{}'.format(mpiTasks)] + parallel_args.extend(['-np', '{}'.format(mpiTasks)]) elif 'CONDA_PREFIX' in os.environ and mpiTasks > 1: # this is a conda environment, so we need to find out if esmf @@ -330,7 +329,7 @@ def build_mapping_file(self, method='bilinear', additionalArgs=None, def remap_file(self, inFileName, outFileName, variableList=None, overwrite=False, renormalize=None, logger=None, - replaceMpasFill=False): # {{{ + replaceMpasFill=False, parallel_exec=None): # {{{ """ Given a source file defining either an MPAS mesh or a lat-lon grid and a destination file or set of arrays defining a lat-lon grid, constructs @@ -365,6 +364,10 @@ def remap_file(self, inFileName, outFileName, variableList=None, from MPAS output). If this has been handled before the call, replacing the fill value again may cause errors. + parallel_exec : {'srun'}, optional + The name of the parallel executable to use to launch ncremap. + But default, none is used. + Raises ------ OSError @@ -399,9 +402,15 @@ def remap_file(self, inFileName, outFileName, variableList=None, 'Note: this presumes use of the conda-forge ' 'channel.') - args = ['ncremap', - '-m', self.mappingFileName, - '--vrb=1'] + if parallel_exec is not None: + # use the specified parallel executable + args = parallel_exec.split(' ') + else: + args = list() + + args.extend(['ncremap', + '-m', self.mappingFileName, + '--vrb=1']) regridArgs = []