Re: [netcdfgroup] java netcdf large array NegativeArraySizeException

  • To: juergen sorg <j.sorg@xxxxxxxxxxxxx>
  • Subject: Re: [netcdfgroup] java netcdf large array NegativeArraySizeException
  • From: John Caron <caron@xxxxxxxx>
  • Date: Thu, 19 Feb 2015 13:33:11 +0000
4000 x 800 x 800 = 2.5 G. In Java, you cant create an array larger than
2^31 = 2.1 elements. So break up your call into smaller pieces. For
performance, you should minimize the amount of memory you are using, eg
make your code loop over the outer dimension and only work with one 800 *
800 array at a time. Will likely go much faster.

btw, you should ask netcdf-java questions at netcdf-java@xxxxxxxxxxxxxxxx

regards,
john

On Mon, Jan 26, 2015 at 12:48 PM, juergen sorg <j.sorg@xxxxxxxxxxxxx> wrote:

> hi,
>
> i tried to create a netcdf 3-dim double array with a shape of
> (4400,800,800). but on creation it occures a 
> java.lang.NegativeArraySizeException.
> with less data (like 250 instead of 4000) everything works well.
> i am using netcdf 4.3.17 from the maven repository and the file is
> generated with the large file support (CDF 002).
> the first dimension (4400) of the array is unlimited
> (timeDim = UNLIMITED ;).
> because the netcdf files are responses of a service the files are
> generated from an existing ncml file.
>
> here is the code of creating the array:
>
> ArrayDouble data = new ArrayDouble.D3(4000,800,800);
>
>
> thanks in advance
>
> gruss juergen
>
>
> _______________________________________________
> netcdfgroup mailing list
> netcdfgroup@xxxxxxxxxxxxxxxx
> For list information or to unsubscribe,  visit:
> http://www.unidata.ucar.edu/mailing_lists/
>
  • 2015 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: