Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
libcdi
Commits
13f9fff6
Commit
13f9fff6
authored
Apr 17, 2006
by
Uwe Schulzweida
Browse files
gridPrint: print xfirst and xinc if xinc is constant
parent
701bf9c1
Changes
2
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
13f9fff6
2006-05-?? Uwe Schulzweida <schulzweida@dkrz.de>
* using GRIB library version 0.6.6
* gridPrint: print xfirst and xinc if xinc is constant
* Version 0.9.7 released
2006-03-08 Uwe Schulzweida <schulzweida@dkrz.de>
...
...
src/grid.c
View file @
13f9fff6
...
...
@@ -2442,11 +2442,20 @@ void gridCompress(int gridID)
gridptr
->
xsize
=
gridsize
;
gridptr
->
ysize
=
gridsize
;
gridptr
->
xvals
=
(
double
*
)
realloc
(
gridptr
->
xvals
,
gridsize
*
sizeof
(
double
));
gridptr
->
yvals
=
(
double
*
)
realloc
(
gridptr
->
yvals
,
gridsize
*
sizeof
(
double
));
gridptr
->
area
=
(
double
*
)
realloc
(
gridptr
->
area
,
gridsize
*
sizeof
(
double
));
gridptr
->
xbounds
=
(
double
*
)
realloc
(
gridptr
->
xbounds
,
nv
*
gridsize
*
sizeof
(
double
));
gridptr
->
ybounds
=
(
double
*
)
realloc
(
gridptr
->
ybounds
,
nv
*
gridsize
*
sizeof
(
double
));
if
(
gridptr
->
xvals
)
gridptr
->
xvals
=
(
double
*
)
realloc
(
gridptr
->
xvals
,
gridsize
*
sizeof
(
double
));
if
(
gridptr
->
yvals
)
gridptr
->
yvals
=
(
double
*
)
realloc
(
gridptr
->
yvals
,
gridsize
*
sizeof
(
double
));
if
(
gridptr
->
area
)
gridptr
->
area
=
(
double
*
)
realloc
(
gridptr
->
area
,
gridsize
*
sizeof
(
double
));
if
(
gridptr
->
xbounds
)
gridptr
->
xbounds
=
(
double
*
)
realloc
(
gridptr
->
xbounds
,
nv
*
gridsize
*
sizeof
(
double
));
if
(
gridptr
->
ybounds
)
gridptr
->
ybounds
=
(
double
*
)
realloc
(
gridptr
->
ybounds
,
nv
*
gridsize
*
sizeof
(
double
));
free
(
gridptr
->
mask
);
gridptr
->
mask
=
NULL
;
...
...
@@ -2828,19 +2837,35 @@ void gridPrint(int gridID)
if
(
xvals
)
{
nbyte0
=
fprintf
(
fp
,
"xvals : "
)
;
nbyte
=
nbyte0
;
for
(
index
=
0
;
index
<
xdim
;
index
++
)
double
xfirst
=
0
.
0
,
xinc
=
0
.
0
;
if
(
type
==
GRID_LONLAT
||
type
==
GRID_GAUSSIAN
)
{
if
(
nbyte
>
80
)
xfirst
=
gridInqXval
(
gridID
,
0
);
xinc
=
gridInqXinc
(
gridID
);
}
if
(
!
DBL_IS_EQUAL
(
xinc
,
0
)
)
{
fprintf
(
fp
,
"xfirst : %g
\n
"
,
xfirst
);
fprintf
(
fp
,
"xinc : %g
\n
"
,
xinc
);
}
else
{
nbyte0
=
fprintf
(
fp
,
"xvals : "
);
nbyte
=
nbyte0
;
for
(
index
=
0
;
index
<
xdim
;
index
++
)
{
fprintf
(
fp
,
"
\n
"
);
fprintf
(
fp
,
"%*s"
,
nbyte0
,
""
);
nbyte
=
nbyte0
;
if
(
nbyte
>
80
)
{
fprintf
(
fp
,
"
\n
"
);
fprintf
(
fp
,
"%*s"
,
nbyte0
,
""
);
nbyte
=
nbyte0
;
}
nbyte
+=
fprintf
(
fp
,
"%.9g "
,
xvals
[
index
]);
}
nbyte
+=
fprintf
(
fp
,
"
%.9g "
,
xvals
[
index
]
);
fprintf
(
fp
,
"
\n
"
);
}
fprintf
(
fp
,
"
\n
"
);
}
if
(
xbounds
)
...
...
@@ -2858,19 +2883,35 @@ void gridPrint(int gridID)
if
(
yvals
)
{
nbyte0
=
fprintf
(
fp
,
"yvals : "
)
;
nbyte
=
nbyte0
;
for
(
index
=
0
;
index
<
ydim
;
index
++
)
double
yfirst
=
0
.
0
,
yinc
=
0
.
0
;
if
(
type
==
GRID_LONLAT
)
{
if
(
nbyte
>
80
)
yfirst
=
gridInqYval
(
gridID
,
0
);
yinc
=
gridInqYinc
(
gridID
);
}
if
(
!
DBL_IS_EQUAL
(
yinc
,
0
)
)
{
fprintf
(
fp
,
"yfirst : %g
\n
"
,
yfirst
);
fprintf
(
fp
,
"yinc : %g
\n
"
,
yinc
);
}
else
{
nbyte0
=
fprintf
(
fp
,
"yvals : "
);
nbyte
=
nbyte0
;
for
(
index
=
0
;
index
<
ydim
;
index
++
)
{
fprintf
(
fp
,
"
\n
"
);
fprintf
(
fp
,
"%*s"
,
nbyte0
,
""
);
nbyte
=
nbyte0
;
if
(
nbyte
>
80
)
{
fprintf
(
fp
,
"
\n
"
);
fprintf
(
fp
,
"%*s"
,
nbyte0
,
""
);
nbyte
=
nbyte0
;
}
nbyte
+=
fprintf
(
fp
,
"%.9g "
,
yvals
[
index
]);
}
nbyte
+=
fprintf
(
fp
,
"
%.9g "
,
yvals
[
index
]
);
fprintf
(
fp
,
"
\n
"
);
}
fprintf
(
fp
,
"
\n
"
);
}
if
(
ybounds
)
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment