Buffered file manager module.
- class natcap.invest.recreation.buffered_numpy_disk_map.BufferedNumpyDiskMap(manager_filename, max_bytes_to_buffer)¶
Persistent object to append and read numpy arrays to unique keys.
This object is abstractly a key/value pair map where the operations are to append, read, and delete numpy arrays associated with those keys. The object attempts to keep data in RAM as much as possible and saves data to files on disk to manage memory and persist between instantiations.
- append(array_id, array_data)¶
Append data to the file.
array_id (int) – unique key to identify the array node
array_data (numpy.ndarray) – data to append to node.
Delete node array_id from disk and cache.
Method to flush data in memory to disk.
Read the entirety of the file.
Internally this might mean that part of the file is read from disk and the end from the buffer or any combination of those.
array_id (string) – unique node id to read
contents of node as a numpy.ndarray.