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
6cf2bfbd
Commit
6cf2bfbd
authored
16 years ago
by
Uwe Schulzweida
Browse files
Options
Downloads
Patches
Plain Diff
gridCompare: bug fix for lonlat grids and type = 1 (cdfInqContents)
parent
b238a327
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ChangeLog
+1
-0
1 addition, 0 deletions
ChangeLog
src/grid.c
+47
-14
47 additions, 14 deletions
src/grid.c
with
48 additions
and
14 deletions
ChangeLog
+
1
−
0
View file @
6cf2bfbd
...
...
@@ -5,6 +5,7 @@
* cdfReadVarSliceDP: add swapxy support
* cdfInqContents: support of grid stdname 'longitude' and 'latitude'
* streamFilesuffix: bug fix for IEG [report: Class Teichmann]
* gridCompare: bug fix for lonlat grids and type = 1 (cdfInqContents)
* netcdf: support of timeunit 'year'
* Version 1.2.1 released
...
...
This diff is collapsed.
Click to expand it.
src/grid.c
+
47
−
14
View file @
6cf2bfbd
...
...
@@ -2174,6 +2174,7 @@ int gridIsRotated(int gridID)
int
gridCompare
(
int
gridID
,
GRID
grid
)
{
static
char
func
[]
=
"gridCompare"
;
int
differ
=
1
;
int
xsize
,
ysize
;
...
...
@@ -2189,6 +2190,8 @@ int gridCompare(int gridID, GRID grid)
{
/*
printf("gridID %d\n", gridID);
printf("grid.xdef %d\n", grid.xdef);
printf("grid.ydef %d\n", grid.ydef);
printf("grid.xsize %d\n", grid.xsize);
printf("grid.ysize %d\n", grid.ysize);
printf("grid.xfirst %f\n", grid.xfirst);
...
...
@@ -2203,26 +2206,56 @@ int gridCompare(int gridID, GRID grid)
if
(
grid
.
xsize
==
gridInqXsize
(
gridID
)
&&
grid
.
ysize
==
gridInqYsize
(
gridID
)
)
{
if
(
grid
.
xdef
==
2
&&
grid
.
ydef
==
2
)
if
(
!
(
DBL_IS_EQUAL
(
grid
.
xfirst
,
0
)
&&
DBL_IS_EQUAL
(
grid
.
xlast
,
0
)
&&
DBL_IS_EQUAL
(
grid
.
xinc
,
0
))
&&
!
(
DBL_IS_EQUAL
(
grid
.
yfirst
,
0
)
&&
DBL_IS_EQUAL
(
grid
.
ylast
,
0
)
&&
DBL_IS_EQUAL
(
grid
.
yinc
,
0
))
&&
!
DBL_IS_EQUAL
(
grid
.
xfirst
,
grid
.
xlast
)
&&
!
DBL_IS_EQUAL
(
grid
.
yfirst
,
grid
.
ylast
)
)
{
if
(
!
DBL_IS_EQUAL
(
grid
.
xfirst
,
gridInqXval
(
gridID
,
0
))
||
!
DBL_IS_EQUAL
(
grid
.
yfirst
,
gridInqYval
(
gridID
,
0
)))
{
differ
=
1
;
}
if
(
!
differ
&&
fabs
(
grid
.
xinc
)
>
0
&&
fabs
(
fabs
(
grid
.
xinc
)
-
fabs
(
gridInqXinc
(
gridID
)))
>
fabs
(
grid
.
xinc
/
1000
))
{
if
(
!
(
DBL_IS_EQUAL
(
grid
.
xfirst
,
0
)
&&
DBL_IS_EQUAL
(
grid
.
xlast
,
0
)
&&
DBL_IS_EQUAL
(
grid
.
xinc
,
0
))
&&
!
(
DBL_IS_EQUAL
(
grid
.
yfirst
,
0
)
&&
DBL_IS_EQUAL
(
grid
.
ylast
,
0
)
&&
DBL_IS_EQUAL
(
grid
.
yinc
,
0
))
&&
!
DBL_IS_EQUAL
(
grid
.
xfirst
,
grid
.
xlast
)
&&
!
DBL_IS_EQUAL
(
grid
.
yfirst
,
grid
.
ylast
)
)
{
if
(
!
DBL_IS_EQUAL
(
grid
.
xfirst
,
gridInqXval
(
gridID
,
0
))
||
!
DBL_IS_EQUAL
(
grid
.
yfirst
,
gridInqYval
(
gridID
,
0
)))
{
differ
=
1
;
}
if
(
!
differ
&&
fabs
(
grid
.
xinc
)
>
0
&&
fabs
(
fabs
(
grid
.
xinc
)
-
fabs
(
gridInqXinc
(
gridID
)))
>
fabs
(
grid
.
xinc
/
1000
))
{
differ
=
1
;
}
if
(
!
differ
&&
fabs
(
grid
.
yinc
)
>
0
&&
fabs
(
fabs
(
grid
.
yinc
)
-
fabs
(
gridInqYinc
(
gridID
)))
>
fabs
(
grid
.
yinc
/
1000
))
{
differ
=
1
;
}
}
}
else
{
int
i
;
double
*
xvals
,
*
yvals
;
xvals
=
(
double
*
)
malloc
(
xsize
*
sizeof
(
double
));
yvals
=
(
double
*
)
malloc
(
ysize
*
sizeof
(
double
));
gridInqXvals
(
gridID
,
xvals
);
gridInqYvals
(
gridID
,
yvals
);
for
(
i
=
0
;
i
<
xsize
;
++
i
)
if
(
fabs
(
grid
.
xvals
[
i
]
-
xvals
[
i
])
>
1.e-10
)
{
differ
=
1
;
break
;
}
if
(
!
differ
&&
fabs
(
grid
.
yinc
)
>
0
&&
fabs
(
fabs
(
grid
.
yinc
)
-
fabs
(
gridInqYinc
(
gridID
)))
>
fabs
(
grid
.
yinc
/
1000
))
for
(
i
=
0
;
i
<
ysize
;
++
i
)
if
(
fabs
(
grid
.
yvals
[
i
]
-
yvals
[
i
])
>
1.e-10
)
{
differ
=
1
;
break
;
}
}
free
(
xvals
);
free
(
yvals
);
}
}
else
differ
=
1
;
...
...
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