Raised when an error occurs in a diagnostic routine.
| 40 | |
| 41 | |
| 42 | class DiagnosticError(Exception): |
| 43 | """Raised when an error occurs in a diagnostic routine.""" |
| 44 | def __init__(self, message=None): |
| 45 | """Initialize a :class:`wrf.DiagnosticError` object. |
| 46 | |
| 47 | Args: |
| 48 | |
| 49 | message (:obj:`str`): The error message. |
| 50 | |
| 51 | """ |
| 52 | self._msg = message |
| 53 | |
| 54 | def __str__(self): |
| 55 | return self._msg |
| 56 | |
| 57 | def __call__(self, message): |
| 58 | """Callable method to make the exception object raise itself. |
| 59 | |
| 60 | This allows the exception to be thrown from inside Fortran routines |
| 61 | by using f2py's callback mechanism. This is no longer used within |
| 62 | wrf-python, but may be useful to other users. |
| 63 | |
| 64 | See Also: |
| 65 | |
| 66 | `f2py doc <http://docs.scipy.org/doc/numpy-1.11.0/f2py/>`_ |
| 67 | |
| 68 | """ |
| 69 | raise self.__class__(message) |
| 70 | |
| 71 | |
| 72 | # The routines below are thin wrappers around the Fortran functions. These |