/** * Write the input file to the output file. * @param cancel allow user to cancel; may be null. * @return the open output file. * @throws IOException */ public NetcdfFile write(CancelTask cancel) throws IOException { try { if (version.isNetdf4format()) addGroup4(null, fileIn.getRootGroup()); else addNetcdf3(); if (cancel != null && cancel.isCancel()) return null; if (debugWrite) System.out.printf("About to write = %n%s%n", writer.getNetcdfFile()); // create the file writer.create(); if (debug) System.out.printf("File Out= %n%s%n", writer.getNetcdfFile()); if (cancel != null && cancel.isCancel()) return null; double total = copyVarData(varList, null, cancel); if (cancel != null && cancel.isCancel()) return null; writer.flush(); if (debug) System.out.println("FileWriter done total bytes = " + total); } catch (IOException ioe) { writer.abort(); // clean up throw ioe; } return writer.getNetcdfFile(); }
/** * Write the input file to the output file. * @param cancel allow user to cancel; may be null. * @return the open output file. * @throws IOException */ public NetcdfFile write(CancelTask cancel) throws IOException { try { if (version.isExtendedModel()) addGroupExtended(null, fileIn.getRootGroup()); else addGroupClassic(); if (cancel != null && cancel.isCancel()) return null; // create the file writer.create(); if (cancel != null && cancel.isCancel()) return null; double total = copyVarData(varList, null, cancel); if (cancel != null && cancel.isCancel()) return null; writer.flush(); if (debug) System.out.println("FileWriter done total bytes = " + total); } catch (IOException ioe) { ioe.printStackTrace(); writer.abort(); // clean up throw ioe; } return writer.getNetcdfFile(); }
/** * Write the input file to the output file. * @param cancel allow user to cancel; may be null. * @return the open output file. * @throws IOException */ public NetcdfFile write(CancelTask cancel) throws IOException { try { if (version.isExtendedModel()) addGroupExtended(null, fileIn.getRootGroup()); else addGroupClassic(); if (cancel != null && cancel.isCancel()) return null; // create the file writer.create(); if (cancel != null && cancel.isCancel()) return null; double total = copyVarData(varList, null, cancel); if (cancel != null && cancel.isCancel()) return null; writer.flush(); if (debug) System.out.println("FileWriter done total bytes = " + total); } catch (IOException ioe) { ioe.printStackTrace(); writer.abort(); // clean up throw ioe; } return writer.getNetcdfFile(); }
public void finish() throws IOException { writer.updateAttribute(null, new Attribute(CDM.LAT_MIN, llbb.getLowerLeftPoint().getLatitude())); writer.updateAttribute(null, new Attribute(CDM.LAT_MAX, llbb.getUpperRightPoint().getLatitude())); writer.updateAttribute(null, new Attribute(CDM.LON_MIN, llbb.getLowerLeftPoint().getLongitude())); writer.updateAttribute(null, new Attribute(CDM.LON_MAX, llbb.getUpperRightPoint().getLongitude())); if((writer.getNetcdfFile().findAttribute("@"+CDM.TIME_START) != null) && (writer.getNetcdfFile().findAttribute("@"+CDM.TIME_END) != null )){ if (minDate == null) minDate = CalendarDate.present(); if (maxDate == null) maxDate = CalendarDate.present(); writer.updateAttribute(null, new Attribute(CDM.TIME_START, CalendarDateFormatter.toDateTimeStringISO(minDate))); writer.updateAttribute(null, new Attribute(CDM.TIME_END, CalendarDateFormatter.toDateTimeStringISO(maxDate))); } writer.close(); }
if (show) System.out.println("ncfile = " + writer.getNetcdfFile());
if (show) System.out.println("ncfile = " + writer.getNetcdfFile()); NetcdfFile ncfile = writer.getNetcdfFile();
ncfile.create(); } catch (IOException e) { System.err.println("ERROR creating file " + ncfile.getNetcdfFile().getLocation() + "\n" + e); assert (false);
ncfile.create(); } catch (IOException e) { System.err.println("ERROR creating file " + ncfile.getNetcdfFile().getLocation() + "\n" + e); assert (false);