DaniSb170 / nctoolbox

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

Elapse time when reading Grib files #51

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
The problem is the elapse time when reading a variable

What is the expected output? What do you see instead?
Output is well obtained, the problem is the elapse time reading the Grib file

What version of the product are you using? On what operating system?
Last available version on windows xp

Please provide any additional information below.

I'm reading Grib files from the ERA Interim reanalysis with matlab.The Grib 
files size is about 500MB (a file per year)

The elapse time for reading a single variable is about 20 seconds, which makes 
the matlab routine extremely slow.

I'm using the following instructions:

pointer=ncgeodataset(id);
var=pointer.geovariable('N10_metre_U_wind_component'); 
datau=var.data(:,:,inx2,inx3);

Being inx2 and inx3 the lat/long indexes
Is there any faster alternative to read data?

Thank you very much
Best regards
Jose

Original issue reported on code.google.com by josemi.j...@gmail.com on 13 Jun 2012 at 10:16

GoogleCodeExporter commented 8 years ago
Hi Jose,

Are you reading a local file or an opendap url? If it's a URL can you post the 
link so that I can run tests against it? If it's a local file would it be 
possible for you to put the file on an FTP server or web server so I can fetch 
it and test with it?

Thanks

Original comment by bschlin...@gmail.com on 13 Jun 2012 at 3:42

GoogleCodeExporter commented 8 years ago
I'm reading in a local way,
Please give me your email address so I can send instructions to download the 
data,
Thank you very much,

Best regards
Jose

Original comment by josemi.j...@gmail.com on 13 Jun 2012 at 4:53

GoogleCodeExporter commented 8 years ago
Hi Jose, you can send instructions to bschlining@gmail.com

Original comment by bschlin...@gmail.com on 13 Jun 2012 at 5:56

GoogleCodeExporter commented 8 years ago
Here's my timings:

In Matlab:
    >> tic;datau=nc.data('N10_metre_U_wind_component',[1 1 1 1], [1 1460 1 1]);toc
Elapsed time is 9.122844 seconds.

Using attached Groovy script:
    >> gribtest.groovy output.grib N10_metre_U_wind_component
0.686330000 s - Open dataset
0.076044000 s - Find Variable
10.416374000 s - Read Data
0.013523000 s - Copy to Array
11.192271000 s (Total)

The Groovy script is showing that nearly ALL the time is spent in Grib's Java 
implementation. There's nothing in nctoolbox contributing to the long reads 
you're seeing. Rather, the delay is all in Grib's java code. If you need to 
read grib files faster you'll need to contact the NetCDF folks at UCAR and see 
if they'll optimize the grib code. Sorry.

Original comment by bschlin...@gmail.com on 13 Jun 2012 at 8:04

Attachments:

GoogleCodeExporter commented 8 years ago
Thank you very much for the help,
It'll be difficult to get the UCAR people working in this, but it's great to 
know that the problem is not in the nctoolbox.

Congratulations on the toolbox, it's awesome and above all very easy to use,
Thanks
Regards
Jose,

Original comment by josemi.j...@gmail.com on 14 Jun 2012 at 11:43