Commit cc886cfc authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

patch from Nathanael Huebbe: added cdf_get_vara_uchar()

parent 90b39d11
...@@ -536,6 +536,19 @@ void cdf_get_vara_text(int ncid, int varid, const size_t start[], ...@@ -536,6 +536,19 @@ void cdf_get_vara_text(int ncid, int varid, const size_t start[],
} }
void cdf_get_vara_uchar(int ncid, int varid, const size_t start[], const size_t count[], unsigned char *tp)
{
int status;
status = nc_get_vara_uchar(ncid, varid, start, count, tp);
if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d", ncid, varid);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
void cdf_put_var_double(int ncid, int varid, const double *dp) void cdf_put_var_double(int ncid, int varid, const double *dp)
{ {
int status; int status;
......
...@@ -22,14 +22,11 @@ void cdf_inq_dimid (int ncid, const char *name, int *dimidp); ...@@ -22,14 +22,11 @@ void cdf_inq_dimid (int ncid, const char *name, int *dimidp);
void cdf_inq_dim (int ncid, int dimid, char *name, size_t * lengthp); void cdf_inq_dim (int ncid, int dimid, char *name, size_t * lengthp);
void cdf_inq_dimname (int ncid, int dimid, char *name); void cdf_inq_dimname (int ncid, int dimid, char *name);
void cdf_inq_dimlen (int ncid, int dimid, size_t * lengthp); void cdf_inq_dimlen (int ncid, int dimid, size_t * lengthp);
void cdf_def_var (int ncid, const char *name, nc_type xtype, int ndims, void cdf_def_var (int ncid, const char *name, nc_type xtype, int ndims, const int dimids[], int *varidp);
const int dimids[], int *varidp); void cdf_def_var_serial(int ncid, const char *name, nc_type xtype, int ndims, const int dimids[], int *varidp);
void cdf_def_var_serial(int ncid, const char *name, nc_type xtype, int ndims,
const int dimids[], int *varidp);
void cdf_inq_varid(int ncid, const char *name, int *varidp); void cdf_inq_varid(int ncid, const char *name, int *varidp);
void cdf_inq_nvars(int ncid, int *nvarsp); void cdf_inq_nvars(int ncid, int *nvarsp);
void cdf_inq_var(int ncid, int varid, char *name, nc_type *xtypep, void cdf_inq_var(int ncid, int varid, char *name, nc_type *xtypep, int *ndimsp, int dimids[], int *nattsp);
int *ndimsp, int dimids[], int *nattsp);
void cdf_inq_varname (int ncid, int varid, char *name); void cdf_inq_varname (int ncid, int varid, char *name);
void cdf_inq_vartype (int ncid, int varid, nc_type *xtypep); void cdf_inq_vartype (int ncid, int varid, nc_type *xtypep);
void cdf_inq_varndims (int ncid, int varid, int *ndimsp); void cdf_inq_varndims (int ncid, int varid, int *ndimsp);
...@@ -60,25 +57,18 @@ void cdf_get_var1_text(int ncid, int varid, const size_t index[], char *tp); ...@@ -60,25 +57,18 @@ void cdf_get_var1_text(int ncid, int varid, const size_t index[], char *tp);
void cdf_get_var1_double(int ncid, int varid, const size_t index[], double *dp); void cdf_get_var1_double(int ncid, int varid, const size_t index[], double *dp);
void cdf_put_var1_double(int ncid, int varid, const size_t index[], const double *dp); void cdf_put_var1_double(int ncid, int varid, const size_t index[], const double *dp);
void cdf_get_vara_text(int ncid, int varid, const size_t start[], void cdf_get_vara_uchar(int ncid, int varid, const size_t start[], const size_t count[], unsigned char *tp);
const size_t count[], char *tp); void cdf_get_vara_text(int ncid, int varid, const size_t start[], const size_t count[], char *tp);
void cdf_get_vara_double(int ncid, int varid, const size_t start[], void cdf_get_vara_double(int ncid, int varid, const size_t start[], const size_t count[], double *dp);
const size_t count[], double *dp); void cdf_put_vara_double(int ncid, int varid, const size_t start[], const size_t count[], const double *dp);
void cdf_put_vara_double(int ncid, int varid, const size_t start[],
const size_t count[], const double *dp); void cdf_get_vara_float(int ncid, int varid, const size_t start[], const size_t count[], float *fp);
void cdf_put_vara_float(int ncid, int varid, const size_t start[], const size_t count[], const float *fp);
void cdf_get_vara_float(int ncid, int varid, const size_t start[],
const size_t count[], float *fp); void cdf_put_att_text(int ncid, int varid, const char *name, size_t len, const char *tp);
void cdf_put_vara_float(int ncid, int varid, const size_t start[], void cdf_put_att_int(int ncid, int varid, const char *name, nc_type xtype, size_t len, const int *ip);
const size_t count[], const float *fp); void cdf_put_att_double(int ncid, int varid, const char *name, nc_type xtype, size_t len, const double *dp);
void cdf_put_att_text(int ncid, int varid, const char *name, size_t len,
const char *tp);
void cdf_put_att_int(int ncid, int varid, const char *name, nc_type xtype,
size_t len, const int *ip);
void cdf_put_att_double(int ncid, int varid, const char *name, nc_type xtype,
size_t len, const double *dp);
void cdf_get_att_string(int ncid, int varid, const char *name, char **tp); void cdf_get_att_string(int ncid, int varid, const char *name, char **tp);
void cdf_get_att_text (int ncid, int varid, const char *name, char *tp); void cdf_get_att_text (int ncid, int varid, const char *name, char *tp);
......
...@@ -4249,12 +4249,7 @@ void cdfReadVarSliceDP(stream_t *streamptr, int varID, int levelID, double *data ...@@ -4249,12 +4249,7 @@ void cdfReadVarSliceDP(stream_t *streamptr, int varID, int levelID, double *data
data[i] = (double) data_fp[i]; data[i] = (double) data_fp[i];
free(data_fp); free(data_fp);
} }
else else if ( vlistInqVarDatatype(vlistID, varID) == DATATYPE_UINT8 )
cdf_get_vara_double(fileID, ncvarid, start, count, data);
if ( swapxy ) transpose2dArrayDP(xsize, ysize, data);
if ( vlistInqVarDatatype(vlistID, varID) == DATATYPE_UINT8 )
{ {
nc_type xtype; nc_type xtype;
cdf_inq_vartype(fileID, ncvarid, &xtype); cdf_inq_vartype(fileID, ncvarid, &xtype);
...@@ -4264,6 +4259,12 @@ void cdfReadVarSliceDP(stream_t *streamptr, int varID, int levelID, double *data ...@@ -4264,6 +4259,12 @@ void cdfReadVarSliceDP(stream_t *streamptr, int varID, int levelID, double *data
if ( data[i] < 0 ) data[i] += 256; if ( data[i] < 0 ) data[i] += 256;
} }
} }
else
{
cdf_get_vara_double(fileID, ncvarid, start, count, data);
}
if ( swapxy ) transpose2dArrayDP(xsize, ysize, data);
*nmiss = 0; *nmiss = 0;
double missval = vlistInqVarMissval(vlistID, varID); double missval = vlistInqVarMissval(vlistID, varID);
......
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