Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libcdi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mpim-sw
libcdi
Commits
148f4cac
Commit
148f4cac
authored
5 years ago
by
Ralf Mueller
Browse files
Options
Downloads
Patches
Plain Diff
use CDI_MAX_NAME for char length
parent
2e44a3d5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
interfaces/cdi.cpp
+13
-10
13 additions, 10 deletions
interfaces/cdi.cpp
interfaces/cdi.hpp
+2
-2
2 additions, 2 deletions
interfaces/cdi.hpp
with
15 additions
and
12 deletions
interfaces/cdi.cpp
+
13
−
10
View file @
148f4cac
...
...
@@ -7,7 +7,6 @@
#if defined(__cplusplus)
extern
"C"
{
#endif
#include
"cdi.h"
#if defined (__cplusplus)
}
#endif
...
...
@@ -19,11 +18,12 @@ extern "C" {
*/
CdiGrid
::
CdiGrid
()
{
gridID
=
-
1
;
}
CdiGrid
::
CdiGrid
(
int
gridid
)
{
char
_name
[
C
HARSIZ
E
];
char
_xname
[
C
HARSIZ
E
],
_xlongname
[
C
HARSIZ
E
],
_xstdname
[
C
HARSIZ
E
],
_xunits
[
C
HARSIZ
E
];
char
_yname
[
C
HARSIZ
E
],
_ylongname
[
C
HARSIZ
E
],
_ystdname
[
C
HARSIZ
E
],
_yunits
[
C
HARSIZ
E
];
char
_name
[
C
DI_MAX_NAM
E
];
char
_xname
[
C
DI_MAX_NAM
E
],
_xlongname
[
C
DI_MAX_NAM
E
],
_xstdname
[
C
DI_MAX_NAM
E
],
_xunits
[
C
DI_MAX_NAM
E
];
char
_yname
[
C
DI_MAX_NAM
E
],
_ylongname
[
C
DI_MAX_NAM
E
],
_ystdname
[
C
DI_MAX_NAM
E
],
_yunits
[
C
DI_MAX_NAM
E
];
gridID
=
gridid
;
//std::cout << "DEBUG:input gridid =" << gridid << std::endl;
type
=
gridInqType
(
gridID
);
/* strcpy(_name,gridNamePtr(type)); */
name
=
std
::
string
(
gridNamePtr
(
type
));
...
...
@@ -33,7 +33,7 @@ CdiGrid::CdiGrid(int gridid) {
ysize
=
gridInqYsize
(
gridID
);
xvalues
.
resize
(
xsize
);
yvalues
.
resize
(
ysize
);
//
std::cout << "(gridID:" << gridID<< ") xsize: " << xsize << " ysize:" << ysize << std::endl;
// std::cout << "
DEBUG:
(gridID:" << gridID<< ") xsize: " << xsize << " ysize:" << ysize << std::endl;
getValues
();
getBounds
();
...
...
@@ -208,7 +208,7 @@ CdiTaxis::~CdiTaxis() { if (taxisID >= 0) taxisID = -1; }
*/
CdiZaxis
::
CdiZaxis
()
{
zaxisID
=
-
1
;
}
CdiZaxis
::
CdiZaxis
(
int
zaxisid
)
{
char
name
[
C
HARSIZ
E
],
longname
[
C
HARSIZ
E
],
units
[
C
HARSIZ
E
];
char
name
[
C
DI_MAX_NAM
E
],
longname
[
C
DI_MAX_NAM
E
],
units
[
C
DI_MAX_NAM
E
];
zaxisID
=
zaxisid
;
size
=
zaxisInqSize
(
zaxisID
);
...
...
@@ -243,7 +243,7 @@ CdiZaxis::~CdiZaxis() { if (zaxisID >= 0) zaxisID = -1; }
*/
CdiVariable
::
CdiVariable
()
{
size
=
-
1
;
}
CdiVariable
::
CdiVariable
(
int
streamid
,
int
vlistid
,
int
varid
)
{
char
_name
[
C
HARSIZ
E
],
_longname
[
C
HARSIZ
E
],
_units
[
C
HARSIZ
E
],
_stdname
[
C
HARSIZ
E
];
char
_name
[
C
DI_MAX_NAM
E
],
_longname
[
C
DI_MAX_NAM
E
],
_units
[
C
DI_MAX_NAM
E
],
_stdname
[
C
DI_MAX_NAM
E
];
streamID
=
streamid
;
vlistID
=
vlistid
;
varID
=
varid
;
...
...
@@ -362,7 +362,9 @@ Cdi::Cdi(const char *path) {
getVars
();
}
Cdi
::~
Cdi
()
{}
Cdi
::~
Cdi
()
{
streamClose
(
streamID
);
}
void
Cdi
::
getTaxes
()
{
...
...
@@ -388,17 +390,18 @@ void
Cdi
::
getGrids
()
{
int
gridID
;
ngrids
=
vlistNgrids
(
vlistID
);
std
::
cout
<<
"ngrids="
<<
ngrids
<<
std
::
endl
;
for
(
int
i
=
0
;
i
<
ngrids
;
i
++
)
{
gridID
=
vlistGrid
(
vlistID
,
i
);
//
std::cout << "getGrids : gridID=" << gridID << std::endl;
std
::
cout
<<
"getGrids : gridID="
<<
gridID
<<
std
::
endl
;
grids
[
gridID
]
=
CdiGrid
(
gridID
);
}
}
void
Cdi
::
getVars
()
{
char
name
[
C
HARSIZ
E
];
char
name
[
C
DI_MAX_NAM
E
];
int
varID
,
code
;
// std::cout << vlistID << std::endl;
for
(
varID
=
0
;
varID
<
nvars
;
varID
++
)
...
...
This diff is collapsed.
Click to expand it.
interfaces/cdi.hpp
+
2
−
2
View file @
148f4cac
#include
<string>
#include
<vector>
#include
<map>
#
define CHARSIZE 128
#
include
"cdi.h"
class
CdiGrid
{
public:
...
...
@@ -40,7 +40,7 @@ class CdiTaxis {
int
ntsteps
,
unit
;
int
rdate
,
rtime
,
vdate
,
vtime
;
int
type
,
calendar
,
hasBounds
;
char
name
[
C
HARSIZ
E
];
char
name
[
C
DI_MAX_NAM
E
];
const
char
*
unitname
;
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment