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

[THREDDS #ICY-921665]: Error generated using NetcdfFile.openInMemory

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.


  • Subject: [THREDDS #ICY-921665]: Error generated using NetcdfFile.openInMemory
  • Date: Tue, 05 Feb 2008 06:35:25 -0700

Hi Leakha:

use 

    URL url = new URL( location);
    byte[] contents = IO.readContentsToByteArray(url.openStream());
    NetcdfFile.openInMemory(uri.toString(), contents);

IO is currently in thredds.util package, but will move to ucar.nc2.util in 
version 4.0. I will also add a new method in 4.0:

  /**
   * Read a remote CDM file into memory. All reads are then done from memory.
   * @param uri location of CDM file, must be accessible through 
uri.toURL().openStream().
   * @return a NetcdfFile, which is completely in memory
   * @throws IOException if error reading file
   */
  public static NetcdfFile openInMemory(URI uri) throws IOException;

Ticket Details
===================
Ticket ID: ICY-921665
Department: Support THREDDS
Priority: Normal
Status: Closed