Codota Logo
Dimension.getLength
Code IndexAdd Codota to your IDE (free)

How to use
getLength
method
in
ucar.nc2.Dimension

Best Java code snippets using ucar.nc2.Dimension.getLength (Showing top 20 results out of 333)

  • Common ways to obtain Dimension
private void myMethod () {
Dimension d =
  • Codota IconVariable v;v.getDimension(0)
  • Codota IconNetcdfDataset ds;String str;ds.findDimension(str)
  • Codota IconGroup g;String name;g.findDimension(name)
  • Smart code suggestions by Codota
}
origin: geotools/geotools

public static int getDimensionLength(Variable var, final int dimensionIndex) {
  return var.getDimension(dimensionIndex).getLength();
}
origin: geotools/geotools

/**
 * Get Z Dimension Lenght for standard CF variables
 *
 * @param var
 * @return
 */
public static int getZDimensionLength(Variable var) {
  final int rank = var.getRank();
  if (rank > 2) {
    return var.getDimension(rank - Z_DIMENSION).getLength();
  }
  // TODO: Should I avoid use this method in case of 2D Variables?
  return 0;
}
origin: geotools/geotools

    variableDS
        .getDimension(variableDS.getRank() - NetCDFUtilities.X_DIMENSION)
        .getLength();
height =
    variableDS
        .getDimension(variableDS.getRank() - NetCDFUtilities.Y_DIMENSION)
        .getLength();
  numBands = variableDS.getRank() > 2 ? variableDS.getDimension(2).getLength() : 1;
origin: org.n52.sensorweb.sos/coding-netcdf

private int[] getDimShapes(List<Dimension> dims) {
  int[] dimShapes = new int[dims.size()];
  int dimCounter = 0;
  for (Dimension dim : dims) {
    dimShapes[dimCounter++] = dim.getLength();
  }
  return dimShapes;
}
origin: apache/tika

xhtml.element("li", dim.getFullName() + "=" + String.valueOf(dim.getLength()) + ";");
xhtml.newline();
origin: edu.ucar/netcdf

private long[] _computeChunkingUnlimited(Variable v) {
 List<Dimension> dims = v.getDimensions();
 long[] result = new long[dims.size()];
 int count = 0;
 for (Dimension d : dims) {
  if (d.isUnlimited()) result[count++] = 1;
  else result[count++] = d.getLength();
 }
 return result;
}
origin: edu.ucar/netcdf

public static void writeFromFile(NetcdfFile fileIn, String fileOutName) throws IOException {
 DataOutputStream stream = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(fileOutName), 10 * 1000));
 N3outputStreamWriter writer = new N3outputStreamWriter(fileIn);
 int numrec = fileIn.getUnlimitedDimension() == null ? 0 : fileIn.getUnlimitedDimension().getLength();
 writer.writeHeader(stream, numrec);
 writer.writeDataAll(stream);
 stream.close();
}
origin: edu.ucar/netcdf

static private boolean hasDimension_( NetcdfFile ncFile, String name,
                   int min, int max ) {
 boolean result = false;
 Dimension d = ncFile.findDimension( name );
 if ( d != null ) {
  final int size = d.getLength();
  result = inRangeI_( size, min, max );
 }
 return result;
}
origin: edu.ucar/cdm

 private int[] computeChunkingGrib(Variable v) {
  int n = v.getRank();
  int[] result = new int[n];
  if( n < 2 ) {
    result[0] = 1; // Unlimited variable with rank 1

  } else {
    for (int i=0; i<n; i++)
      result[i] = (i<n-2) ? 1 : v.getDimension(i).getLength();
  }    
  return result;
 }
}
origin: Unidata/thredds

 private int[] computeChunkingGrib(Variable v) {
  int n = v.getRank();
  int[] result = new int[n];
  if( n < 2 ) {
    result[0] = 1; // Unlimited variable with rank 1

  } else {
    for (int i=0; i<n; i++)
      result[i] = (i<n-2) ? 1 : v.getDimension(i).getLength();
  }    
  return result;
 }
}
origin: apache/tika

