diff --git a/rocketpy/mathutils/function.py b/rocketpy/mathutils/function.py index 1fd878b36..4a879bf1f 100644 --- a/rocketpy/mathutils/function.py +++ b/rocketpy/mathutils/function.py @@ -231,8 +231,29 @@ def source(x): # Finally set data source as source self.source = source - if self.__interpolation__ is None: + + # Update extrapolation method + if ( + self.__extrapolation__ is None + or self.__extrapolation__ == "shepard" + ): + self.set_extrapolation("shepard") + else: + raise ValueError( + "Multidimensional datasets only support shepard extrapolation." + ) + + # Set default multidimensional interpolation if it hasn't + if ( + self.__interpolation__ is None + or self.__interpolation__ == "shepard" + ): self.set_interpolation("shepard") + else: + raise ValueError( + "Multidimensional datasets only support shepard interpolation." + ) + # Return self return self