@Override public int getDimension(String name) { String groupName = getDirectory(name); String variableName = getName(name); Group group = getGroup(groupName); return group.findDimension(variableName).getLength(); }
@Override public int getDimension(String name) { String groupName = getDirectory(name); String variableName = getName(name); Group group = getGroup(groupName); return group.findDimension(variableName).getLength(); }
@Override public Hashtable<String, Object> getVariableAttributes(String name) { String groupName = getDirectory(name); String variableName = getName(name); Group group = getGroup(groupName); Variable variable = group.findVariable(variableName); Hashtable<String, Object> toReturn = new Hashtable<String, Object>(); if (variable != null) { List<Attribute> attributes = variable.getAttributes(); for (Attribute attribute: attributes) { toReturn.put(attribute.getName(), arrayToString(attribute.getValues())); } } return toReturn; }
@Override public Hashtable<String, Object> getVariableAttributes(String name) { String groupName = getDirectory(name); String variableName = getName(name); Group group = getGroup(groupName); Variable variable = group.findVariable(variableName); Hashtable<String, Object> toReturn = new Hashtable<String, Object>(); if (variable != null) { List<Attribute> attributes = variable.getAttributes(); for (Attribute attribute: attributes) { toReturn.put(attribute.getName(), arrayToString(attribute.getValues())); } } return toReturn; }
@Override public String getAttributeValue(String path) { String groupName = getDirectory(path); String attributeName = getName(path); Group group = getGroup(groupName); Attribute attribute = group.findAttribute(attributeName); if (attribute == null) return null; return arrayToString(attribute.getValues()); }
@Override public String getAttributeValue(String path) { String groupName = getDirectory(path); String attributeName = getName(path); Group group = getGroup(groupName); Attribute attribute = group.findAttribute(attributeName); if (attribute == null) return null; return arrayToString(attribute.getValues()); }
@Override public Object getArray(String path, int[] origin, int[] shape) throws ServiceException { String groupName = getDirectory(path); String variableName = getName(path); Group group = getGroup(groupName); Variable variable = group.findVariable(variableName); try { if (origin != null && shape != null) { return variable.read(origin, shape).reduce().copyToNDJavaArray(); } return variable.read().copyToNDJavaArray(); } catch (InvalidRangeException e) { throw new ServiceException(e); } catch (IOException e) { throw new ServiceException(e); } catch (NullPointerException e) { return null; } }
@Override public Object getArray(String path, int[] origin, int[] shape) throws ServiceException { String groupName = getDirectory(path); String variableName = getName(path); Group group = getGroup(groupName); Variable variable = group.findVariable(variableName); try { if (origin != null && shape != null) { return variable.read(origin, shape).reduce().copyToNDJavaArray(); } return variable.read().copyToNDJavaArray(); } catch (InvalidRangeException e) { throw new ServiceException(e); } catch (IOException e) { throw new ServiceException(e); } catch (NullPointerException e) { return null; } }