ReferencedEnvelope bbox = reader.georeferencing.getBoundingBox(variableDS.getShortName()); coordinateReferenceSystem = bbox.getCoordinateReferenceSystem();
reader.georeferencing.getCoordinatesVariables(variableDS.getShortName())) { if (!cv.isNumeric()) { continue;
/** * @param coordinateReferenceSystem * @throws MismatchedDimensionException * @throws IOException */ private void initSpatialDomain() throws Exception { // SPATIAL DOMAIN final UnidataSpatialDomain spatialDomain = new UnidataSpatialDomain(); this.setSpatialDomain(spatialDomain); ReferencedEnvelope bbox = reader.georeferencing.getBoundingBox(variableDS.getShortName()); spatialDomain.setCoordinateReferenceSystem(coordinateReferenceSystem); spatialDomain.setReferencedEnvelope(bbox); spatialDomain.setGridGeometry(getGridGeometry()); }
public String getShortName() { return vs.getShortName(); }
public String getShortName() { return vs.getShortName(); }
public String getShortName() { return vs.getShortName(); }
description = variableDS.getShortName();
public String getShortName() { return vs.getShortName(); }
CoverageSlice.Attributes.GEOMETRY, NetCDFCRSUtilities.GEOM_FACTORY.toGeometry( reader.georeferencing.getBoundingBox(variableDS.getShortName()))); feature.setAttribute(CoverageSlice.Attributes.INDEX, imageIndex);
@Override public String setName(String newName) { this.orgName = getShortName(); super.setShortName(newName); return newName; }
@Override public String setName(String newName) { this.orgName = getShortName(); super.setShortName(newName); return newName; }
@Override public String setName(String newName) { this.orgName = getShortName(); super.setShortName(newName); return newName; }
public StructureData getJoinData(Cursor cursor) { int recnum = -1; switch (type) { case modulo: recnum = cursor.recnum[0] % param; break; case divide: recnum = cursor.recnum[0] / param; break; case level: recnum = cursor.recnum[param]; break; case raw: recnum = cursor.recnum[0]; break; case scalar: recnum = 0; break; } return StructureDataFactory.make(v.getShortName(), data.getObject(recnum)); }
public StructureData getJoinData(Cursor cursor) { int recnum = -1; switch (type) { case modulo: recnum = cursor.recnum[0] % param; break; case divide: recnum = cursor.recnum[0] / param; break; case level: recnum = cursor.recnum[param]; break; case raw: recnum = cursor.recnum[0]; break; case scalar: recnum = 0; break; } return StructureDataFactory.make(v.getShortName(), data.getObject(recnum)); }
@Override public StructureData getJoinData(Cursor cursor) { int recnum = -1; switch (type) { case modulo: recnum = cursor.recnum[0] % param; break; case divide: recnum = cursor.recnum[0] / param; break; case level: recnum = cursor.recnum[param]; break; case raw: recnum = cursor.recnum[0]; break; case scalar: recnum = 0; break; } return StructureDataFactory.make(v.getShortName(), data.getObject(recnum)); }
private void writeVariable(VariableDS v, Array mdata) throws IOException { int count = 0; String name = v.getShortName(); String units = v.getUnitsString(); out.format("%svar='%s' units='%s' : ", indent, name, units); mdata.resetLocalIterator(); while (mdata.hasNext()) { if (count++ > 0) out.format(","); if (v.getDataType().isNumeric()) { double val = mdata.nextDouble(); if (v.isMissing(val)) { // check if missing out.format("missing"); } else { out.format("%s", Double.toString(val)); } } else { // not numeric out.format("%s", mdata.next()); } } out.format("%n"); }
/** * @param coordinateReferenceSystem * @throws MismatchedDimensionException * @throws IOException */ private void initSpatialDomain() throws Exception { // SPATIAL DOMAIN final UnidataSpatialDomain spatialDomain = new UnidataSpatialDomain(); this.setSpatialDomain(spatialDomain); ReferencedEnvelope bbox = reader.georeferencing.getBoundingBox(variableDS.getShortName()); spatialDomain.setCoordinateReferenceSystem(coordinateReferenceSystem); spatialDomain.setReferencedEnvelope(bbox); spatialDomain.setGridGeometry(getGridGeometry()); }
/** * Add a CoordinateAxis to the dataset, by turning the VariableDS into a CoordinateAxis (if needed). * Also adds it to the list of variables. Replaces any existing Variable and CoordinateAxis with the same name. * * @param v make this VariableDS into a CoordinateAxis * @return the CoordinateAxis */ public CoordinateAxis addCoordinateAxis(VariableDS v) { if (v == null) return null; CoordinateAxis oldVar = findCoordinateAxis(v.getFullName()); if (oldVar != null) coordAxes.remove(oldVar); CoordinateAxis ca = (v instanceof CoordinateAxis) ? (CoordinateAxis) v : CoordinateAxis.factory(this, v); coordAxes.add(ca); if (v.isMemberOfStructure()) { Structure parentOrg = v.getParentStructure(); // gotta be careful to get the wrapping parent Structure parent = (Structure) findVariable(parentOrg.getFullNameEscaped()); parent.replaceMemberVariable(ca); } else { removeVariable(v.getParentGroup(), v.getShortName()); // remove by short name if it exists addVariable(ca.getParentGroup(), ca); } return ca; }
/** * Constructor for CHAR or STRING variables. * Must be ISO dates. * * @param ncd the containing dataset * @param org the underlying Variable * @param errMessages put error messages here; may be null * @param dims list of dimensions * @throws IOException on read error * @throws IllegalArgumentException if cant convert coordinate values to a Date */ private CoordinateAxis1DTime(NetcdfDataset ncd, VariableDS org, Formatter errMessages, String dims) throws IOException { super(ncd, org.getParentGroup(), org.getShortName(), DataType.STRING, dims, org.getUnitsString(), org.getDescription()); //Gotta set the original var. Otherwise it would be unable to read the values this.orgVar = org; this.orgName = org.orgName; this.helper = new CoordinateAxisTimeHelper(getCalendarFromAttribute(), null); if (org.getDataType() == DataType.CHAR) cdates = makeTimesFromChar(org, errMessages); else cdates = makeTimesFromStrings(org, errMessages); List<Attribute> atts = org.getAttributes(); for (Attribute att : atts) { addAttribute(att); } }
private VariableDS makeTimeCoordinate(NetcdfDataset result, Group group, String dimName, CalendarDate base, FmrcInvLite.ValueB valueb) { DataType dtype = DataType.DOUBLE; VariableDS timeVar = new VariableDS(result, group, null, dimName, dtype, dimName, null, null); // LOOK could just make a CoordinateAxis1D timeVar.addAttribute(new Attribute(CDM.LONG_NAME, "Forecast time for ForecastModelRunCollection")); timeVar.addAttribute(new ucar.nc2.Attribute("standard_name", "time")); timeVar.addAttribute(new ucar.nc2.Attribute(CDM.UNITS, "hours since " + base)); timeVar.addAttribute(new ucar.nc2.Attribute(CDM.MISSING_VALUE, Double.NaN)); timeVar.addAttribute(new ucar.nc2.Attribute(_Coordinate.AxisType, AxisType.Time.toString())); // construct the values int ntimes = valueb.offset.length; timeVar.setCachedData(Array.factory( DataType.DOUBLE, new int[] {ntimes}, valueb.offset)); group.addVariable(timeVar); if (valueb.bounds != null) { String bname = timeVar.getShortName() + "_bounds"; timeVar.addAttribute(new ucar.nc2.Attribute("bounds", bname)); Dimension bd = ucar.nc2.dataset.DatasetConstructor.getBoundsDimension( result); VariableDS boundsVar = new VariableDS(result, group, null, bname, dtype, dimName+" " + bd.getShortName(), null, null); boundsVar.addAttribute(new Attribute(CDM.LONG_NAME, "bounds for "+ timeVar.getShortName())); boundsVar.setCachedData(Array.factory( DataType.DOUBLE, new int[] {ntimes, 2}, valueb.bounds)); group.addVariable(boundsVar); } return timeVar; }