Commit 6d4a793b authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

cdf_read_record: implementation for MEMTYPE_FLOAT

parent 5ab74acc
......@@ -683,7 +683,7 @@ void cdfReadVarSliceSP(stream_t *streamptr, int varID, int levelID, float *data,
}
void cdfReadRecord(stream_t *streamptr, double *data, int *nmiss)
void cdf_read_record(stream_t *streamptr, int memtype, void *data, int *nmiss)
{
if ( CDI_Debug ) Message("streamID = %d", streamptr->self);
......@@ -693,7 +693,10 @@ void cdfReadRecord(stream_t *streamptr, double *data, int *nmiss)
int varID = streamptr->tsteps[tsID].records[recID].varID;
int levelID = streamptr->tsteps[tsID].records[recID].levelID;
cdfReadVarSliceDP(streamptr, varID, levelID, data, nmiss);
if ( memtype == MEMTYPE_DOUBLE )
cdfReadVarSliceDP(streamptr, varID, levelID, data, nmiss);
else
cdfReadVarSliceSP(streamptr, varID, levelID, data, nmiss);
}
#endif
......@@ -1254,7 +1254,6 @@ void cdf_write_var_slice(stream_t *streamptr, int varID, int levelID, int memtyp
long nvals = gridInqSize(gridID);
cdf_write_var_data(fileID, vlistID, varID, ncvarid, dtype, nvals, xsize, ysize, swapxy, start, count, memtype, data, nmiss);
}
......
......@@ -542,7 +542,7 @@ void cdfCopyRecord(stream_t *streamptr2, stream_t *streamptr1)
double *data = (double *) Malloc((size_t)datasize * sizeof (double));
int nmiss;
cdfReadRecord(streamptr1, data, &nmiss);
cdf_read_record(streamptr1, memtype, data, &nmiss);
cdf_write_record(streamptr2, memtype, data, nmiss);
Free(data);
......
......@@ -14,7 +14,7 @@ void cdfDefRecord(stream_t * streamptr);
void cdfCopyRecord(stream_t *streamptr2, stream_t *streamptr1);
void cdfReadRecord(stream_t *streamptr, double *data, int *nmiss);
void cdf_read_record(stream_t *streamptr, int memtype, void *data, int *nmiss);
void cdf_write_record(stream_t *streamptr, int memtype, const void *data, int nmiss);
void cdfReadVarDP(stream_t *streamptr, int varID, double *data, int *nmiss);
......
......@@ -314,8 +314,7 @@ void stream_read_record(int streamID, int memtype, void *data, int *nmiss)
case FILETYPE_NC2:
case FILETYPE_NC4:
case FILETYPE_NC4C:
if ( memtype == MEMTYPE_FLOAT ) Error("cdfReadRecord not implemented for memtype float!");
cdfReadRecord(streamptr, data, nmiss);
cdf_read_record(streamptr, memtype, data, nmiss);
break;
#endif
default:
......
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