read data test success

This commit is contained in:
この中二病に爆焔を! 2024-02-04 20:28:52 +08:00
parent 2a07d19849
commit 177d75529f
3 changed files with 6 additions and 7 deletions

View File

@ -63,6 +63,7 @@ Public Class DataReader : Implements IDisposable
Return CType(v, doubles)
Case CDFDataTypes.NC_CHAR
Case CDFDataTypes.NC_INT
Return CType(NetCDF.Get_int(handle, name), integers)
Case CDFDataTypes.NC_SHORT
Case Else
Throw New NotImplementedException(type.ToString)

View File

@ -990,11 +990,8 @@ Partial Public Module NetCDF
Public Function Get_int(ncid As Integer, VarName As String) As Integer()
Dim varid As Integer = Nothing
nc_inq_varid(ncid, VarName, varid)
Dim dimid As Integer = Nothing
nc_inq_dimid(ncid, VarName, dimid)
Dim len As IntPtr = Nothing
nc_inq_dimlen(ncid, dimid, len)
Dim data = New Integer(CInt(len) - 1) {}
Dim dims = Get_Dimensions(ncid, varid)
Dim data = New Integer(dims.ProductALL - 1) {}
nc_get_var_int(ncid, varid, data)
Return data
End Function

View File

@ -3,11 +3,12 @@ require(Darwinism);
imports "CDF" from "Darwinism";
const nc = CDF::open("E:\\GCModeller\\src\\runtime\\Darwinism\\src\\data\\CDF.PInvoke\\temperature.nc");
const tmin = CDF::var_data(nc, "tmin");
# const tmin = CDF::var_data(nc, "tmin");
print(vars(nc));
print(as.numeric(tmin));
# print(as.numeric(tmin));
for(name in vars(nc)) {
print(name);
print(as.numeric(CDF::var_data(nc, name)));
}