Commit 380ff943 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

cdfReadVarSliceDP: store DATATYPE_FLT32 in a float array andconvert it to double

parent 79d1ff49
......@@ -4,6 +4,7 @@
2012-11-15 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* cdfReadVarSliceDP: store DATATYPE_FLT32 in a float array and convert it to double (speedup 2x)
* cdfInqTimestep: added check for timevalue = NC_FILL_DOUBLE
2012-11-14 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
......
......@@ -3661,7 +3661,15 @@ int cdfReadVarSliceDP(int streamID, int varID, int levelID, double *data, int *n
for (idim = 0; idim < ndims; idim++)
Message("dim = %d start = %d count = %d", idim, start[idim], count[idim]);
cdf_get_vara_double(fileID, ncvarid, start, count, data);
if ( vlistInqVarDatatype(vlistID, varID) == DATATYPE_FLT32 )
{
float *data_fp = (float *) data;
cdf_get_vara_float(fileID, ncvarid, start, count, data_fp);
for ( i = gridsize-1; i >=0; i-- )
data[i] = (double) data_fp[i];
}
else
cdf_get_vara_double(fileID, ncvarid, start, count, data);
if ( swapxy )
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment