src/header.js
function dimensionsList(buffer) {
  var recordId, recordName;
  const dimList = buffer.readUint32();
  if (dimList === ZERO) {
    utils.notNetcdf((buffer.readUint32() !== ZERO), 'wrong empty tag for list of dimensions');
    return [];
  } else {
    utils.notNetcdf((dimList !== NC_DIMENSION), 'wrong tag for list of dimensions');

    // Length of dimensions
    const dimensionSize = buffer.readUint32();
    var dimensions = new Array(dimensionSize);
    for (var dim = 0; dim < dimensionSize; dim++) {
      // Read name
      var name = utils.readName(buffer);

      // Read dimension size
      const size = buffer.readUint32();
      if (size === NC_UNLIMITED) { // in netcdf 3 one field can be of size unlimmited
        recordId = dim;
        recordName = name;
      }

      dimensions[dim] = {
        name: name,
        size: size
      };
    }
  }
  return {
    dimensions: dimensions,
    recordId: recordId,
    recordName: recordName
  };
}
function dimensionsList(buffer) {
  var recordId, recordName;
  const dimList = buffer.readUint32();
  if (dimList === ZERO) {
    utils.notNetcdf((buffer.readUint32() !== ZERO), 'wrong empty tag for list of dimensions');
    return [];
  } else {
    utils.notNetcdf((dimList !== NC_DIMENSION), 'wrong tag for list of dimensions');

    // Length of dimensions
    const dimensionSize = buffer.readUint32();
    var dimensions = new Array(dimensionSize);
    for (var dim = 0; dim < dimensionSize; dim++) {
      // Read name
      var name = utils.readName(buffer);

      // Read dimension size
      const size = buffer.readUint32();
      if (size === NC_UNLIMITED) { // in netcdf 3 one field can be of size unlimmited
        recordId = dim;
        recordName = name;
      }

      dimensions[dim] = {
        name: name,
        size: size
      };
    }
  }
  return {
    dimensions: dimensions,
    recordId: recordId,
    recordName: recordName
  };
}
function dimensionsList ( buffer ) { var recordId , recordName ; const dimList = buffer . readUint32 ( ) ; if ( dimList === ZERO ) { utils . notNetcdf ( ( buffer . readUint32 ( ) !== ZERO ) , 'wrong empty tag for list of dimensions' ) ; return [ ] ; } else { utils . notNetcdf ( ( dimList !== NC_DIMENSION ) , 'wrong tag for list of dimensions' ) ; // Length of dimensions const dimensionSize = buffer . readUint32 ( ) ; var dimensions = new Array ( dimensionSize ) ; for ( var dim = 0 ; dim < dimensionSize ; dim ++ ) { // Read name var name = utils . readName ( buffer ) ; // Read dimension size const size = buffer . readUint32 ( ) ; if ( size === NC_UNLIMITED ) { // in netcdf 3 one field can be of size unlimmited recordId = dim ; recordName = name ; } dimensions [ dim ] = { name : name , size : size } ; } } return { dimensions : dimensions , recordId : recordId , recordName : recordName } ; }
List of dimensions
@ignore
@param {IOBuffer} buffer - Buffer for the file data
@return {object} - Ojbect containing the following properties:
* `dimensions` that is an array of dimension object:
* `name`: String with the name of the dimension
* `size`: Number with the size of the dimension dimensions: dimensions
* `recordId`: the id of the dimension that has unlimited size or undefined,
* `recordName`: name of the dimension that has unlimited size
List of dimensions