Unverified Commit c3c1f9c7 authored by jlaura's avatar jlaura Committed by GitHub
Browse files

moves isd creation into correct py class and adds exceptions to RasterGM (#7)

* moves isd creation into correct py class

* Adds exception handling to RasterGM.
parent d3072740
Loading
Loading
Loading
Loading
+23 −22
Original line number Diff line number Diff line
@@ -11,7 +11,12 @@

%include <std_string.i>

%pythoncode %{
    import json    
%}

%include "Isd.h"
%extend csm::Isd {
    %pythoncode %{
        import json
        import numpy as np
@@ -21,8 +26,6 @@
            if not isinstance(stream, dict):
                stream = json.loads(stream)
            for k, v in stream.items():
          if isinstance(v, np.ndarray):
              v = v.tolist()
                if isinstance(v, list):
                    for i in v:
                        isd.addParam(k, str(i))
@@ -32,7 +35,5 @@
        @classmethod
        def load(cls, fp):
            return cls.loads(fp.read())

  Isd.load = load
  Isd.loads = loads
    %}
}
 No newline at end of file
+10 −0
Original line number Diff line number Diff line
@@ -4,8 +4,18 @@
%}

%ignore CSM_RASTER_FAMILY;
%include exception.i
%exception {
    try {
        $action
    } catch (const std::exception &e) {
        SWIG_exception(SWIG_RuntimeError, e.what());
    }
} 


%import model.i
%import geometricmodel.i
%import csm.i

%include RasterGM.h