Java Code Examples for ucar.nc2.Attribute#getShortName()
The following examples show how to use
ucar.nc2.Attribute#getShortName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestH5iospCompare.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public boolean attCheckOk(Variable v, Attribute att) { String name = att.getShortName(); if (name.equalsIgnoreCase(CDM.ADD_OFFSET)) return false; if (name.equalsIgnoreCase("offset")) return false; if (name.equalsIgnoreCase(CDM.SCALE_FACTOR)) return false; if (name.equalsIgnoreCase("factor")) return false; if (name.equalsIgnoreCase("unit")) return false; if (name.equalsIgnoreCase(CDM.UNITS)) return false; return true; }
Example 2
Source File: TestH4iospCompare.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public boolean attCheckOk(Variable v, Attribute att) { String name = att.getShortName(); if (name.equalsIgnoreCase(CDM.ADD_OFFSET)) return false; if (name.equalsIgnoreCase("offset")) return false; if (name.equalsIgnoreCase(CDM.SCALE_FACTOR)) return false; if (name.equalsIgnoreCase("factor")) return false; if (name.equalsIgnoreCase("unit")) return false; if (name.equalsIgnoreCase(CDM.UNITS)) return false; return true; }
Example 3
Source File: WriterCFPointAbstract.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 5 votes |
private void addDataVariablesClassic(Dimension recordDim, StructureData stnData, HashSet<String> varSet, String coordVars) { addDimensionsClassic(dataVars); for (StructureMembers.Member m : stnData.getMembers()) { VariableSimpleIF oldVar = findDataVar(m.getName()); if (oldVar == null) continue; List<Dimension> dims = makeDimensionList(oldVar.getDimensions()); dims.add(0, recordDim); Variable.Builder newVar; if (oldVar.getDataType() == DataType.STRING && !isExtendedModel) { // What should the string length be ?? String name = oldVar.getShortName(); Dimension strlen = new Dimension(name + "_strlen", defaultStringLength); newVar = Variable.builder().setName(name).setDataType(DataType.CHAR).setDimensions(dims).addDimension(strlen); writerb.getRootGroup().addDimensionIfNotExists(strlen); } else { newVar = Variable.builder().setName(oldVar.getShortName()).setDataType(oldVar.getDataType()).setDimensions(dims); } if (writerb.getRootGroup().replaceVariable(newVar)) { logger.warn("Variable was already added =" + oldVar.getShortName()); } for (Attribute att : oldVar.attributes()) { String attName = att.getShortName(); if (!reservedVariableAtts.contains(attName) && !attName.startsWith("_Coordinate")) newVar.addAttribute(att); } newVar.addAttribute(new Attribute(CF.COORDINATES, coordVars)); varSet.add(oldVar.getShortName()); } }
Example 4
Source File: WriterCFPointAbstract.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 5 votes |
private void addDataVariablesExtended(Structure.Builder<?> recordb, StructureData obsData, String coordNames) { for (StructureMembers.Member m : obsData.getMembers()) { VariableSimpleIF oldVar = findDataVar(m.getName()); if (oldVar == null) continue; // make dimension list StringBuilder dimNames = new StringBuilder(); for (Dimension d : oldVar.getDimensions()) { if (d.isUnlimited()) continue; if (d.getShortName() == null || !d.getShortName().equals(recordDimName)) dimNames.append(" ").append(d.getLength()); // anonymous } Variable.Builder newVar = Variable.builder().setName(oldVar.getShortName()).setDataType(oldVar.getDataType()) .setParentGroupBuilder(writerb.getRootGroup()).setDimensionsByName(dimNames.toString()); recordb.addMemberVariable(newVar); // TODO /* * Variable newVar = * writer.addStructureMember(record, oldVar.getShortName(), oldVar.getDataType(), dimNames.toString()); * if (newVar == null) { * logger.warn("Variable already exists =" + oldVar.getShortName()); // LOOK barf * continue; * } */ for (Attribute att : oldVar.attributes()) { String attName = att.getShortName(); if (!reservedVariableAtts.contains(attName) && !attName.startsWith("_Coordinate")) newVar.addAttribute(att); } newVar.addAttribute(new Attribute(CF.COORDINATES, coordNames)); } }
Example 5
Source File: NetcdfCopier.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 5 votes |
private Attribute convertAttribute(Attribute org) { if (extended || !org.getDataType().isUnsigned()) { return org; } Array orgValues = org.getValues(); Array nc3Values = Array.makeFromJavaArray(orgValues.getStorage(), false); return new Attribute(org.getShortName(), nc3Values); }
Example 6
Source File: TestDODScompareWithFiles.java From tds with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public boolean attCheckOk(Variable v, Attribute att) { // if (v != null && v.isMemberOfStructure()) return false; String name = att.getShortName(); if (name.equals(_Coordinate.Axes)) return false; if (name.equals(CDM.UNSIGNED)) return false; return true; }
Example 7
Source File: TestCdmRemoteCompareDataP.java From tds with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public boolean attCheckOk(Variable v, Attribute att) { String name = att.getShortName(); if (name.equals(_Coordinate.Axes)) return false; return true; }
Example 8
Source File: TestCdmRemoteCompareHeadersP.java From tds with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public boolean attCheckOk(Variable v, Attribute att) { // if (v != null && v.isMemberOfStructure()) return false; String name = att.getShortName(); if (name.equals(_Coordinate.Axes)) return false; return true; }