Skip to content
Snippets Groups Projects
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
Branches
No related tags found
No related merge requests found
...@@ -11,7 +11,12 @@ ...@@ -11,7 +11,12 @@
%include <std_string.i> %include <std_string.i>
%pythoncode %{
import json
%}
%include "Isd.h" %include "Isd.h"
%extend csm::Isd {
%pythoncode %{ %pythoncode %{
import json import json
import numpy as np import numpy as np
...@@ -21,8 +26,6 @@ ...@@ -21,8 +26,6 @@
if not isinstance(stream, dict): if not isinstance(stream, dict):
stream = json.loads(stream) stream = json.loads(stream)
for k, v in stream.items(): for k, v in stream.items():
if isinstance(v, np.ndarray):
v = v.tolist()
if isinstance(v, list): if isinstance(v, list):
for i in v: for i in v:
isd.addParam(k, str(i)) isd.addParam(k, str(i))
...@@ -32,7 +35,5 @@ ...@@ -32,7 +35,5 @@
@classmethod @classmethod
def load(cls, fp): def load(cls, fp):
return cls.loads(fp.read()) return cls.loads(fp.read())
Isd.load = load
Isd.loads = loads
%} %}
}
\ No newline at end of file
...@@ -4,8 +4,18 @@ ...@@ -4,8 +4,18 @@
%} %}
%ignore CSM_RASTER_FAMILY; %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 model.i
%import geometricmodel.i %import geometricmodel.i
%import csm.i %import csm.i
%include RasterGM.h %include RasterGM.h
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment