Ejemplo n.º 1
0
        public string GetVariableName(NetCdfVariable ncVariable)
        {
            var nameBuilder = new StringBuilder((int)NetCdfWrapper.Limits.NC_MAX_NAME);

            CheckResult(NetCdfWrapper.nc_inq_varname(id, ncVariable, nameBuilder));
            return(nameBuilder.ToString());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Note that only char array can be higher dimensional here, it will then
        /// be flattened before written
        /// </summary>
        public void Write(NetCdfVariable ncVariable, int[] origin, int[] shape, Array array)
        {
            var originPtr  = NetCdfFileHelper.ConvertToIntPtr(origin);
            var shapePtr   = NetCdfFileHelper.ConvertToIntPtr(shape);
            var ncDataType = GetNetCdfDataType(array);

            switch (ncDataType)
            {
            case NetCdfDataType.NC_BYTE:
                CheckResult(NetCdfWrapper.nc_put_vara(id, ncVariable, originPtr, shapePtr, (byte[])array));
                break;

            case NetCdfDataType.NC_CHAR:
                var bytes = NetCdfFileHelper.FlattenCharArray(array, shape);
                CheckResult(NetCdfWrapper.nc_put_vara_text(id, ncVariable, originPtr, shapePtr, bytes));
                break;

            case NetCdfDataType.NC_INT:
                CheckResult(NetCdfWrapper.nc_put_vara_int(id, ncVariable, originPtr, shapePtr, (int[])array));
                break;

            case NetCdfDataType.NC_FLOAT:
                CheckResult(NetCdfWrapper.nc_put_vara_float(id, ncVariable, originPtr, shapePtr, (float[])array));
                break;

            case NetCdfDataType.NC_DOUBLE:
                CheckResult(NetCdfWrapper.nc_put_vara_double(id, ncVariable, originPtr, shapePtr, (double[])array));
                break;

            default:
                throw new Exception(
                          String.Format("Unknown type for writing NetCDF variable to file: type {0} to file {1}",
                                        ncDataType, path));
            }
        }
Ejemplo n.º 3
0
        public NetCdfDataType GetVariableDataType(NetCdfVariable ncVariable)
        {
            NetCdfDataType type;

            CheckResult(NetCdfWrapper.nc_inq_vartype(id, ncVariable, out type));
            return(type);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// write array to file, origin is assumed at 0, and shape is taken from array
        /// </summary>
        /// <param name="ncVariable"></param>
        /// <param name="array"></param>
        public void Write(NetCdfVariable ncVariable, Array array)
        {
            var shape  = array.GetShape();
            var origin = new int[array.Rank];

            Write(ncVariable, origin, shape, array);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Use this when the attribute might not exist
        /// </summary>
        /// <param name="ncVariable"></param>
        /// <param name="attributeName"></param>
        /// <returns>The attribute value as a string, or null</returns>
        public string GetAttributeValue(NetCdfVariable ncVariable, string attributeName)
        {
            var attribute = GetAttribute(ncVariable, attributeName);

            if (attribute != null)
            {
                return(attribute.Value.ToString());
            }
            return(null);
        }
Ejemplo n.º 6
0
 /// <summary>
 /// When shape = -1, this is replaced by the size of the dimension
 /// as read from the netcdf file
 /// </summary>
 /// <param name="ncVariable"></param>
 /// <param name="shape"></param>
 private void CreateShapeForFullRange(NetCdfVariable ncVariable, ref int[] shape)
 {
     for (int i = 0; i < shape.Length; ++i)
     {
         if (shape[i] != -1)
         {
             continue;
         }
         shape[i] = GetShape(ncVariable)[i];
     }
 }
Ejemplo n.º 7
0
        private int[] GetDimensionIds(NetCdfVariable ncVariable)
        {
            int nDims;

            CheckResult(NetCdfWrapper.nc_inq_varndims(id, ncVariable, out nDims));

            var dimIds = new int[nDims];

            NetCdfWrapper.nc_inq_vardimid(id, ncVariable, dimIds);
            return(dimIds);
        }
Ejemplo n.º 8
0
        public IEnumerable <string> GetVariableDimensionNames(NetCdfVariable ncVariable)
        {
            var dimensions = GetDimensionIds(ncVariable);

            foreach (var dimId in dimensions)
            {
                var nameBuilder = new StringBuilder((int)NetCdfWrapper.Limits.NC_MAX_NAME);
                CheckResult(NetCdfWrapper.nc_inq_dimname(id, dimId, nameBuilder));

                yield return(nameBuilder.ToString());
            }
        }
Ejemplo n.º 9
0
        public NetCdfVariable AddVariable(string varName, Type type, NetCdfDimension[] ncDimensions)
        {
            int varId;

            CheckResult(NetCdfWrapper.nc_def_var(id, varName, NetCdfWrapper.GetNetCdf3DataType(type), ncDimensions.Length,
                                                 ncDimensions.Select(d => (int)d).ToArray(), out varId));
            var ncVar = new NetCdfVariable(varId);

            // variable name is unique here, guaranteed by nc_def_var call above
            ncVariableLookupByName.Add(varName, ncVar);
            return(ncVar);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Read a part of the variable from file, given a certain stride
        /// </summary>
        /// <param name="ncVariable"></param>
        /// <param name="origin"></param>
        /// <param name="shape">When shape is -1, this corresponds to reading that entire dimension</param>
        /// <param name="stride"></param>
        /// <returns></returns>
        public Array Read(NetCdfVariable ncVariable, int[] origin, int[] shape, int[] stride)
        {
            CreateShapeForFullRange(ncVariable, ref shape);
            var count = Enumerable.Range(0, origin.Length).Select(i => (shape[i] - origin[i]) / stride[i]).ToArray();
            var size  = NetCdfFileHelper.GetSize(count);

            var originPtr = NetCdfFileHelper.ConvertToIntPtr(origin);
            var stridePtr = NetCdfFileHelper.ConvertToIntPtr(stride);
            var countPtr  = NetCdfFileHelper.ConvertToIntPtr(count);

            var type = GetDataType(ncVariable);

            switch (type)
            {
            case NetCdfDataType.NC_BYTE:
                var byteArray = new byte[size];
                CheckResult(NetCdfWrapper.nc_get_vars(id, ncVariable, originPtr, countPtr, stridePtr, byteArray));
                return(NetCdfFileHelper.CreateArrayFromShape(byteArray, count));

            case NetCdfDataType.NC_CHAR:
                if (shape.Length != 2)
                {
                    throw new NotSupportedException(
                              "NetCdf: only char arrays for independent string variables supported");
                }
                var charArray = new byte[size];
                CheckResult(NetCdfWrapper.nc_get_vars_text(id, ncVariable, originPtr, countPtr, stridePtr, charArray));
                return(NetCdfFileHelper.CreateCharArrayFromShape(charArray, count));

            case NetCdfDataType.NC_INT:
                var intArray = new int[size];
                CheckResult(NetCdfWrapper.nc_get_vars_int(id, ncVariable, originPtr, countPtr, stridePtr, intArray));
                return(NetCdfFileHelper.CreateArrayFromShape(intArray, count));

            case NetCdfDataType.NC_FLOAT:
                var floatArray = new float[size];
                CheckResult(NetCdfWrapper.nc_get_vars_float(id, ncVariable, originPtr, countPtr, stridePtr, floatArray));
                return(NetCdfFileHelper.CreateArrayFromShape(floatArray, count));

            case NetCdfDataType.NC_DOUBLE:
                var doubleArray = new double[size];
                CheckResult(NetCdfWrapper.nc_get_vars_double(id, ncVariable, originPtr, countPtr, stridePtr, doubleArray));
                return(NetCdfFileHelper.CreateArrayFromShape(doubleArray, count));

            default:
                throw new Exception(
                          String.Format("Unknown type for reading NetCDF variable from file: type {0} from file {1}",
                                        type, path));
            }
        }
Ejemplo n.º 11
0
        public int[] GetShape(NetCdfVariable ncVariable)
        {
            var dimIds = GetDimensionIds(ncVariable);
            var nDims  = dimIds.Length;
            var shape  = new int[nDims];

            for (int i = 0; i < nDims; ++i)
            {
                IntPtr len;
                CheckResult(NetCdfWrapper.nc_inq_dimlen(id, dimIds[i], out len));
                shape[i] = len.ToInt32();
            }

            return(shape);
        }
Ejemplo n.º 12
0
        public bool IsCharArray(NetCdfVariable ncVariable)
        {
            int nDims;

            NetCdfWrapper.nc_inq_varndims(id, ncVariable, out nDims);
            if (nDims < 2)
            {
                return(false);
            }

            NetCdfDataType ncType;

            CheckResult(NetCdfWrapper.nc_inq_vartype(id, ncVariable, out ncType));
            return(ncType == NetCdfDataType.NC_CHAR);
        }
Ejemplo n.º 13
0
        public bool IsVariableUnlimited(NetCdfVariable ncVariable)
        {
            int nDims;

            CheckResult(NetCdfWrapper.nc_inq_varndims(id, ncVariable, out nDims));

            var dimIds = new int[nDims];

            CheckResult(NetCdfWrapper.nc_inq_vardimid(id, ncVariable, dimIds));

            int unlimitedDimId;

            CheckResult(NetCdfWrapper.nc_inq_unlimdim(id, out unlimitedDimId));

            return(dimIds.Contains(unlimitedDimId));
        }
Ejemplo n.º 14
0
        public Dictionary <string, object> GetAttributes(NetCdfVariable ncVariable)
        {
            var nameValueDictionary = new Dictionary <string, object>();

            int nAtts;

            CheckResult(NetCdfWrapper.nc_inq_varnatts(id, ncVariable, out nAtts));

            for (int i = 0; i < nAtts; ++i)
            {
                var nameBuilder = new StringBuilder((int)NetCdfWrapper.Limits.NC_MAX_NAME);
                NetCdfWrapper.nc_inq_attname(id, ncVariable, i, nameBuilder);
                var name = nameBuilder.ToString();

                var attribute = GetAttribute(ncVariable, name);
                nameValueDictionary.Add(attribute.Name, attribute.Value);
            }

            return(nameValueDictionary);
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Read out the entire variable from the file
        /// </summary>
        /// <param name="ncVariable"></param>
        /// <returns></returns>
        public Array Read(NetCdfVariable ncVariable)
        {
            var type  = GetDataType(ncVariable);
            var size  = GetSize(ncVariable);
            var shape = GetShape(ncVariable);

            switch (type)
            {
            case NetCdfDataType.NC_BYTE:
                var byteArray = new byte[size];
                CheckResult(NetCdfWrapper.nc_get_var(id, ncVariable, byteArray));
                return(NetCdfFileHelper.CreateArrayFromShape(byteArray, shape));

            case NetCdfDataType.NC_CHAR:
                var charArray = new byte[size];
                CheckResult(NetCdfWrapper.nc_get_var_text(id, ncVariable, charArray));
                return(NetCdfFileHelper.CreateCharArrayFromShape(charArray, shape));

            case NetCdfDataType.NC_INT:
                var intArray = new int[size];
                CheckResult(NetCdfWrapper.nc_get_var_int(id, ncVariable, intArray));
                return(NetCdfFileHelper.CreateArrayFromShape(intArray, shape));

            case NetCdfDataType.NC_FLOAT:
                var floatArray = new float[size];
                CheckResult(NetCdfWrapper.nc_get_var_float(id, ncVariable, floatArray));
                return(NetCdfFileHelper.CreateArrayFromShape(floatArray, shape));

            case NetCdfDataType.NC_DOUBLE:
                var doubleArray = new double[size];
                CheckResult(NetCdfWrapper.nc_get_var_double(id, ncVariable, doubleArray));
                return(NetCdfFileHelper.CreateArrayFromShape(doubleArray, shape));

            default:
                throw new Exception(
                          String.Format("Unknown type for reading NetCDF variable from file: type {0} from file {1}",
                                        type, path));
            }
        }
Ejemplo n.º 16
0
 public int GetSize(NetCdfVariable ncVariable)
 {
     var shape = GetShape(ncVariable);
     return NetCdfFileHelper.GetSize(shape);
 }
Ejemplo n.º 17
0
        /// <summary>
        /// Read a part of the variable from file, given a certain stride
        /// </summary>
        /// <param name="ncVariable"></param>
        /// <param name="origin"></param>
        /// <param name="shape">When shape is -1, this corresponds to reading that entire dimension</param>
        /// <param name="stride"></param>
        /// <returns></returns>
        public Array Read(NetCdfVariable ncVariable, int[] origin, int[] shape, int[] stride)
        {
            CreateShapeForFullRange(ncVariable, ref shape);
            var count = Enumerable.Range(0, origin.Length).Select(i => (shape[i] - origin[i])/stride[i]).ToArray();
            var size = NetCdfFileHelper.GetSize(count);

            var originPtr = NetCdfFileHelper.ConvertToIntPtr(origin);
            var stridePtr = NetCdfFileHelper.ConvertToIntPtr(stride);
            var countPtr = NetCdfFileHelper.ConvertToIntPtr(count);

            var type = GetDataType(ncVariable);
            switch (type)
            {
                case NetCdfDataType.NC_BYTE:
                    var byteArray = new byte[size];
                    CheckResult(NetCdfWrapper.nc_get_vars(id, ncVariable, originPtr, countPtr, stridePtr, byteArray));
                    return NetCdfFileHelper.CreateArrayFromShape(byteArray, count);
                case NetCdfDataType.NC_CHAR:
                    if (shape.Length != 2)
                    {
                        throw new NotSupportedException(
                            "NetCdf: only char arrays for independent string variables supported");
                    }
                    var charArray = new byte[size];
                    CheckResult(NetCdfWrapper.nc_get_vars_text(id, ncVariable, originPtr, countPtr, stridePtr, charArray));
                    return NetCdfFileHelper.CreateCharArrayFromShape(charArray, count);
                case NetCdfDataType.NC_INT:
                    var intArray = new int[size];
                    CheckResult(NetCdfWrapper.nc_get_vars_int(id, ncVariable, originPtr, countPtr, stridePtr, intArray));
                    return NetCdfFileHelper.CreateArrayFromShape(intArray, count);
                case NetCdfDataType.NC_FLOAT:
                    var floatArray = new float[size];
                    CheckResult(NetCdfWrapper.nc_get_vars_float(id, ncVariable, originPtr, countPtr, stridePtr, floatArray));
                    return NetCdfFileHelper.CreateArrayFromShape(floatArray, count);
                case NetCdfDataType.NC_DOUBLE:
                    var doubleArray = new double[size];
                    CheckResult(NetCdfWrapper.nc_get_vars_double(id, ncVariable, originPtr, countPtr, stridePtr, doubleArray));
                    return NetCdfFileHelper.CreateArrayFromShape(doubleArray, count);
                default:
                    throw new Exception(
                        String.Format("Unknown type for reading NetCDF variable from file: type {0} from file {1}",
                                      type, path));
            }
        }
Ejemplo n.º 18
0
        public int GetSize(NetCdfVariable ncVariable)
        {
            var shape = GetShape(ncVariable);

            return(NetCdfFileHelper.GetSize(shape));
        }
Ejemplo n.º 19
0
        public bool IsCharArray(NetCdfVariable ncVariable)
        {
            int nDims;
            NetCdfWrapper.nc_inq_varndims(id, ncVariable, out nDims);
            if (nDims < 2) return false;

            NetCdfDataType ncType;
            CheckResult(NetCdfWrapper.nc_inq_vartype(id, ncVariable, out ncType));
            return (ncType == NetCdfDataType.NC_CHAR);
        }
Ejemplo n.º 20
0
 public void SetCaching(NetCdfVariable ncVariable, bool caching)
 {
     // todo: what should we do here?
 }
Ejemplo n.º 21
0
 public NetCdfVariable AddVariable(string varName, Type type, NetCdfDimension[] ncDimensions)
 {
     int varId;
     CheckResult(NetCdfWrapper.nc_def_var(id, varName, NetCdfWrapper.GetNetCdf3DataType(type), ncDimensions.Length,
                                          ncDimensions.Select(d => (int)d).ToArray(), out varId));
     var ncVar = new NetCdfVariable(varId);
     
     // variable name is unique here, guaranteed by nc_def_var call above
     ncVariableLookupByName.Add(varName, ncVar);
     return ncVar;
 }
Ejemplo n.º 22
0
 public NetCdfDataType GetVariableDataType(NetCdfVariable ncVariable)
 {
     NetCdfDataType type;
     CheckResult(NetCdfWrapper.nc_inq_vartype(id, ncVariable, out type));
     return type;
 }
Ejemplo n.º 23
0
 public void AddAttribute(NetCdfVariable ncVariable, NetCdfAttribute ncAttribute)
 {
    WriteAttribute(ncVariable, ncAttribute);
 }
Ejemplo n.º 24
0
        public bool IsVariableUnlimited(NetCdfVariable ncVariable)
        {
            int nDims;
            CheckResult(NetCdfWrapper.nc_inq_varndims(id, ncVariable, out nDims));

            var dimIds = new int[nDims];
            CheckResult(NetCdfWrapper.nc_inq_vardimid(id, ncVariable, dimIds));

            int unlimitedDimId;
            CheckResult(NetCdfWrapper.nc_inq_unlimdim(id, out unlimitedDimId));

            return dimIds.Contains(unlimitedDimId);
        }
Ejemplo n.º 25
0
        public int[] GetShape(NetCdfVariable ncVariable)
        {
            var dimIds = GetDimensionIds(ncVariable);
            var nDims = dimIds.Length;
            var shape = new int[nDims];

            for (int i = 0; i < nDims; ++i)
            {
                IntPtr len;
                CheckResult(NetCdfWrapper.nc_inq_dimlen(id, dimIds[i], out len));
                shape[i] = len.ToInt32();
            }

            return shape;
        }
Ejemplo n.º 26
0
        private int[] GetDimensionIds(NetCdfVariable ncVariable)
        {
            int nDims;
            CheckResult(NetCdfWrapper.nc_inq_varndims(id, ncVariable, out nDims));

            var dimIds = new int[nDims];
            NetCdfWrapper.nc_inq_vardimid(id, ncVariable, dimIds);
            return dimIds;
        }
Ejemplo n.º 27
0
 public IEnumerable<NetCdfDimension> GetDimensions(NetCdfVariable ncVariable)
 {
     return GetVariableDimensionNames(ncVariable).Select(GetDimension);
 }
Ejemplo n.º 28
0
        public Dictionary<string, object> GetAttributes(NetCdfVariable ncVariable)
        {
            var nameValueDictionary = new Dictionary<string, object>();

            int nAtts;
            CheckResult(NetCdfWrapper.nc_inq_varnatts(id, ncVariable, out nAtts));

            for (int i = 0; i < nAtts; ++i)
            {
                var nameBuilder = new StringBuilder((int)NetCdfWrapper.Limits.NC_MAX_NAME);
                NetCdfWrapper.nc_inq_attname(id, ncVariable, i, nameBuilder);
                var name = nameBuilder.ToString();

                var attribute = GetAttribute(ncVariable, name);
                nameValueDictionary.Add(attribute.Name, attribute.Value);
            }

            return nameValueDictionary;
        }
Ejemplo n.º 29
0
        /// <summary>
        /// Read out the entire variable from the file
        /// </summary>
        /// <param name="ncVariable"></param>
        /// <returns></returns>
        public Array Read(NetCdfVariable ncVariable)
        {
            var type = GetDataType(ncVariable);
            var size = GetSize(ncVariable);
            var shape = GetShape(ncVariable);

            switch (type)
            {
                case NetCdfDataType.NC_BYTE:
                    var byteArray = new byte[size];
                    CheckResult(NetCdfWrapper.nc_get_var(id, ncVariable, byteArray));
                    return NetCdfFileHelper.CreateArrayFromShape(byteArray, shape);
                case NetCdfDataType.NC_CHAR:
                    var charArray = new byte[size];
                    CheckResult(NetCdfWrapper.nc_get_var_text(id, ncVariable, charArray));
                    return NetCdfFileHelper.CreateCharArrayFromShape(charArray, shape);
                case NetCdfDataType.NC_INT:
                    var intArray = new int[size];
                    CheckResult(NetCdfWrapper.nc_get_var_int(id, ncVariable, intArray));
                    return NetCdfFileHelper.CreateArrayFromShape(intArray, shape);
                case NetCdfDataType.NC_FLOAT:
                    var floatArray = new float[size];
                    CheckResult(NetCdfWrapper.nc_get_var_float(id, ncVariable, floatArray));
                    return NetCdfFileHelper.CreateArrayFromShape(floatArray, shape);
                case NetCdfDataType.NC_DOUBLE:
                    var doubleArray = new double[size];
                    CheckResult(NetCdfWrapper.nc_get_var_double(id, ncVariable, doubleArray));
                    return NetCdfFileHelper.CreateArrayFromShape(doubleArray, shape);
                default:
                    throw new Exception(
                        String.Format("Unknown type for reading NetCDF variable from file: type {0} from file {1}",
                                      type, path));
            }
        }
Ejemplo n.º 30
0
 public string GetVariableName(NetCdfVariable ncVariable)
 {
     var nameBuilder = new StringBuilder((int)NetCdfWrapper.Limits.NC_MAX_NAME);
     CheckResult(NetCdfWrapper.nc_inq_varname(id, ncVariable, nameBuilder));
     return nameBuilder.ToString();
 }
Ejemplo n.º 31
0
 /// <summary>
 /// Use this when the attribute might not exist
 /// </summary>
 /// <param name="ncVariable"></param>
 /// <param name="attributeName"></param>
 /// <returns>The attribute value as a string, or null</returns>
 public string GetAttributeValue(NetCdfVariable ncVariable, string attributeName)
 {
     var attribute = GetAttribute(ncVariable, attributeName);
     if (attribute != null) return attribute.Value.ToString();
     return null;
 }
Ejemplo n.º 32
0
        public IEnumerable<string> GetVariableDimensionNames(NetCdfVariable ncVariable)
        {
            var dimensions = GetDimensionIds(ncVariable);
            foreach (var dimId in dimensions)
            {
                var nameBuilder = new StringBuilder((int) NetCdfWrapper.Limits.NC_MAX_NAME);
                CheckResult(NetCdfWrapper.nc_inq_dimname(id, dimId, nameBuilder));

                yield return nameBuilder.ToString();
            }
        }
Ejemplo n.º 33
0
 public IEnumerable <NetCdfDimension> GetDimensions(NetCdfVariable ncVariable)
 {
     return(GetVariableDimensionNames(ncVariable).Select(GetDimension));
 }
Ejemplo n.º 34
0
        /// <summary>
        /// Note that only char array can be higher dimensional here, it will then
        /// be flattened before written
        /// </summary>
        public void Write(NetCdfVariable ncVariable, int[] origin, int[] shape, Array array)
        {
            var originPtr = NetCdfFileHelper.ConvertToIntPtr(origin);
            var shapePtr = NetCdfFileHelper.ConvertToIntPtr(shape);
            var ncDataType = GetNetCdfDataType(array);

            switch (ncDataType)
            {
                case NetCdfDataType.NC_BYTE:
                    CheckResult(NetCdfWrapper.nc_put_vara(id, ncVariable, originPtr, shapePtr, (byte[])array));
                    break;
                case NetCdfDataType.NC_CHAR:
                    var bytes = NetCdfFileHelper.FlattenCharArray(array, shape);
                    CheckResult(NetCdfWrapper.nc_put_vara_text(id, ncVariable, originPtr, shapePtr, bytes));
                    break;
                case NetCdfDataType.NC_INT:
                    CheckResult(NetCdfWrapper.nc_put_vara_int(id, ncVariable, originPtr, shapePtr, (int[]) array));
                    break;
                case NetCdfDataType.NC_FLOAT:
                    CheckResult(NetCdfWrapper.nc_put_vara_float(id, ncVariable, originPtr, shapePtr, (float[])array));
                    break;
                case NetCdfDataType.NC_DOUBLE:
                    CheckResult(NetCdfWrapper.nc_put_vara_double(id, ncVariable, originPtr, shapePtr, (double[]) array));
                    break;
                default:
                    throw new Exception(
                        String.Format("Unknown type for writing NetCDF variable to file: type {0} to file {1}",
                                      ncDataType, path));
            }
        }
Ejemplo n.º 35
0
 public void AddAttribute(NetCdfVariable ncVariable, NetCdfAttribute ncAttribute)
 {
     WriteAttribute(ncVariable, ncAttribute);
 }
Ejemplo n.º 36
0
 /// <summary>
 /// When shape = -1, this is replaced by the size of the dimension
 /// as read from the netcdf file
 /// </summary>
 /// <param name="ncVariable"></param>
 /// <param name="shape"></param>
 private void CreateShapeForFullRange(NetCdfVariable ncVariable, ref int[] shape)
 {
     for (int i = 0; i < shape.Length; ++i)
     {
         if (shape[i] != -1) continue;
         shape[i] = GetShape(ncVariable)[i];
     }
 }
Ejemplo n.º 37
0
        /// <summary>
        /// write array to file, origin is assumed at 0, and shape is taken from array
        /// </summary>
        /// <param name="ncVariable"></param>
        /// <param name="array"></param>
        public void Write(NetCdfVariable ncVariable, Array array)
        {
            var shape = array.GetShape();
            var origin = new int[array.Rank];

            Write(ncVariable, origin, shape, array);
        }
Ejemplo n.º 38
0
 public void SetCaching(NetCdfVariable ncVariable, bool caching)
 {
     // todo: what should we do here?
 }