/// <summary>
        /// Set of dimensions for each CS must be equal to the set of dimensions for the variable.
        /// </summary>
        private void CheckCoordinateSystems()
        {
            DimensionList dlist = changes.Dimensions == null ? dims : changes.Dimensions;
            CoordinateSystemCollection cscoll = changes.Cs == null ? csystems : changes.Cs;

            foreach (CoordinateSystem cs in cscoll)
            {
                if (dlist != cs.GetDimensions(SchemaVersion.Recent))
                {
                    throw new Exception("Set of dimensions for each coordinate system must be equal to the set of dimensions for the variable.");
                }
            }
        }
        /// <summary>
        /// Adds the data to the variable starting with specified origin indices.
        /// </summary>
        /// <param name="origin">Indices to start adding of data. Null means all zeros.</param>
        /// <param name="a">Data to add to the variable.</param>
        public override void PutData(int[] origin, Array a)
        {
            if (origin != null && origin.Length != Rank)
            {
                throw new ArgumentException("Origin contains incorrect number of dimensions.");
            }
            if (a.Rank != Rank)
            {
                throw new ArgumentException("Array has wrong rank.");
            }

            StartChanging();

            if (origin == null)
            {
                origin = new int[Rank];
            }

            // Updating shape
            DimensionList proposedDims = changes.Dimensions;

            if (proposedDims == null)
            {
                proposedDims       = dims.Clone();
                changes.Dimensions = proposedDims;
            }

            for (int i = 0; i < proposedDims.Count; i++)
            {
                int shape = origin[i] + a.GetLength(i);
                if (shape > proposedDims[i].Length)
                {
                    proposedDims[i] = new Dimension(proposedDims[i].Name, shape);
                }
            }

            // Adding new data piece to the change list
            DataPiece piece = new DataPiece();

            piece.Origin = origin;
            piece.Data   = a;

            changes.DataPieces.Add(piece);

            // Firing the event
            FireEventVariableChanged(VariableChangeAction.PutData);
        }