Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
libcdi
Commits
c34f0314
Commit
c34f0314
authored
May 04, 2007
by
Uwe Schulzweida
Browse files
No commit message
No commit message
parent
cebb8a88
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/cdi_error.c
View file @
c34f0314
...
...
@@ -8,7 +8,7 @@
static
char
UnknownError
[]
=
"Unknown Error"
;
static
char
_EUFTYPE
[]
=
"Unsupported file type"
;
static
char
_ELIBNAVAIL
[]
=
"Unsupported file type (library
not available
)"
;
static
char
_ELIBNAVAIL
[]
=
"Unsupported file type (library
support not compiled in
)"
;
static
char
_EUFSTRUCT
[]
=
"Unsupported file structure"
;
char
*
cdiStringError
(
int
cdiErrno
)
...
...
src/stream.c
View file @
c34f0314
...
...
@@ -282,7 +282,7 @@ int get_fnames(const char *argument, char *fnames[], int max_fnames)
strcat
(
command
,
pch
);
pfp
=
popen
(
command
,
"r"
);
if
(
pfp
==
0
)
if
(
pfp
==
NULL
)
SysError
(
func
,
"popen %s failed"
,
command
);
nfiles
=
0
;
...
...
@@ -297,9 +297,10 @@ int get_fnames(const char *argument, char *fnames[], int max_fnames)
}
pclose
(
pfp
);
/*
for ( j = 0; j < nfiles; j++ )
fnames[j] = fnames[j];
*/
}
}
...
...
@@ -556,7 +557,7 @@ int cdiInqContents(int streamID)
default:
{
if
(
CDI_Debug
)
Message
(
func
,
"%s
library not available
!"
,
strfiletype
(
filetype
));
Message
(
func
,
"%s
support not compiled in
!"
,
strfiletype
(
filetype
));
status
=
CDI_ELIBNAVAIL
;
}
...
...
@@ -643,7 +644,7 @@ int streamOpen(const char *filename, const char *filemode, int filetype)
#endif
default:
{
if
(
CDI_Debug
)
Message
(
func
,
"%s
library not available
!"
,
strfiletype
(
filetype
));
if
(
CDI_Debug
)
Message
(
func
,
"%s
support not compiled in
!"
,
strfiletype
(
filetype
));
return
(
CDI_ELIBNAVAIL
);
}
}
...
...
@@ -748,7 +749,7 @@ int streamOpenA(const char *filename, const char *filemode, int filetype)
#endif
default:
{
if
(
CDI_Debug
)
Message
(
func
,
"%s
library not available
!"
,
strfiletype
(
filetype
));
if
(
CDI_Debug
)
Message
(
func
,
"%s
support not compiled in
!"
,
strfiletype
(
filetype
));
return
(
CDI_ELIBNAVAIL
);
}
}
...
...
@@ -818,7 +819,7 @@ int streamOpenA(const char *filename, const char *filemode, int filetype)
#endif
default:
{
if
(
CDI_Debug
)
Message
(
func
,
"%s
library not available
!"
,
strfiletype
(
filetype
));
if
(
CDI_Debug
)
Message
(
func
,
"%s
support not compiled in
!"
,
strfiletype
(
filetype
));
return
(
CDI_ELIBNAVAIL
);
}
}
...
...
@@ -867,7 +868,7 @@ int streamOpenA(const char *filename, const char *filemode, int filetype)
#endif
default:
{
if
(
CDI_Debug
)
Message
(
func
,
"%s
library not available
!"
,
strfiletype
(
filetype
));
if
(
CDI_Debug
)
Message
(
func
,
"%s
support not compiled in
!"
,
strfiletype
(
filetype
));
return
(
CDI_ELIBNAVAIL
);
}
}
...
...
@@ -901,7 +902,7 @@ open stream. Otherwise, a negative number with the error status is returned.
@Item CDI_ESYSTEM Operating system error
@Item CDI_EINVAL Invalid argument
@Item CDI_EUFILETYPE Unsupported file type
@Item CDI_ELIBNAVAIL Library
not available
@Item CDI_ELIBNAVAIL Library
support not compiled in
@EndList
@Example
...
...
@@ -1007,7 +1008,7 @@ open stream. Otherwise, a negative number with the error status is returned.
@Item CDI_ESYSTEM Operating system error
@Item CDI_EINVAL Invalid argument
@Item CDI_EUFILETYPE Unsupported file type
@Item CDI_ELIBNAVAIL Library
not available
@Item CDI_ELIBNAVAIL Library
support not compiled in
@EndList
@Example
...
...
@@ -1110,7 +1111,7 @@ void streamClose(int streamID)
#endif
default:
{
Error
(
func
,
"%s
library not available
!"
,
strfiletype
(
filetype
));
Error
(
func
,
"%s
support not compiled in
!"
,
strfiletype
(
filetype
));
break
;
}
}
...
...
@@ -1319,7 +1320,7 @@ int streamInqTimestep(int streamID, int tsID)
#endif
default:
{
Error
(
func
,
"%s
library not available
!"
,
strfiletype
(
filetype
));
Error
(
func
,
"%s
support not compiled in
!"
,
strfiletype
(
filetype
));
break
;
}
}
...
...
@@ -1407,7 +1408,7 @@ void streamReadVar(int streamID, int varID, double *data, int *nmiss)
#endif
default:
{
Error
(
func
,
"%s
library not available
!"
,
strfiletype
(
filetype
));
Error
(
func
,
"%s
support not compiled in
!"
,
strfiletype
(
filetype
));
break
;
}
}
...
...
@@ -1488,7 +1489,7 @@ void streamWriteVar(int streamID, int varID, double *data, int nmiss)
#endif
default:
{
Error
(
func
,
"%s
library not available
!"
,
strfiletype
(
filetype
));
Error
(
func
,
"%s
support not compiled in
!"
,
strfiletype
(
filetype
));
break
;
}
}
...
...
@@ -1567,7 +1568,7 @@ void streamReadVarSlice(int streamID, int varID, int levelID, double *data, int
#endif
default:
{
Error
(
func
,
"%s
library not available
!"
,
strfiletype
(
filetype
));
Error
(
func
,
"%s
support not compiled in
!"
,
strfiletype
(
filetype
));
break
;
}
}
...
...
@@ -1648,7 +1649,7 @@ void streamWriteVarSlice(int streamID, int varID, int levelID, double *data, int
#endif
default:
{
Error
(
func
,
"%s
library not available
!"
,
strfiletype
(
filetype
));
Error
(
func
,
"%s
support not compiled in
!"
,
strfiletype
(
filetype
));
break
;
}
}
...
...
src/stream_grb.c
View file @
c34f0314
...
...
@@ -23,6 +23,9 @@
#define UNDEFID CDI_UNDEFID
int
_readline_
(
FILE
*
fp
,
char
*
line
,
int
len
);
typedef
struct
{
int
code
;
int
table
;
...
...
@@ -922,7 +925,71 @@ void grbAddRecord(int streamID, int code, int *isec1, int *isec2, double *fsec2,
if
(
varInqTable
(
varID
)
==
UNDEFID
)
{
int
tableID
;
tableID
=
tableInq
(
varInqModel
(
varID
),
ISEC1_CodeTable
,
NULL
);
/*
if ( tableID == UNDEFID && cdiPartabPath )
{
char line[8192];
char command[4096];
FILE *pfp;
int nfiles;
int max_partab = 4096;
char *fnames[4096];
int cen, sub, ver, tab, nf, fi;
int icen, isub, iver, itab;
icen = ISEC1_CenterID;
isub = ISEC1_SubCenterID;
iver = ISEC1_ModelID;
itab = ISEC1_CodeTable;
sprintf(command, "cd %s 2> /dev/null; ls * 2> /dev/null", cdiPartabPath);
pfp = popen(command, "r");
if ( pfp == NULL )
SysError(func, "popen %s failed", command);
nfiles = 0;
while ( _readline_(pfp, line, 8192) )
{
cen = -1; sub = -1; ver = -1; tab = -1;
nf = sscanf(line, "Cen%d_Sub%d_Ver%d_Tab%d", &cen, &sub, &ver, &tab);
printf("%d %d %d %d %d\n", nf, cen, sub, ver, tab);
if ( nfiles >= max_partab )
{
Warning(func, "Too many parameter tables (limit: %d)", max_partab);
break;
}
fnames[nfiles++] = strdupx(line);
printf("test: %s\n", line);
}
pclose(pfp);
if ( nfiles )
{
cen = -1; sub = -1; ver = -1; tab = -1;
for ( fi = 0; fi < nfiles; ++fi )
{
nf = sscanf(fnames[fi], "Cen%d_Sub%d_Ver%d_Tab%d", &cen, &sub, &ver, &tab);
if ( nf == 4 && cen == icen && sub == isub && ver == iver && tab == itab ) goto END_LABEL;
}
for ( fi = 0; fi < nfiles; ++fi )
{
nf = sscanf(fnames[fi], "Cen%d_Sub%d_Tab%d", &cen, &sub, &tab);
if ( nf == 3 && cen == icen && sub == isub && tab == itab ) goto END_LABEL;
}
END_LABEL:
if ( fi < nfiles )
{
printf("found table %s\n", fnames[fi]);
}
}
}
*/
if
(
tableID
==
UNDEFID
)
tableID
=
tableDef
(
varInqModel
(
varID
),
ISEC1_CodeTable
,
NULL
);
varDefTable
(
varID
,
tableID
);
...
...
src/stream_int.c
View file @
c34f0314
...
...
@@ -23,6 +23,9 @@ int cdiSplitLtype105 = CDI_UNDEFID;
int
cdiIgnoreAttCoordinates
=
FALSE
;
char
*
cdiPartabPath
=
NULL
;
int
cdiPartabIntern
=
1
;
double
cdiDefaultMissval
=
-
9.E33
;
...
...
@@ -94,6 +97,7 @@ long cdiGetenvInt(char *envName)
void
cdiInitialize
(
void
)
{
static
char
func
[]
=
"cdiInitialize"
;
static
int
Init_CDI
=
FALSE
;
char
*
envString
;
long
value
;
...
...
@@ -119,6 +123,12 @@ void cdiInitialize(void)
envString
=
getenv
(
"IGNORE_ATT_COORDINATES"
);
if
(
envString
)
cdiIgnoreAttCoordinates
=
atoi
(
envString
);
envString
=
getenv
(
"PARTAB_INTERN"
);
if
(
envString
)
cdiPartabIntern
=
atoi
(
envString
);
envString
=
getenv
(
"PARTAB_PATH"
);
if
(
envString
)
cdiPartabPath
=
strdup
(
envString
);
}
}
...
...
src/stream_int.h
View file @
c34f0314
...
...
@@ -231,6 +231,9 @@ extern int cdiDefaultLeveltype;
extern
int
cdiNcMissingValue
;
extern
int
cdiSplitLtype105
;
extern
char
*
cdiPartabPath
;
extern
int
cdiPartabIntern
;
STREAM
*
stream_to_pointer
(
int
idx
);
STREAM
*
stream_new_entry
(
void
);
void
stream_delete_entry
(
STREAM
*
streamptr
);
...
...
src/stream_record.c
View file @
c34f0314
...
...
@@ -191,7 +191,7 @@ void streamInqRecord(int streamID, int *varID, int *levelID)
#endif
default:
{
Error(func, "%s
library not available
!", strfiletype(filetype));
Error(func, "%s
support not compiled in
!", strfiletype(filetype));
break;
}
}
...
...
@@ -283,7 +283,7 @@ void streamDefRecord(int streamID, int varID, int levelID)
#endif
default:
{
Error
(
func
,
"%s
library not available
!"
,
strfiletype
(
filetype
));
Error
(
func
,
"%s
support not compiled in
!"
,
strfiletype
(
filetype
));
break
;
}
}
...
...
@@ -345,7 +345,7 @@ void streamReadRecord(int streamID, double *data, int *nmiss)
#endif
default:
{
Error
(
func
,
"%s
library not available
!"
,
strfiletype
(
filetype
));
Error
(
func
,
"%s
support not compiled in
!"
,
strfiletype
(
filetype
));
break
;
}
}
...
...
@@ -405,7 +405,7 @@ void streamWriteRecord(int streamID, double *data, int nmiss)
#endif
default:
{
Error
(
func
,
"%s
library not available
!"
,
strfiletype
(
filetype
));
Error
(
func
,
"%s
support not compiled in
!"
,
strfiletype
(
filetype
));
break
;
}
}
...
...
src/table.c
View file @
c34f0314
...
...
@@ -17,7 +17,7 @@
#include
"tablepar.h"
#include
"table.h"
#define MAX_TABLE
99
#define MAX_TABLE
256
#define MAX_PARS 1024
typedef
struct
...
...
@@ -106,7 +106,8 @@ void parTableInit(void)
{
ParTableInit
=
1
;
tableDefault
();
if
(
cdiPartabIntern
)
tableDefault
();
tableGetPath
();
}
...
...
@@ -350,7 +351,7 @@ int tableFromEnv(int modelID, int tablenum)
sprintf
(
tablename
+
len
,
"_%03d"
,
tablenum
);
}
tablenamefound
=
1
;
/* printf("
tableInq
: tablename = >%s<\n", tablename); */
/* printf("
%s
: tablename = >%s<\n",
func,
tablename); */
}
else
{
...
...
@@ -366,7 +367,7 @@ int tableFromEnv(int modelID, int tablenum)
sprintf
(
tablename
+
len
,
"_%03d"
,
tablenum
);
}
tablenamefound
=
1
;
/* printf("
tableInq
: tablename = >%s<\n", tablename); */
/* printf("
%s
: tablename = >%s<\n",
func,
tablename); */
}
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment