congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
VariableSimpleIF.getDimensions
Code IndexAdd Tabnine to your IDE (free)

How to use
getDimensions
method
in
ucar.nc2.VariableSimpleIF

Best Java code snippets using ucar.nc2.VariableSimpleIF.getDimensions (Showing top 20 results out of 315)

origin: edu.ucar/netcdf

public List<Dimension> getDimensions() { return v.getDimensions(); }
public List<Attribute> getAttributes() { return v.getAttributes(); }
origin: edu.ucar/cdm

public List<Dimension> getDimensions() { return v.getDimensions(); }
public List<Attribute> getAttributes() { return v.getAttributes(); }
origin: Unidata/thredds

public List<Dimension> getDimensions() { return v.getDimensions(); }
public List<Attribute> getAttributes() { return v.getAttributes(); }
origin: Unidata/thredds

protected void addDimensionsClassic(List<? extends VariableSimpleIF> vars, Map<String, Dimension> dimMap) throws IOException {
 Set<Dimension> oldDims = new HashSet<>(20);
 // find all dimensions needed by these variables
 for (VariableSimpleIF var : vars) {
  List<Dimension> dims = var.getDimensions();
  oldDims.addAll(dims);
 }
 // add them
 for (Dimension d : oldDims) {
  // The dimension we're creating below will be shared, so we need an appropriate name for it.
  String dimName = getSharedDimName(d);
  if (!writer.hasDimension(null, dimName)) {
   Dimension newDim = writer.addDimension(null, dimName, d.getLength(), false, d.isVariableLength());
   dimMap.put(dimName, newDim);
  }
 }
}
origin: edu.ucar/cdm

protected void addDimensionsClassic(List<? extends VariableSimpleIF> vars, Map<String, Dimension> dimMap) throws IOException {
 Set<Dimension> oldDims = new HashSet<>(20);
 // find all dimensions needed by these variables
 for (VariableSimpleIF var : vars) {
  List<Dimension> dims = var.getDimensions();
  oldDims.addAll(dims);
 }
 // add them
 for (Dimension d : oldDims) {
  // The dimension we're creating below will be shared, so we need an appropriate name for it.
  String dimName = getSharedDimName(d);
  if (!writer.hasDimension(null, dimName)) {
   Dimension newDim = writer.addDimension(null, dimName, d.getLength(), true, false, d.isVariableLength());
   dimMap.put(dimName, newDim);
  }
 }
}
origin: Unidata/thredds

public void getDetailInfo( java.util.Formatter sf) {
 sf.format("FeatureDataset on location= %s%n", getLocation());
 sf.format("  featureType= %s%n",getFeatureType());
 sf.format("  title= %s%n",getTitle());
 sf.format("  desc= %s%n",getDescription());
 sf.format("  range= %s%n",getCalendarDateRange());
 sf.format("  start= %s%n", getCalendarDateEnd());
 sf.format("  end  = %s%n",getCalendarDateEnd());
 LatLonRect bb = getBoundingBox();
 sf.format("  bb   = %s%n", bb);
 if (bb != null)
  sf.format("  bb   = %s%n",getBoundingBox().toString2());
 sf.format("  has netcdf = %b%n", (getNetcdfFile() != null));
 List<Attribute> ga = getGlobalAttributes();
 if (ga.size() > 0) {
  sf.format("  Attributes%n");
  for (Attribute a : ga)
   sf.format("    %s%n",a);
 }
 List<VariableSimpleIF> vars = getDataVariables();
 sf.format("%n  Data Variables (%d)%n",vars.size());
 for (VariableSimpleIF v : vars) {
  sf.format("    name='%s' desc='%s' units=%s' type='%s' dims=(", v.getShortName(), v.getDescription(), v.getUnitsString(), v.getDataType());
  for (Dimension d : v.getDimensions()) sf.format("%s ", d);
  sf.format(")%n");
 }
 if (parseInfo.toString().length() > 0)
  sf.format("%nparseInfo=%n%s%n", parseInfo);
}
origin: edu.ucar/cdm

public void getDetailInfo( java.util.Formatter sf) {
 sf.format("FeatureDataset on location= %s%n", getLocation());
 sf.format("  featureType= %s%n",getFeatureType());
 sf.format("  title= %s%n",getTitle());
 sf.format("  desc= %s%n",getDescription());
 sf.format("  range= %s%n",getCalendarDateRange());
 sf.format("  start= %s%n", getCalendarDateEnd());
 sf.format("  end  = %s%n",getCalendarDateEnd());
 LatLonRect bb = getBoundingBox();
 sf.format("  bb   = %s%n", bb);
 if (bb != null)
  sf.format("  bb   = %s%n",getBoundingBox().toString2());
 sf.format("  has netcdf = %b%n", (getNetcdfFile() != null));
 List<Attribute> ga = getGlobalAttributes();
 if (ga.size() > 0) {
  sf.format("  Attributes%n");
  for (Attribute a : ga)
   sf.format("    %s%n",a);
 }
 List<VariableSimpleIF> vars = getDataVariables();
 sf.format("%n  Data Variables (%d)%n",vars.size());
 for (VariableSimpleIF v : vars) {
  sf.format("    name='%s' desc='%s' units=%s' type='%s' dims=(", v.getShortName(), v.getDescription(), v.getUnitsString(), v.getDataType());
  for (Dimension d : v.getDimensions()) sf.format("%s ", d);
  sf.format(")%n");
 }
 if (parseInfo.toString().length() > 0)
  sf.format("%nparseInfo=%n%s%n", parseInfo);
}
origin: edu.ucar/cdm

protected void addExtraVariables() throws IOException {
 if (extra == null) return;
 if (extraMap == null) extraMap = new HashMap<>();
 addDimensionsClassic(extra, dimMap);
 for (VariableSimpleIF vs : extra) {
  List<Dimension> dims = makeDimensionList(dimMap, vs.getDimensions());
  Variable mv = writer.addVariable(null, vs.getShortName(), vs.getDataType(), dims);
  for (Attribute att : vs.getAttributes())
   mv.addAttribute(att);
  extraMap.put(mv.getShortName(), mv);
 }
}
origin: Unidata/thredds

protected void addExtraVariables() throws IOException {
 if (extra == null) return;
 if (extraMap == null) extraMap = new HashMap<>();
 addDimensionsClassic(extra, dimMap);
 for (VariableSimpleIF vs : extra) {
  List<Dimension> dims = makeDimensionList(dimMap, vs.getDimensions());
  Variable mv = writer.addVariable(null, vs.getShortName(), vs.getDataType(), dims);
  for (Attribute att : vs.getAttributes())
   mv.addAttribute(att);
  extraMap.put(mv.getShortName(), mv);
 }
}
origin: edu.ucar/cdm

private void createDataVariables(List<VariableSimpleIF> dataVars) throws IOException {
 // find all dimensions needed by the data variables
 for (VariableSimpleIF var : dataVars) {
  List<Dimension> dims = var.getDimensions();
  dimSet.addAll(dims);
 }
 // add them
 for (Dimension d : dimSet) {
  if (!d.isUnlimited())
   ncfile.addDimension(d.getShortName(), d.getLength(), d.isShared(), false, d.isVariableLength());
 }
 // add the data variables all using the record dimension
 for (VariableSimpleIF oldVar : dataVars) {
  List<Dimension> dims = oldVar.getDimensions();
  StringBuilder dimNames = new StringBuilder(recordDimName);
  for (Dimension d : dims) {
   if (!d.isUnlimited())
    dimNames.append(" ").append(d.getShortName());
  }
  Variable newVar = ncfile.addVariable(oldVar.getShortName(), oldVar.getDataType(), dimNames.toString());
  List<Attribute> atts = oldVar.getAttributes();
  for (Attribute att : atts) {
   ncfile.addVariableAttribute(newVar, att);
  }
 }
}
origin: Unidata/thredds

protected void addCoordinatesExtended(Structure parent, List<VariableSimpleIF> coords) throws IOException {
 for (VariableSimpleIF vs : coords) {
  String dims = Dimension.makeDimensionsString(vs.getDimensions());
  Variable member = writer.addStructureMember(parent, vs.getShortName(), vs.getDataType(), dims);
  if (member == null) {
   logger.warn("Variable already exists =" + vs.getShortName());  // LOOK barf
   continue;
  }
  for (Attribute att : vs.getAttributes())
   member.addAttribute(att);
 }
}
origin: Unidata/thredds

private void createDataVariables(List<VariableSimpleIF> dataVars) throws IOException {
 // find all dimensions needed by the data variables
 for (VariableSimpleIF var : dataVars) {
  List<Dimension> dims = var.getDimensions();
  dimSet.addAll(dims);
 }
 // add them
 for (Dimension d : dimSet) {
  if (!d.isUnlimited())
   ncfile.addDimension(d.getShortName(), d.getLength(), d.isShared(), false, d.isVariableLength());
 }
 // add the data variables all using the record dimension
 for (VariableSimpleIF oldVar : dataVars) {
  List<Dimension> dims = oldVar.getDimensions();
  StringBuilder dimNames = new StringBuilder(recordDimName);
  for (Dimension d : dims) {
   if (!d.isUnlimited())
    dimNames.append(" ").append(d.getShortName());
  }
  Variable newVar = ncfile.addVariable(oldVar.getShortName(), oldVar.getDataType(), dimNames.toString());
  List<Attribute> atts = oldVar.getAttributes();
  for (Attribute att : atts) {
   ncfile.addVariableAttribute(newVar, att);
  }
 }
}
origin: edu.ucar/netcdf

private void createDataVariables(List<VariableSimpleIF> dataVars) throws IOException {
 // find all dimensions needed by the data variables
 for (VariableSimpleIF var : dataVars) {
  List<Dimension> dims = var.getDimensions();
  dimSet.addAll(dims);
 }
 // add them
 for (Dimension d : dimSet) {
  if (!d.isUnlimited())
   ncfile.addDimension(d.getShortName(), d.getLength(), d.isShared(), false, d.isVariableLength());
 }
 // add the data variables all using the record dimension
 for (VariableSimpleIF oldVar : dataVars) {
  List<Dimension> dims = oldVar.getDimensions();
  StringBuilder dimNames = new StringBuilder(recordDimName);
  for (Dimension d : dims) {
   if (!d.isUnlimited())
    dimNames.append(" ").append(d.getShortName());
  }
  Variable newVar = ncfile.addVariable(oldVar.getShortName(), oldVar.getDataType(), dimNames.toString());
  List<Attribute> atts = oldVar.getAttributes();
  for (Attribute att : atts) {
   ncfile.addVariableAttribute(newVar, att);
  }
 }
}
origin: Unidata/thredds

protected void replaceDataVars(StructureMembers sm) {
 for (StructureMembers.Member m : sm.getMembers()) {
  VariableSimpleIF org = this.cols.get(m.getName());
  int rank = org.getRank();
  List<Dimension> orgDims = org.getDimensions();
  // only keep the last n
  int n = m.getShape().length;
  List<Dimension> dims = orgDims.subList(rank-n, rank);
  VariableSimpleImpl result = new VariableSimpleImpl(org.getShortName(), org.getDescription(), org.getUnitsString(), org.getDataType(), dims);
  for (Attribute att : org.getAttributes()) result.add(att);
  this.cols.put(m.getName(), result);
 }
}
origin: edu.ucar/cdm

