SasktranIF Programming Language Interface

The SasktranIF module provides a standard interface so it can be integrated into different high level programming languages such as Python, Matlab, IDL etc. The interface is still a work in progress. Ideally it would not pass class definitions across the shareable object/DLL boundary as this can present internal structure and organization issues. In reality we pass simple C++ classes across the boundary which are simple and almost virtual (but not quite). We have not experienced any problems on Windows or Linux but this may be due to the fact that we exclusively use Visual Studio on Windows and GNU gcc on Linux.

The SasktranIF module acts as a go-between for the high level language(eg Python) and the C++ sasktran modules. There are two parts to this go-between process,

  • functions exposed by SasktranIF to the high level language
  • functions exposed by the C++ Sasktran module to SasktranIF

Functions exposed by C++ modules

SKTRANIF_CreateEngine2

Requests that a binary module create a new instance of the specified engine object for the user. A Sasktran C++ module implements and exports this function only if it provides radiative transfer engines. The format of the function is:

extern "C" DLL_PUBLIC bool SKTRANIF_CreateEngine2( const char* userenginename, ISKEngine_Stub**  engine)

SKTRANIF_CreateClimatology2

Requests that a binary module create a new instance of a climatology object for the user. A Sasktran C++ module implements and exports this function only if it provides climatologies. The format of the function is:

extern "C" DLL_PUBLIC bool SKTRANIF_CreateClimatology2( const char* userclimatename , ISKClimatology_Stub**  climatology )

SKTRANIF_CreateOpticalProperty2

Requests that a binary module create a new instance of an optical property object for the user. A Sasktran C++ module implements and exports this function only if it provides optical properties. The format of the function is:

extern "C" DLL_PUBLIC bool SKTRANIF_CreateOpticalProperty2( const char* useroptpropname, ISKOpticalProperty_Stub**  optprop )

SKTRANIF_CreateEmission2

Requests that a binary module create a new instance of an emission object for the user. A Sasktran C++ module implements and exports this function only if it provides emission properties. The format of the function is:

extern "C" DLL_PUBLIC bool SKTRANIF_CreateEmission2( const char* useroptpropname, ISKEmission_Stub**  emission )

SKTRANIF_CreateBRDF2

Requests that a binary module create a new instance of an BRDF object for the user. A Sasktran C++ module implements and exports this function only if it provides BRDF object. The format of the function is:

extern "C" DLL_PUBLIC bool SKTRANIF_CreateBRDF2( const char* brdfname, ISKBrdf_Stub**  brdf )

SKTRANIF_CreateSolarSpectrum2

Requests that a binary module create a new instance of an SolarSpectrum object for the user. A Sasktran C++ module implements and exports this function only if it provides SolarSpectrum objects. The format of the function is:

extern "C" DLL_PUBLIC bool SKTRANIF_CreateSolarSpectrum2( const char* solarname, ISKSolarSpectrum_Stub**  solar )

SKTRANIF_CreateGeodetic2

Requests that a binary module create a new instance of an geodetic object for the user. A Sasktran C++ module implements and exports this function only if it provides a geodetic object. Note that teh core components distribute working version of a geodetic object. The format of the function is:

extern "C" DLL_PUBLIC bool SKTRANIF_CreateGeodetic2( const char* geoidname, ISKGeodetic_Stub**  geoid)

SKTRAN_IFSetRegistryDirectoryInChildDLL

This function must be implemented by the C++ binary module. It instructs the module to use a YAML based registry scheme in the specified directory. This scheme works well with the nxRegistry classes used in the sasktran core components. We strongly recommend that new C++ modules manage their registry settings with the same nxRegistry classes. The format of the function is:

extern "C" DLL_PUBLIC bool SKTRAN_IFSetRegistryDirectoryInChildDLL( const char* registrydirname)

SKTRAN_IFCreateRegistryEntriesForChildDLL

This function must be implemented by the C++ binary module. It instructs the module to register its sasktran objects in the current registry. The high level languages configure the SasktranIF with registry information and SasktranIF passes this information onto the modules. Its a bit complicated but it works. We strongly recommend that new C++ modules manage their registry settings with the same nxRegistry classes. The format of the function is:

extern "C" DLL_PUBLIC bool SKTRAN_IFCreateRegistryEntriesForChildDLL( const char* paramstr )

SKTRAN_IFInitializeLogger

This function should be implemented by the C++ binary module. It allows the module to send its logging information, via nxLog::Record, to the high level language logging system. The format of the function is:

extern "C" DLL_PUBLIC bool SKTRAN_IFInitializeLogger( InxLog* logger)

SKTRAN_IFGlobalHandleTable

This function is optional for the C++ binary module. It allows the module to register this DLL with additional objects that may not be in the registry. We recommend that C++ modules register all objects in the registry. The format of the function is:

extern "C" DLL_PUBLIC bool SKTRAN_IFGlobalHandleTable( GlobalClimatologyHandleTable** entry, int* numpoints )

Functions exposed to high level languages

SKTRAN_IFSetRegistryDirectory

extern “C” bool SKTRAN_IFSetRegistryDirectory(const char* registrydirname);

SKTRAN_IFCreateRegistryEntriesForDLL

extern “C” bool SKTRAN_IFCreateRegistryEntriesForDLL( const char* dllname, const char* paramstr );

class ISKEngine

class ISKClimatology

class ISKOpticalProperty

class ISKEmission

class ISKBrdf

class ISKSolarSpectrum

class ISKGeodetic