Module cswt_error_mod

module cswt_error_mod

        ! Uses
    use s2_types_mod, only: S2_STRING_LEN

        ! Variables
    integer, private, parameter :: CSWT_ERROR_NUM = 27
    integer, public, parameter :: CSWT_ERROR_NONE = 0
    integer, public, parameter :: CSWT_ERROR_INIT = 1
    integer, public, parameter :: CSWT_ERROR_NOT_INIT = 2
    integer, public, parameter :: CSWT_ERROR_INIT_FAIL = 3
    integer, public, parameter :: CSWT_ERROR_SIZE_INVALID = 4
    integer, public, parameter :: CSWT_ERROR_MEM_ALLOC_FAIL = 5
    integer, public, parameter :: CSWT_ERROR_TMPL_PARAM_INVALID = 6
    integer, public, parameter :: CSWT_ERROR_SWAV_FTYPE_INVALID = 7
    integer, public, parameter :: CSWT_ERROR_SWAV_DIL_ERROR = 8
    integer, public, parameter :: CSWT_ERROR_SWAV_ROT_ERROR = 9
    integer, public, parameter :: CSWT_ERROR_TR_AZBANDLIM_INVALID = 10
    integer, public, parameter :: CSWT_ERROR_TR_FILE_EXISTS = 11
    integer, public, parameter :: CSWT_ERROR_TR_FILE_INVALID = 12
    integer, public, parameter :: CSWT_ERROR_TR_LMAX_INVALID = 13
    integer, public, parameter :: CSWT_ERROR_TR_MMAX_INVALID = 14
    integer, public, parameter :: CSWT_ERROR_TR_NGAMMA_INVALID = 15
    integer, public, parameter :: CSWT_ERROR_TR_WCOEFF_NCOMP = 16
    integer, public, parameter :: CSWT_ERROR_TR_WCOEFF_COMP = 17
    integer, public, parameter :: CSWT_ERROR_TR_SWAV_NPRES = 18
    integer, public, parameter :: CSWT_ERROR_TR_DIL_UNIT_INVALID = 19
    integer, public, parameter :: CSWT_ERROR_TR_METHOD_INVALID = 20
    integer, public, parameter :: CSWT_ERROR_TR_KERNEL_INVALID = 21
    integer, public, parameter :: CSWT_ERROR_TR_MASK_MODE_INVALID = 22
    integer, public, parameter :: CSWT_ERROR_TR_THRESNSIG_MODE_INVALID = 23
    integer, public, parameter :: CSWT_ERROR_ANALYSIS = 24
    integer, public, parameter :: CSWT_ERROR_MASK_GEN = 25
    integer, public, parameter :: CSWT_ERROR_PLOT_SWAV = 26
    character (len=S2_STRING_LEN), private, parameter, dimension (CSWT_ERROR_NUM) :: error_comment = (/ 'No error                                                                 ', 'Attempt to initialise object that has already been initialised           ', 'Object not initialised                                                   ', 'Object initialisation failed                                             ', 'Sizes invalid                                                            ', 'Memory allocation failed                                                 ', 'Invalid number of input parameters in template function                  ', 'Invalid function type                                                    ', 'Error dilating spherical wavelet                                         ', 'Error rotating spherical wavelet                                         ', 'Azimuthal band limit not met (increase N_gamma)                          ', 'File already exists                                                      ', 'File invalid                                                             ', 'Lmax invalid                                                             ', 'Mmax invalid                                                             ', 'N gamma invalid (must be odd)                                            ', 'Wavelet coefficients not computed                                        ', 'Wavelet coefficients already computed                                    ', 'Wavelet not present                                                      ', 'Invalid dilation unit                                                    ', 'Spherical wavelet transform method type invalid                          ', 'Kernel invalid                                                           ', 'Invalid mask method specifier                                            ', 'Invalid mask thresholding method specifier                               ', 'Error in cswt_analysis program                                           ', 'Error in cswt_mask_gen program                                           ', 'Error in cswt_plot_swav program                                          ' /)
    logical, private, parameter, dimension (CSWT_ERROR_NUM) :: halt_default = (/ .false., .true., .true., .true., .true., .true., .true., .true., .true., .true., .true., .true., .true., .true., .true., .true., .true., .false., .true., .true., .true., .true., .true., .true., .true., .true., .true. /)

        ! Subroutines and functions
    public subroutine cswt_error (error_code, procedure, comment_add, comment_out, halt_in)

end module cswt_error_mod
Functionality to handle errors that may occur in the CSWT library. Public CSWT error codes are defined, with corresponding private error comments and default halt execution status.

Author: J. D. McEwen (mcewen@mrao.cam.ac.uk)

Version: 0.2 - November 2004


Description of Variables

CSWT_ERROR_NUM

integer, private, parameter :: CSWT_ERROR_NUM = 27

CSWT_ERROR_NONE

integer, public, parameter :: CSWT_ERROR_NONE = 0

CSWT_ERROR_INIT

integer, public, parameter :: CSWT_ERROR_INIT = 1

CSWT_ERROR_NOT_INIT

integer, public, parameter :: CSWT_ERROR_NOT_INIT = 2

CSWT_ERROR_INIT_FAIL

integer, public, parameter :: CSWT_ERROR_INIT_FAIL = 3

CSWT_ERROR_SIZE_INVALID

integer, public, parameter :: CSWT_ERROR_SIZE_INVALID = 4

CSWT_ERROR_MEM_ALLOC_FAIL

