• 大小: 4.37MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-10-11
  • 语言: C#
  • 标签: .nc  NetCDF  

资源简介

请在VS2013版本以上打开,仅向上兼容,不可向下,内有备注,请查看。

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Microsoft.Research.ScientificDataSet.NetCDF4
{
    public partial class NetCDF
    {
        /// 
        /// ‘size‘ argument to ncdimdef for an unlimited dimension
        /// 

        public const int NC_UNLIMITED = 0;

        /// 
        /// attribute id to put/get a global attribute
        /// 

        public const int NC_GLOBAL = -1;

        /// 
        /// The netcdf external data types
        /// 

        public enum NcType : int
        {
            /// signed 1 byte intege
            NC_BYTE = 1
            /// ISO/ASCII character
            NC_CHAR = 2
            /// signed 2 byte integer
            NC_SHORT = 3
            /// signed 4 byte integer
            NC_INT = 4
            /// single precision floating point number
            NC_FLOAT = 5
            /// double precision floating point number
            NC_DOUBLE = 6
            /// signed 8-byte int
            NC_INT64 = 10
            /// string
            NC_STRING = 12
        }

        public static Type GetCLRType(NcType ncType)
        {
            switch (ncType)
            {
                case NcType.NC_BYTE:
                    return typeof(byte);
                case NcType.NC_CHAR:
                    return typeof(sbyte);
                case NcType.NC_SHORT:
                    return typeof(short);
                case NcType.NC_INT:
                    return typeof(int);
                case NcType.NC_INT64:
                    return typeof(long);
                case NcType.NC_FLOAT:
                    return typeof(float);
                case NcType.NC_DOUBLE:
                    return typeof(double);
                case NcType.NC_STRING:
                    return typeof(string);
                default:
                    throw new ApplicationException(“Unknown nc type“);
            }
        }

        public static NcType GetNcType(Type type)
        {
            switch (Type.GetTypeCode(type))
            {
                case TypeCode.Double:
                    return NcType.NC_DOUBLE;

                case TypeCode.Single:
                    return NcType.NC_FLOAT;

                case TypeCode.Int64:
                    return NcType.NC_INT64;

                case TypeCode.Int32:
                    return NcType.NC_INT;

                case TypeCode.Int16:
                    return NcType.NC_SHORT;

                case TypeCode.Byte:
                    return NcType.NC_BYTE;

                case TypeCode.SByte:
                    return NcType.NC_CHAR;

                case TypeCode.String:
                   

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2019-04-11 16:27  C#读取.nc文件\
     目录           0  2016-05-14 23:13  C#读取.nc文件\netcdfRead\
     目录           0  2016-05-15 14:45  C#读取.nc文件\netcdfRead\netcdfRead\
     文件         187  2016-05-14 23:13  C#读取.nc文件\netcdfRead\netcdfRead\App.config
     文件        6064  2016-05-14 23:14  C#读取.nc文件\netcdfRead\netcdfRead\Constants.cs
     文件       12071  2016-05-15 00:19  C#读取.nc文件\netcdfRead\netcdfRead\DotNetCdf.cs
     文件        1016  2016-05-15 14:45  C#读取.nc文件\netcdfRead\netcdfRead\Program.cs
     目录           0  2016-05-14 23:13  C#读取.nc文件\netcdfRead\netcdfRead\Properties\
     文件        1432  2016-05-14 23:13  C#读取.nc文件\netcdfRead\netcdfRead\Properties\AssemblyInfo.cs
     目录           0  2016-05-14 23:13  C#读取.nc文件\netcdfRead\netcdfRead\bin\
     目录           0  2016-05-14 23:22  C#读取.nc文件\netcdfRead\netcdfRead\bin\Debug\
     文件     1739776  2016-05-14 23:09  C#读取.nc文件\netcdfRead\netcdfRead\bin\Debug\netcdf4.dll
     文件       12288  2016-05-15 14:45  C#读取.nc文件\netcdfRead\netcdfRead\bin\Debug\netcdfRead.exe
     文件         187  2016-05-14 23:13  C#读取.nc文件\netcdfRead\netcdfRead\bin\Debug\netcdfRead.exe.config
     文件       17920  2016-05-15 14:45  C#读取.nc文件\netcdfRead\netcdfRead\bin\Debug\netcdfRead.pdb
     文件       23168  2016-05-15 14:45  C#读取.nc文件\netcdfRead\netcdfRead\bin\Debug\netcdfRead.vshost.exe
     文件         187  2016-05-14 23:13  C#读取.nc文件\netcdfRead\netcdfRead\bin\Debug\netcdfRead.vshost.exe.config
     文件         490  2015-10-30 15:19  C#读取.nc文件\netcdfRead\netcdfRead\bin\Debug\netcdfRead.vshost.exe.manifest
     文件     6921120  2016-05-09 22:44  C#读取.nc文件\netcdfRead\netcdfRead\bin\Debug\test.nc
     文件        2642  2016-05-14 23:22  C#读取.nc文件\netcdfRead\netcdfRead\netcdfRead.csproj
     目录           0  2016-05-14 23:13  C#读取.nc文件\netcdfRead\netcdfRead\obj\
     目录           0  2016-05-15 14:45  C#读取.nc文件\netcdfRead\netcdfRead\obj\Debug\
     文件        6689  2016-05-14 23:14  C#读取.nc文件\netcdfRead\netcdfRead\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
     目录           0  2019-04-11 16:28  C#读取.nc文件\netcdfRead\netcdfRead\obj\Debug\TempPE\
     文件           0  2016-05-14 23:13  C#读取.nc文件\netcdfRead\netcdfRead\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
     文件           0  2016-05-14 23:13  C#读取.nc文件\netcdfRead\netcdfRead\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
     文件           0  2016-05-14 23:13  C#读取.nc文件\netcdfRead\netcdfRead\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
     文件         694  2016-05-15 14:45  C#读取.nc文件\netcdfRead\netcdfRead\obj\Debug\netcdfRead.csproj.FileListAbsolute.txt
     文件        1755  2016-05-14 23:22  C#读取.nc文件\netcdfRead\netcdfRead\obj\Debug\netcdfRead.csprojResolveAssemblyReference.cache
     文件       12288  2016-05-15 14:45  C#读取.nc文件\netcdfRead\netcdfRead\obj\Debug\netcdfRead.exe
     文件       17920  2016-05-15 14:45  C#读取.nc文件\netcdfRead\netcdfRead\obj\Debug\netcdfRead.pdb
............此处省略3个文件信息

评论

共有 条评论

相关资源