private Variable identifyIdVariable(NetcdfDataset ds, CF.FeatureType ftype) { Variable result; switch (ftype) { case timeSeriesProfile: case timeSeries: result = Evaluator.findVariableWithAttributeValue(ds, CF.CF_ROLE, CF.TIMESERIES_ID); if (result != null) return result; return Evaluator.findVariableWithAttributeValue(ds, CF.STANDARD_NAME, CF.STATION_ID); // old way for backwards compatibility case trajectory: case trajectoryProfile: result = Evaluator.findVariableWithAttributeValue(ds, CF.CF_ROLE, CF.TRAJECTORY_ID); if (result != null) return result; return Evaluator.findVariableWithAttributeValue(ds, CF.STANDARD_NAME, CF.TRAJECTORY_ID); // old way for backwards compatibility case profile: result = Evaluator.findVariableWithAttributeValue(ds, CF.CF_ROLE, CF.PROFILE_ID); if (result != null) return result; return Evaluator.findVariableWithAttributeValue(ds, CF.STANDARD_NAME, CF.PROFILE_ID); // old way for backwards compatibility default: return null; } }
/** * Find the dimension pointed to by key * * @param ds in this dataset * @param key may be dimension name or ":gatt" where gatt is local attribute whose value is the dimension name * @param errlog error messages here * @return name of dimension or null if not exist */ static public String getDimensionName(NetcdfDataset ds, String key, Formatter errlog) { Dimension d = getDimension(ds, key, errlog); return (d == null) ? null : d.getShortName(); }
/** * Turn the key into a String and return the corresponding featureType, if any. * * @param ds look in this datset * @param key if starts with ":", replace with value of global attribute * @param errlog error messages here * @return featureType, or null */ static public FeatureType getFeatureType(NetcdfDataset ds, String key, Formatter errlog) { FeatureType ft = null; String fts = getLiteral(ds, key, errlog); if (fts != null) { ft = FeatureType.valueOf(fts.toUpperCase()); if ((ft == null) && (errlog != null)) errlog.format(" Cant find Feature type %s from %s\n", fts, key); } return ft; }
@Override protected boolean identifyEncodingTimeSeriesProfile(NetcdfDataset ds, EncodingInfo info, CF.FeatureType ftype, Formatter errlog) { Evaluator.VarAtt varatt = Evaluator.findVariableWithAttribute(ds, CF.SAMPLE_DIMENSION); if (varatt == null) return false; String dimName = varatt.att.getStringValue(); info.grandChildDim = ds.findDimension(dimName); info.grandChildStruct = Evaluator.findStructureWithDimensions(ds, info.grandChildDim, null); Variable stdId = Evaluator.findVariableWithAttributeValue(ds, CF.CF_ROLE, CF.TIMESERIES_ID); Structure stn = stdId.getParentStructure(); if (stn.getRank() == 0) { // could be scalar Variable profileId = Evaluator.findVariableWithAttributeValue(ds, CF.CF_ROLE, CF.PROFILE_ID); Structure profile = profileId.getParentStructure(); info.childDim = profile.getDimension(0);
public TableConfig getConfig(FeatureType wantFeatureType, NetcdfDataset ds, Formatter errlog) { Dimension obsDim = Evaluator.getDimension(ds, "recNum", errlog); if (obsDim == null) { errlog.format("MADIS: must have an Observation dimension: named recNum"); boolean hasStruct = Evaluator.hasNetcdf3RecordStructure(ds); FeatureType ft = Evaluator.getFeatureType(ds, ":thredds_data_type", errlog); if (null == ft) { if ((ds.findDimension("manLevel") != null) && (ds.findVariable("prMan") != null)) { obs.dimName = Evaluator.getDimensionName(ds, "recNum", errlog); obs.time = vn.obsTime; obs.timeNominal = vn.nominalTime; obs.dimName = Evaluator.getDimensionName(ds, "recNum", errlog); obs.time = vn.obsTime; obs.timeNominal = vn.nominalTime;
public TableConfig getConfig(FeatureType wantFeatureType, NetcdfDataset ds, Formatter errlog) { Dimension obsDim = Evaluator.getDimension(ds, "recNum", errlog); if (obsDim == null) { errlog.format("MADIS: must have an Observation dimension: named recNum"); boolean hasStruct = Evaluator.hasRecordStructure(ds); FeatureType ft = Evaluator.getFeatureType(ds, ":thredds_data_type", errlog); if (null == ft) { if ((ds.findDimension("manLevel") != null) && (ds.findVariable("prMan") != null)) { obs.dimName = Evaluator.getDimensionName(ds, "recNum", errlog); obs.time = vn.obsTime; obs.timeNominal = vn.nominalTime; obs.dimName = Evaluator.getDimensionName(ds, "recNum", errlog); obs.time = vn.obsTime; obs.timeNominal = vn.nominalTime;
boolean hasStruct = Evaluator.hasNetcdf3RecordStructure(ds); stnTable.stnId = Evaluator.findNameOfVariableWithAttributeValue(ds, "standard_name", "station_id"); if (stnTable.stnId == null) { errlog.format("Must have a Station id variable with standard name station_id"); if (obsTableType == null) { multidimStruct = Evaluator.findStructureWithDimensions(ds, stationDim, obsDim); if (multidimStruct != null) { obsTableType = Table.Type.MultidimStructure;
return null; boolean hasStruct = Evaluator.hasNetcdf3RecordStructure(ds); FeatureType ft = Evaluator.getFeatureType(ds, ":cdm_datatype", null); if (ft == null ) ft = Evaluator.getFeatureType(ds, ":cdm_data_type", null); stationTable.featureType = FeatureType.STATION; stationTable.dimName = stationDim.getShortName(); stationTable.limit = Evaluator.getVariableName(ds, "number_stations", null); stationTable.stnId = Evaluator.getVariableName(ds, "station_id", null); stationTable.stnDesc = Evaluator.getVariableName(ds, "station_description", null); stationTable.stnWmoId = Evaluator.getVariableName(ds, "wmo_id", null); obsTable.parentIndex = Evaluator.getVariableName(ds, "parent_index", null); obsTable.timeNominal = Evaluator.getVariableName(ds, "time_nominal", null);
Structure multidimStruct = Evaluator.findStructureWithDimensions(ds, stationDim, obsDim); if (multidimStruct == null) { errlog.format("GempakCdm: Cannot figure out Station/obs table structure"); Structure nestedStruct = Evaluator.findNestedStructure(multidimStruct); if (nestedStruct == null) { errlog.format("GempakCdm: Cannot find nested Structure for profile");
obsTable = makeStructTable(ds, FeatureType.STATION, info, errlog); obsTable.parentIndex = (info.instanceId == null) ? null : info.instanceId.getFullName(); Variable stnIdVar = Evaluator.findVariableWithAttributeAndDimension(ds, CF.CF_ROLE, CF.STATION_ID, obsDim, errlog); if (stnIdVar == null) stnIdVar = Evaluator.findVariableWithAttributeAndDimension(ds, CF.STANDARD_NAME, CF.STATION_ID, obsDim, errlog); obsTable.stnId = (stnIdVar == null) ? null : stnIdVar.getFullName(); obsTable.stnDesc = Evaluator.findNameOfVariableWithAttributeValue(ds, CF.STANDARD_NAME, CF.PLATFORM_NAME); if (obsTable.stnDesc == null) obsTable.stnDesc = Evaluator.findNameOfVariableWithAttributeValue(ds, CF.STANDARD_NAME, CF.STATION_DESC); obsTable.stnWmoId = Evaluator.findNameVariableWithStandardNameAndDimension(ds, CF.STATION_WMOID, obsDim, errlog); obsTable.stnAlt = Evaluator.findNameVariableWithStandardNameAndDimension(ds, CF.SURFACE_ALTITUDE, obsDim, errlog); if (obsTable.stnAlt == null) obsTable.stnAlt = Evaluator.findNameVariableWithStandardNameAndDimension(ds, CF.STATION_ALTITUDE, obsDim, errlog); break;
return null; boolean hasStruct = Evaluator.hasRecordStructure(ds); FeatureType ft = Evaluator.getFeatureType(ds, ":cdm_datatype", null); if (ft == null ) ft = Evaluator.getFeatureType(ds, ":cdm_data_type", null); stationTable.featureType = FeatureType.STATION; stationTable.dimName = stationDim.getShortName(); stationTable.limit = Evaluator.getVariableName(ds, "number_stations", null); stationTable.stnId = Evaluator.getVariableName(ds, "station_id", null); stationTable.stnDesc = Evaluator.getVariableName(ds, "station_description", null); stationTable.stnWmoId = Evaluator.getVariableName(ds, "wmo_id", null); obsTable.parentIndex = Evaluator.getVariableName(ds, "parent_index", null); obsTable.timeNominal = Evaluator.getVariableName(ds, "time_nominal", null);
boolean hasStruct = Evaluator.hasRecordStructure(ds); stnTable.stnId = Evaluator.findNameOfVariableWithAttributeValue(ds, "standard_name", "station_id"); if (stnTable.stnId == null) { errlog.format("Must have a Station id variable with standard name station_id"); if (obsTableType == null) { multidimStruct = Evaluator.findStructureWithDimensions(ds, stationDim, obsDim); if (multidimStruct != null) { obsTableType = Table.Type.MultidimStructure;
@Override protected boolean identifyEncodingProfile(NetcdfDataset ds, EncodingInfo info, Formatter errlog) { Evaluator.VarAtt varatt = Evaluator.findVariableWithAttribute(ds, CF.SAMPLE_DIMENSION); if (varatt == null) return false; String dimName = varatt.att.getStringValue(); Dimension obsDim = ds.findDimension(dimName); Structure profile = info.lat.getParentStructure(); if (profile.getRank() == 0) { // could be scalar info.set(Encoding.single, null, obsDim); } Dimension profileDim = profile.getDimension(0); // now find the child structure info.childStruct = Evaluator.findStructureWithDimensions(ds, obsDim, null); // the raggeds if (identifyRaggeds(ds, info, profileDim, obsDim, errlog)) return true; errlog.format("CFpointObsExt: %s only supports ragged array representation%n", CF.FeatureType.profile); return false; }
public TableConfig getConfig(FeatureType wantFeatureType, NetcdfDataset ds, Formatter errlog) throws IOException { TableConfig nt = new TableConfig(Table.Type.ArrayStructure, "station"); nt.featureType = FeatureType.STATION_PROFILE; nt.structName = "station"; nt.stnId = STN_NAME; nt.lat = STN_LAT; nt.lon = STN_LON; nt.elev = STN_ELEV; // make the station array structure in memory // nt.as = makeIndex(ds); TableConfig obs = new TableConfig(Table.Type.Structure, "obsRecord"); obs.structName = "record"; obs.dimName = Evaluator.getDimensionName(ds, "record", errlog); obs.lat = UnidataPointDatasetHelper.getCoordinateName(ds, AxisType.Lat); obs.lon = UnidataPointDatasetHelper.getCoordinateName(ds, AxisType.Lon); obs.elev = UnidataPointDatasetHelper.getCoordinateName(ds, AxisType.Height); obs.time = UnidataPointDatasetHelper.getCoordinateName(ds, AxisType.Time); obs.stnId = Evaluator.getVariableName(ds, "name", errlog); //obs.join = new TableConfig.JoinConfig(Join.Type.Index); // create an IndexJoin and attach to the obs.join //indexJoin = new IndexJoin(obs.join); nt.addChild(obs); TableConfig levels = new TableConfig(Table.Type.Structure, "seq1"); levels.structName = "seq1"; levels.elev = UnidataPointDatasetHelper.getCoordinateName(ds, AxisType.Height); //levels.join = new TableConfig.JoinConfig(Join.Type.NestedStructure); obs.addChild(levels); return nt; }
Evaluator.VarAtt varatt = Evaluator.findVariableWithAttribute(ds, CF.INSTANCE_DIMENSION); if (varatt == null) varatt = Evaluator.findVariableWithAttribute(ds, CF.RAGGED_PARENTINDEX); if (varatt == null) return false; varatt = Evaluator.findVariableWithAttribute(ds, CF.SAMPLE_DIMENSION); if (varatt == null) varatt = Evaluator.findVariableWithAttribute(ds, CF.RAGGED_ROWSIZE); if (varatt == null) return false;
public TableConfig getConfig(FeatureType wantFeatureType, NetcdfDataset ds, Formatter errlog) { VNames vn = getVariableNames(ds, errlog); TableConfig trajTable = new TableConfig(Table.Type.Construct, "trajectory"); trajTable.featureType = FeatureType.TRAJECTORY; trajTable.feature_id = TRAJ_ID; TableConfig obs = new TableConfig(Table.Type.ParentId, "record"); obs.parentIndex = TRAJ_ID; obs.dimName = Evaluator.getDimensionName(ds, "recNum", errlog); obs.time = vn.obsTime; obs.timeNominal = vn.nominalTime; //obs.stnId = vn.stnId; //obs.stnDesc = vn.stnDesc; obs.lat = vn.lat; obs.lon = vn.lon; obs.elev = vn.elev; trajTable.addChild(obs); return trajTable; }
stnTable.stnId = Evaluator.findNameOfVariableWithAttributeValue(ds, CF.CF_ROLE, CF.STATION_ID); if (stnTable.stnId == null) stnTable.stnId = Evaluator.findNameOfVariableWithAttributeValue(ds, CF.STANDARD_NAME, CF.STATION_ID); // old way if (stnTable.stnId == null) { errlog.format("Must have a Station id variable with standard name station_id%n"); stnTable.stnDesc = Evaluator.findNameOfVariableWithAttributeValue(ds, CF.STANDARD_NAME, CF.PLATFORM_NAME); if (stnTable.stnDesc == null) stnTable.stnDesc = Evaluator.findNameOfVariableWithAttributeValue(ds, CF.STANDARD_NAME, CF.STATION_DESC); stnTable.stnWmoId = Evaluator.findNameOfVariableWithAttributeValue(ds, CF.STANDARD_NAME, CF.STATION_WMOID);
Structure multidimStruct = Evaluator.findStructureWithDimensions(ds, stationDim, obsDim);
@Override protected boolean identifyEncodingTimeSeriesProfile(NetcdfDataset ds, EncodingInfo info, CF.FeatureType ftype, Formatter errlog) { Evaluator.VarAtt varatt = Evaluator.findVariableWithAttribute(ds, CF.SAMPLE_DIMENSION); if (varatt == null) return false; String dimName = varatt.att.getStringValue(); info.grandChildDim = ds.findDimension(dimName); info.grandChildStruct = Evaluator.findStructureWithDimensions(ds, info.grandChildDim, null); Variable stdId = Evaluator.findVariableWithAttributeValue(ds, CF.CF_ROLE, CF.TIMESERIES_ID); Structure stn = stdId.getParentStructure(); if (stn.getRank() == 0) { // could be scalar Variable profileId = Evaluator.findVariableWithAttributeValue(ds, CF.CF_ROLE, CF.PROFILE_ID); Structure profile = profileId.getParentStructure(); info.childDim = profile.getDimension(0);
public TableConfig getConfig(FeatureType wantFeatureType, NetcdfDataset ds, Formatter errlog) { Dimension obsDim = Evaluator.getDimension(ds, "recNum", errlog); if (obsDim == null) { errlog.format("MADIS: must have an Observation dimension: named recNum"); boolean hasStruct = Evaluator.hasNetcdf3RecordStructure(ds); FeatureType ft = Evaluator.getFeatureType(ds, ":thredds_data_type", errlog); if (null == ft) { if ((ds.findDimension("manLevel") != null) && (ds.findVariable("prMan") != null)) { obs.dimName = Evaluator.getDimensionName(ds, "recNum", errlog); obs.time = vn.obsTime; obs.timeNominal = vn.nominalTime; obs.dimName = Evaluator.getDimensionName(ds, "recNum", errlog); obs.time = vn.obsTime; obs.timeNominal = vn.nominalTime;