protected void addCoordinatesExtended(Structure parent, List<VariableSimpleIF> coords) throws IOException {
 for (VariableSimpleIF vs : coords) {
  String dims = Dimension.makeDimensionsString(vs.getDimensions());
  Variable member = writer.addStructureMember(parent, vs.getShortName(), vs.getDataType(), dims);
  if (member == null) {
   logger.warn("Variable already exists =" + vs.getShortName());  // LOOK barf
   continue;
  }
  for (Attribute att : vs.getAttributes())
   member.addAttribute(att);
 }
 parent.calcElementSize();
}
origin: edu.ucar/netcdf

private void createDataVariables(List<VariableSimpleIF> dataVars) throws IOException {
 String coordNames = timeName + " " + latName +" "+ lonName;
 if (altUnits != null)
  coordNames = coordNames +" " + altName;
 // find all dimensions needed by the data variables
 for (VariableSimpleIF var : dataVars) {
  List<Dimension> dims = var.getDimensions();
  dimSet.addAll(dims);
 }
 // add them
 for (Dimension d : dimSet) {
  if (!d.isUnlimited())
   writer.addDimension(null, d.getShortName(), d.getLength(), d.isShared(), false, d.isVariableLength());
 }
 // add the data variables all using the record dimension
 for (VariableSimpleIF oldVar : dataVars) {
  List<Dimension> dims = oldVar.getDimensions();
  StringBuilder dimNames = new StringBuilder(recordDimName);
  for (Dimension d : dims) {
   if (!d.isUnlimited())
    dimNames.append(" ").append(d.getShortName());
  }
  Variable newVar = writer.addVariable(null, oldVar.getShortName(), oldVar.getDataType(), dimNames.toString());
  List<Attribute> atts = oldVar.getAttributes();
  for (Attribute att : atts) {
   newVar.addAttribute( att);
  }
  newVar.addAttribute( new Attribute(CF.COORDINATES, coordNames));
 }
}
origin: edu.ucar/cdm

protected void addDataVariablesExtended(StructureData obsData, String coordVars) throws IOException {
 for (StructureMembers.Member m : obsData.getMembers()) {
  VariableSimpleIF oldVar = getDataVar(m.getName());
  if (oldVar == null) continue;
  // skip duplicates
  // if (record.findVariable(oldVar.getShortName()) != null) continue;
  // make dimension list
  StringBuilder dimNames = new StringBuilder();
  for (Dimension d : oldVar.getDimensions()) {
   if (d.isUnlimited()) continue;
   if (d.getShortName() == null || !d.getShortName().equals(recordDimName))
    dimNames.append(" ").append(d.getLength());  // anonymous
  }
  Variable newVar = writer.addStructureMember(record, oldVar.getShortName(), oldVar.getDataType(), dimNames.toString());
  if (newVar == null) {
   logger.warn("Variable already exists =" + oldVar.getShortName());  // LOOK barf
   continue;
  }
  List<Attribute> atts = oldVar.getAttributes();
  for (Attribute att : atts) {
   String attName = att.getShortName();
   if (!reservedVariableAtts.contains(attName) && !attName.startsWith("_Coordinate"))
    newVar.addAttribute(att);
  }
  newVar.addAttribute(new Attribute(CF.COORDINATES, coordVars));
 }
}
origin: Unidata/thredds

protected void addDataVariablesExtended(StructureData obsData, String coordVars) throws IOException {
 for (StructureMembers.Member m : obsData.getMembers()) {
  VariableSimpleIF oldVar = getDataVar(m.getName());
  if (oldVar == null) continue;
  // skip duplicates
  // if (record.findVariable(oldVar.getShortName()) != null) continue;
  // make dimension list
  StringBuilder dimNames = new StringBuilder();
  for (Dimension d : oldVar.getDimensions()) {
   if (d.isUnlimited()) continue;
   if (d.getShortName() == null || !d.getShortName().equals(recordDimName))
    dimNames.append(" ").append(d.getLength());  // anonymous
  }
  Variable newVar = writer.addStructureMember(record, oldVar.getShortName(), oldVar.getDataType(), dimNames.toString());
  if (newVar == null) {
   logger.warn("Variable already exists =" + oldVar.getShortName());  // LOOK barf
   continue;
  }
  List<Attribute> atts = oldVar.getAttributes();
  for (Attribute att : atts) {
   String attName = att.getShortName();
   if (!reservedVariableAtts.contains(attName) && !attName.startsWith("_Coordinate"))
    newVar.addAttribute(att);
  }
  newVar.addAttribute(new Attribute(CF.COORDINATES, coordVars));
 }
}
origin: edu.ucar/cdm

protected void addCoordinatesClassic(Dimension recordDim, List<VariableSimpleIF> coords, Map<String, Variable> varMap) throws IOException {
 addDimensionsClassic(coords, dimMap);
 for (VariableSimpleIF oldVar : coords) {
  List<Dimension> dims = makeDimensionList(dimMap, oldVar.getDimensions());
  dims.add(0, recordDim);
  Variable newVar;
  if (oldVar.getDataType().equals(DataType.STRING)  && !writer.getVersion().isExtendedModel()) {
   if (oldVar instanceof Variable)
    newVar = writer.addStringVariable(null, (Variable) oldVar, dims);
   else
    newVar = writer.addStringVariable(null, oldVar.getShortName(), dims, 20); // LOOK barf
  } else {
   newVar = writer.addVariable(null, oldVar.getShortName(), oldVar.getDataType(), dims);
  }
  if (newVar == null) {
   logger.warn("Variable already exists =" + oldVar.getShortName());  // LOOK barf
   continue;
  }
  for (Attribute att : oldVar.getAttributes())
   newVar.addAttribute(att);
  varMap.put(newVar.getShortName(), newVar);
 }
}
origin: Unidata/thredds

protected void addCoordinatesClassic(Dimension recordDim, List<VariableSimpleIF> coords, Map<String, Variable> varMap) throws IOException {
 addDimensionsClassic(coords, dimMap);
 for (VariableSimpleIF oldVar : coords) {
  List<Dimension> dims = makeDimensionList(dimMap, oldVar.getDimensions());
  dims.add(0, recordDim);
  Variable newVar;
  if (oldVar.getDataType().equals(DataType.STRING)  && !writer.getVersion().isExtendedModel()) {
   if (oldVar instanceof Variable)
    newVar = writer.addStringVariable(null, (Variable) oldVar, dims);
   else
    newVar = writer.addStringVariable(null, oldVar.getShortName(), dims, 20); // LOOK barf
  } else {
   newVar = writer.addVariable(null, oldVar.getShortName(), oldVar.getDataType(), dims);
  }
  if (newVar == null) {
   logger.warn("Variable already exists =" + oldVar.getShortName());  // LOOK barf
   continue;
  }
  for (Attribute att : oldVar.getAttributes())
   newVar.addAttribute(att);
  varMap.put(newVar.getShortName(), newVar);
 }
}
ucar.nc2VariableSimpleIFgetDimensions

Javadoc

Dimension List. empty for a scalar variable.

Popular methods of VariableSimpleIF

  • getShortName
    short name of the data Variable
  • getDescription
    description of the Variable
  • getUnitsString
    Units of the Variable. These should be udunits compatible if possible
  • findAttributeIgnoreCase
    find the attribute for the variable with the given name, ignoring case.
  • getAttributes
    Attributes for the variable.
  • getDataType
    Variable's data type
  • getFullName
    full, backslash escaped name of the data Variable
  • getRank
    Variable rank
  • getShape
    Variable shape

Popular in Java

  • Start an intent from android
  • runOnUiThread (Activity)
  • notifyDataSetChanged (ArrayAdapter)
  • putExtra (Intent)
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • Collectors (java.util.stream)
  • 21 Best IntelliJ Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now