cdm/src/main/java/ucar/nc2/NetcdfFile.java
public static NetcdfFile openInMemory(URI uri) throws IOException {
    URL url = uri.toURL();
    byte[] contents = IO.readContentsToByteArray(url.openStream());
    return openInMemory(uri.toString(), contents);
  }
public static NetcdfFile openInMemory(URI uri) throws IOException {
    URL url = uri.toURL();
    byte[] contents = IO.readContentsToByteArray(url.openStream());
    return openInMemory(uri.toString(), contents);
  }
Read a remote CDM file into memory. All reads are then done from memory.

@param uri location of CDM file, must be accessible through url.toURL().openStream().
@return a NetcdfFile, which is completely in memory
@throws IOException if error reading file