DaniSb170 / nctoolbox

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

Geosubset method crippled by slow Z computation #54

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago

The geosubset method for geovariable is crippled by extremely slow Z 
computation for stretched coordinate models.  In the example below, the user 
asks for a subset of surface temperature (the top layer from a ROMS model), and 
geosubset takes 45 seconds ( on my system) to return.  If you ask for just the 
subset of data, it takes 0.38 seconds:

url='http://oceanmodeling.pmc.ucsc.edu:8080/thredds/dodsC/ccsnrt/fmrc/CCSNRT_Agg
regation_best.ncd';
 nc=ncgeodataset(url);
  tvar=nc.geovariable('temp');

  s.lon=[-123.0 -121.5];
  s.lat=[35.5 37.3]; 
  s.z_index=42;
  s.time=[2012 05 18 12 0 0];
  tic; tg=tvar.geosubset(s);toc

The Z computation must be doing something very stupid, like looping over I and 
J and computing the Z coordinates at each grid cell instead of vectorization 
the computation.

So what should we do?

1. Make it optional to compute Z when doing geosubset.  Note that in this 
example, the user who just wanted surface temperature probably doesn't even 
care about Z.  So add an argument or something:

tvar.geosubset(s,'no-z'), or s.zcalc='false' or something.

2. Figure out why the computation of Z is so slow and fix it.

Original issue reported on code.google.com by rsignell on 21 Jun 2012 at 6:34

GoogleCodeExporter commented 8 years ago

Original comment by crosb...@gmail.com on 21 Jun 2012 at 7:06