This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
> Full Name: Ann Marie Ascough > Email Address: address@hidden > Organization: USGS > Package Version: 4.0 > Operating System: XP 64-bit > Hardware: > Description of problem: I need to find a way to extract a block of data from a Netcdf file. I have been using Java in Matlab to read the Netcdf files but I have to find a way to efficiently grab a block of data from a file. > I have a function that searches the file to find if a certain bounding box of data is contained within the file, I am using the ProjectionRect class to do that and it works great. Now I want to have that same function return the actual data inside the bounding box. The getData method of Interface PointCollection seems to be exactly what I am looking for but when I try to initiate one of the classes that implements that method I generally get an InstantiationException. I want to extract a group of data at one time because these files are so large it takes over twenty minutes to search and extract data point by point. > Is there a better way to accomplish what I need? > Thanks for your help. > Ann Marie > Hi Ann Marie: theres not really a magic bullet to efficiently extract point data. you are limited to the array-oriented API thats documented in the NetcdfFile javadoc (http://www.unidata.ucar.edu/software/netcdf-java/v2.2.22/javadoc/index.html). Even if the system can open the file as a PointCollection, it will be using those methods underneath. netcdf is not an indexed file system, you may need to use a relational database. if you want to send me a typical file, and what you are trying to do, i can see if theres any obvious solutions. Ticket Details =================== Ticket ID: XGJ-464529 Department: Support netCDF Java Priority: High Status: Closed