[hdf-compass] 15/295: Updated ASCII plugin to only load data when it is called.
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Sun May 8 10:35:20 UTC 2016
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch debian/master
in repository hdf-compass.
commit 61ef7bf0236d7af260532c818228a83fb9309489
Author: Matt Comerford <matthew.comerford at colorado.edu>
Date: Thu Jul 3 09:49:46 2014 -0600
Updated ASCII plugin to only load data when it is called.
---
asc_model/__init__.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/asc_model/__init__.py b/asc_model/__init__.py
index 21cad87..8e076ac 100644
--- a/asc_model/__init__.py
+++ b/asc_model/__init__.py
@@ -127,7 +127,10 @@ class ASCFile(compass_model.Array):
def __init__(self, store, key):
self._store = store
self._key = key
- self.data = np.loadtxt(self._key, skiprows=6, unpack=True)
+ # Need to load nrows and ncols
+ nrows = int(linecache.getline(self._key, 1).lstrip("ncols"))
+ ncols = int(linecache.getline(self._key, 2).lstrip("nrows"))
+ self.data = np.zeros((nrows, ncols), dtype=float)
@property
def key(self):
@@ -154,6 +157,7 @@ class ASCFile(compass_model.Array):
return self.data.dtype
def __getitem__(self, args):
+ self.data = np.loadtxt(self._key, skiprows=6, unpack=True)
return self.data[args]
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/hdf-compass.git
More information about the debian-science-commits
mailing list