xhtml.newline();
for (Dimension dim : ncFile.getDimensions()) {
  xhtml.element("li", dim.getFullName() + " = " + dim.getLength());
origin: Unidata/thredds

@Override
public void hashCodeShow(Indent indent) {
 System.out.printf("%sDim hash = %d%n", indent, hashCode());
 System.out.printf("%s shortName '%s' = %d%n", indent, getShortName(), getShortName() == null ? -1 : getShortName().hashCode());
 System.out.printf("%s getLength %s%n", indent, getLength());
 System.out.printf("%s isUnlimited %s%n", indent, isUnlimited());
 System.out.printf("%s isVariableLength %s%n", indent, isVariableLength());
 System.out.printf("%s isShared %s%n", indent, isShared());
 if (getGroup() != null)
  System.out.printf("%s parentGroup %s = %d%n", indent, getGroup(), getGroup().hashCode());
}
origin: openmicroscopy/bioformats

@Override
public int getDimension(String name) {
 String groupName = getDirectory(name);
 String variableName = getName(name);
 Group group = getGroup(groupName);
 return group.findDimension(variableName).getLength();
}
origin: Unidata/thredds

private Element makeDim( Dimension dim) {
 Element dimElem = new Element("dimension", thredds.client.catalog.Catalog.ncmlNS);
 dimElem.setAttribute("name", dim.getShortName());
 dimElem.setAttribute("length", Integer.toString(dim.getLength()));
 if (dim.isUnlimited())
  dimElem.setAttribute("isUnlimited", "true");
 return dimElem;
}
origin: edu.ucar/cdm

public StructureDataIterator getStructureDataIterator(Cursor cursor, int bufferSize) throws IOException {
 StructureData parentStruct = cursor.getParentStructure();
 if (parentStruct instanceof StructureDataProxy) parentStruct =  ((StructureDataProxy) parentStruct).getOriginalStructureData(); // tricky dicky
 ArrayStructureMA asma = new ArrayStructureMA(sm, new int[]{inner.getLength()});
 for (String colName : cols.keySet()) {
  Array data = parentStruct.getArray(colName);
  StructureMembers.Member childm = sm.findMember(colName);
  childm.setDataArray(data);
 }
 return asma.getStructureDataIterator();
}
origin: Unidata/thredds

private static void read(GridDatatype gdt, Count count, int rtIndex, int tIndex, Dimension zDim) throws IOException {
 if (zDim != null) {
  for (int z = 0; z < zDim.getLength(); z++)
   read(gdt, count, rtIndex, tIndex, z);
 } else {
  read(gdt, count, rtIndex, tIndex, -1);
 }
}
origin: edu.ucar/netcdf

public static Element writeDimension(Dimension dim, Namespace ns) {
 Element dimElem = new Element("dimension", ns);
 dimElem.setAttribute("name", dim.getShortName());
 dimElem.setAttribute("length", Integer.toString(dim.getLength()));
 if (dim.isUnlimited())
  dimElem.setAttribute("isUnlimited", "true");
 if (dim.isVariableLength())
  dimElem.setAttribute("isVariableLength", "true");
 return dimElem;
}
origin: edu.ucar/cdm

private CoordinateAxis makeFakeCoordAxis(NetcdfDataset ds, String axisName, Dimension dim) {
 if (dim == null) return null;
 CoordinateAxis v = new CoordinateAxis1D(ds, null, axisName, DataType.SHORT, dim.getShortName(), "", "synthesized coordinate: only an index");
 v.addAttribute(new Attribute(_Coordinate.AxisType, "GeoZ"));
 if (!axisName.equals(dim.getShortName()))
  v.addAttribute(new Attribute(_Coordinate.AliasForDimension, dim.getShortName()));
 v.setValues(dim.getLength(), 0, 1);
 return v;
}
origin: edu.ucar/netcdf

private CoordinateAxis makeLonCoordAxis(NetcdfDataset ds, String axisName, Dimension dim) {
 if (dim == null) return null;
 double dx = 4 * findAttributeDouble(ds, "DX");
 int nx = dim.getLength();
 double startx = centerX - dx * (nx - 1) / 2;
 CoordinateAxis v = new CoordinateAxis1D(ds, null, axisName, DataType.DOUBLE, dim.getShortName(), "degrees_east", "synthesized longitude coordinate");
 ds.setValues(v, nx, startx, dx);
 v.addAttribute(new Attribute(_Coordinate.AxisType, "Lon"));
 if (!axisName.equals(dim.getShortName()))
  v.addAttribute(new Attribute(_Coordinate.AliasForDimension, dim.getShortName()));
 return v;
}
origin: Unidata/thredds

static NcStreamProto.Dimension.Builder encodeDim(Dimension dim) {
 NcStreamProto.Dimension.Builder dimBuilder = NcStreamProto.Dimension.newBuilder();
 if (dim.getShortName() != null)
  dimBuilder.setName(dim.getShortName());
 if (!dim.isVariableLength())
  dimBuilder.setLength(dim.getLength());
 dimBuilder.setIsPrivate(!dim.isShared());
 dimBuilder.setIsVlen(dim.isVariableLength());
 dimBuilder.setIsUnlimited(dim.isUnlimited());
 return dimBuilder;
}
ucar.nc2DimensiongetLength

Javadoc

Get the length of the Dimension.

Popular methods of Dimension

  • getShortName
  • <init>
    Copy Constructor. used to make global dimensions
  • getFullName
  • isUnlimited
    If unlimited, then the length can increase; otherwise it is immutable.
  • isVariableLength
    If variable length, then the length is unknown until the data is read.
  • equals
    Instances which have same contents are equal. Careful!! this is not object identity !!
  • isShared
    If this Dimension is shared, or is private to a Variable. All Dimensions in NetcdfFile.getDimensions
  • setLength
    Set the Dimension length.
  • setName
    Set the name, converting to valid CDM object name if needed.
  • setShared
    Set whether this is shared.
  • getGroup
    Get the Group that owns this Dimension.
  • setUnlimited
    Set whether this is unlimited, meaning length can increase.
  • getGroup,
  • setUnlimited,
  • getName,
  • getParentGroup,
  • hashCode,
  • makeFullName,
  • setGroup,
  • setImmutable,
  • setParentGroup

Popular in Java

  • Creating JSON documents from java classes using gson
  • putExtra (Intent)
  • addToBackStack (FragmentTransaction)
  • runOnUiThread (Activity)
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • IsNull (org.hamcrest.core)
    Is the value null?
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now