Skip to content

Please clarify this _ier_codes value for Exceptions from sTriangulation._update_triangulation(...) #117

@sound-fx

Description

@sound-fx

Where spherical.py defines _ier_codes, one of the values -- the value for -2 -- should be extended.

_ier_codes = {0:  "no errors were encountered.",
              -1: "N < 3 on input.",
              -2: "the first three nodes lie on a great circle.\nSet permute to True or reorder nodes manually.",
              -3: "duplicate nodes were encountered.",
              -4: "an error flag was returned by a call to SWAP in ADDNOD.\n \
                   This is an internal error and should be reported to the programmer.",
              'L':"nodes L and M coincide for some M > L.\n \
                   The linked list represents a triangulation of nodes 1 to M-1 in this case.",
              1: "NCC, N, NROW, or an LCC entry is outside its valid range on input.",
              2: "the triangulation data structure (LIST,LPTR,LEND) is invalid.",
              'K': 'NPTS(K) is not a valid index in the range 1 to N.',
              9999: "Triangulation encountered duplicate nodes."}

The trmesh subroutine can return a value ierr==-2 in two different instances, but the _ier_codes[-2] message accurately describes only the first of these. The second instance is this block from the subroutine:

    call addnod ( near(k), k, x, y, z, list, lptr, lend, lnew, ier )

    if ( ier /= 0 ) then
      write ( *, '(a)' ) ' '
      write ( *, '(a)' ) 'sTRMESH - Fatal error!'
      write ( *, '(a,i8)' ) '  ADDNOD returned error code IER = ', ier
      return
    end if

The _ier_codes[-2] message should mention this second instance as a possibility, as otherwise it can misrepresent the error and give unhelpful guidance.

Better still, if the sTriangulation._update_triangulation(self, lons, lats) method parses the stdout from the call to trmesh subroutine, it can distinguish between these two instances and give the specific, applicable error message.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions