GeoEco.Matlab.MatlabFunctions
- class GeoEco.Matlab.MatlabFunctions
Bases:
objectAllows GeoEco functions implemented in MATLAB to be called as Python functions.
Certain functions in GeoEco are implemented in MATLAB code. In order for these functions to run, either MATLAB R2026a or the MATLAB Runtime R2026a must be installed. The MATLAB Runtime is free and may be downloaded from https://www.mathworks.com/help/compiler/install-the-matlab-runtime.html. Please follow the installation instructions carefully. Version R2026a must be used; other versions will not work. MATLAB Runtime allows multiple versions can be installed at the same time.
To call MATLAB functions using
MatlabFunctions, it is first necessary to callInitialize(), which loads the necessary MATLAB libraries into the current process and binds astaticmethod()toMatlabFunctionsfor each MATLAB function implemented by GeoEco. For example:from GeoEco.Matlab import MatlabFunctions MatlabFunctions.Initialize() a = [1,2,3] b = MatlabFunctions.TestParameterType(a) assert b == a
The
TestParameterTypefunction simply accepts one argument and returns it back to the caller. We use it in GeoEco’s automated tests to verify that we can exchange different data types with MATLAB properly.Note
GeoEco’s MATLAB functions are part of GeoEco’s internal API and are not recommended for external callers. Because of this, we do not formally document them. But you can find them in GeoEco’s source code repository, or by unzipping the
.ctffile found inside GeoEco’s Python package directory and digging around in the resulting directory structure.Warning
MATLAB is large and complex program that utilizes a lot of third-party programming libraries (.so files on Linux and .DLL files on Windows). Other large and complex programs such as ArcGIS may utilize some of the same libraries. Loading both MATLAB and ArcGIS into the same process can result in a situation known as dependency hell, in which one program requires version A of a third-party library but the other program requires version B, but both versions cannot be loaded into the same process at the same time. When these version conflicts occur, the first program may run successfully but the second one may fail. Because GeoEco often involves utilizing ArcGIS, we recommend accessing GeoEco’s MATLAB functions with the
MatlabWorkerProcessclass rather thanMatlabFunctions.MatlabWorkerProcessalso exposes GeoEco’s MATLAB functions asstaticmethod()s, but loadsMatlabFunctionsin a separate process and proxies function calls to it. By keeping MATLAB in a separate process, dependency hell is avoided.Methods
Initializes MATLAB and binds a
staticmethod()toMatlabFunctionsfor each GeoEco MATLAB function.