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
5fd27bfa
Commit
5fd27bfa
authored
5 years ago
by
Uwe Schulzweida
Browse files
Options
Downloads
Patches
Plain Diff
Refactor cdf_define_institut_and_model_id().
parent
477a07b4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/stream_cdf_i.c
+40
-37
40 additions, 37 deletions
src/stream_cdf_i.c
with
40 additions
and
37 deletions
src/stream_cdf_i.c
+
40
−
37
View file @
5fd27bfa
...
...
@@ -3042,6 +3042,45 @@ void cdf_sort_varname(int *varids, const int nvars, const ncvar_t *ncvars)
for
(
int
i
=
0
;
i
<
nvars
;
i
++
)
Message
(
"sorted varids[%d] = %d"
,
i
,
varids
[
i
]);
}
static
void
cdf_define_institut_and_model_id
(
int
vlistID
,
int
varID
)
{
int
varInstID
=
vlistInqVarInstitut
(
vlistID
,
varID
);
int
varModelID
=
vlistInqVarModel
(
vlistID
,
varID
);
int
varTableID
=
vlistInqVarTable
(
vlistID
,
varID
);
const
int
code
=
vlistInqVarCode
(
vlistID
,
varID
);
if
(
cdiDefaultTableID
!=
CDI_UNDEFID
)
{
char
name
[
CDI_MAX_NAME
];
name
[
0
]
=
0
;
char
longname
[
CDI_MAX_NAME
];
longname
[
0
]
=
0
;
char
units
[
CDI_MAX_NAME
];
units
[
0
]
=
0
;
tableInqEntry
(
cdiDefaultTableID
,
code
,
-
1
,
name
,
longname
,
units
);
if
(
name
[
0
]
)
{
vlistDestroyVarName
(
vlistID
,
varID
);
vlistDestroyVarLongname
(
vlistID
,
varID
);
vlistDestroyVarUnits
(
vlistID
,
varID
);
if
(
varTableID
!=
CDI_UNDEFID
)
{
vlistDefVarName
(
vlistID
,
varID
,
name
);
if
(
longname
[
0
]
)
vlistDefVarLongname
(
vlistID
,
varID
,
longname
);
if
(
units
[
0
]
)
vlistDefVarUnits
(
vlistID
,
varID
,
units
);
}
else
{
varTableID
=
cdiDefaultTableID
;
}
}
if
(
cdiDefaultModelID
!=
CDI_UNDEFID
)
varModelID
=
cdiDefaultModelID
;
if
(
cdiDefaultInstID
!=
CDI_UNDEFID
)
varInstID
=
cdiDefaultInstID
;
}
if
(
varInstID
!=
CDI_UNDEFID
)
vlistDefVarInstitut
(
vlistID
,
varID
,
varInstID
);
if
(
varModelID
!=
CDI_UNDEFID
)
vlistDefVarModel
(
vlistID
,
varID
,
varModelID
);
if
(
varTableID
!=
CDI_UNDEFID
)
vlistDefVarTable
(
vlistID
,
varID
,
varTableID
);
}
// define all input data variables
static
void
cdf_define_all_vars
(
stream_t
*
streamptr
,
int
vlistID
,
int
instID
,
int
modelID
,
int
*
varids
,
int
nvars
,
int
num_ncvars
,
ncvar_t
*
ncvars
,
ncdim_t
*
ncdims
)
...
...
@@ -3230,43 +3269,7 @@ void cdf_define_all_vars(stream_t *streamptr, int vlistID, int instID, int model
}
}
for
(
int
varID
=
0
;
varID
<
nvars
;
varID
++
)
{
int
varInstID
=
vlistInqVarInstitut
(
vlistID
,
varID
);
int
varModelID
=
vlistInqVarModel
(
vlistID
,
varID
);
int
varTableID
=
vlistInqVarTable
(
vlistID
,
varID
);
const
int
code
=
vlistInqVarCode
(
vlistID
,
varID
);
if
(
cdiDefaultTableID
!=
CDI_UNDEFID
)
{
char
name
[
CDI_MAX_NAME
];
name
[
0
]
=
0
;
char
longname
[
CDI_MAX_NAME
];
longname
[
0
]
=
0
;
char
units
[
CDI_MAX_NAME
];
units
[
0
]
=
0
;
tableInqEntry
(
cdiDefaultTableID
,
code
,
-
1
,
name
,
longname
,
units
);
if
(
name
[
0
]
)
{
vlistDestroyVarName
(
vlistID
,
varID
);
vlistDestroyVarLongname
(
vlistID
,
varID
);
vlistDestroyVarUnits
(
vlistID
,
varID
);
if
(
varTableID
!=
CDI_UNDEFID
)
{
vlistDefVarName
(
vlistID
,
varID
,
name
);
if
(
longname
[
0
]
)
vlistDefVarLongname
(
vlistID
,
varID
,
longname
);
if
(
units
[
0
]
)
vlistDefVarUnits
(
vlistID
,
varID
,
units
);
}
else
{
varTableID
=
cdiDefaultTableID
;
}
}
if
(
cdiDefaultModelID
!=
CDI_UNDEFID
)
varModelID
=
cdiDefaultModelID
;
if
(
cdiDefaultInstID
!=
CDI_UNDEFID
)
varInstID
=
cdiDefaultInstID
;
}
if
(
varInstID
!=
CDI_UNDEFID
)
vlistDefVarInstitut
(
vlistID
,
varID
,
varInstID
);
if
(
varModelID
!=
CDI_UNDEFID
)
vlistDefVarModel
(
vlistID
,
varID
,
varModelID
);
if
(
varTableID
!=
CDI_UNDEFID
)
vlistDefVarTable
(
vlistID
,
varID
,
varTableID
);
}
for
(
int
varID
=
0
;
varID
<
nvars
;
varID
++
)
cdf_define_institut_and_model_id
(
vlistID
,
varID
);
}
static
...
...
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