private String createValidObjectName(String name) { return N3iosp.makeValidNetcdfObjectName(name); }
private String createValidObjectName(String name) { return N3iosp.makeValidNetcdfObjectName(name); }
private String createValidObjectName(String name) { return N3iosp.makeValidNetcdfObjectName(name); }
private static void testValid(String test) { //boolean isValid = isValidNetcdf3ObjectName(test); //String convert = makeValidNetcdf3ObjectName(test); //boolean isValid2 = isValidNetcdf3ObjectName(convert); //System.out.printf("old: %s (%s) == %s (%s) %n", test, isValid, convert, isValid2); boolean isValid = isValidNetcdfObjectName(test); String convert = makeValidNetcdfObjectName(test); boolean isValid2 = isValidNetcdfObjectName(convert); System.out.printf("new: %s (%s) == %s (%s) %n%n", test, isValid, convert, isValid2); } }
private static void testValid(String test) { //boolean isValid = isValidNetcdf3ObjectName(test); //String convert = makeValidNetcdf3ObjectName(test); //boolean isValid2 = isValidNetcdf3ObjectName(convert); //System.out.printf("old: %s (%s) == %s (%s) %n", test, isValid, convert, isValid2); boolean isValid = isValidNetcdfObjectName(test); String convert = makeValidNetcdfObjectName(test); boolean isValid2 = isValidNetcdfObjectName(convert); System.out.printf("new: %s (%s) == %s (%s) %n%n", test, isValid, convert, isValid2); }
private static void testValid(String test) { //boolean isValid = isValidNetcdf3ObjectName(test); //String convert = makeValidNetcdf3ObjectName(test); //boolean isValid2 = isValidNetcdf3ObjectName(convert); //System.out.printf("old: %s (%s) == %s (%s) %n", test, isValid, convert, isValid2); boolean isValid = isValidNetcdfObjectName(test); String convert = makeValidNetcdfObjectName(test); boolean isValid2 = isValidNetcdfObjectName(convert); System.out.printf("new: %s (%s) == %s (%s) %n%n", test, isValid, convert, isValid2); }
public static String getVariableName(RasterDataNode rasterDataNode) { String name = N3iosp.makeValidNetcdfObjectName(rasterDataNode.getName()); name = name.replace( '.', '_' ); if (!VariableNameHelper.isVariableNameValid(name)) { name = VariableNameHelper.convertToValidName(name); } return name; }
/** * Add a Global attribute to the file. Must be in define mode. * @param att the attribute. * @return the created attribute */ public Attribute addGlobalAttribute(Attribute att) { if (!defineMode) throw new UnsupportedOperationException("not in define mode"); if (!N3iosp.isValidNetcdfObjectName(att.getShortName())) { String attName = N3iosp.makeValidNetcdfObjectName(att.getShortName()); log.warn("illegal netCDF-3 attribute name= "+att.getShortName() + " change to "+ attName); att = new Attribute(attName, att.getValues()); } return super.addAttribute(null, att); }
/** * Add a Dimension to the file * * @param dim copy this dimension * @return the new Dimension */ public Dimension writeDimension(Dimension dim) { String useName = N3iosp.makeValidNetcdfObjectName(dim.getShortName()); Dimension newDim = ncfile.addDimension(useName, dim.isUnlimited() ? 0 : dim.getLength(), dim.isShared(), dim.isUnlimited(), dim.isVariableLength()); dimHash.put(useName, newDim); if (debug) System.out.println("write dim= " + newDim); return newDim; }
/** * Add a Dimension to the file * * @param dim copy this dimension * @return the new Dimension */ public Dimension writeDimension(Dimension dim) { String useName = N3iosp.makeValidNetcdfObjectName(dim.getShortName()); Dimension newDim = ncfile.addDimension(useName, dim.isUnlimited() ? 0 : dim.getLength(), dim.isShared(), dim.isUnlimited(), dim.isVariableLength()); dimHash.put(useName, newDim); if (debug) System.out.println("write dim= " + newDim); return newDim; }
/** * Add a Global attribute to the file. Must be in define mode. * @param att the attribute. * @return the created attribute */ public Attribute addGlobalAttribute(Attribute att) { if (!defineMode) throw new UnsupportedOperationException("not in define mode"); if (!N3iosp.isValidNetcdfObjectName(att.getShortName())) { String attName = N3iosp.makeValidNetcdfObjectName(att.getShortName()); log.warn("illegal netCDF-3 attribute name= "+att.getShortName() + " change to "+ attName); att = new Attribute(attName, att.getValues()); } return super.addAttribute(null, att); }
/** * Add a Dimension to the file * * @param dim copy this dimension * @return the new Dimension */ public Dimension writeDimension(Dimension dim) { String useName = N3iosp.makeValidNetcdfObjectName(dim.getShortName()); Dimension newDim = ncfile.addDimension(useName, dim.isUnlimited() ? 0 : dim.getLength(), dim.isShared(), dim.isUnlimited(), dim.isVariableLength()); dimHash.put(useName, newDim); if (debug) System.out.println("write dim= " + newDim); return newDim; }
private void copyAll(NetcdfFileWriteable ncfile, Variable oldVar) throws IOException { String newName = N3iosp.makeValidNetcdfObjectName(oldVar.getName()); Array data = oldVar.read(); try { if (oldVar.getDataType() == DataType.STRING) { data = convertToChar(ncfile.findVariable(newName), data); } if (data.getSize() > 0) // zero when record dimension = 0 ncfile.write(newName, data); } catch (InvalidRangeException e) { e.printStackTrace(); throw new IOException(e.getMessage() + " for Variable " + oldVar.getName()); } }
private void copyAll(NetcdfFileWriteable ncfile, Variable oldVar) throws IOException { String newName = N3iosp.makeValidNetcdfObjectName(oldVar.getName()); Array data = oldVar.read(); try { if (oldVar.getDataType() == DataType.STRING) { data = convertToChar(ncfile.findVariable(newName), data); } if (data.getSize() > 0) // zero when record dimension = 0 ncfile.write(newName, data); } catch (InvalidRangeException e) { e.printStackTrace(); throw new IOException(e.getMessage() + " for Variable " + oldVar.getName()); } }
private static void copyAll(NetcdfFileWriteable ncfile, Variable oldVar) throws IOException { String newName = N3iosp.makeValidNetcdfObjectName(oldVar.getShortName()); newName = NetcdfFile.makeValidPathName(newName); Array data = oldVar.read(); try { if (oldVar.getDataType() == DataType.STRING) { data = convertToChar(ncfile.findVariable(newName), data); } if (data.getSize() > 0) // zero when record dimension = 0 ncfile.write(newName, data); } catch (InvalidRangeException e) { e.printStackTrace(); throw new IOException(e.getMessage() + " for Variable " + oldVar.getFullName()); } }
private static void copyAll(NetcdfFileWriteable ncfile, Variable oldVar) throws IOException { String newName = N3iosp.makeValidNetcdfObjectName(oldVar.getShortName()); newName = NetcdfFile.makeValidPathName(newName); Array data = oldVar.read(); try { if (oldVar.getDataType() == DataType.STRING) { data = convertToChar(ncfile.findVariable(newName), data); } if (data.getSize() > 0) // zero when record dimension = 0 ncfile.write(newName, data); } catch (InvalidRangeException e) { e.printStackTrace(); throw new IOException(e.getMessage() + " for Variable " + oldVar.getFullName()); } }
private static void copyAll(NetcdfFileWriteable ncfile, Variable oldVar) throws IOException { String newName = N3iosp.makeValidNetcdfObjectName(oldVar.getShortName()); newName = NetcdfFile.makeValidPathName(newName); Array data = oldVar.read(); try { if (oldVar.getDataType() == DataType.STRING) { data = convertToChar(ncfile.findVariable(newName), data); } if (data.getSize() > 0) // zero when record dimension = 0 ncfile.write(newName, data); } catch (InvalidRangeException e) { e.printStackTrace(); throw new IOException(e.getMessage() + " for Variable " + oldVar.getFullName()); } }
/** * Write a global attribute to the file. * * @param att take attribute name, value, from here */ public void writeGlobalAttribute(Attribute att) { String useName = N3iosp.makeValidNetcdfObjectName(att.getShortName()); if (att.isArray()) // why rewrite them ?? ncfile.addGlobalAttribute(useName, att.getValues()); else if (att.isString()) ncfile.addGlobalAttribute(useName, att.getStringValue()); else ncfile.addGlobalAttribute(useName, att.getNumericValue()); }
/** * Write a global attribute to the file. * * @param att take attribute name, value, from here */ public void writeGlobalAttribute(Attribute att) { String useName = N3iosp.makeValidNetcdfObjectName(att.getShortName()); if (att.isArray()) // why rewrite them ?? ncfile.addGlobalAttribute(useName, att.getValues()); else if (att.isString()) ncfile.addGlobalAttribute(useName, att.getStringValue()); else ncfile.addGlobalAttribute(useName, att.getNumericValue()); }
/** * Write a global attribute to the file. * * @param att take attribute name, value, from here */ public void writeGlobalAttribute(Attribute att) { String useName = N3iosp.makeValidNetcdfObjectName(att.getShortName()); if (att.isArray()) // why rewrite them ?? ncfile.addGlobalAttribute(useName, att.getValues()); else if (att.isString()) ncfile.addGlobalAttribute(useName, att.getStringValue()); else ncfile.addGlobalAttribute(useName, att.getNumericValue()); }