Re: JLink Java exception reading netcdf file via input
- To: mathgroup at smc.vnet.net
- Subject: [mg113946] Re: JLink Java exception reading netcdf file via input
- From: Herman Kuun <oomkoos1 at gmail.com>
- Date: Fri, 19 Nov 2010 05:07:38 -0500 (EST)
Looking at the error message; "OutOfMemoryError: Java heap " Try increasing the Java Virtual Machine's heapsize by editing; $UserBaseDirectory/Kernel/init.m and add the following two lines; Needs["JLink`"]; ReinstallJava[JVMArguments -> "-Xmx800m"]; Best Herman On Thu, Nov 18, 2010 at 2:05 PM, m. r. <schaferk at bellsouth.net> wrote: > greetings: > Mathematica version 7.0.1 Mac OSX x86 > > > i use the (below) code to read a netcdf file successfully with 50M > file > > nx=600;ny=300; > > eta = Partition[ > Partition[ > Import[ "Eta.NCOM.ARPS.input.nc", {"Datasets", "Eta"} > ] // Flatten, nx > ], ny > ]; > > [PBG5:LZS64/expt_104/run] me% ls -l Eta.NCOM.ARPS.input.nc > -rw-r--r-- 1 me me 59768432 Sep 28 2009 /Users/me/Papers/ > 4paperMindoro/nc/Eta.NCOM.ARPS.input.nc > > when i try the same technique on another file of approximately 200M, > i get a JLink exception. > > nx=348;ny0; > > eta = Partition[ > Partition[ > Import[ "Eta.MITgcm.LZS64.02.1.4.8.input.nc", {"Datasets", "Eta"} > ] // Flatten, nx > ], ny > ]; > > [PBG5:LZS64/expt_104/run] schaferk% ls -l *.nc > -rw-r--r-- 1 me me 200761728 Oct 15 19:34 > Eta.MITgcm.LZS64.02.1.4.8.input.nc > > here is the error message: > > JLink`Java::"excptn" : " > StyleBox[\"\\\"\<A Java exception occurred: \>\\\"\", \"MT\"] \ > [NoBreak] > StyleBox[\"\\\"\<java.lang.OutOfMemoryError: Java heap \ > space\\\\\\\\n\\\\\\\\tat \ > ucar.ma2.ArrayFloat.<init>(ArrayFloat.java:86)\\\\\\\\n\\\\\\\\tat \ > ucar.ma2.ArrayFloat$D4.<init>(ArrayFloat.java:313)\\\\\\\\n\\\\\\\ > \tat \ > ucar.ma2.ArrayFloat$D4.<init>(ArrayFloat.java:305)\\\\\\\\n\\\\\\\ > \tat \ > ucar.ma2.ArrayFloat.factory(ArrayFloat.java:51)\\\\\\\\n\\\\\\\\tat \ > ucar.ma2.ArrayFloat.factory(ArrayFloat.java:36)\\\\\\\\n\\\\\\\\tat \ > ucar.ma2.Array.factory(Array.java:130)\\\\\\\\n\\\\\\\\tat \ > ucar.ma2.Array.factory(Array.java:90)\\\\\\\\n\\\\\\\\tat \ > ucar.ma2.Array.copy(Array.java:449)\\\\\\\\n\\\\\\\\tat \ > ucar.ma2.Array.copyTo1DJavaArray(Array.java:478)\>\\\"\", \"MT\"] \ > [NoBreak] > StyleBox[\"\\\"\<.\>\\\"\", \"MT\"] " > > the tech support fellow said that the 50 million entry array Eta is > running into a > bottle neck in the Import process and that there is no workaround. > > another popular math software system was able to read the file in a > few seconds. > > any ideas of a workaround in Mathematica? > > michael schaferkotter > >