From 378804a609e0283d8b912d49d1644ef21b20bd4c Mon Sep 17 00:00:00 2001 From: ranjanan Date: Mon, 13 Mar 2023 22:14:39 +0530 Subject: [PATCH] Fix indexing while reading source and ground files --- src/io.jl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/io.jl b/src/io.jl index 4a89dc2..2e8bc1e 100644 --- a/src/io.jl +++ b/src/io.jl @@ -262,7 +262,9 @@ function read_source_and_ground_maps(T, V, source_file, ground_file, habitatmeta elseif filetype == FILE_TYPE_TXTLIST rc = _txt_list_reader(ground_file, T, habitatmeta) ground_map = -9999 * ones(T, habitatmeta.nrows, habitatmeta.ncols) - ground_map[V.(rc[:,2]), V.(rc[:,3])] = rc[:,1] + for (x,y,v) in zip(rc[:,2], rc[:,3], rc[:,1]) + ground_map[V(x), V(y)] = v + end else throw(ErrorException("Cannot recognise file type.")) end @@ -277,7 +279,9 @@ function read_source_and_ground_maps(T, V, source_file, ground_file, habitatmeta elseif filetype == FILE_TYPE_TXTLIST rc = _txt_list_reader(source_file, T, habitatmeta) source_map = -9999 * ones(T, habitatmeta.nrows, habitatmeta.ncols) - source_map[V.(rc[:,2]), V.(rc[:,3])] = rc[:,1] + for (x,y,v) in zip(rc[:,2], rc[:,3], rc[:,1]) + source_map[V(x), V(y)] = v + end else throw(ErrorException("Cannot recognize file type.")) end