SDSlite icon indicating copy to clipboard operation
SDSlite copied to clipboard

Reading nc4

Open Azawizi opened this issue 2 years ago • 0 comments

Tried reading a netcdf-4 file with netcdf 4.9.0 and SDS 2.0.3 in VS2022. Kept getting the error message Extension not registered. i tried running

var uri = NetCDF4.NetCDFUri(){ FileName = "filename.nc4", OpenMode = ResourceOpenMode.ReadOnly};
var sds = DataSet.Open(uri);

tried the solution offered in #32

protected bool Register_Extension(string extension)
{
     Type dType = NetCDFDataSet.GetType("Microsoft.Research.Science.Data.NetCDF4.NetCDFDataSet");
     return DataSetFactory.RegisterExtension(extension, dType);
}
var uri = NetCDF4.NetCDFUri(){FileName="filename.nc4", OpenMode=ResourceOpenMode.ReadOnly};
var sds = DataSet.Open(uri);
var sds = DataSet.Open("msds:netcdf?fileName=filename.nc4&openMode=readOnly");

After trying this i got the error message "Failed to create DataSet instance from uri msds:nc?file=filename&openMode=readOnly NetCDFInterop.NetCDFDynamic called for exception"

Azawizi avatar Dec 29 '22 13:12 Azawizi