# HG changeset patch # User abarth93 # Date 1352732549 0 # Node ID f53febae9f93588427b6f25116186b1923dfce90 # Parent 9eb4a3b222e2e70611da424110d6605701abdd2b diff -r 9eb4a3b222e2 -r f53febae9f93 extra/ncArray/DESCRIPTION --- a/extra/ncArray/DESCRIPTION Sun Nov 11 13:33:52 2012 +0000 +++ b/extra/ncArray/DESCRIPTION Mon Nov 12 15:02:29 2012 +0000 @@ -4,7 +4,7 @@ Author: Alexander Barth Maintainer: Alexander Barth Title: ncArray -Description: Subsetting and concatenating of NetCDF files +Description: Access a single or a collection of NetCDF files as a multi-dimensional array Categories: IO Depends: octave (>= 3.4.0), octcdf (>= 1.1.5) Autoload: yes diff -r 9eb4a3b222e2 -r f53febae9f93 extra/ncArray/inst/cached_decompress.m --- a/extra/ncArray/inst/cached_decompress.m Sun Nov 11 13:33:52 2012 +0000 +++ b/extra/ncArray/inst/cached_decompress.m Mon Nov 12 15:02:29 2012 +0000 @@ -7,25 +7,27 @@ % % Output: % fname: the filename of the uncompressed file +% +% Global variables: +% CACHED_DECOMPRESS_DIR (default fullfile(getenv('HOME'),'tmp','Cache')): +% cache directory of decompressed files +% CACHED_DECOMPRESS_LOG_FID (default 1): file id for log message +% CACHED_DECOMPRESS_MAX_SIZE (default 1e10): maximum size of cache in bytes. % Alexander Barth, 2012-06-13 % -function [fname] = cached_decompress(url) +function [fname]=cached_decompress(url) global CACHED_DECOMPRESS_DIR global CACHED_DECOMPRESS_LOG_FID - +global CACHED_DECOMPRESS_MAX_SIZE cache_dir = CACHED_DECOMPRESS_DIR; if isempty(cache_dir) cache_dir = fullfile(getenv('HOME'),'tmp','Cache'); end -% do nothing if -% file is a a remote url (begins with http:) -% or file does not end with .gz or .bz2 - if beginswith(url,'http:') || ~(endswith(url,'.gz') || endswith(url,'.bz2')) % opendap url or not compressed file fname = url; @@ -69,7 +71,11 @@ d=dir(cache_dir); cashe_size = sum([d.bytes]); -max_cache_size = 1e10; +max_cache_size = CACHED_DECOMPRESS_MAX_SIZE; + +if isempty(max_cache_size) + max_cache_size = 1e10; +end if (cashe_size > max_cache_size)