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
a04716b0
Commit
a04716b0
authored
Nov 25, 2015
by
Uwe Schulzweida
Browse files
cdfDefXaxis/cdfDefXaxis: generate bounds for CDI_cmor_mode
parent
7f41e310
Changes
4
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
a04716b0
...
...
@@ -3,6 +3,10 @@
* Version 1.7.1 released
* using CGRIBEX library version 1.7.4
2015-11-25 Uwe Schulzweida
* cdfDefXaxis/cdfDefXaxis: generate bounds for CDI_cmor_mode
2015-11-23 Nathanael Huebbe
* replaced the vlist locked flag by two other flags
...
...
configure
View file @
a04716b0
...
...
@@ -26089,17 +26089,49 @@ _ACEOF
#
# Check for non-standard builtin
ac_fn_c_check_decl "$LINENO" "__builtin_ctz" "ac_cv_have_decl___builtin_ctz" "$ac_includes_default"
if test "x$ac_cv_have_decl___builtin_ctz" = xyes; then :
ac_have_decl=1
for builtin in __builtin_ctz
do :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether __builtin_ctz is declared" >&5
$as_echo_n "checking whether __builtin_ctz is declared... " >&6; }
if ${acx_cv_have_decl___builtin_ctz+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_have_decl=0
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
unsigned lbz = __builtin_ctz(56U)
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
acx_cv_have_decl___builtin_ctz=yes
else
acx_cv_have_decl___builtin_ctz=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_have_decl___builtin_ctz" >&5
$as_echo "$acx_cv_have_decl___builtin_ctz" >&6; }
if test "x$acx_cv_have_decl___builtin_ctz" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL___BUILTIN_CTZ 1
_ACEOF
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL___BUILTIN_CTZ $ac_have_decl
break
else
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL___BUILTIN_CTZ 0
_ACEOF
fi
done
# Check compiler version
case "$CC" in
src/config.h.in
View file @
a04716b0
...
...
@@ -58,8 +58,7 @@
don't. */
#undef HAVE_DECL__SC_PAGE_SIZE
/* Define to 1 if you have the declaration of `__builtin_ctz', and to 0 if you
don't. */
/* Define to 1 if __builtin_ctz is available, 0 if not */
#undef HAVE_DECL___BUILTIN_CTZ
/* Define to 1 if you have the <dlfcn.h> header file. */
...
...
src/stream_cdf.c
View file @
a04716b0
...
...
@@ -1251,19 +1251,13 @@ void cdfDefXaxis(stream_t *streamptr, int gridID, int ndims)
if
(
streamptr
->
ncmode
==
2
)
cdf_redef
(
fileID
);
if
(
ndims
)
{
cdf_def_dim
(
fileID
,
axisname
,
dimlen
,
&
dimID
);
if
(
gridInqXboundsPtr
(
gridID
)
||
gridInqYboundsPtr
(
gridID
)
)
{
size_t
nvertex
=
2
;
if
(
nc_inq_dimid
(
fileID
,
BNDS_NAME
,
&
nvdimID
)
!=
NC_NOERR
)
cdf_def_dim
(
fileID
,
BNDS_NAME
,
nvertex
,
&
nvdimID
);
}
}
if
(
ndims
)
cdf_def_dim
(
fileID
,
axisname
,
dimlen
,
&
dimID
);
if
(
gridInqXvalsPtr
(
gridID
)
)
int
gen_bounds
=
FALSE
;
int
grid_is_cyclic
=
gridIsCircular
(
gridID
);
const
double
*
pvals
=
gridInqXvalsPtr
(
gridID
);
double
*
pbounds
=
NULL
;
if
(
pvals
)
{
cdf_def_var
(
fileID
,
axisname
,
xtype
,
ndims
,
&
dimID
,
&
ncvarid
);
...
...
@@ -1276,7 +1270,28 @@ void cdfDefXaxis(stream_t *streamptr, int gridID, int ndims)
cdf_put_att_text
(
fileID
,
ncvarid
,
"axis"
,
1
,
"X"
);
if
(
gridInqXboundsPtr
(
gridID
)
&&
nvdimID
!=
UNDEFID
)
if
(
gridInqXboundsPtr
(
gridID
)
)
pbounds
=
(
double
*
)
gridInqXboundsPtr
(
gridID
);
if
(
CDI_cmor_mode
&&
grid_is_cyclic
&&
!
pbounds
)
{
gen_bounds
=
TRUE
;
pbounds
=
(
double
*
)
malloc
(
2
*
dimlen
*
sizeof
(
double
));
for
(
size_t
i
=
0
;
i
<
dimlen
-
1
;
++
i
)
{
pbounds
[
i
*
2
+
1
]
=
(
pvals
[
i
]
+
pvals
[
i
+
1
])
/
2
;
pbounds
[(
i
+
1
)
*
2
]
=
(
pvals
[
i
]
+
pvals
[
i
+
1
])
/
2
;
}
pbounds
[
0
]
=
(
pvals
[
0
]
+
pvals
[
dimlen
-
1
]
-
360
)
/
2
;
pbounds
[
2
*
dimlen
-
1
]
=
(
pvals
[
dimlen
-
1
]
+
pvals
[
0
]
+
360
)
/
2
;
}
if
(
pbounds
)
{
size_t
nvertex
=
2
;
if
(
nc_inq_dimid
(
fileID
,
BNDS_NAME
,
&
nvdimID
)
!=
NC_NOERR
)
cdf_def_dim
(
fileID
,
BNDS_NAME
,
nvertex
,
&
nvdimID
);
}
if
(
pbounds
&&
nvdimID
!=
UNDEFID
)
{
strcat
(
axisname
,
"_"
);
strcat
(
axisname
,
BNDS_NAME
);
...
...
@@ -1297,8 +1312,9 @@ void cdfDefXaxis(stream_t *streamptr, int gridID, int ndims)
cdf_enddef
(
fileID
);
streamptr
->
ncmode
=
2
;
if
(
ncvarid
!=
UNDEFID
)
cdf_put_var_double
(
fileID
,
ncvarid
,
gridInqXvalsPtr
(
gridID
));
if
(
ncbvarid
!=
UNDEFID
)
cdf_put_var_double
(
fileID
,
ncbvarid
,
gridInqXboundsPtr
(
gridID
));
if
(
ncvarid
!=
UNDEFID
)
cdf_put_var_double
(
fileID
,
ncvarid
,
pvals
);
if
(
ncbvarid
!=
UNDEFID
)
cdf_put_var_double
(
fileID
,
ncbvarid
,
pbounds
);
if
(
gen_bounds
)
Free
(
pbounds
);
if
(
ndims
==
0
)
streamptr
->
ncxvarID
[
gridindex
]
=
ncvarid
;
}
...
...
@@ -1378,19 +1394,13 @@ void cdfDefYaxis(stream_t *streamptr, int gridID, int ndims)
if
(
streamptr
->
ncmode
==
2
)
cdf_redef
(
fileID
);
if
(
ndims
)
{
cdf_def_dim
(
fileID
,
axisname
,
dimlen
,
&
dimID
);
if
(
gridInqXboundsPtr
(
gridID
)
||
gridInqYboundsPtr
(
gridID
)
)
{
size_t
nvertex
=
2
;
if
(
nc_inq_dimid
(
fileID
,
BNDS_NAME
,
&
nvdimID
)
!=
NC_NOERR
)
cdf_def_dim
(
fileID
,
BNDS_NAME
,
nvertex
,
&
nvdimID
);
}
}
if
(
ndims
)
cdf_def_dim
(
fileID
,
axisname
,
dimlen
,
&
dimID
);
if
(
gridInqYvalsPtr
(
gridID
)
)
int
gen_bounds
=
FALSE
;
int
grid_is_cyclic
=
gridIsCircular
(
gridID
);
const
double
*
pvals
=
gridInqYvalsPtr
(
gridID
);
double
*
pbounds
=
NULL
;
if
(
pvals
)
{
cdf_def_var
(
fileID
,
axisname
,
xtype
,
ndims
,
&
dimID
,
&
ncvarid
);
...
...
@@ -1403,7 +1413,28 @@ void cdfDefYaxis(stream_t *streamptr, int gridID, int ndims)
cdf_put_att_text
(
fileID
,
ncvarid
,
"axis"
,
1
,
"Y"
);
if
(
gridInqYboundsPtr
(
gridID
)
&&
nvdimID
!=
UNDEFID
)
if
(
gridInqYboundsPtr
(
gridID
)
)
pbounds
=
(
double
*
)
gridInqYboundsPtr
(
gridID
);
if
(
CDI_cmor_mode
&&
grid_is_cyclic
&&
!
pbounds
)
{
gen_bounds
=
TRUE
;
pbounds
=
(
double
*
)
malloc
(
2
*
dimlen
*
sizeof
(
double
));
for
(
size_t
i
=
0
;
i
<
dimlen
-
1
;
++
i
)
{
pbounds
[
i
*
2
+
1
]
=
(
pvals
[
i
]
+
pvals
[
i
+
1
])
/
2
;
pbounds
[(
i
+
1
)
*
2
]
=
(
pvals
[
i
]
+
pvals
[
i
+
1
])
/
2
;
}
pbounds
[
0
]
=
(
pvals
[
0
]
<
0
)
?
-
90
:
90
;
pbounds
[
2
*
dimlen
-
1
]
=
(
pvals
[
dimlen
-
1
]
<
0
)
?
-
90
:
90
;
}
if
(
pbounds
)
{
size_t
nvertex
=
2
;
if
(
nc_inq_dimid
(
fileID
,
BNDS_NAME
,
&
nvdimID
)
!=
NC_NOERR
)
cdf_def_dim
(
fileID
,
BNDS_NAME
,
nvertex
,
&
nvdimID
);
}
if
(
pbounds
&&
nvdimID
!=
UNDEFID
)
{
strcat
(
axisname
,
"_"
);
strcat
(
axisname
,
BNDS_NAME
);
...
...
@@ -1424,8 +1455,9 @@ void cdfDefYaxis(stream_t *streamptr, int gridID, int ndims)
cdf_enddef
(
fileID
);
streamptr
->
ncmode
=
2
;
if
(
ncvarid
!=
UNDEFID
)
cdf_put_var_double
(
fileID
,
ncvarid
,
gridInqYvalsPtr
(
gridID
));
if
(
ncbvarid
!=
UNDEFID
)
cdf_put_var_double
(
fileID
,
ncbvarid
,
gridInqYboundsPtr
(
gridID
));
if
(
ncvarid
!=
UNDEFID
)
cdf_put_var_double
(
fileID
,
ncvarid
,
pvals
);
if
(
ncbvarid
!=
UNDEFID
)
cdf_put_var_double
(
fileID
,
ncbvarid
,
pbounds
);
if
(
gen_bounds
)
Free
(
pbounds
);
if
(
ndims
==
0
)
streamptr
->
ncyvarID
[
gridindex
]
=
ncvarid
;
}
...
...
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