[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: opendap indices subscript



Hi Thomas:

The FileWriter is a simple piece of code that reads the entire variable's data 
into memory and then writes it out to the new file. It should see how large the 
data is and do it in some reasonable sized chunks, say, 1 Mbyte. You could take 
FileWriter and modify it for your needs. If you did it in a general way, I 
could add it to the release so others could take advantage of it.

Thomas LOUBRIEU wrote:
Hi all,

I have a problem when I use the java netcdf API (in version 2.2.18 or 2.2.19) for saving OPeNDAP request results as NetCDF files.

One example of OPeNDAP URL I use is :
http://www.ifremer.fr/thredds3/dodsC/CORIOLIS-GLOBAL-RTOA/sea_water_temperature/aggregated_time_serie?temperature[0:1][1:2][13:23][13:33]

I first tried  with these lines of code :

    try {
          NetcdfDatasetCache.disable();
ncfile = (NetcdfFile)NetcdfDataset.acquireDataset(filename, null);
          FileWriter.writeToFile(ncfile,
                  "/tmp/test.nc",
                  false,
                  0);                    } catch (IOException ioe) {
            System.out.println("trying to open " +  ioe.getMessage());
                  }
...

But the API is trying to download the full dataset by sending to the server a request like : http://www.ifremer.fr/thredds3/dodsC/CORIOLIS-GLOBAL-RTOA/sea_water_temperature/aggregated_time_serie?temperature

Of course the server cannot answer such a request because the volume for the dataset is about 20 Gb...

In order to avoid this, I've created an object in order to set to 'false' the 'preload' static attribute of the 'DODSNetcdfFile' object.

Now the API sends requests like :
http://www.ifremer.fr/thredds3/dodsC/CORIOLIS-GLOBAL-RTOA/sea_water_temperature/aggregated_time_serie?latitude[0:1:10]
or
http://www.ifremer.fr/thredds3/dodsC/CORIOLIS-GLOBAL-RTOA/sea_water_temperature/aggregated_time_serie?temperature[0:1:1][0:1:1][0:1:10][0:1:20]
...
(as many as required variables)

It is quite right but the offsets of my array subscript disappear and become '0' for every request and every variable.

It seems that the problem happens in the 'readArrays' method of the 'DODSNetcdfFile' object.

Does anyone already face this problem ? Is this a bug or a mis-use of the API ?

Thanks in advance for any piece of advice you could give me.

Thomas




===============================================================================
To unsubscribe netcdf-java, visit:
http://www.unidata.ucar.edu/mailing-list-delete-form.html
===============================================================================

===============================================================================
To unsubscribe netcdf-java, visit:
http://www.unidata.ucar.edu/mailing-list-delete-form.html
===============================================================================