NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program. _From owner-netcdf-java@xxxxxxxxxxxxxxxx Fri May 13 07:13:08 2005 Received: (from majordo@localhost) by unidata.ucar.edu (UCAR/Unidata) id j4DDBnqX005490 for netcdf-java-out; Fri, 13 May 2005 07:11:49 -0600 (MDT) Received: from vimg3.rdg.ac.uk (vimg3.rdg.ac.uk [134.225.1.80]) by unidata.ucar.edu (UCAR/Unidata) with ESMTP id j4DDBmP3005482 for <netcdf-java@xxxxxxxxxxxxxxxx>; Fri, 13 May 2005 07:11:48 -0600 (MDT) Organization: UCAR/Unidata Keywords: 200505131311.j4DDBmP3005482 Received: from vimp2.rdg.ac.uk ([134.225.16.91]) by vimg3.rdg.ac.uk (Exim: gateway) with esmtp id 1DWZx9-0005PU-00 for netcdf-java@xxxxxxxxxxxxxxxx; Fri, 13 May 2005 14:11:43 +0100 Received: from vimh1.rdg.ac.uk ([134.225.16.83]) by vimp2.rdg.ac.uk (Exim: virusscanner) with esmtp id 1DWZx4-0006yB-00 for netcdf-java@xxxxxxxxxxxxxxxx; Fri, 13 May 2005 14:11:38 +0100 Received: from mercury.nerc-essc.ac.uk ([192.171.166.1]) by vimh1.rdg.ac.uk (Exim: host) with esmtp id 1DWZx3-0006zl-00; Fri, 13 May 2005 14:11:37 +0100 Received: from sweeney.nerc-essc.ac.uk (sweeney.nerc-essc.ac.uk [192.171.166.116]) by mercury.nerc-essc.ac.uk (8.12.10/8.12.10) with ESMTP id j4DDBbXZ010756; Fri, 13 May 2005 14:11:37 +0100 (BST) Received: from localhost.localdomain (sweeney [127.0.0.1]) by sweeney.nerc-essc.ac.uk (8.12.8/8.12.8) with ESMTP id j4DDBbwX009402; Fri, 13 May 2005 14:11:37 +0100 Received: (from apache@localhost) by localhost.localdomain (8.12.8/8.12.8/Submit) id j4DDBak9009400; Fri, 13 May 2005 14:11:36 +0100 Received: from brahman.nerc-essc.ac.uk (brahman.nerc-essc.ac.uk [192.171.166.139]) by www.nerc-essc.ac.uk (IMP) with HTTP for <ads@xxxxxxxxxxxxxxxxxxxxxxx>; Fri, 13 May 2005 14:11:36 +0100 Cc: support-netcdf-java@xxxxxxxxxxxxxxxx MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.2 X-Originating-IP: 192.171.166.139 X-Scanner: exiscan *1DWZx4-0006yB-00*BjAtZdRdWiY* (The University of Reading) Sender: owner-netcdf-java@xxxxxxxxxxxxxxxx Precedence: bulk Hello folks, I was just wondering if anyone in the community has been using the netcdf library for manipulating GRIB files and if you have come across any problems related to extracting subsets of data along x-y space of a 4D grid (T,Z,lat,lon) where size (Z=20,lat=630,lon=899). When I am trying to extract it at one go, I am getting the following error messages: for range: myList.add(0, new Range(0, 0, 1)); myList.add(1, new Range(0, 9, 2)); myList.add(2, new Range(500, 550, 1)); myList.add(3, new Range(700, 725, 1)); Array arr = myVar.read(myList); ArrayList newList = new ArrayList(); Error: java.lang.ArrayIndexOutOfBoundsException: 6630 at ucar.ma2.ArrayFloat.setFloat(ArrayFloat.java:193) at ucar.ma2.IteratorFast.setFloatNext(IteratorFast.java:61) at ucar.nc2.iosp.grib.GribServiceProvider.readXY(GribServiceProvider.java:177) at ucar.nc2.iosp.grib.GribServiceProvider.readLevel(GribServiceProvider.java:150) at ucar.nc2.iosp.grib.GribServiceProvider.readData(GribServiceProvider.java:134) at ucar.nc2.NetcdfFile.readData(NetcdfFile.java:848) at ucar.nc2.Variable._read(Variable.java:737) at ucar.nc2.Variable.read(Variable.java:451) at Test2netcdf.readData(Test2netcdf.java:50) at Test2netcdf.main(Test2netcdf.java:112) I have to extract the data in two stages.In the first step, I just have to extract data at a particular time and depth level(s) but all of latitude-longitude space. Then, in second stage I have to apply the range for latitude-longitude. ArrayList myList = new ArrayList(); myList.add(0, new Range(0, 0, 1)); myList.add(1, new Range(0, 9, 2)); myList.add(2, new Range(0, 629, 1));//all of lat myList.add(3, new Range(0, 899, 1));//all of lon Array arr = myVar.read(myList); ArrayList newList = new ArrayList(); int[] newShape = arr.getShape(); newList.add(0, new Range(0, 0, 1)); newList.add(1, new Range(0, (newShape[1]-1), 1)); newList.add(2, new Range(500, 550, 1));//apply range for lat newList.add(3, new Range(700, 725, 1));//apply range for lon Array new_arr = arr.sectionNoReduce(newList); float[] data = (float[])new_arr.copyTo1DJavaArray(); This approach is ok when extracting data from small number of files but the performance would deteriorate if extracting from 100+ files having quite big lat-lon spaces. Your comments would be much appreciated. Cheers, Adit
netcdf-java
archives: