Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
libcdi
Commits
e27e04c8
Commit
e27e04c8
authored
Apr 26, 2019
by
Uwe Schulzweida
Browse files
netCDF4: dimids are greater than ndims after ncrename (bug fix).
parent
c73bf0b0
Changes
3
Show whitespace changes
Inline
Side-by-side
ChangeLog
View file @
e27e04c8
...
...
@@ -3,6 +3,10 @@
* using CGRIBEX library version 1.9.3
* Version 1.9.7 released
2019-04-26 Uwe Schulzweida
* netCDF4: dimids are greater than ndims after ncrename (bug fix)
2019-04-15 Uwe Schulzweida
* Removed funtion gridPrint()
...
...
src/cdf_read.c
View file @
e27e04c8
...
...
@@ -445,7 +445,7 @@ void cdfGetSliceSlapDescription(stream_t *streamptr, int varId, int levelId, boo
streamptr
->
numvals
+=
gridsize
;
int
dimIds
[
3
];
//this array joins the old variables xid, yid, and zid
int
dimIds
[
3
];
//
this array joins the old variables xid, yid, and zid
cdfInqDimIds
(
streamptr
,
varId
,
&
dimIds
);
int
skipdim
=
cdfGetSkipDim
(
fileId
,
ncvarid
,
&
dimIds
);
...
...
src/stream_cdf_i.c
View file @
e27e04c8
...
...
@@ -2674,7 +2674,6 @@ int cdf_define_all_grids(ncgrid_t *ncgrid, int vlistID, ncdim_t *ncdims, int nva
xaxisid
=
(
xdimid
!=
CDI_UNDEFID
)
?
ncdims
[
xdimid
].
ncvarid
:
CDI_UNDEFID
;
yaxisid
=
(
ydimid
!=
CDI_UNDEFID
)
?
ncdims
[
ydimid
].
ncvarid
:
CDI_UNDEFID
;
if
(
cdf_read_coordinates
(
lazyGrid
,
ncvar
,
ncvars
,
ncdims
,
timedimid
,
xvarid
,
yvarid
,
xsize
,
ysize
,
&
vdimid
)
)
continue
;
...
...
@@ -2690,9 +2689,9 @@ int cdf_define_all_grids(ncgrid_t *ncgrid, int vlistID, ncdim_t *ncdims, int nva
if
(
lproj
&&
lgrid
)
{
int
d
u
mid
;
int
d
i
mid
;
cdf_read_coordinates
(
lazyProj
,
ncvar
,
ncvars
,
ncdims
,
timedimid
,
xaxisid
,
yaxisid
,
xsize
,
ysize
,
&
d
u
mid
);
xaxisid
,
yaxisid
,
xsize
,
ysize
,
&
d
i
mid
);
}
if
(
CDI_Debug
)
...
...
@@ -2733,8 +2732,10 @@ int cdf_define_all_grids(ncgrid_t *ncgrid, int vlistID, ncdim_t *ncdims, int nva
int
gridindex
=
vlistGridIndex
(
vlistID
,
gridID
);
ncgrid
[
gridindex
].
gridID
=
gridID
;
ncgrid
[
gridindex
].
ncIDs
[
CDF_DIMID_X
]
=
xdimid
;
ncgrid
[
gridindex
].
ncIDs
[
CDF_DIMID_Y
]
=
ydimid
;
ncgrid
[
gridindex
].
ncIDs
[
CDF_DIMID_X
]
=
ncdims
[
xdimid
].
dimid
;
ncgrid
[
gridindex
].
ncIDs
[
CDF_DIMID_Y
]
=
ncdims
[
ydimid
].
dimid
;
//ncgrid[gridindex].ncIDs[CDF_DIMID_X] = xdimid;
//ncgrid[gridindex].ncIDs[CDF_DIMID_Y] = ydimid;
if
(
grid
->
type
==
GRID_TRAJECTORY
)
{
ncgrid
[
gridindex
].
ncIDs
[
CDF_VARID_X
]
=
xvarid
;
...
...
@@ -2972,6 +2973,7 @@ int cdf_define_all_zaxes(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int
}
int
zaxisindex
=
vlistZaxisIndex
(
vlistID
,
zaxisID
);
//US streamptr->zaxisID[zaxisindex] = ncdims[zdimid].dimid;
streamptr
->
zaxisID
[
zaxisindex
]
=
zdimid
;
if
(
CDI_Debug
)
...
...
@@ -3028,7 +3030,7 @@ int cdf_cmp_varname(const void *s1, const void *s2)
// 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
)
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
)
{
if
(
CDI_Debug
)
for
(
int
i
=
0
;
i
<
nvars
;
i
++
)
Message
(
"varids[%d] = %d"
,
i
,
varids
[
i
]);
...
...
@@ -3132,15 +3134,18 @@ void cdf_define_all_vars(stream_t *streamptr, int vlistID, int instID, int model
if
(
gridInqType
(
gridID
)
==
GRID_UNSTRUCTURED
&&
ndims
-
iodim
<=
2
&&
(
ydimid
==
xdimid
||
ydimid
==
CDI_UNDEFID
)
)
{
ixyz
=
(
xdimid
==
dimids
[
ndims
-
1
])
?
321
:
213
;
ixyz
=
(
xdimid
==
ncdims
[
dimids
[
ndims
-
1
]].
dimid
)
?
321
:
213
;
//US ixyz = (xdimid == dimids[ndims-1]) ? 321 : 213;
}
else
{
for
(
int
idim
=
iodim
;
idim
<
ndims
;
idim
++
)
{
if
(
xdimid
==
dimids
[
idim
]
)
ixyz
+=
1
*
ipow10
[
ndims
-
idim
-
1
];
else
if
(
ydimid
==
dimids
[
idim
]
)
ixyz
+=
2
*
ipow10
[
ndims
-
idim
-
1
];
else
if
(
zdimid
==
dimids
[
idim
]
)
ixyz
+=
3
*
ipow10
[
ndims
-
idim
-
1
];
int
dimid
=
ncdims
[
dimids
[
idim
]].
dimid
;
//US int dimid = dimids[idim];
if
(
xdimid
==
dimid
)
ixyz
+=
1
*
ipow10
[
ndims
-
idim
-
1
];
else
if
(
ydimid
==
dimid
)
ixyz
+=
2
*
ipow10
[
ndims
-
idim
-
1
];
else
if
(
zdimid
==
dimid
)
ixyz
+=
3
*
ipow10
[
ndims
-
idim
-
1
];
}
}
...
...
@@ -3635,7 +3640,6 @@ int cdfCheckVars(int nvars, ncvar_t *ncvars, size_t ntsteps, int timedimid)
if
(
xtypeIsText
(
ncvars
[
ncvarid
].
xtype
)
)
{
printf
(
"ncvars[ncvarid].isvar %d
\n
"
,
ncvars
[
ncvarid
].
isvar
);
ncvars
[
ncvarid
].
isvar
=
0
;
Warning
(
"Unsupported data type (char/string), skipped variable %s!"
,
ncvars
[
ncvarid
].
name
);
continue
;
...
...
@@ -3984,7 +3988,7 @@ int cdfInqContents(stream_t *streamptr)
streamptr
->
ntsteps
=
(
long
)
ntsteps
;
// define all data variables
cdf_define_all_vars
(
streamptr
,
vlistID
,
instID
,
modelID
,
varids
,
nvars_data
,
nvars
,
ncvars
);
cdf_define_all_vars
(
streamptr
,
vlistID
,
instID
,
modelID
,
varids
,
nvars_data
,
nvars
,
ncvars
,
ncdims
);
cdiCreateTimesteps
(
streamptr
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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