public void augmentDataset(NetcdfDataset ds, CancelTask cancelTask) throws IOException { List<Variable> vars = ds.getVariables(); for (Variable var : vars) { String unit = var.getUnitsString(); if (unit != null) { if (unit.equalsIgnoreCase("hybrid_sigma_pressure") || unit.equalsIgnoreCase("sigma_level")) { // both a coordinate axis and transform var.addAttribute(new Attribute(_Coordinate.AxisType, AxisType.GeoZ.toString())); var.addAttribute(new Attribute(_Coordinate.TransformType, TransformType.Vertical.toString())); var.addAttribute(new Attribute(_Coordinate.Axes, var.getFullName())); } } } }
/** * Override Object.hashCode() to be consistent with equals. */ public int hashCode() { if (hashCode == 0) { int result = 17; result = 37 * result + getName().hashCode(); result = 37 * result + getAuthority().hashCode(); result = 37 * result + getTransformType().hashCode(); for (Parameter att : params) { result = 37 * result + att.getName().hashCode(); //result = 37*result + att.getValue().hashCode(); } hashCode = result; } return hashCode; }
@Override public void augmentDataset(NetcdfDataset ds, CancelTask cancelTask) throws IOException { List<Variable> vars = ds.getVariables(); for (Variable var : vars) { String unit = var.getUnitsString(); if (unit != null) { if (unit.equalsIgnoreCase("hybrid_sigma_pressure") || unit.equalsIgnoreCase("sigma_level")) { // both a coordinate axis and transform var.addAttribute(new Attribute(_Coordinate.AxisType, AxisType.GeoZ.toString())); var.addAttribute(new Attribute(_Coordinate.TransformType, TransformType.Vertical.toString())); var.addAttribute(new Attribute(_Coordinate.Axes, var.getFullName())); } } } }
/** * Override Object.hashCode() to be consistent with equals. */ public int hashCode() { if (hashCode == 0) { int result = 17; result = 37 * result + getName().hashCode(); result = 37 * result + getAuthority().hashCode(); result = 37 * result + getTransformType().hashCode(); for (Parameter att : params) { result = 37 * result + att.getName().hashCode(); //result = 37*result + att.getValue().hashCode(); } hashCode = result; } return hashCode; }
public void augmentDataset(NetcdfDataset ds, CancelTask cancelTask) throws IOException { List<Variable> vars = ds.getVariables(); for (Variable var : vars) { String unit = var.getUnitsString(); if (unit != null) { if (unit.equalsIgnoreCase("hybrid_sigma_pressure") || unit.equalsIgnoreCase("sigma_level")) { // both a coordinate axis and transform var.addAttribute(new Attribute(_Coordinate.AxisType, AxisType.GeoZ.toString())); var.addAttribute(new Attribute(_Coordinate.TransformType, TransformType.Vertical.toString())); var.addAttribute(new Attribute(_Coordinate.Axes, var.getFullName())); } } } }
/** * Override Object.hashCode() to be consistent with equals. */ public int hashCode() { if (hashCode == 0) { int result = 17; result = 37 * result + getName().hashCode(); result = 37 * result + getAuthority().hashCode(); result = 37 * result + getTransformType().hashCode(); for (Parameter att : params) { result = 37 * result + att.getName().hashCode(); //result = 37*result + att.getValue().hashCode(); } hashCode = result; } return hashCode; }
private Element writeCoordTransform(CoordinateTransform ct) { Element ctElem = new Element("coordTransform"); ctElem.setAttribute("name", ct.getName()); ctElem.setAttribute("transformType", ct.getTransformType().toString()); List params = ct.getParameters(); for (int i = 0; i < params.size(); i++) { Parameter param = (Parameter) params.get(i); Element pElem = new Element("parameter"); pElem.setAttribute("name", param.getName()); pElem.setAttribute("value", param.getStringValue()); ctElem.addContent(pElem); } return ctElem; }
private Element writeCoordTransform(CoordinateTransform ct) { Element ctElem = new Element("coordTransform"); ctElem.setAttribute("name", ct.getName()); ctElem.setAttribute("transformType", ct.getTransformType().toString()); List params = ct.getParameters(); for (int i = 0; i < params.size(); i++) { Parameter param = (Parameter) params.get(i); Element pElem = new Element("parameter"); pElem.setAttribute("name", param.getName()); pElem.setAttribute("value", param.getStringValue()); ctElem.addContent(pElem); } return ctElem; }
private Element writeCoordTransform(CoordinateTransform ct) { Element ctElem = new Element("coordTransform"); ctElem.setAttribute("name", ct.getName()); ctElem.setAttribute("transformType", ct.getTransformType().toString()); List params = ct.getParameters(); for (int i = 0; i < params.size(); i++) { Parameter param = (Parameter) params.get(i); Element pElem = new Element("parameter"); pElem.setAttribute("name", param.getName()); pElem.setAttribute("value", param.getStringValue()); ctElem.addContent(pElem); } return ctElem; }
v.addAttribute(new Attribute(_Coordinate.TransformType, TransformType.Vertical.toString())); if (v.findAttribute(_Coordinate.Axes) == null) v.addAttribute(new Attribute(_Coordinate.Axes, v.getFullName())); // LOOK: may also be time dependent gridMap.addAttribute(new Attribute(_Coordinate.TransformType, TransformType.Projection.toString())); gridMap.addAttribute(new Attribute(_Coordinate.AxisTypes, "GeoX GeoY")); got_grid_mapping = true; String grid_mapping_name = ds.findAttValueIgnoreCase(v, CF.GRID_MAPPING_NAME, null); if (grid_mapping_name != null) { v.addAttribute(new Attribute(_Coordinate.TransformType, TransformType.Projection.toString())); v.addAttribute(new Attribute(_Coordinate.AxisTypes, "GeoX GeoY"));
v.addAttribute(new Attribute(_Coordinate.TransformType, TransformType.Vertical.toString())); if (v.findAttribute(_Coordinate.Axes) == null) v.addAttribute(new Attribute(_Coordinate.Axes, v.getFullName())); // LOOK: may also be time dependent gridMap.addAttribute(new Attribute(_Coordinate.TransformType, TransformType.Projection.toString())); gridMap.addAttribute(new Attribute(_Coordinate.AxisTypes, "GeoX GeoY")); got_grid_mapping = true; String grid_mapping_name = ds.findAttValueIgnoreCase(v, CF.GRID_MAPPING_NAME, null); if (grid_mapping_name != null) { v.addAttribute(new Attribute(_Coordinate.TransformType, TransformType.Projection.toString())); v.addAttribute(new Attribute(_Coordinate.AxisTypes, "GeoX GeoY"));
private Element makeCoordTransform( CoordinateTransform coordTransform) { Element elem = new Element("coordinateTransform", ncNS); elem.setAttribute("name", coordTransform.getName()); elem.setAttribute("authority", coordTransform.getAuthority()); if (coordTransform.getTransformType() != null) elem.setAttribute("transformType", coordTransform.getTransformType().toString()); List<Parameter> params = coordTransform.getParameters(); for (Parameter p : params) { elem.addContent(makeAttribute(p, "parameter")); } return elem; }
v.addAttribute(new Attribute(_Coordinate.TransformType, TransformType.Vertical.toString())); if (v.findAttribute(_Coordinate.Axes) == null) v.addAttribute(new Attribute(_Coordinate.Axes, v.getFullName())); // LOOK: may also be time dependent gridMap.addAttribute(new Attribute(_Coordinate.TransformType, TransformType.Projection.toString())); String grid_mapping_name = ds.findAttValueIgnoreCase(v, CF.GRID_MAPPING_NAME, null); if (grid_mapping_name != null) { v.addAttribute(new Attribute(_Coordinate.TransformType, TransformType.Projection.toString()));
private Element makeCoordTransform( CoordinateTransform coordTransform) { Element elem = new Element("coordinateTransform", ncNS); elem.setAttribute("name", coordTransform.getName()); elem.setAttribute("authority", coordTransform.getAuthority()); if (coordTransform.getTransformType() != null) elem.setAttribute("transformType", coordTransform.getTransformType().toString()); List<Parameter> params = coordTransform.getParameters(); for (Parameter p : params) { elem.addContent(makeAttribute(p, "parameter")); } return elem; }
private Element makeCoordTransform( CoordinateTransform coordTransform) { Element elem = new Element("coordinateTransform", thredds.client.catalog.Catalog.ncmlNS); elem.setAttribute("name", coordTransform.getName()); elem.setAttribute("authority", coordTransform.getAuthority()); if (coordTransform.getTransformType() != null) elem.setAttribute("transformType", coordTransform.getTransformType().toString()); List<Parameter> params = coordTransform.getParameters(); for (Parameter p : params) { elem.addContent(makeAttribute(p, "parameter")); } return elem; }
private Element writeCoordTransform(CoordinateTransform ct) { Element ctElem = new Element("coordTransform"); ctElem.setAttribute("name", ct.getName()); ctElem.setAttribute("transformType", ct.getTransformType().toString()); for (Parameter param : ct.getParameters()) { Element pElem = new Element("parameter"); pElem.setAttribute("name", param.getName()); pElem.setAttribute("value", param.getStringValue()); ctElem.addContent(pElem); } return ctElem; }
private Element writeCoordTransform(CoordinateTransform ct) { Element ctElem = new Element("coordTransform"); ctElem.setAttribute("name", ct.getName()); ctElem.setAttribute("transformType", ct.getTransformType().toString()); for (Parameter param : ct.getParameters()) { Element pElem = new Element("parameter"); pElem.setAttribute("name", param.getName()); pElem.setAttribute("value", param.getStringValue()); ctElem.addContent(pElem); } return ctElem; }
private Element writeCoordTransform(CoordinateTransform ct) { Element ctElem = new Element("coordTransform"); ctElem.setAttribute("name", ct.getName()); ctElem.setAttribute("transformType", ct.getTransformType().toString()); for (Parameter param : ct.getParameters()) { Element pElem = new Element("parameter"); pElem.setAttribute("name", param.getName()); pElem.setAttribute("value", param.getStringValue()); ctElem.addContent(pElem); } return ctElem; }
/** * Create a "dummy" Coordinate Transform Variable based on the given CoordinateTransform. * This creates a scalar Variable with dummy data, and adds the Parameters of the CoordinateTransform * as attributes. * @param ds for this dataset * @param ct based on the CoordinateTransform * @return the Coordinate Transform Variable. You must add it to the dataset. */ static public VariableDS makeDummyTransformVariable(NetcdfDataset ds, CoordinateTransform ct) { VariableDS v = new VariableDS( ds, null, null, ct.getName(), DataType.CHAR, "", null, null); List<Parameter> params = ct.getParameters(); for (Parameter p : params) { if (p.isString()) v.addAttribute(new Attribute(p.getName(), p.getStringValue())); else { double[] data = p.getNumericValues(); Array dataA = Array.factory(DataType.DOUBLE, new int[]{data.length}, data); v.addAttribute(new Attribute(p.getName(), dataA)); } } v.addAttribute( new Attribute(_Coordinate.TransformType, ct.getTransformType().toString())); // fake data Array data = Array.factory(DataType.CHAR, new int[] {}, new char[] {' '}); v.setCachedData(data, true); return v; }
/** * Create a "dummy" Coordinate Transform Variable based on the given CoordinateTransform. * This creates a scalar Variable with dummy data, and adds the Parameters of the CoordinateTransform * as attributes. * @param ds for this dataset * @param ct based on the CoordinateTransform * @return the Coordinate Transform Variable. You must add it to the dataset. */ static public VariableDS makeDummyTransformVariable(NetcdfDataset ds, CoordinateTransform ct) { VariableDS v = new VariableDS( ds, null, null, ct.getName(), DataType.CHAR, "", null, null); List<Parameter> params = ct.getParameters(); for (Parameter p : params) { if (p.isString()) v.addAttribute(new Attribute(p.getName(), p.getStringValue())); else { double[] data = p.getNumericValues(); Array dataA = Array.factory(double.class, new int[]{data.length}, data); v.addAttribute(new Attribute(p.getName(), dataA)); } } v.addAttribute( new Attribute(_Coordinate.TransformType, ct.getTransformType().toString())); // fake data Array data = Array.factory(DataType.CHAR.getPrimitiveClassType(), new int[] {}, new char[] {' '}); v.setCachedData(data, true); return v; }