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

Mergetime: Merge declaration and definition

parent 8f2ee9d5
......@@ -409,7 +409,7 @@ void *Intlevel3d(void *argument)
missval = vlistInqVarMissval(vlistID1, varID);
gridsize = gridInqSize(gridID);
vert_interp_lev3d(expol, gridsize, missval, vardata1[varID], vardata2[varID],
vert_interp_lev3d(gridsize, missval, vardata1[varID], vardata2[varID],
nlevo, lev_idx1, lev_idx2, lev_wgt1, lev_wgt2);
for ( levelID = 0; levelID < nlevo; levelID++ )
......
......@@ -31,10 +31,10 @@
void *Mergetime(void *argument)
{
int streamID1, streamID2 = CDI_UNDEFID;
int streamID1;
int tsID2 = 0, recID, varID, levelID;
int vlistID1, vlistID2;
int nfiles, fileID;
int fileID;
int taxisID1, taxisID2 = CDI_UNDEFID;
int lcopy = FALSE;
int gridsize;
......@@ -44,7 +44,6 @@ void *Mergetime(void *argument)
int next_fileID;
int skip_same_time = FALSE;
int process_timestep;
const char *ofilename;
double *array = NULL;
typedef struct
{
......@@ -56,7 +55,6 @@ void *Mergetime(void *argument)
int vtime;
int nrecs;
} sfile_t;
sfile_t *sf = NULL;
cdoInitialize(argument);
......@@ -78,9 +76,9 @@ void *Mergetime(void *argument)
if ( UNCHANGED_RECORD ) lcopy = TRUE;
nfiles = cdoStreamCnt() - 1;
int nfiles = cdoStreamCnt() - 1;
sf = (sfile_t*) malloc(nfiles*sizeof(sfile_t));
sfile_t *sf = (sfile_t*) malloc(nfiles*sizeof(sfile_t));
for ( fileID = 0; fileID < nfiles; fileID++ )
{
......@@ -118,14 +116,14 @@ void *Mergetime(void *argument)
}
}
ofilename = cdoStreamName(nfiles)->args;
const char *ofilename = cdoStreamName(nfiles)->args;
if ( !cdoSilentMode && !cdoOverwriteMode )
if ( fileExists(ofilename) )
if ( !userFileOverwrite(ofilename) )
cdoAbort("Outputfile %s already exists!", ofilename);
streamID2 = streamOpenWrite(cdoStreamName(nfiles), cdoFiletype());
int streamID2 = streamOpenWrite(cdoStreamName(nfiles), cdoFiletype());
if ( ! lcopy )
{
......
......@@ -417,7 +417,7 @@ void interp_Z(const double * restrict geop, const double * restrict gz, double *
/*
* 3d vertical interpolation routine (see vert_interp_lev() in src/Intlevel.c)
*/
void vert_interp_lev3d(int lexpol, int gridsize, double missval, double *vardata1, double *vardata2,
void vert_interp_lev3d(int gridsize, double missval, double *vardata1, double *vardata2,
int nlev2, int *lev_idx1, int *lev_idx2, double *lev_wgt1, double *lev_wgt2)
{
int i, ilev;
......@@ -475,43 +475,6 @@ void vert_interp_lev3d(int lexpol, int gridsize, double missval, double *vardata
}
}
}
if ( lexpol )
{
/*
printf("lexpol nlev2 %d!\n", nlev2);
for ( i = 0; i < gridsize; i++ )
{
if ( DBL_IS_EQUAL(vardata2[i], missval) )
{
for ( ilev = 1; ilev < nlev2; ilev++ )
{
if ( !DBL_IS_EQUAL(vardata2[ilev*gridsize+i], missval) ) break;
}
if ( ilev < nlev2 )
{
for ( int k = 0; k < ilev; k++ )
vardata2[k*gridsize+i] = vardata2[ilev*gridsize+i];
}
}
}
for ( i = 0; i < gridsize; i++ )
{
if ( DBL_IS_EQUAL(vardata2[(nlev2-1)*gridsize+i], missval) )
{
for ( ilev = nlev2-2; ilev >= 0; ilev-- )
{
if ( !DBL_IS_EQUAL(vardata2[ilev*gridsize+i], missval) ) break;
}
if ( ilev >= 0 )
{
for ( int k = nlev2-1; k > ilev; k-- )
vardata2[k*gridsize+i] = vardata2[ilev*gridsize+i];
}
}
}
*/
}
}
#if defined(CDO)
......
......@@ -26,7 +26,7 @@ void interp_X(const double * restrict gt, double *pt, const double * restrict hy
const double * restrict plev, long nplev, long ngp, long nhlev, double missval);
void vert_interp_lev3d(int lexpol, int gridsize, double missval, double *vardata1, double *vardata2,
void vert_interp_lev3d(int gridsize, double missval, double *vardata1, double *vardata2,
int nlev2, int *lev_idx1, int *lev_idx2, double *lev_wgt1, double *lev_wgt2);
void vert_gen_weights3d(int expol, int nlev1, int gridsize, double *lev1, int nlev2, double *lev2,
int *lev_idx1, int *lev_idx2, double *lev_wgt1, double *lev_wgt2);
......
Supports Markdown
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