Commit 9812e779 authored by Hoek, Steven's avatar Hoek, Steven
Browse files

Few TODO comments added as well as a method called get_value

parent ec57b91b
......@@ -89,6 +89,7 @@ class AsciiGrid(GridEnvelope2D, Raster):
def readheader(self):
# Assume that the file is open; read header of the file and assign all attributes
if (self.datafile != None):
# TODO: make this case-insensitive!
if (not self.datafile.closed):
hl = self.datafile.readline();
self.ncols = int(hl.replace('ncols', ''));
......@@ -187,6 +188,7 @@ class AsciiGrid(GridEnvelope2D, Raster):
# We assume that exactly 1 row is included.
try:
if (self.datatype == const.INTEGER):
# TODO deal with numpy arrays if necessary
for k in range(0, self.ncols):
s = str(sequence_with_data[k]).rjust(const.MAXDIGITSPERCELL + 1);
self.datafile.write(s);
......@@ -210,3 +212,10 @@ class AsciiGrid(GridEnvelope2D, Raster):
self.readheader();
super(AsciiGrid, self).reset()
def get_value(self, i, k):
# Return the wanted value
for _ in range(0, i): self.next(False)
line = self.next()
self.reset()
return line[int(k)]
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment