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
8de5ba22
Commit
8de5ba22
authored
Feb 09, 2010
by
Uwe Schulzweida
Browse files
added function gridInqComplexPacking/gridDefComplexPacking
parent
0233d43d
Changes
9
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
8de5ba22
2010-02-09 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* added function gridInqComplexPacking/gridDefComplexPacking
2010-02-08 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* Version 1.4.2 released
...
...
app/printinfo.h
View file @
8de5ba22
...
...
@@ -250,8 +250,10 @@ static void printGridInfo(int vlistID)
}
else
if
(
gridtype
==
GRID_SPECTRAL
)
{
fprintf
(
stdout
,
"size : dim = %d truncation = %d spc = %d
\n
"
,
fprintf
(
stdout
,
"size : dim = %d truncation = %d spc = %d"
,
gridsize
,
trunc
,
gridsize
/
2
);
fprintf
(
stdout
,
" complexPacking = %d"
,
gridInqComplexPacking
(
gridID
));
fprintf
(
stdout
,
"
\n
"
);
}
else
if
(
gridtype
==
GRID_GME
)
{
...
...
configure
View file @
8de5ba22
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.61 for cdi 1.4.
2
.
# Generated by GNU Autoconf 2.61 for cdi 1.4.
3
.
#
# Report bugs to <Uwe.Schulzweida@zmaw.de>.
#
...
...
@@ -574,8 +574,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME
=
'cdi'
PACKAGE_TARNAME
=
'cdi'
PACKAGE_VERSION
=
'1.4.
2
'
PACKAGE_STRING
=
'cdi 1.4.
2
'
PACKAGE_VERSION
=
'1.4.
3
'
PACKAGE_STRING
=
'cdi 1.4.
3
'
PACKAGE_BUGREPORT
=
'Uwe.Schulzweida@zmaw.de'
# Factoring default headers for most tests.
...
...
@@ -1258,7 +1258,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat
<<
_ACEOF
\`
configure' configures cdi 1.4.
2
to adapt to many kinds of systems.
\`
configure' configures cdi 1.4.
3
to adapt to many kinds of systems.
Usage:
$0
[OPTION]... [VAR=VALUE]...
...
...
@@ -1329,7 +1329,7 @@ fi
if
test
-n
"
$ac_init_help
"
;
then
case
$ac_init_help
in
short
|
recursive
)
echo
"Configuration of cdi 1.4.
2
:"
;;
short
|
recursive
)
echo
"Configuration of cdi 1.4.
3
:"
;;
esac
cat
<<
\
_ACEOF
...
...
@@ -1462,7 +1462,7 @@ fi
test
-n
"
$ac_init_help
"
&&
exit
$ac_status
if
$ac_init_version
;
then
cat
<<
\
_ACEOF
cdi configure 1.4.
2
cdi configure 1.4.
3
generated by GNU Autoconf 2.61
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
...
...
@@ -1476,7 +1476,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by cdi
$as_me
1.4.
2
, which was
It was created by cdi
$as_me
1.4.
3
, which was
generated by GNU Autoconf 2.61. Invocation command line was
$ $0
$@
...
...
@@ -2303,7 +2303,7 @@ fi
# Define the identity of the package.
PACKAGE
=
'cdi'
VERSION
=
'1.4.
2
'
VERSION
=
'1.4.
3
'
cat
>>
confdefs.h
<<
_ACEOF
...
...
@@ -9031,7 +9031,7 @@ exec 6>&1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by cdi
$as_me
1.4.
2
, which was
This file was extended by cdi
$as_me
1.4.
3
, which was
generated by GNU Autoconf 2.61. Invocation command line was
CONFIG_FILES =
$CONFIG_FILES
...
...
@@ -9084,7 +9084,7 @@ Report bugs to <bug-autoconf@gnu.org>."
_ACEOF
cat
>>
$CONFIG_STATUS
<<
_ACEOF
ac_cs_version="
\\
cdi config.status 1.4.
2
cdi config.status 1.4.
3
configured by
$0
, generated by GNU Autoconf 2.61,
with options
\\
"`echo "
$ac_configure_args
" | sed 's/^ //; s/[
\\
""
\`\$
]/
\\\\
&/g'`
\\
"
...
...
configure.ac
View file @
8de5ba22
# Process this file with autoconf to produce a configure script.
AC_INIT(cdi, 1.4.
2
, Uwe.Schulzweida@zmaw.de)
AC_INIT(cdi, 1.4.
3
, Uwe.Schulzweida@zmaw.de)
echo "configuring ${PACKAGE_NAME} ${PACKAGE_VERSION}"
...
...
src/cdi.h
View file @
8de5ba22
...
...
@@ -647,6 +647,9 @@ void gridDefRowlon(int gridID, int nrowlon, const int *rowlon_vec);
void
gridInqRowlon
(
int
gridID
,
int
*
rowlon_vec
);
void
gridChangeType
(
int
gridID
,
int
gridtype
);
void
gridDefComplexPacking
(
int
gridID
,
int
lpack
);
int
gridInqComplexPacking
(
int
gridID
);
/* ZAXIS routines */
void
zaxisName
(
int
zaxistype
,
char
*
zaxisname
);
...
...
src/grid.c
View file @
8de5ba22
...
...
@@ -53,17 +53,17 @@ static int _grid_init = FALSE;
static
pthread_once_t
_grid_init_thread
=
PTHREAD_ONCE_INIT
;
static
pthread_mutex_t
_grid_mutex
;
# define GRID_LOCK
pthread_mutex_lock(&_grid_mutex)
;
# define GRID_UNLOCK
pthread_mutex_unlock(&_grid_mutex)
;
# define GRID_INIT \
if ( _grid_init == FALSE ) pthread_once(&_grid_init_thread, grid_initialize)
;
# define GRID_LOCK
()
pthread_mutex_lock(&_grid_mutex)
# define GRID_UNLOCK
()
pthread_mutex_unlock(&_grid_mutex)
# define GRID_INIT
()
\
if ( _grid_init == FALSE ) pthread_once(&_grid_init_thread, grid_initialize)
#else
# define GRID_LOCK
# define GRID_UNLOCK
# define GRID_INIT \
if ( _grid_init == FALSE ) grid_initialize()
;
# define GRID_LOCK
()
# define GRID_UNLOCK
()
# define GRID_INIT
()
\
if ( _grid_init == FALSE ) grid_initialize()
#endif
...
...
@@ -79,7 +79,8 @@ static gridPtrToIdx *_gridList = NULL;
static
gridPtrToIdx
*
_gridAvail
=
NULL
;
static
void
grid_list_new
(
void
)
static
void
grid_list_new
(
void
)
{
static
char
func
[]
=
"grid_list_new"
;
...
...
@@ -88,16 +89,16 @@ static void grid_list_new(void)
_gridList
=
(
gridPtrToIdx
*
)
malloc
(
_grid_max
*
sizeof
(
gridPtrToIdx
));
}
static
void
grid_list_delete
(
void
)
static
void
grid_list_delete
(
void
)
{
static
char
func
[]
=
"grid_list_delete"
;
if
(
_gridList
)
free
(
_gridList
);
}
static
void
grid_init_pointer
(
void
)
static
void
grid_init_pointer
(
void
)
{
int
i
;
...
...
@@ -113,21 +114,21 @@ static void grid_init_pointer(void)
_gridAvail
=
_gridList
;
}
static
grid_t
*
grid_to_pointer
(
int
idx
)
{
static
char
func
[]
=
"grid_to_pointer"
;
grid_t
*
gridptr
=
NULL
;
GRID_INIT
GRID_INIT
();
if
(
idx
>=
0
&&
idx
<
_grid_max
)
{
GRID_LOCK
GRID_LOCK
();
gridptr
=
_gridList
[
idx
].
ptr
;
GRID_UNLOCK
GRID_UNLOCK
();
}
else
Error
(
func
,
"grid index %d undefined!"
,
idx
);
...
...
@@ -135,9 +136,9 @@ grid_t *grid_to_pointer(int idx)
return
(
gridptr
);
}
/* Create an index from a pointer */
static
int
grid_from_pointer
(
grid_t
*
ptr
)
static
int
grid_from_pointer
(
grid_t
*
ptr
)
{
static
char
func
[]
=
"grid_from_pointer"
;
int
idx
=
-
1
;
...
...
@@ -145,7 +146,7 @@ static int grid_from_pointer(grid_t *ptr)
if
(
ptr
)
{
GRID_LOCK
GRID_LOCK
();
if
(
_gridAvail
)
{
...
...
@@ -161,7 +162,7 @@ static int grid_from_pointer(grid_t *ptr)
else
Warning
(
func
,
"Too many open grids (limit is %d)!"
,
_grid_max
);
GRID_UNLOCK
GRID_UNLOCK
();
}
else
Error
(
func
,
"Internal problem (pointer %p undefined)"
,
ptr
);
...
...
@@ -169,8 +170,8 @@ static int grid_from_pointer(grid_t *ptr)
return
(
idx
);
}
static
void
grid_init_entry
(
grid_t
*
gridptr
)
static
void
grid_init_entry
(
grid_t
*
gridptr
)
{
gridptr
->
self
=
grid_from_pointer
(
gridptr
);
...
...
@@ -221,6 +222,7 @@ static void grid_init_entry(grid_t *gridptr)
gridptr
->
ypole
=
0
.
0
;
gridptr
->
angle
=
0
.
0
;
gridptr
->
locked
=
FALSE
;
gridptr
->
lcomplex
=
0
;
gridptr
->
xname
[
0
]
=
0
;
gridptr
->
yname
[
0
]
=
0
;
gridptr
->
xlongname
[
0
]
=
0
;
...
...
@@ -231,8 +233,8 @@ static void grid_init_entry(grid_t *gridptr)
gridptr
->
ystdname
[
0
]
=
0
;
}
static
grid_t
*
grid_new_entry
(
void
)
static
grid_t
*
grid_new_entry
(
void
)
{
static
char
func
[]
=
"grid_new_entry"
;
grid_t
*
gridptr
;
...
...
@@ -244,15 +246,15 @@ static grid_t *grid_new_entry(void)
return
(
gridptr
);
}
static
void
grid_delete_entry
(
grid_t
*
gridptr
)
static
void
grid_delete_entry
(
grid_t
*
gridptr
)
{
static
char
func
[]
=
"grid_delete_entry"
;
int
idx
;
idx
=
gridptr
->
self
;
GRID_LOCK
GRID_LOCK
();
free
(
gridptr
);
...
...
@@ -260,14 +262,14 @@ static void grid_delete_entry(grid_t *gridptr)
_gridList
[
idx
].
ptr
=
0
;
_gridAvail
=
&
_gridList
[
idx
];
GRID_UNLOCK
GRID_UNLOCK
();
if
(
GRID_Debug
)
Message
(
func
,
"Removed idx %d from grid list"
,
idx
);
}
static
void
grid_initialize
(
void
)
static
void
grid_initialize
(
void
)
{
char
*
env
;
...
...
@@ -282,17 +284,17 @@ static void grid_initialize(void)
grid_list_new
();
atexit
(
grid_list_delete
);
GRID_LOCK
GRID_LOCK
();
grid_init_pointer
();
GRID_UNLOCK
GRID_UNLOCK
();
_grid_init
=
TRUE
;
}
static
void
grid_copy
(
grid_t
*
gridptr2
,
grid_t
*
gridptr1
)
static
void
grid_copy
(
grid_t
*
gridptr2
,
grid_t
*
gridptr1
)
{
int
gridID2
;
...
...
@@ -301,8 +303,8 @@ static void grid_copy(grid_t *gridptr2, grid_t *gridptr1)
gridptr2
->
self
=
gridID2
;
}
static
void
grid_check_ptr
(
const
char
*
func
,
grid_t
*
gridptr
)
static
void
grid_check_ptr
(
const
char
*
func
,
grid_t
*
gridptr
)
{
if
(
gridptr
==
NULL
)
Error
(
func
,
"grid undefined!"
);
...
...
@@ -314,14 +316,14 @@ int gridSize(void)
int
gridsize
=
0
;
int
i
;
GRID_INIT
GRID_INIT
();
GRID_LOCK
GRID_LOCK
();
for
(
i
=
0
;
i
<
_grid_max
;
i
++
)
if
(
_gridList
[
i
].
ptr
)
gridsize
++
;
GRID_UNLOCK
GRID_UNLOCK
();
return
(
gridsize
);
}
...
...
@@ -635,7 +637,7 @@ int gridCreate(int gridtype, int size)
if
(
CDI_Debug
)
Message
(
func
,
"gridtype: %d size: %d"
,
gridtype
,
size
);
GRID_INIT
GRID_INIT
();
gridptr
=
grid_new_entry
();
if
(
!
gridptr
)
Error
(
func
,
"No memory"
);
...
...
@@ -2522,6 +2524,7 @@ int gridGenerate(grid_t grid)
case
GRID_SPECTRAL
:
{
gridDefTrunc
(
gridID
,
grid
.
trunc
);
if
(
grid
.
lcomplex
)
gridDefComplexPacking
(
gridID
,
1
);
break
;
}
case
GRID_GME
:
...
...
@@ -3545,3 +3548,26 @@ void gridInqLaea(int gridID, double *earth_radius, double *lon_0, double *lat_0)
Warning
(
func
,
"LAEA grid undefined (gridID = %d)"
,
gridID
);
}
}
void
gridDefComplexPacking
(
int
gridID
,
int
lcomplex
)
{
grid_t
*
gridptr
;
gridptr
=
grid_to_pointer
(
gridID
);
gridptr
->
lcomplex
=
lcomplex
;
}
int
gridInqComplexPacking
(
int
gridID
)
{
int
lcomplex
;
grid_t
*
gridptr
;
gridptr
=
grid_to_pointer
(
gridID
);
lcomplex
=
gridptr
->
lcomplex
;
return
(
lcomplex
);
}
src/grid.h
View file @
8de5ba22
...
...
@@ -49,6 +49,7 @@ typedef struct {
int
xsize
;
int
ysize
;
int
locked
;
int
lcomplex
;
char
xname
[
256
];
char
yname
[
256
];
char
xlongname
[
256
];
...
...
src/stream_cgribex.c
View file @
8de5ba22
...
...
@@ -89,7 +89,6 @@ int cgribexGetIsRotated(int *isec2)
return
(
isRotated
);
}
static
int
cgribexGetZaxisType
(
int
grb_ltype
)
{
...
...
@@ -413,6 +412,11 @@ void cgribexAddRecord(int streamID, int param, int *isec1, int *isec2, double *f
{
grid
.
size
=
ISEC4_NumValues
;
grid
.
trunc
=
ISEC2_PentaJ
;
if
(
ISEC2_RepMode
==
2
)
grid
.
lcomplex
=
1
;
else
grid
.
lcomplex
=
0
;
break
;
}
case
GRID_GME
:
...
...
@@ -1827,7 +1831,10 @@ void cgribexDefGrid(int *isec1, int *isec2, int gridID)
ISEC2_PentaK
=
ISEC2_PentaJ
;
ISEC2_PentaM
=
ISEC2_PentaJ
;
ISEC2_RepType
=
1
;
ISEC2_RepMode
=
1
;
if
(
gridInqComplexPacking
(
gridID
)
)
ISEC2_RepMode
=
2
;
else
ISEC2_RepMode
=
1
;
break
;
}
case
GRID_GME
:
...
...
src/stream_gribapi.c
View file @
8de5ba22
...
...
@@ -506,6 +506,11 @@ void gribapiAddRecord(int streamID, int param, grib_handle *gh,
grid
.
size
=
datasize
;
GRIB_CHECK
(
grib_get_long
(
gh
,
"J"
,
&
lpar
),
0
);
grid
.
trunc
=
lpar
;
GRIB_CHECK
(
grib_get_long
(
gh
,
"complexPacking"
,
&
lpar
),
0
);
if
(
lpar
)
grid
.
lcomplex
=
1
;
else
grid
.
lcomplex
=
0
;
break
;
}
/*
...
...
@@ -2049,11 +2054,11 @@ void gribapiDefGrid(grib_handle *gh, int gridID, int ljpeg)
GRIB_CHECK
(
grib_set_long
(
gh
,
"numberOfDataPoints"
,
gridInqSize
(
gridID
)),
0
);
GRIB_CHECK
(
grib_set_long
(
gh
,
"numberOfValues"
,
gridInqSize
(
gridID
)),
0
);
GRIB_CHECK
(
grib_set_string
(
gh
,
"typeOfPacking"
,
"spectral_simple"
,
&
len
),
0
);
/*
ISEC2_RepType = 1;
ISEC2_RepMode = 1
;
*/
if
(
gridInqComplexPacking
(
gridID
)
)
GRIB_CHECK
(
grib_set_long
(
gh
,
"complexPacking"
,
1
),
0
);
else
GRIB_CHECK
(
grib_set_long
(
gh
,
"complexPacking"
,
0
),
0
)
;
break
;
}
/*
...
...
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