read data test success
This commit is contained in:
parent
2a07d19849
commit
177d75529f
|
@ -63,6 +63,7 @@ Public Class DataReader : Implements IDisposable
|
||||||
Return CType(v, doubles)
|
Return CType(v, doubles)
|
||||||
Case CDFDataTypes.NC_CHAR
|
Case CDFDataTypes.NC_CHAR
|
||||||
Case CDFDataTypes.NC_INT
|
Case CDFDataTypes.NC_INT
|
||||||
|
Return CType(NetCDF.Get_int(handle, name), integers)
|
||||||
Case CDFDataTypes.NC_SHORT
|
Case CDFDataTypes.NC_SHORT
|
||||||
Case Else
|
Case Else
|
||||||
Throw New NotImplementedException(type.ToString)
|
Throw New NotImplementedException(type.ToString)
|
||||||
|
|
|
@ -990,11 +990,8 @@ Partial Public Module NetCDF
|
||||||
Public Function Get_int(ncid As Integer, VarName As String) As Integer()
|
Public Function Get_int(ncid As Integer, VarName As String) As Integer()
|
||||||
Dim varid As Integer = Nothing
|
Dim varid As Integer = Nothing
|
||||||
nc_inq_varid(ncid, VarName, varid)
|
nc_inq_varid(ncid, VarName, varid)
|
||||||
Dim dimid As Integer = Nothing
|
Dim dims = Get_Dimensions(ncid, varid)
|
||||||
nc_inq_dimid(ncid, VarName, dimid)
|
Dim data = New Integer(dims.ProductALL - 1) {}
|
||||||
Dim len As IntPtr = Nothing
|
|
||||||
nc_inq_dimlen(ncid, dimid, len)
|
|
||||||
Dim data = New Integer(CInt(len) - 1) {}
|
|
||||||
nc_get_var_int(ncid, varid, data)
|
nc_get_var_int(ncid, varid, data)
|
||||||
Return data
|
Return data
|
||||||
End Function
|
End Function
|
||||||
|
|
|
@ -3,11 +3,12 @@ require(Darwinism);
|
||||||
imports "CDF" from "Darwinism";
|
imports "CDF" from "Darwinism";
|
||||||
|
|
||||||
const nc = CDF::open("E:\\GCModeller\\src\\runtime\\Darwinism\\src\\data\\CDF.PInvoke\\temperature.nc");
|
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(vars(nc));
|
||||||
print(as.numeric(tmin));
|
# print(as.numeric(tmin));
|
||||||
|
|
||||||
for(name in vars(nc)) {
|
for(name in vars(nc)) {
|
||||||
|
print(name);
|
||||||
print(as.numeric(CDF::var_data(nc, name)));
|
print(as.numeric(CDF::var_data(nc, name)));
|
||||||
}
|
}
|
Loading…
Reference in New Issue