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
b1c602b5
Commit
b1c602b5
authored
3 years ago
by
Uwe Schulzweida
Browse files
Options
Downloads
Patches
Plain Diff
zaxis_compare: check bounds (bug fix)
parent
2eee99a8
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#16070
failed
1 month ago
Stage: external
Changes
4
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
ChangeLog
+4
-0
4 additions, 0 deletions
ChangeLog
src/varscan.c
+28
-10
28 additions, 10 deletions
src/varscan.c
src/varscan.h
+2
-2
2 additions, 2 deletions
src/varscan.h
src/vlist.c
+4
-4
4 additions, 4 deletions
src/vlist.c
with
38 additions
and
16 deletions
ChangeLog
+
4
−
0
View file @
b1c602b5
...
...
@@ -2,6 +2,10 @@
* Version 2.0.5 released
2022-03-11 Uwe Schulzweida
* zaxis_compare: check bounds (bug fix)
2022-03-10 Uwe Schulzweida
* ecCodes encode: fix problem with startStep for step type MIN/MAX [report: Johannes Schick]
...
...
This diff is collapsed.
Click to expand it.
src/varscan.c
+
28
−
10
View file @
b1c602b5
...
...
@@ -776,8 +776,8 @@ varDefZAxisReference(int nhlev, int nvgrid, unsigned char uuid[CDI_UUID_SIZE])
}
bool
zaxis
C
ompare
(
int
zaxisID
,
int
zaxistype
,
int
nlevels
,
bool
hasBounds
,
const
double
*
levels
,
const
char
*
longname
,
const
char
*
unit
s
,
int
ltype1
,
int
ltype2
)
zaxis
_c
ompare
(
int
zaxisID
,
int
zaxistype
,
int
nlevels
,
const
double
*
levels
,
const
double
*
lbound
s
,
const
double
*
ubounds
,
const
char
*
longname
,
const
char
*
units
,
int
ltype1
,
int
ltype2
)
{
bool
differ
=
true
;
...
...
@@ -786,12 +786,11 @@ zaxisCompare(int zaxisID, int zaxistype, int nlevels, bool hasBounds, const doub
cdiInqKeyInt
(
zaxisID
,
CDI_GLOBAL
,
CDI_KEY_TYPEOFSECONDFIXEDSURFACE
,
&
ltype2_0
);
const
bool
ltype1IsEqual
=
(
ltype1
==
ltype1_0
);
const
bool
ltype2IsEqual
=
(
ltype2
==
ltype2_0
);
const
bool
hasBounds
=
(
lbounds
&&
ubounds
);
printf
(
"ltype1IsEqual, ltype2IsEqual %d %d
\n
"
,
ltype1IsEqual
,
ltype2IsEqual
);
if
(
ltype1IsEqual
&&
ltype2IsEqual
&&
(
zaxistype
==
zaxisInqType
(
zaxisID
)
||
zaxistype
==
ZAXIS_GENERIC
))
{
const
bool
hasBoundsZ
=
(
zaxisInqLbounds
(
zaxisID
,
NULL
)
>
0
);
printf
(
" hasBoundsZ, hasBounds %d %d
\n
"
,
hasBoundsZ
,
hasBounds
);
const
bool
hasBoundsZ
=
(
zaxisInqLbounds
(
zaxisID
,
NULL
)
>
0
&&
zaxisInqUbounds
(
zaxisID
,
NULL
)
>
0
);
if
(
nlevels
==
zaxisInqSize
(
zaxisID
)
&&
hasBoundsZ
==
hasBounds
)
{
const
double
*
dlevels
=
zaxisInqLevelsPtr
(
zaxisID
);
...
...
@@ -805,6 +804,23 @@ zaxisCompare(int zaxisID, int zaxistype, int nlevels, bool hasBounds, const doub
if
(
levelID
==
nlevels
)
differ
=
false
;
}
if
(
!
differ
&&
hasBounds
)
{
double
*
bounds
=
malloc
(
2
*
nlevels
*
sizeof
(
double
));
zaxisInqLbounds
(
zaxisID
,
bounds
);
zaxisInqUbounds
(
zaxisID
,
bounds
+
nlevels
);
for
(
int
levelID
=
0
;
levelID
<
nlevels
;
levelID
++
)
{
if
(
fabs
(
lbounds
[
levelID
]
-
bounds
[
levelID
])
>
1.e-9
||
fabs
(
ubounds
[
levelID
]
-
bounds
[
levelID
+
nlevels
])
>
1.e-9
)
{
differ
=
true
;
break
;
}
}
free
(
bounds
);
}
if
(
!
differ
)
{
if
(
longname
&&
longname
[
0
])
...
...
@@ -833,8 +849,9 @@ struct varDefZAxisSearchState
int
resIDValue
;
int
zaxistype
;
int
nlevels
;
bool
hasBounds
;
const
double
*
levels
;
const
double
*
lbounds
;
const
double
*
ubounds
;
const
char
*
longname
;
const
char
*
units
;
int
ltype1
;
...
...
@@ -846,8 +863,8 @@ varDefZAxisSearch(int id, void *res, void *data)
{
struct
varDefZAxisSearchState
*
state
=
(
struct
varDefZAxisSearchState
*
)
data
;
(
void
)
res
;
if
(
zaxis
C
ompare
(
id
,
state
->
zaxistype
,
state
->
nlevels
,
state
->
hasBounds
,
state
->
levels
,
state
->
l
ongname
,
state
->
u
nit
s
,
state
->
ltype1
,
state
->
ltype2
)
if
(
zaxis
_c
ompare
(
id
,
state
->
zaxistype
,
state
->
nlevels
,
state
->
levels
,
state
->
l
bounds
,
state
->
u
bound
s
,
state
->
longname
,
state
->
units
,
state
->
ltype1
,
state
->
ltype2
)
==
false
)
{
state
->
resIDValue
=
id
;
...
...
@@ -879,7 +896,7 @@ varDefZaxis(int vlistID, int zaxistype, int nlevels, const double *levels, const
{
zaxisID
=
vlistptr
->
zaxisIDs
[
index
];
if
(
!
zaxis
C
ompare
(
zaxisID
,
zaxistype
,
nlevels
,
hasBounds
,
levels
,
longname
,
units
,
ltype1
,
ltype2
))
if
(
!
zaxis
_c
ompare
(
zaxisID
,
zaxistype
,
nlevels
,
levels
,
levels1
,
levels
2
,
longname
,
units
,
ltype1
,
ltype2
))
{
zaxisdefined
=
true
;
break
;
...
...
@@ -892,7 +909,8 @@ varDefZaxis(int vlistID, int zaxistype, int nlevels, const double *levels, const
query
.
zaxistype
=
zaxistype
;
query
.
nlevels
=
nlevels
;
query
.
levels
=
levels
;
query
.
hasBounds
=
hasBounds
;
query
.
lbounds
=
levels1
;
query
.
ubounds
=
levels2
;
query
.
longname
=
longname
;
query
.
units
=
units
;
query
.
ltype1
=
ltype1
;
...
...
This diff is collapsed.
Click to expand it.
src/varscan.h
+
2
−
2
View file @
b1c602b5
...
...
@@ -34,8 +34,8 @@ void varDefOptGribInt(int varID, int tile_index, long lval, const char *keyword)
void
varDefOptGribDbl
(
int
varID
,
int
tile_index
,
double
dval
,
const
char
*
keyword
);
int
varOptGribNentries
(
int
varID
);
bool
zaxis
C
ompare
(
int
zaxisID
,
int
zaxistype
,
int
nlevels
,
bool
lbounds
,
const
double
*
levels
,
const
char
*
longname
,
const
char
*
units
,
int
ltype1
,
int
ltype2
);
bool
zaxis
_c
ompare
(
int
zaxisID
,
int
zaxistype
,
int
nlevels
,
const
double
*
levels
,
const
double
*
lbounds
,
const
double
*
ubounds
,
const
char
*
longname
,
const
char
*
units
,
int
ltype1
,
int
ltype2
);
#endif
/*
...
...
This diff is collapsed.
Click to expand it.
src/vlist.c
+
4
−
4
View file @
b1c602b5
...
...
@@ -415,8 +415,9 @@ struct vgzSearchState
int
resIDValue
;
int
zaxistype
;
int
nlevels
;
bool
lbounds
;
const
double
*
levels
;
const
double
*
lbounds
;
const
double
*
ubounds
;
};
static
enum
cdiApplyRet
...
...
@@ -424,7 +425,7 @@ vgzZAxisSearch(int id, void *res, void *data)
{
struct
vgzSearchState
*
state
=
(
struct
vgzSearchState
*
)
data
;
(
void
)
res
;
if
(
zaxis
C
ompare
(
id
,
state
->
zaxistype
,
state
->
nlevels
,
state
->
lbounds
,
state
->
level
s
,
NULL
,
NULL
,
0
,
-
1
)
==
false
)
if
(
zaxis
_c
ompare
(
id
,
state
->
zaxistype
,
state
->
nlevels
,
state
->
levels
,
state
->
lbounds
,
state
->
ubound
s
,
NULL
,
NULL
,
0
,
-
1
)
==
false
)
{
state
->
resIDValue
=
id
;
return
CDI_APPLY_STOP
;
...
...
@@ -449,7 +450,7 @@ vlist_generate_zaxis(int vlistID, int zaxistype, int nlevels, const double *leve
{
zaxisID
=
vlistptr
->
zaxisIDs
[
index
];
if
(
zaxis
C
ompare
(
zaxisID
,
zaxistype
,
nlevels
,
hasB
ounds
,
level
s
,
NULL
,
NULL
,
0
,
-
1
)
==
false
)
if
(
zaxis
_c
ompare
(
zaxisID
,
zaxistype
,
nlevels
,
levels
,
lb
ounds
,
ubound
s
,
NULL
,
NULL
,
0
,
-
1
)
==
false
)
{
zaxisdefined
=
true
;
break
;
...
...
@@ -462,7 +463,6 @@ vlist_generate_zaxis(int vlistID, int zaxistype, int nlevels, const double *leve
query
.
zaxistype
=
zaxistype
;
query
.
nlevels
=
nlevels
;
query
.
levels
=
levels
;
query
.
lbounds
=
hasBounds
;
if
((
zaxisglobdefined
=
(
cdiResHFilterApply
(
getZaxisOps
(),
vgzZAxisSearch
,
&
query
)
==
CDI_APPLY_STOP
)))
zaxisID
=
query
.
resIDValue
;
...
...
This diff is collapsed.
Click to expand it.
Thomas Jahns
@k202069
mentioned in issue
#16
·
1 year ago
mentioned in issue
#16
mentioned in issue #16
Toggle commit list
Thomas Jahns
@k202069
mentioned in commit
a73d02ba
·
1 year ago
mentioned in commit
a73d02ba
mentioned in commit a73d02baae80cbceadba676089f2969b87ea870e
Toggle commit list
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