DataOutputStream stream = new DataOutputStream(new BufferedOutputStream(s.getOutputStream(), bufferSize));
NetcdfFile ncfile = NetcdfFile.open(f.getPath());
N3outputStreamWriter writer = new N3outputStreamWriter(ncfile);
writer.writeHeader(stream, -1);
writer.writeDataAll(stream);
stream.close();
stream.close();