Commit 4fd7ec43 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

fixed bug with gribHandles

parent bb2a0b97
......@@ -177,8 +177,8 @@ void cdiDefGlobal(const char *string, int val);
/* param format: DDDCCCNNN */
void cdiDecodeParam(int param, int *num, int *cat, int *dis);
int cdiEncodeParam(int num, int cat, int dis);
void cdiDecodeParam(int param, int *pnum, int *pcat, int *pdis);
int cdiEncodeParam(int pnum, int pcat, int pdis);
/* date format: YYYYMMDD */
/* time format: hhmmss */
......
......@@ -305,15 +305,15 @@
!
! cdiDecodeParam
! (INTEGER param,
! INTEGER dis,
! INTEGER cat,
! INTEGER num)
! INTEGER pnum,
! INTEGER pcat,
! INTEGER pdis)
EXTERNAL cdiDecodeParam
INTEGER cdiEncodeParam
! (INTEGER dis,
! INTEGER cat,
! INTEGER num)
! (INTEGER pnum,
! INTEGER pcat,
! INTEGER pdis)
EXTERNAL cdiEncodeParam
! cdiDecodeDate
......
......@@ -816,48 +816,48 @@ int streamOpenA(const char *filename, const char *filemode, int filetype)
switch (filetype)
{
#if defined (HAVE_LIBGRIB)
case FILETYPE_GRB:
case FILETYPE_GRB2:
{
gribClose(fileID);
break;
}
case FILETYPE_GRB:
case FILETYPE_GRB2:
{
gribClose(fileID);
break;
}
#endif
#if defined (HAVE_LIBSERVICE)
case FILETYPE_SRV:
{
fileClose(fileID);
break;
}
case FILETYPE_SRV:
{
fileClose(fileID);
break;
}
#endif
#if defined (HAVE_LIBEXTRA)
case FILETYPE_EXT:
{
fileClose(fileID);
break;
}
case FILETYPE_EXT:
{
fileClose(fileID);
break;
}
#endif
#if defined (HAVE_LIBIEG)
case FILETYPE_IEG:
{
fileClose(fileID);
break;
}
case FILETYPE_IEG:
{
fileClose(fileID);
break;
}
#endif
#if defined (HAVE_LIBNETCDF)
case FILETYPE_NC:
case FILETYPE_NC2:
case FILETYPE_NC4:
{
cdfClose(fileID);
break;
}
case FILETYPE_NC:
case FILETYPE_NC2:
case FILETYPE_NC4:
{
cdfClose(fileID);
break;
}
#endif
default:
{
if ( CDI_Debug ) Message(func, "%s support not compiled in!", strfiletype(filetype));
return (CDI_ELIBNAVAIL);
}
default:
{
if ( CDI_Debug ) Message(func, "%s support not compiled in!", strfiletype(filetype));
return (CDI_ELIBNAVAIL);
}
}
switch (filetype)
......
......@@ -471,7 +471,9 @@ int grbWriteVarSliceDP(int streamID, int varID, int levelID, const double *data,
if ( filetype == FILETYPE_GRB2 )
{
int ngrids = vlistNgrids(vlistID);
int ghindex = ngrids*gridID + zaxisID;
int ghindex = ngrids*vlistGridIndex(vlistID, gridID) + vlistZaxisIndex(vlistID, zaxisID);
if ( ghindex >= streamptr->gribHandleNums )
Error(func, "Internal problem, grib handle not found!");
gh = streamptr->gribHandle[ghindex];
}
......
......@@ -438,34 +438,44 @@ void streamCopyRecord(int streamID2, int streamID1)
byteorder1 = streamptr1->byteorder;
byteorder2 = streamptr2->byteorder;
if ( filetype1 == filetype2 &&
byteorder1 == byteorder2 ) filetype = filetype2;
if ( filetype1 == filetype2 ) filetype = filetype2;
if ( filetype == FILETYPE_GRB )
switch (filetype)
{
status = grbCopyRecord(streamID2, streamID1);
}
#if defined (HAVE_LIBGRIB)
case FILETYPE_GRB:
case FILETYPE_GRB2:
{
status = grbCopyRecord(streamID2, streamID1);
break;
}
#endif
#if defined (HAVE_LIBSERVICE)
else if ( filetype == FILETYPE_SRV )
{
status = srvCopyRecord(streamID2, streamID1);
}
case FILETYPE_SRV:
{
status = srvCopyRecord(streamID2, streamID1);
break;
}
#endif
#if defined (HAVE_LIBEXTRA)
else if ( filetype == FILETYPE_EXT )
{
status = extCopyRecord(streamID2, streamID1);
}
case FILETYPE_EXT:
{
status = extCopyRecord(streamID2, streamID1);
break;
}
#endif
#if defined (HAVE_LIBIEG)
else if ( filetype == FILETYPE_IEG )
{
status = iegCopyRecord(streamID2, streamID1);
}
case FILETYPE_IEG:
{
status = iegCopyRecord(streamID2, streamID1);
break;
}
#endif
else
{
status = cdfCopyRecord(streamID2, streamID1);
default:
{
status = cdfCopyRecord(streamID2, streamID1);
break;
}
}
}
......
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