public static NcVariableMap create(final Group group) { return new NcVariableMap(group.getVariables()); }
public static VariableMap create(Group group) { return new VariableMap(group.getVariables()); }
synchronized boolean removeRecordStructure() { boolean found = false; for (Variable v : uvars) { if (v.getFullName().equals("record")) { uvars.remove(v); ncfile.getRootGroup().getVariables().remove(v); found = true; break; } } ncfile.finish(); return found; }
synchronized boolean removeRecordStructure() { boolean found = false; for (Variable v : uvars) { if (v.getFullName().equals("record")) { uvars.remove(v); ncfile.getRootGroup().getVariables().remove(v); found = true; break; } } ncfile.finish(); return found; }
synchronized boolean removeRecordStructure() { boolean found = false; for (Variable v : uvars) { if (v.getFullName().equals("record")) { uvars.remove(v); ncfile.getRootGroup().getVariables().remove(v); found = true; break; } } ncfile.finish(); return found; }
private void findUsedDimensions(Group parent, Map<Dimension, List<Variable>> dimUsedMap) { for (Variable v : parent.getVariables()) { for (Dimension d : v.getDimensions()) { if (!d.isShared()) continue; List<Variable> vlist = dimUsedMap.get(d); if (vlist == null) { vlist = new ArrayList<Variable>(); dimUsedMap.put(d, vlist); } vlist.add(v); } } for (Group g : parent.getGroups()) findUsedDimensions(g, dimUsedMap); }
private void findUsedDimensions(Group parent, Map<Dimension, List<Variable>> dimUsedMap) { for (Variable v : parent.getVariables()) { for (Dimension d : v.getDimensions()) { if (!d.isShared()) continue; List<Variable> vlist = dimUsedMap.get(d); if (vlist == null) { vlist = new ArrayList<Variable>(); dimUsedMap.put(d, vlist); } vlist.add(v); } } for (Group g : parent.getGroups()) findUsedDimensions(g, dimUsedMap); }
private void fixBandNames() { String navGroup = "Geophysical_Data"; List<Variable> variables = ncFile.findGroup(navGroup).getVariables(); String varName; for (Variable variable : variables) { varName = variable.getShortName().replace("L", "Lt"); variable.setName(varName); } }
public Variable findVariableByAttribute(Group g, String attName, String attValue) { if (g == null) g = getRootGroup(); for (Variable v : g.getVariables()) { for (Attribute att : v.getAttributes()) if (attName.equals(att.getShortName()) && attValue.equals(att.getStringValue())) return v; } for (Group nested : g.getGroups()) { Variable v = findVariableByAttribute(nested, attName, attValue); if (v != null) return v; } return null; }
public Variable findVariableByAttribute(Group g, String attName, String attValue) { if (g == null) g = getRootGroup(); for (Variable v : g.getVariables()) { for (Attribute att : v.getAttributes()) if (attName.equals(att.getShortName()) && attValue.equals(att.getStringValue())) return v; } for (Group nested : g.getGroups()) { Variable v = findVariableByAttribute(nested, attName, attValue); if (v != null) return v; } return null; }
private void fixAttributes(Group g) { for (Variable v : g.getVariables()) { for (Attribute a : v.getAttributes()) { if (a.getShortName().equalsIgnoreCase("UNIT") || a.getShortName().equalsIgnoreCase("UNITS")) a.setShortName(CDM.UNITS); if (a.getShortName().equalsIgnoreCase("SCALE_FACTOR")) a.setShortName(CDM.SCALE_FACTOR); if (a.getShortName().equalsIgnoreCase("OFFSET")) a.setShortName(CDM.ADD_OFFSET); } } for (Group ng : g.getGroups()) { fixAttributes(ng); } }
private void fixAttributes(Group g) { for (Variable v : g.getVariables()) { for (Attribute a : v.getAttributes()) { if (a.getShortName().equalsIgnoreCase("UNIT")) a.setShortName(CDM.UNITS); if (a.getShortName().equalsIgnoreCase("SCALE_FACTOR")) a.setShortName(CDM.SCALE_FACTOR); if (a.getShortName().equalsIgnoreCase("OFFSET")) a.setShortName(CDM.ADD_OFFSET); } } for (Group ng : g.getGroups()) { fixAttributes(ng); } }
private void count(Group g) { ndims += g.getDimensions().size(); nvars += g.getVariables().size(); ngatts += g.getAttributes().size(); ngroups += g.getGroups().size(); for (Variable v : g.getVariables()) { natts += v.getAttributes().size(); if (v instanceof Structure) { nstructFields += ((Structure) v).getVariables().size(); } } for (Group ng : g.getGroups()) count(ng); } }
private void count(Group g) { ndims += g.getDimensions().size(); nvars += g.getVariables().size(); ngatts += g.getAttributes().size(); ngroups += g.getGroups().size(); for (Variable v : g.getVariables()) { natts += v.getAttributes().size(); if (v instanceof Structure) { nstructFields += ((Structure) v).getVariables().size(); } } for (Group ng : g.getGroups()) count(ng); } }
void transferData(Group oldGroup) throws IOException, InvalidRangeException { for (Variable v : oldGroup.getVariables()) { if (!isRadial && v.getRank() >= 3) { invertOneVar(v); } else { System.out.printf("write %s%n",v.getNameAndDimensions()); Array data = v.read(); Variable nv = ncOut.findVariable(v.getFullName()); ncOut.write(nv, data); } } // recurse for (Group g : oldGroup.getGroups()) transferData( g); }
void transferData(Group oldGroup) throws IOException, InvalidRangeException { for (Variable v : oldGroup.getVariables()) { if (!isRadial && v.getRank() >= 3) { invertOneVar(v); } else { System.out.printf("write %s%n",v.getNameAndDimensions()); Array data = v.read(); Variable nv = ncOut.findVariable(v.getFullName()); ncOut.write(nv, data); } } // recurse for (Group g : oldGroup.getGroups()) transferData( g); }
void transferData(Group oldGroup) throws IOException, InvalidRangeException { for (Variable v : oldGroup.getVariables()) { if (!isRadial && v.getRank() >= 3) { invertOneVar(v); } else { System.out.printf("write %s%n",v.getNameAndDimensions()); Array data = v.read(); Variable nv = ncOut.findVariable(v.getFullName()); ncOut.write(nv, data); } } // recurse for (Group g : oldGroup.getGroups()) transferData( g); }
private void convertGroup(Group g, Group from) { for (EnumTypedef et : from.getEnumTypedefs()) g.addEnumeration(et); for (Dimension d : from.getDimensions()) g.addDimension(new Dimension(d.getShortName(), d)); for (Attribute a : from.getAttributes()) g.addAttribute(a); for (Variable v : from.getVariables()) g.addVariable(convertVariable(g, v)); for (Group nested : from.getGroups()) { Group nnested = new Group(this, g, nested.getShortName()); g.addGroup(nnested); convertGroup(nnested, nested); } }
private void convertGroup(Group g, Group from) { for (EnumTypedef et : from.getEnumTypedefs()) g.addEnumeration(et); for (Dimension d : from.getDimensions()) g.addDimension(new Dimension(d.getShortName(), d)); for (Attribute a : from.getAttributes()) g.addAttribute(a); for (Variable v : from.getVariables()) g.addVariable(convertVariable(g, v)); for (Group nested : from.getGroups()) { Group nnested = new Group(this, g, nested.getShortName()); g.addGroup(nnested); convertGroup(nnested, nested); } }
private void convertGroup(Group g, Group from) { for (EnumTypedef et : from.getEnumTypedefs()) g.addEnumeration(et); for (Dimension d : from.getDimensions()) g.addDimension(new Dimension(d.getShortName(), d)); for (Attribute a : from.getAttributes()) g.addAttribute(a); for (Variable v : from.getVariables()) g.addVariable(convertVariable(g, v)); for (Group nested : from.getGroups()) { Group nnested = new Group(this, g, nested.getShortName()); g.addGroup(nnested); convertGroup(nnested, nested); } }