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

cdf_int.c: cleanup

parent be97a8ff
......@@ -133,8 +133,7 @@ void cdf_redef(int ncid)
status = nc_redef(ncid);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -144,8 +143,7 @@ void cdf_enddef(int ncid)
status = nc_enddef(ncid);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -155,8 +153,7 @@ void cdf_sync(int ncid)
status = nc_sync(ncid);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -170,8 +167,7 @@ void cdf_inq(int ncid, int *ndimsp, int *nvarsp, int *ngattsp, int *unlimdimidp)
Message("ncid = %d ndims = %d nvars = %d ngatts = %d unlimid = %d",
ncid, *ndimsp, *nvarsp, *ngattsp, *unlimdimidp);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -184,8 +180,7 @@ void cdf_def_dim(int ncid, const char *name, size_t len, int *dimidp)
if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d name = %s len = %d", ncid, name, len);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -195,11 +190,10 @@ void cdf_inq_dimid(int ncid, const char *name, int *dimidp)
status = nc_inq_dimid(ncid, name, dimidp);
if (CDF_Debug || status != NC_NOERR)
if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d name = %s dimid= %d", ncid, name, *dimidp);
if (status != NC_NOERR)
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -210,11 +204,9 @@ void cdf_inq_dim(int ncid, int dimid, char *name, size_t * lengthp)
status = nc_inq_dim(ncid, dimid, name, lengthp);
if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d dimid = %d length = %d name = %s",
ncid, dimid, *lengthp, name);
Message("ncid = %d dimid = %d length = %d name = %s", ncid, dimid, *lengthp, name);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -227,8 +219,7 @@ void cdf_inq_dimname(int ncid, int dimid, char *name)
if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d dimid = %d name = %s", ncid, dimid, name);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -241,8 +232,7 @@ void cdf_inq_dimlen(int ncid, int dimid, size_t * lengthp)
if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d dimid = %d length = %d", ncid, dimid, *lengthp);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -257,8 +247,7 @@ void cdf_def_var(int ncid, const char *name, nc_type xtype, int ndims,
Message("ncid = %d name = %s xtype = %d ndims = %d varid = %d",
ncid, name, xtype, ndims, *varidp);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -271,8 +260,7 @@ void cdf_inq_varid(int ncid, const char *name, int *varidp)
if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d name = %s varid = %d ", ncid, name, *varidp);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -285,8 +273,7 @@ void cdf_inq_nvars(int ncid, int *nvarsp)
if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d nvars = %d", ncid, *nvarsp);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -301,8 +288,7 @@ void cdf_inq_var(int ncid, int varid, char *name, nc_type *xtypep, int *ndimsp,
Message("ncid = %d varid = %d ndims = %d xtype = %d natts = %d name = %s",
ncid, varid, *ndimsp, *xtypep, *nattsp, name);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -315,8 +301,7 @@ void cdf_inq_varname(int ncid, int varid, char *name)
if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d name = %s", ncid, varid, name);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -329,8 +314,7 @@ void cdf_inq_vartype(int ncid, int varid, nc_type *xtypep)
if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d xtype = %s", ncid, varid, *xtypep);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -343,8 +327,7 @@ void cdf_inq_varndims(int ncid, int varid, int *ndimsp)
if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d", ncid, varid);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -357,8 +340,7 @@ void cdf_inq_vardimid(int ncid, int varid, int dimids[])
if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d", ncid, varid);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -368,11 +350,10 @@ void cdf_inq_varnatts(int ncid, int varid, int *nattsp)
status = nc_inq_varnatts(ncid, varid, nattsp);
if (CDF_Debug || status != NC_NOERR)
if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d nattsp = %d", ncid, varid, *nattsp);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -382,11 +363,10 @@ void cdf_put_var_text(int ncid, int varid, const char *tp)
status = nc_put_var_text(ncid, varid, tp);
if (CDF_Debug || status != NC_NOERR)
fprintf (stderr, "cdf_put_var_text : %d %d %s \n", ncid, varid, tp);
if ( CDF_Debug || status != NC_NOERR )
Message("%d %d %s", ncid, varid, tp);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -396,11 +376,10 @@ void cdf_put_var_short(int ncid, int varid, const short *sp)
status = nc_put_var_short(ncid, varid, sp);
if (CDF_Debug || status != NC_NOERR)
fprintf (stderr, "cdf_put_var_short : %d %d %hd \n", ncid, varid, *sp);
if ( CDF_Debug || status != NC_NOERR )
Message("%d %d %hd", ncid, varid, *sp);
if (status != NC_NOERR)
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -410,11 +389,10 @@ void cdf_put_var_int(int ncid, int varid, const int *ip)
status = nc_put_var_int(ncid, varid, ip);
if (CDF_Debug || status != NC_NOERR)
fprintf (stderr, "cdf_put_var_int : %d %d %d \n", ncid, varid, *ip);
if ( CDF_Debug || status != NC_NOERR )
Message("%d %d %d", ncid, varid, *ip);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -424,11 +402,10 @@ void cdf_put_var_long(int ncid, int varid, const long *lp)
status = nc_put_var_long(ncid, varid, lp);
if (CDF_Debug || status != NC_NOERR)
fprintf (stderr, "cdf_put_var_long : %d %d %ld \n", ncid, varid, *lp);
if ( CDF_Debug || status != NC_NOERR )
Message("%d %d %ld", ncid, varid, *lp);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -438,16 +415,15 @@ void cdf_put_var_float(int ncid, int varid, const float *fp)
status = nc_put_var_float(ncid, varid, fp);
if (CDF_Debug || status != NC_NOERR)
fprintf (stderr, "cdf_put_var_float : %d %d %f \n", ncid, varid, *fp);
if ( CDF_Debug || status != NC_NOERR )
Message("%d %d %f", ncid, varid, *fp);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
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)
{
int status;
......@@ -456,8 +432,7 @@ void cdf_put_vara_double(int ncid, int varid, const size_t start[],
if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d val0 = %f", ncid, varid, *dp);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -471,8 +446,7 @@ void cdf_put_vara_float(int ncid, int varid, const size_t start[],
if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d val0 = %f", ncid, varid, *fp);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -486,8 +460,7 @@ void cdf_get_vara_int(int ncid, int varid, const size_t start[],
if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d", ncid, varid);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -501,8 +474,7 @@ void cdf_get_vara_double(int ncid, int varid, const size_t start[],
if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d", ncid, varid);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -516,8 +488,7 @@ void cdf_get_vara_float(int ncid, int varid, const size_t start[],
if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d", ncid, varid);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -531,8 +502,7 @@ void cdf_get_vara_text(int ncid, int varid, const size_t start[],
if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d", ncid, varid);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -545,8 +515,7 @@ void cdf_put_var_double (int ncid, int varid, const double *dp)
if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d val0 = %f", ncid, varid, *dp);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -559,8 +528,7 @@ void cdf_get_var1_text(int ncid, int varid, const size_t index[], char *tp)
if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d", ncid, varid);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -573,8 +541,7 @@ void cdf_get_var1_double(int ncid, int varid, const size_t index[], double *dp)
if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d", ncid, varid);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -587,8 +554,7 @@ void cdf_put_var1_double(int ncid, int varid, const size_t index[], const double
if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d val = %f", ncid, varid, *dp);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -601,8 +567,7 @@ void cdf_get_var_text(int ncid, int varid, char *tp)
if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d", ncid, varid);
if (status != NC_NOERR)
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -615,8 +580,7 @@ void cdf_get_var_short(int ncid, int varid, short *sp)
if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d", ncid, varid);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -629,8 +593,7 @@ void cdf_get_var_int(int ncid, int varid, int *ip)
if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d", ncid, varid);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -643,8 +606,7 @@ void cdf_get_var_long(int ncid, int varid, long *lp)
if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d", ncid, varid);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -657,8 +619,7 @@ void cdf_get_var_float(int ncid, int varid, float *fp)
if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d", ncid, varid);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -668,11 +629,10 @@ void cdf_get_var_double(int ncid, int varid, double *dp)
status = nc_get_var_double(ncid, varid, dp);
if (CDF_Debug || status != NC_NOERR)
if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d val[0] = %f", ncid, varid, *dp);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -683,12 +643,10 @@ void cdf_copy_att(int ncid_in, int varid_in, const char *name, int ncid_out,
status = nc_copy_att(ncid_in, varid_in, name, ncid_out, varid_out);
if (CDF_Debug || status != NC_NOERR)
fprintf (stderr, "cdf_copy_att : %d %d %s %d %d\n", ncid_in, varid_out,
name, ncid_out, varid_out);
if ( CDF_Debug || status != NC_NOERR )
Message("%d %d %s %d %d", ncid_in, varid_out, name, ncid_out, varid_out);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -699,12 +657,11 @@ void cdf_put_att_text(int ncid, int varid, const char *name, size_t len,
status = nc_put_att_text(ncid, varid, name, len, tp);
if (CDF_Debug || status != NC_NOERR)
if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d att = %s text = %s",
ncid, varid, name, tp);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -715,12 +672,10 @@ void cdf_put_att_int(int ncid, int varid, const char *name, nc_type xtype,
status = nc_put_att_int(ncid, varid, name, xtype, len, ip);
if (CDF_Debug || status != NC_NOERR)
Message("ncid = %d varid = %d att = %s val = %d",
ncid, varid, name, *ip);
if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d att = %s val = %d", ncid, varid, name, *ip);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -731,11 +686,10 @@ void cdf_put_att_double(int ncid, int varid, const char *name, nc_type xtype,
status = nc_put_att_double(ncid, varid, name, xtype, len, dp);
if (CDF_Debug || status != NC_NOERR)
fprintf (stderr, "cdf_put_att_double : %d %d %f \n", ncid, varid, *dp);
if ( CDF_Debug || status != NC_NOERR )
Message("%d %d %f", ncid, varid, *dp);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -745,11 +699,10 @@ void cdf_get_att_text(int ncid, int varid, char *name, char *tp)
status = nc_get_att_text(ncid, varid, name, tp);
if (CDF_Debug || status != NC_NOERR)
if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d name = %s", ncid, varid, name);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -759,12 +712,10 @@ void cdf_get_att_int(int ncid, int varid, char *name, int *ip)
status = nc_get_att_int(ncid, varid, name, ip);
if (CDF_Debug || status != NC_NOERR)
Message("ncid = %d varid = %d att = %s val = %d",
ncid, varid, name, *ip);
if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d att = %s val = %d", ncid, varid, name, *ip);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -778,8 +729,7 @@ void cdf_get_att_double(int ncid, int varid, char *name, double *dp)
Message("ncid = %d varid = %d att = %s val = %.9g",
ncid, varid, name, *dp);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -793,8 +743,7 @@ void cdf_inq_att(int ncid, int varid, const char *name, nc_type *xtypep,
if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d", ncid, varid);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -807,8 +756,7 @@ void cdf_inq_atttype(int ncid, int varid, const char *name, nc_type * xtypep)
if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d", ncid, varid);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -818,12 +766,10 @@ void cdf_inq_attlen(int ncid, int varid, const char *name, size_t * lenp)
status = nc_inq_attlen(ncid, varid, name, lenp);
if (CDF_Debug || status != NC_NOERR)
Message("ncid = %d varid = %d name = %s len = %d",
ncid, varid, name, *lenp);
if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d name = %s len = %d", ncid, varid, name, *lenp);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -833,12 +779,10 @@ void cdf_inq_attname(int ncid, int varid, int attnum, char *name)
status = nc_inq_attname(ncid, varid, attnum, name);
if (CDF_Debug || status != NC_NOERR)
Message("ncid = %d varid = %d attnum = %d name = %s",
ncid, varid, attnum, name);
if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d attnum = %d name = %s", ncid, varid, attnum, name);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -851,8 +795,7 @@ void cdf_inq_attid(int ncid, int varid, const char *name, int *attnump)
if ( CDF_Debug || status != NC_NOERR )
Message("ncid = %d varid = %d", ncid, varid);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
#endif
......
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