xarray-contrib / xarray-simlab

Xarray extension and framework for computer model simulations
http://xarray-simlab.readthedocs.io
BSD 3-Clause "New" or "Revised" License
73 stars 9 forks source link

Issue with non-decorated classes inheriting from process-decorated classes #138

Closed benbovy closed 4 years ago

benbovy commented 4 years ago

That's an edge case with a surprising effect: if we create a new class that inherits from an existing process class, but we forget to decorate it with xs.process, it is actually the latter (i.e., the parent class) that is used when the former (i.e., the child class) is included in a Model. No error is raised when creating the Model object, so it was hard to figure it out.

We must ensure that the function below raises an error when cls is not itself process-decorated. The try... except block in that function is not enough.

https://github.com/benbovy/xarray-simlab/blob/45359e99cbf6341464b02cb937618c051a58a31c/xsimlab/process.py#L24