From 5509ed1e4d52beb85ca6ef7cfa257afe2a581c7c Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Sun, 23 May 2021 10:25:22 +0200 Subject: [PATCH] Add a flag to set the ESMF extrapolation method This is useful for bilinear interpolation of meshes with culled land cells (like MPAS meshes), where you still want to show values along the coastline. --- pyremap/remapper.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pyremap/remapper.py b/pyremap/remapper.py index a007e87..a4cb398 100644 --- a/pyremap/remapper.py +++ b/pyremap/remapper.py @@ -102,7 +102,8 @@ def __init__(self, sourceDescriptor, destinationDescriptor, def build_mapping_file(self, method='bilinear', additionalArgs=None, logger=None, mpiTasks=1, tempdir=None, - esmf_path=None, esmf_parallel_exec=None): # {{{ + esmf_path=None, esmf_parallel_exec=None, + extrap_method=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 @@ -140,6 +141,9 @@ def build_mapping_file(self, method='bilinear', additionalArgs=None, The name of the parallel executable to use to launch ESMF tools. But default, 'mpirun' from the conda environment is used + extrap_method : {'neareststod', 'nearestidavg','creep'}, optional + The method used to extrapolate unmapped destination locations + Raises ------ OSError @@ -197,6 +201,9 @@ def build_mapping_file(self, method='bilinear', additionalArgs=None, '--netcdf4', '--no_log'] + if extrap_method is not None: + args.extend(['--extrap_method', extrap_method]) + parallel_args = [] if mpiTasks > 1: