Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Hoek, Steven
lmgeo
Commits
9812e779
Commit
9812e779
authored
Jun 22, 2016
by
Hoek, Steven
Browse files
Few TODO comments added as well as a method called get_value
parent
ec57b91b
Changes
1
Show whitespace changes
Inline
Side-by-side
formats/asciigrid.py
View file @
9812e779
...
...
@@ -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
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment