1 Star 0 Fork 10

michael sun/GeoFly

forked from Yonghe/GeoFlying 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
LowAPI.cs 4.13 KB
一键复制 编辑 原始数据 按行查看 历史
Yonghe 提交于 2020-10-02 09:33 . first
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace NetCDF
{
public enum NC_Type
{
NC_NAT,
NC_BYTE,
NC_CHAR,
NC_SHORT,
NC_INT,
NC_FLOAT,
NC_DOUBLE,
NC_UBYTE,
NC_USHORT,
NC_UINT,
NC_INT64,
NC_UINT64,
NC_STRING
}
public static class LowAPI
{
[DllImport("netcdf.dll")]
public static extern int nc_inq_dim(int ncid, int dimid,StringBuilder nameb, ref int len);
[DllImport("netcdf.dll")]
public static extern int nc_inq_varname(int ncid, int varid, StringBuilder name);
[DllImport("netcdf.dll")]
public static extern int nc_get_var_float(int ncid, int varid, float[] ip);
[DllImport("netcdf.dll")]
public static extern int nc_get_var_short(int ncid, int varid, short[] ip);
[DllImport("netcdf.dll")]
public static extern int nc_get_var_int(int ncid, int varid, int[] ip);
[DllImport("netcdf.dll")]
public static extern int nc_inq_varndims(int ncid, int varid, ref int ndim);
[DllImport("netcdf.dll")]
public static extern int nc_inq_vardimid(int ncid, int varid, int[] dimid);
[DllImport("netcdf.dll")]
public static extern int nc_get_vara_int(int ncid, int varid, int[] start, int[] count, int[] ip);
[DllImport("netcdf.dll")]
public static extern int nc_get_vara_float(int ncid, int varid, int[] start, int[] count, float[] ip);
[DllImport("netcdf.dll")]
public static extern int nc_get_vara_double(int ncid, int varid, int[] start, int[] count, double[] ip);
[DllImport("netcdf.dll")]
public static extern int nc_inq_vartype(int ncid, int varid, ref NC_Type type);
[DllImport("netcdf.dll")]
public static extern int nc_inq_att(int ncid, int varid, string name, ref NC_Type type, ref int len);
[DllImport("netcdf.dll")]
public static extern int nc_inq_varnatts(int ncid, int varid, ref int nattsp);
[DllImport("netcdf.dll")]
public static extern int nc_inq_attname(int ncid, int varid, int attnum, StringBuilder name);
[DllImport("netcdf.dll")]
public static extern int nc_get_att_text(int ncid, int varid, string name, StringBuilder value);
[DllImport("netcdf.dll")]
public static extern int nc_open(string filename, int mode, ref int id);
[DllImport("netcdf.dll")]
public static extern int nc_create(string path, int cmode, ref int ncidp);
[DllImport("netcdf.dll")]
public static extern int nc_close(int ncidp);
[DllImport("netcdf.dll")]
public static extern int nc_inq_nvars(int ncidp, ref int nvars);
[DllImport("netcdf.dll")]
public static extern int nc_inq_varid(int ncid, string nvars, ref int varid);
[DllImport("netcdf.dll")]
public static extern int nc_inq_ndims(int ncid, ref int ndimsp);
[DllImport("netcdf.dll")]
public static extern int nc_inq_dimname(int ncid, int dimid, StringBuilder name);
[DllImport("netcdf.dll")]
public static extern int nc_inq_unlimdim(int ncid, ref int unlimdimid);
[DllImport("netcdf.dll")]
public static extern int nc_get_att_short(int ncid, int varid, string name, ref short value);
[DllImport("netcdf.dll")]
public static extern int nc_get_att_int(int ncid, int varid, string name, ref int value);
[DllImport("netcdf.dll")]
public static extern int nc_get_att_long(int ncid, int varid, string name, ref long value);
[DllImport("netcdf.dll")]
public static extern int nc_get_att_float(int ncid, int varid, string name, ref float value);
[DllImport("netcdf.dll")]
public static extern int nc_get_att_double(int ncid, int varid, string name, ref double value);
[DllImport("netcdf.dll")]
public static extern int nc_def_dim(int ncid, string name, int len, ref int id);
[DllImport("netcdf.dll")]
public static extern int nc_def_var(int ncid, string name, NC_Type type, int ndims, int[] dimids, ref int varid);
[DllImport("netcdf.dll")]
public static extern int nc_enddef(int ncid);
[DllImport("netcdf.dll")]
public static extern int nc_put_vara_float (int ncid, int varid, int[] start, int[] countp, float[] op);
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C#
1
https://gitee.com/michael-sun123/geo-fly.git
git@gitee.com:michael-sun123/geo-fly.git
michael-sun123
geo-fly
GeoFly
master

搜索帮助