integer, public, parameter :: CSWT_ERROR_MEM_ALLOC_FAIL = 5

CSWT_ERROR_TMPL_PARAM_INVALID

integer, public, parameter :: CSWT_ERROR_TMPL_PARAM_INVALID = 6

CSWT_ERROR_SWAV_FTYPE_INVALID

integer, public, parameter :: CSWT_ERROR_SWAV_FTYPE_INVALID = 7

CSWT_ERROR_SWAV_DIL_ERROR

integer, public, parameter :: CSWT_ERROR_SWAV_DIL_ERROR = 8

CSWT_ERROR_SWAV_ROT_ERROR

integer, public, parameter :: CSWT_ERROR_SWAV_ROT_ERROR = 9

CSWT_ERROR_TR_AZBANDLIM_INVALID

integer, public, parameter :: CSWT_ERROR_TR_AZBANDLIM_INVALID = 10

CSWT_ERROR_TR_FILE_EXISTS

integer, public, parameter :: CSWT_ERROR_TR_FILE_EXISTS = 11

CSWT_ERROR_TR_FILE_INVALID

integer, public, parameter :: CSWT_ERROR_TR_FILE_INVALID = 12

CSWT_ERROR_TR_LMAX_INVALID

integer, public, parameter :: CSWT_ERROR_TR_LMAX_INVALID = 13

CSWT_ERROR_TR_MMAX_INVALID

integer, public, parameter :: CSWT_ERROR_TR_MMAX_INVALID = 14

CSWT_ERROR_TR_NGAMMA_INVALID

integer, public, parameter :: CSWT_ERROR_TR_NGAMMA_INVALID = 15

CSWT_ERROR_TR_WCOEFF_NCOMP

integer, public, parameter :: CSWT_ERROR_TR_WCOEFF_NCOMP = 16

CSWT_ERROR_TR_WCOEFF_COMP

integer, public, parameter :: CSWT_ERROR_TR_WCOEFF_COMP = 17

CSWT_ERROR_TR_SWAV_NPRES

integer, public, parameter :: CSWT_ERROR_TR_SWAV_NPRES = 18

CSWT_ERROR_TR_DIL_UNIT_INVALID

integer, public, parameter :: CSWT_ERROR_TR_DIL_UNIT_INVALID = 19

CSWT_ERROR_TR_METHOD_INVALID

integer, public, parameter :: CSWT_ERROR_TR_METHOD_INVALID = 20

CSWT_ERROR_TR_KERNEL_INVALID

integer, public, parameter :: CSWT_ERROR_TR_KERNEL_INVALID = 21

CSWT_ERROR_TR_MASK_MODE_INVALID

integer, public, parameter :: CSWT_ERROR_TR_MASK_MODE_INVALID = 22

CSWT_ERROR_TR_THRESNSIG_MODE_INVALID

integer, public, parameter :: CSWT_ERROR_TR_THRESNSIG_MODE_INVALID = 23

CSWT_ERROR_ANALYSIS

integer, public, parameter :: CSWT_ERROR_ANALYSIS = 24

CSWT_ERROR_MASK_GEN

integer, public, parameter :: CSWT_ERROR_MASK_GEN = 25

CSWT_ERROR_PLOT_SWAV

integer, public, parameter :: CSWT_ERROR_PLOT_SWAV = 26

error_comment

character (len=S2_STRING_LEN), private, parameter, dimension (CSWT_ERROR_NUM) :: error_comment = (/ 'No error                                                                 ', 'Attempt to initialise object that has already been initialised           ', 'Object not initialised                                                   ', 'Object initialisation failed                                             ', 'Sizes invalid                                                            ', 'Memory allocation failed                                                 ', 'Invalid number of input parameters in template function                  ', 'Invalid function type                                                    ', 'Error dilating spherical wavelet                                         ', 'Error rotating spherical wavelet                                         ', 'Azimuthal band limit not met (increase N_gamma)                          ', 'File already exists                                                      ', 'File invalid                                                             ', 'Lmax invalid                                                             ', 'Mmax invalid                                                             ', 'N gamma invalid (must be odd)                                            ', 'Wavelet coefficients not computed                                        ', 'Wavelet coefficients already computed                                    ', 'Wavelet not present                                                      ', 'Invalid dilation unit                                                    ', 'Spherical wavelet transform method type invalid                          ', 'Kernel invalid                                                           ', 'Invalid mask method specifier                                            ', 'Invalid mask thresholding method specifier                               ', 'Error in cswt_analysis program                                           ', 'Error in cswt_mask_gen program                                           ', 'Error in cswt_plot_swav program                                          ' /)
Comment associated with each error type.

halt_default

logical, private, parameter, dimension (CSWT_ERROR_NUM) :: halt_default = (/ .false., .true., .true., .true., .true., .true., .true., .true., .true., .true., .true., .true., .true., .true., .true., .true., .true., .false., .true., .true., .true., .true., .true., .true., .true., .true., .true. /)
Default program halt status of each error type.

Description of Subroutines and Functions

cswt_error

public subroutine cswt_error (error_code, procedure, comment_add, comment_out, halt_in)
    integer, intent(in) :: error_code
    character (len=*), optional, intent(in) :: procedure
    character (len=*), optional, intent(in) :: comment_add
    character (len=*), optional, intent(inout) :: comment_out
    logical, optional, intent(in) :: halt_in
end subroutine cswt_error
Display error message corresponding to error_code and halt program execution if required.

Variables:

Author: J. D. McEwen

Version: 0.2 - November 2004