mtalpe / nctoolbox

Automatically exported from code.google.com/p/nctoolbox
0 stars 0 forks source link

Can we do local disk caching? #46

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Can we do local disk caching in Nctoolbox?

I think in the old njtbx we used to do something like
import ucar.nc2.util.DiskCache2;
cache = DiskCache2(cacheDir, false, persistMinutes, scourEveryMinutes);

or something.

If we *can* do it, can a demo or a blurb of doc be created to describe how?

Thanks,
Rich

Original issue reported on code.google.com by rsignell on 11 May 2012 at 7:36

GoogleCodeExporter commented 8 years ago
Yep, we can do local disk caching. (NetCDF caching docs are at 
http://www.unidata.ucar.edu/software/netcdf-java/reference/Caching.html). 
However, there's caching for different things. Can you write me a quick little 
blurb, use case, or user story about what you want to cache, or why you want 
caching enabled? 

Original comment by bschlin...@gmail.com on 11 May 2012 at 8:04

GoogleCodeExporter commented 8 years ago
Here's the use case where we thought caching might help: Alfredo is trying to 
track particles in an unstructured grid (triangle-based) ocean model.  His 
particles are covering a small part of the domain, so his strategy is to loop 
through the particles, finding which triangle the particle is in, and then 
doing an opendap request to get the velocity for the surrounding triangles to 
do the interpolation.  He thought since he may end up asking for the same 
velocities over and over (particles in the same triangle, for example) that it 
would be good to cache locally.  But these are tiny amounts of data, so maybe 
disk caching would not be the right solution?

Any ideas would be welcome.
Thanks,
Rich

Original comment by rsignell on 11 May 2012 at 8:11

GoogleCodeExporter commented 8 years ago
I have a particle model on top of nctoolbox too. Its not hard to optimize this 
stuff in matlab itself. What functions in nctoolbox is he using? Time wise, 
there is a lot of overhead in the subsetting functions, not a lot of time taken 
actually making a request, but having to make many requests in a short period 
of time does start to hurt the speed of service. Disk caching could be a good 
option, or memory caching in matlab workspace itself. Is here requesting the 
same timestep multiple times?

Original comment by crosb...@gmail.com on 18 May 2012 at 2:38