Skip to content
This repository was archived by the owner on Sep 9, 2020. It is now read-only.

wrong None check in asc.py causes last row not being loaded and asc2hasc fail #38

@arkanoid87

Description

@arkanoid87

when nodata header line is missing line:
self._loadHeaderLine(self._nextLine, self._key_nodata, type("a"), True)
returns None but you check self._nodata != "" that would always return True, so first line of data is skipped and this causes last row not being loaded (full of None), then "-m nn" fails to run with misleading error:

    def _loadHeader(self):
        # Mandatory header
        self._set_ncols(self._loadHeaderLine(self._file.readline(), self._key_ncols,  type(1)))
        self._set_nrows(self._loadHeaderLine(self._file.readline(), self._key_nrows,  type(1)))
        self._xll     = self._loadHeaderLine(self._file.readline(), self._key_xll,    type(1.0))
        self._yll     = self._loadHeaderLine(self._file.readline(), self._key_yll,    type(1.0))
        self._set_size( self._loadHeaderLine(self._file.readline(), self._key_size,   type(1.0)))
        # Optional headers
        self._nextLine = self._file.readline()
        self._nodata = self._loadHeaderLine(self._nextLine, self._key_nodata, type("a"), True)
        if self._nodata != "" :
            self._nextLine = self._file.readline()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions