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
b2cbbb47
Commit
b2cbbb47
authored
Jul 12, 2019
by
Uwe Schulzweida
Browse files
Renamed rowlon to reducedPoints.
parent
9e1dd26f
Changes
9
Hide whitespace changes
Inline
Side-by-side
src/cdf_lazy_grid.c
View file @
b2cbbb47
...
...
@@ -345,8 +345,8 @@ cdfLazyGridCopyArrayFields(grid_t *gridptrOrig, grid_t *gridptrDup)
if
(
reducedPointsSize
)
{
gridptrDup
->
r
owlon
=
(
int
*
)
Malloc
(
reducedPointsSize
*
sizeof
(
int
));
memcpy
(
gridptrDup
->
r
owlon
,
gridptrOrig
->
r
owlon
,
reducedPointsSize
*
sizeof
(
int
));
gridptrDup
->
r
educedPoints
=
(
int
*
)
Malloc
(
reducedPointsSize
*
sizeof
(
int
));
memcpy
(
gridptrDup
->
r
educedPoints
,
gridptrOrig
->
r
educedPoints
,
reducedPointsSize
*
sizeof
(
int
));
}
if
(
gridptrOrig
->
x
.
vals
!=
NULL
&&
gridptrOrig
->
x
.
vals
!=
cdfPendingLoad
)
...
...
src/cdi.h
View file @
b2cbbb47
...
...
@@ -996,8 +996,8 @@ void gridDefYbounds(int gridID, const double ybounds[]);
size_t
gridInqYbounds
(
int
gridID
,
double
ybounds
[]);
size_t
gridInqYboundsPart
(
int
gridID
,
int
start
,
size_t
size
,
double
ybounds
[]);
void
gridDefReducedPoints
(
int
gridID
,
int
reducedPointsSize
,
const
int
r
owlon
[]);
void
gridInqReducedPoints
(
int
gridID
,
int
r
owlon
[]);
void
gridDefReducedPoints
(
int
gridID
,
int
reducedPointsSize
,
const
int
r
educedPoints
[]);
void
gridInqReducedPoints
(
int
gridID
,
int
r
educedPoints
[]);
void
gridChangeType
(
int
gridID
,
int
gridtype
);
void
gridDefComplexPacking
(
int
gridID
,
int
lpack
);
...
...
src/cdiFortran.c
View file @
b2cbbb47
...
...
@@ -594,8 +594,8 @@ static int gridInqYboundsPart_fwrap(int gridID, int start, int size, double ybou
return
size_t_c2f
(
v
);
}
FCALLSCFUN4
(
INT
,
gridInqYboundsPart_fwrap
,
GRIDINQYBOUNDSPART
,
gridinqyboundspart
,
INT
,
INT
,
INT
,
DOUBLEV
)
FCALLSCSUB3
(
gridDefReducedPoints
,
GRIDDEFROWLON
,
griddefr
owlon
,
INT
,
INT
,
INTV
)
FCALLSCSUB2
(
gridInqReducedPoints
,
GRIDINQROWLON
,
gridinqr
owlon
,
INT
,
INTV
)
FCALLSCSUB3
(
gridDefReducedPoints
,
GRIDDEFROWLON
,
griddefr
educedPoints
,
INT
,
INT
,
INTV
)
FCALLSCSUB2
(
gridInqReducedPoints
,
GRIDINQROWLON
,
gridinqr
educedPoints
,
INT
,
INTV
)
FCALLSCSUB2
(
gridChangeType
,
GRIDCHANGETYPE
,
gridchangetype
,
INT
,
INT
)
FCALLSCSUB2
(
gridDefComplexPacking
,
GRIDDEFCOMPLEXPACKING
,
griddefcomplexpacking
,
INT
,
INT
)
FCALLSCFUN1
(
INT
,
gridInqComplexPacking
,
GRIDINQCOMPLEXPACKING
,
gridinqcomplexpacking
,
INT
)
...
...
src/gribapi_utilities.c
View file @
b2cbbb47
...
...
@@ -533,11 +533,11 @@ void gribapiGetGridGaussianReduced(grib_handle *gh, grid_t *grid, int editionNum
grid
->
size
=
numberOfPoints
;
grid
->
reducedPointsSize
=
(
int
)
nlat
;
grid
->
r
owlon
=
(
int
*
)
Malloc
(
nlat
*
sizeof
(
int
));
grid
->
r
educedPoints
=
(
int
*
)
Malloc
(
nlat
*
sizeof
(
int
));
long
*
pl
=
(
long
*
)
Malloc
(
nlat
*
sizeof
(
long
));
size_t
dummy
=
nlat
;
FAIL_ON_GRIB_ERROR
(
grib_get_long_array
,
gh
,
"pl"
,
pl
,
&
dummy
);
for
(
size_t
i
=
0
;
i
<
nlat
;
++
i
)
grid
->
r
owlon
[
i
]
=
(
int
)
pl
[
i
];
for
(
size_t
i
=
0
;
i
<
nlat
;
++
i
)
grid
->
r
educedPoints
[
i
]
=
(
int
)
pl
[
i
];
Free
(
pl
);
grid
->
y
.
size
=
nlat
;
...
...
src/grid.c
View file @
b2cbbb47
...
...
@@ -147,7 +147,7 @@ void grid_init(grid_t *gridptr)
grid_axis_init
(
&
gridptr
->
y
);
gridptr
->
area
=
NULL
;
gridptr
->
r
owlon
=
NULL
;
gridptr
->
r
educedPoints
=
NULL
;
gridptr
->
reducedPointsSize
=
0
;
gridptr
->
gme
.
nd
=
0
;
...
...
@@ -196,7 +196,7 @@ void grid_free_components(grid_t *gridptr)
gridptr
->
x
.
cvals
,
gridptr
->
y
.
cvals
,
#endif
gridptr
->
x
.
bounds
,
gridptr
->
y
.
bounds
,
gridptr
->
r
owlon
,
gridptr
->
area
,
gridptr
->
r
educedPoints
,
gridptr
->
area
,
gridptr
->
reference
,
gridptr
->
name
};
for
(
size_t
i
=
0
;
i
<
sizeof
(
p2free
)
/
sizeof
(
p2free
[
0
]);
++
i
)
...
...
@@ -1388,13 +1388,13 @@ int gridInqNP(int gridID)
@EndFunction
*/
void
gridDefReducedPoints
(
int
gridID
,
int
reducedPointsSize
,
const
int
r
owlon
[])
void
gridDefReducedPoints
(
int
gridID
,
int
reducedPointsSize
,
const
int
r
educedPoints
[])
{
grid_t
*
gridptr
=
grid_to_pointer
(
gridID
);
gridptr
->
r
owlon
=
(
int
*
)
Malloc
((
size_t
)
reducedPointsSize
*
sizeof
(
int
));
gridptr
->
r
educedPoints
=
(
int
*
)
Malloc
((
size_t
)
reducedPointsSize
*
sizeof
(
int
));
gridptr
->
reducedPointsSize
=
reducedPointsSize
;
memcpy
(
gridptr
->
r
owlon
,
rowlon
,
(
size_t
)
reducedPointsSize
*
sizeof
(
int
));
memcpy
(
gridptr
->
r
educedPoints
,
reducedPoints
,
(
size_t
)
reducedPointsSize
*
sizeof
(
int
));
gridMark4Update
(
gridID
);
}
...
...
@@ -1408,13 +1408,13 @@ void gridDefReducedPoints(int gridID, int reducedPointsSize, const int rowlon[])
@EndFunction
*/
void
gridInqReducedPoints
(
int
gridID
,
int
*
r
owlon
)
void
gridInqReducedPoints
(
int
gridID
,
int
*
r
educedPoints
)
{
grid_t
*
gridptr
=
grid_to_pointer
(
gridID
);
if
(
gridptr
->
r
owlon
==
0
)
Error
(
"undefined pointer!"
);
if
(
gridptr
->
r
educedPoints
==
0
)
Error
(
"undefined pointer!"
);
memcpy
(
r
owlon
,
gridptr
->
rowlon
,
(
size_t
)
gridptr
->
reducedPointsSize
*
sizeof
(
int
));
memcpy
(
r
educedPoints
,
gridptr
->
reducedPoints
,
(
size_t
)
gridptr
->
reducedPointsSize
*
sizeof
(
int
));
}
static
size_t
...
...
@@ -2833,7 +2833,7 @@ int gridGenerate(const grid_t *grid)
if
(
gridtype
==
GRID_PROJECTION
)
gridptr
->
name
=
strdup
(
grid
->
name
);
if
(
gridtype
==
GRID_GAUSSIAN_REDUCED
)
gridDefReducedPoints
(
gridID
,
grid
->
y
.
size
,
grid
->
r
owlon
);
gridDefReducedPoints
(
gridID
,
grid
->
y
.
size
,
grid
->
r
educedPoints
);
gridptr
->
trunc
=
grid
->
trunc
;
gridptr
->
lcomplex
=
grid
->
lcomplex
;
gridptr
->
gme
.
nd
=
grid
->
gme
.
nd
;
...
...
@@ -2859,8 +2859,8 @@ grid_copy_base_array_fields(grid_t *gridptrOrig, grid_t *gridptrDup)
int
irregular
=
gridtype
==
GRID_CURVILINEAR
||
gridtype
==
GRID_UNSTRUCTURED
;
if
(
reducedPointsSize
)
{
gridptrDup
->
r
owlon
=
(
int
*
)
Malloc
(
reducedPointsSize
*
sizeof
(
int
));
memcpy
(
gridptrDup
->
r
owlon
,
gridptrOrig
->
r
owlon
,
reducedPointsSize
*
sizeof
(
int
));
gridptrDup
->
r
educedPoints
=
(
int
*
)
Malloc
(
reducedPointsSize
*
sizeof
(
int
));
memcpy
(
gridptrDup
->
r
educedPoints
,
gridptrOrig
->
r
educedPoints
,
reducedPointsSize
*
sizeof
(
int
));
}
if
(
gridptrOrig
->
x
.
vals
!=
NULL
)
...
...
@@ -4325,7 +4325,7 @@ static int gridGetComponentFlags(const grid_t * gridP)
|
(
gridHasXBoundsFlag
&
(
int
)((
unsigned
)(
gridP
->
x
.
bounds
==
NULL
)
-
1U
))
|
(
gridHasYBoundsFlag
&
(
int
)((
unsigned
)(
gridP
->
y
.
bounds
==
NULL
)
-
1U
))
|
(
gridHasReferenceFlag
&
(
int
)((
unsigned
)(
gridP
->
reference
==
NULL
)
-
1U
))
|
(
gridHasRowLonFlag
&
(
int
)((
unsigned
)(
gridP
->
r
owlon
==
NULL
)
-
1U
))
|
(
gridHasRowLonFlag
&
(
int
)((
unsigned
)(
gridP
->
r
educedPoints
==
NULL
)
-
1U
))
|
(
gridHasUUIDFlag
&
(
int
)((
unsigned
)
cdiUUIDIsNull
(
gridP
->
uuid
)
-
1U
));
return
flags
;
}
...
...
@@ -4339,7 +4339,7 @@ gridGetPackSize(void * voidP, void *context)
packBuffSize
+=
serializeGetSize
(
gridNint
,
CDI_DATATYPE_INT
,
context
)
+
serializeGetSize
(
1
,
CDI_DATATYPE_UINT32
,
context
);
if
(
gridP
->
r
owlon
)
if
(
gridP
->
r
educedPoints
)
{
xassert
(
gridP
->
reducedPointsSize
);
packBuffSize
+=
serializeGetSize
(
gridP
->
reducedPointsSize
,
CDI_DATATYPE_INT
,
context
)
...
...
@@ -4496,12 +4496,12 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
if
(
memberMask
&
gridHasRowLonFlag
)
{
xassert
(
gridP
->
reducedPointsSize
);
gridP
->
r
owlon
=
(
int
*
)
Malloc
((
size_t
)
gridP
->
reducedPointsSize
*
sizeof
(
int
));
gridP
->
r
educedPoints
=
(
int
*
)
Malloc
((
size_t
)
gridP
->
reducedPointsSize
*
sizeof
(
int
));
serializeUnpack
(
unpackBuffer
,
unpackBufferSize
,
unpackBufferPos
,
gridP
->
r
owlon
,
gridP
->
reducedPointsSize
,
CDI_DATATYPE_INT
,
context
);
gridP
->
r
educedPoints
,
gridP
->
reducedPointsSize
,
CDI_DATATYPE_INT
,
context
);
serializeUnpack
(
unpackBuffer
,
unpackBufferSize
,
unpackBufferPos
,
&
d
,
1
,
CDI_DATATYPE_UINT32
,
context
);
xassert
(
cdiCheckSum
(
CDI_DATATYPE_INT
,
gridP
->
reducedPointsSize
,
gridP
->
r
owlon
)
==
d
);
xassert
(
cdiCheckSum
(
CDI_DATATYPE_INT
,
gridP
->
reducedPointsSize
,
gridP
->
r
educedPoints
)
==
d
);
}
{
...
...
@@ -4691,9 +4691,9 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize,
{
size
=
gridP
->
reducedPointsSize
;
xassert
(
size
>
0
);
serializePack
(
gridP
->
r
owlon
,
size
,
CDI_DATATYPE_INT
,
serializePack
(
gridP
->
r
educedPoints
,
size
,
CDI_DATATYPE_INT
,
packBuffer
,
packBufferSize
,
packBufferPos
,
context
);
d
=
cdiCheckSum
(
CDI_DATATYPE_INT
,
size
,
gridP
->
r
owlon
);
d
=
cdiCheckSum
(
CDI_DATATYPE_INT
,
size
,
gridP
->
r
educedPoints
);
serializePack
(
&
d
,
1
,
CDI_DATATYPE_UINT32
,
packBuffer
,
packBufferSize
,
packBufferPos
,
context
);
}
...
...
src/grid.h
View file @
b2cbbb47
...
...
@@ -102,7 +102,7 @@ struct grid_t {
int
nvertex
;
char
*
reference
;
unsigned
char
uuid
[
CDI_UUID_SIZE
];
/* uuid for grid reference */
int
*
r
owlon
;
int
*
r
educedPoints
;
int
reducedPointsSize
;
int
np
;
/* number of parallels between a pole and the equator */
signed
char
isCyclic
;
/* three possible states:
...
...
src/mo_cdi.f90
View file @
b2cbbb47
...
...
@@ -2325,19 +2325,19 @@ module mo_cdi
integer
(
c_size_t
)
::
f_result
end
function
gridInqYboundsPart
subroutine
gridDefReducedPoints
(
gridID_dummy
,
reducedPointsSize_dummy
,
r
owlon
_dummy
)
bind
(
c
,&
subroutine
gridDefReducedPoints
(
gridID_dummy
,
reducedPointsSize_dummy
,
r
educedPoints
_dummy
)
bind
(
c
,&
&
name
=
'gridDefReducedPoints'
)
import
c_int
integer
(
c_int
),
value
::
gridID_dummy
integer
(
c_int
),
value
::
reducedPointsSize_dummy
integer
(
c_int
),
intent
(
in
)
::
r
owlon
_dummy
(
*
)
integer
(
c_int
),
intent
(
in
)
::
r
educedPoints
_dummy
(
*
)
end
subroutine
gridDefReducedPoints
subroutine
gridInqReducedPoints
(
gridID_dummy
,
r
owlon
_dummy
)
bind
(
c
,
name
=
&
subroutine
gridInqReducedPoints
(
gridID_dummy
,
r
educedPoints
_dummy
)
bind
(
c
,
name
=
&
&
'gridInqReducedPoints'
)
import
c_int
integer
(
c_int
),
value
::
gridID_dummy
integer
(
c_int
),
intent
(
inout
)
::
r
owlon
_dummy
(
*
)
integer
(
c_int
),
intent
(
inout
)
::
r
educedPoints
_dummy
(
*
)
end
subroutine
gridInqReducedPoints
subroutine
gridChangeType
(
gridID_dummy
,
gridtype_dummy
)
bind
(
c
,
name
=
&
...
...
src/stream_cgribex.c
View file @
b2cbbb47
...
...
@@ -355,7 +355,7 @@ bool cgribexGetGrid(stream_t *streamptr, int *isec2, int *isec4, grid_t *grid, i
uvRelativeToGrid
=
gribbyte_get_bit
(
ISEC2_ResFlag
,
5
);
grid
->
np
=
ISEC2_NumPar
;
grid
->
size
=
(
size_t
)
ISEC4_NumValues
;
grid
->
r
owlon
=
ISEC2_RowLonPtr
;
grid
->
r
educedPoints
=
ISEC2_RowLonPtr
;
grid
->
reducedPointsSize
=
(
size_t
)
ISEC2_NumLat
;
grid
->
y
.
size
=
(
size_t
)
ISEC2_NumLat
;
grid
->
x
.
inc
=
0
;
...
...
@@ -500,9 +500,9 @@ void cgribexAddRecord(stream_t *streamptr, cgribexrec_t *cgribexp, int param, si
if
(
gridptr
->
reducedPointsSize
)
{
const
size_t
reducedPointsSize
=
(
size_t
)
gridptr
->
reducedPointsSize
;
int
*
r
owlon
=
gridptr
->
r
owlon
;
gridptr
->
r
owlon
=
(
int
*
)
Malloc
(
reducedPointsSize
*
sizeof
(
int
));
memcpy
(
gridptr
->
r
owlon
,
rowlon
,
reducedPointsSize
*
sizeof
(
int
));
int
*
r
educedPoints
=
gridptr
->
r
educedPoints
;
gridptr
->
r
educedPoints
=
(
int
*
)
Malloc
(
reducedPointsSize
*
sizeof
(
int
));
memcpy
(
gridptr
->
r
educedPoints
,
reducedPoints
,
reducedPointsSize
*
sizeof
(
int
));
}
else
if
(
gridptr
->
projtype
==
CDI_PROJ_RLL
)
{
...
...
src/stream_gribapi.c
View file @
b2cbbb47
...
...
@@ -1896,15 +1896,15 @@ void gribapiDefGridRegular(grib_handle *gh, int gridID, int gridtype, bool gridI
{
nlon
=
0
;
int
*
r
owlon
=
(
int
*
)
Malloc
(
nlat
*
sizeof
(
int
));
int
*
r
educedPoints
=
(
int
*
)
Malloc
(
nlat
*
sizeof
(
int
));
long
*
pl
=
(
long
*
)
Malloc
(
nlat
*
sizeof
(
long
));
gridInqReducedPoints
(
gridID
,
r
owlon
);
for
(
size_t
i
=
0
;
i
<
nlat
;
++
i
)
pl
[
i
]
=
r
owlon
[
i
];
gridInqReducedPoints
(
gridID
,
r
educedPoints
);
for
(
size_t
i
=
0
;
i
<
nlat
;
++
i
)
pl
[
i
]
=
r
educedPoints
[
i
];
GRIB_CHECK
(
grib_set_long_array
(
gh
,
"pl"
,
pl
,
nlat
),
0
);
Free
(
pl
);
Free
(
r
owlon
);
Free
(
r
educedPoints
);
xfirst
=
0
;
xinc
=
360
.
*
0
.
5
/
(
double
)
nlat
;
...
...
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