public void AddDimension(NcDim dim) { if (!IfExists(dim)) { dimensionList.Add(dim); } }
private bool IfExists(NcDim dim) { foreach (NcDim myDim in this.dimensionList) { if (string.Compare(myDim.Name, dim.Name) == 0) { return(true); } } return(false); }
public NcMetaData GetMetadata() { NcMetaData metadata = new NcMetaData(); Dictionary <uint, INetCDFDimension> .Enumerator allDims = this.Dimensions.GetEnumerator(); while (allDims.MoveNext()) { INetCDFDimension iDim = allDims.Current.Value; NcDim dim = new NcDim(iDim.Name, (int)iDim.Length); } return(metadata); }
/// <summary> /// Fills the NcMetada with file metadata /// </summary> /// <param name="reader"></param> /// <returns></returns> public static NcMetaData GetMetaData(NetCDFReader reader) { NcMetaData metadata = new NcMetaData(); //Add No of records metadata.NumberOfRecords = (int)reader.NumberOfRecords; //Add Dimensions Dictionary <uint, INetCDFDimension> .Enumerator dimEnumerator = reader.Dimensions.GetEnumerator(); while (dimEnumerator.MoveNext()) { string name = dimEnumerator.Current.Value.Name; int size = (int)dimEnumerator.Current.Value.Length; NcDim dim = new NcDim(name, size); //dim.IsUnlimited = dimEnumerator.Current.Value.IsRecordDimension; metadata.AddDimension(dim); } //Add Global attributes Dictionary <string, INetCDFAttribute> .Enumerator attrEnumerator = reader.Attributes.GetEnumerator(); while (attrEnumerator.MoveNext()) { NcType attType = (NcType)attrEnumerator.Current.Value.DataType; string attName = attrEnumerator.Current.Key; //Get Attname here object attValue = attrEnumerator.Current.Value.Value; NcAtt att = new NcAtt(attName, attType, attValue); metadata.AddGlobalAttribute(att); } //Add Variables Dictionary <string, INetCDFVariable> .Enumerator varEnumerator = reader.Variables.GetEnumerator(); while (varEnumerator.MoveNext()) { string name = varEnumerator.Current.Value.Name; //object value = varEnumerator.Current.Value; NcType type = (NcType)varEnumerator.Current.Value.DataType; NcVar var = new NcVar(name, type); //Add dimenstions to variables var.NumValues = (int)varEnumerator.Current.Value.NumValues; for (int i = 0; i < varEnumerator.Current.Value.DimensionIDs.Length; i++) { uint dimID = varEnumerator.Current.Value.DimensionIDs[i]; NcDim dim = new NcDim(reader.Dimensions[dimID].Name, (int)reader.Dimensions[dimID].Length); var.Dimensions.Insert(i, dim); } // Add variable attributes Dictionary <string, INetCDFAttribute> .Enumerator vattEnumerator = varEnumerator.Current.Value.Attributes.GetEnumerator(); while (vattEnumerator.MoveNext()) { NcType attType = (NcType)vattEnumerator.Current.Value.DataType; string attName = vattEnumerator.Current.Key; //Get Attname here object attValue = vattEnumerator.Current.Value.Value; NcAtt att = new NcAtt(attName, attType, attValue); var.VariableAttributes.Add(att); } metadata.AddVariable(var); } return(metadata); }
public bool PutRec(NcDim dim, float[] vals, long rec) { return(false); }
public bool PutRec(NcDim dim, double[] vals, long rec) { return(false); }
public bool PutRec(NcDim dim, long[] vals) { return(false); }
public bool PutRec(NcDim dim, char[] vals) { return(false); }
public bool PutRec(NcDim dim, byte[] vals) { return(false); }
public bool PutRec(NcDim dim, short[] vals) { return(false); }
/// <summary> /// Set the current dimension slice for the specified dimension for this variable. /// </summary> /// <param name="dim"></param> /// <param name="rec"></param> public void SetRec(NcDim dim, long rec) { }
public NcValues GetRec(NcDim dim, long index) { return(null); }
public NcValues GetRec(NcDim dim) { return(null); }
public long RecSize(NcDim dim) { return(0); }
public void SetDimensions(int index, NcDim dim) { this.dimensions.Insert(index, dim); }