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
aa0b6504
Commit
aa0b6504
authored
Mar 29, 2017
by
Thomas Jahns
🤸
Browse files
Reduce memory needed for flags.
* Ideally this should be consolidated with scanningMode.
parent
d22bb654
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/gribapi_utilities.c
View file @
aa0b6504
...
...
@@ -767,9 +767,13 @@ void gribapiGetGrid(grib_handle *gh, grid_t *grid)
if
(
gridtype
==
GRID_GAUSSIAN
||
gridtype
==
GRID_LONLAT
||
gridtype
==
GRID_PROJECTION
||
gridtype
==
GRID_LCC
)
{
GRIB_CHECK
(
grib_get_long
(
gh
,
"iScansNegatively"
,
&
grid
->
iScansNegatively
),
0
);
GRIB_CHECK
(
grib_get_long
(
gh
,
"jScansPositively"
,
&
grid
->
jScansPositively
),
0
);
GRIB_CHECK
(
grib_get_long
(
gh
,
"jPointsAreConsecutive"
,
&
grid
->
jPointsAreConsecutive
),
0
);
long
temp
;
GRIB_CHECK
(
grib_get_long
(
gh
,
"iScansNegatively"
,
&
temp
),
0
);
grid
->
iScansNegatively
=
(
bool
)
temp
;
GRIB_CHECK
(
grib_get_long
(
gh
,
"jScansPositively"
,
&
temp
),
0
);
grid
->
jScansPositively
=
(
bool
)
temp
;
GRIB_CHECK
(
grib_get_long
(
gh
,
"jPointsAreConsecutive"
,
&
temp
),
0
);
grid
->
jPointsAreConsecutive
=
(
bool
)
temp
;
grid
->
scanningMode
=
128
*
grid
->
iScansNegatively
+
64
*
grid
->
jScansPositively
+
32
*
grid
->
jPointsAreConsecutive
;
/* scanningMode = 128 * iScansNegatively + 64 * jScansPositively + 32 * jPointsAreConsecutive;
64 = 128 * 0 + 64 * 1 + 32 * 0
...
...
@@ -787,8 +791,9 @@ void gribapiGetGrid(grib_handle *gh, grid_t *grid)
GRIB_CHECK
(
grib_get_long
(
gh
,
"level"
,
&
levelId
),
0
);
Message
(
"(param,ltype,level) = (%3d,%3d,%4d); Scanning mode = %02d -> bits:(%1d.%1d.%1d)*32; uvRelativeToGrid = %02d"
,
\
(
int
)
paramId
,
(
int
)
levelTypeId
,
(
int
)
levelId
,
grid
->
scanningMode
,(
int
)
grid
->
jPointsAreConsecutive
,(
int
)
grid
->
jScansPositively
,(
int
)
grid
->
iScansNegatively
,
(
int
)
grid
->
uvRelativeToGrid
);
grid
->
scanningMode
,
grid
->
jPointsAreConsecutive
,
grid
->
jScansPositively
,
grid
->
iScansNegatively
,
grid
->
uvRelativeToGrid
);
}
#endif //HIRLAM_EXTENSIONS
}
...
...
src/grid.c
View file @
aa0b6504
...
...
@@ -4264,9 +4264,9 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
gridP
->
y
.
stdname
=
xystdname_tab
[
intBuffer
[
GRID_PACK_INT_IDX_YTSTDNNAME
]][
1
];
gridP
->
uvRelativeToGrid
=
intBuffer
[
GRID_PACK_INT_IDX_UVRELATIVETOGRID
];
gridP
->
iScansNegatively
=
intBuffer
[
GRID_PACK_INT_IDX_ISCANSNEGATIVELY
];
gridP
->
jScansPositively
=
intBuffer
[
GRID_PACK_INT_IDX_JSCANSPOSITIVELY
];
gridP
->
jPointsAreConsecutive
=
intBuffer
[
GRID_PACK_INT_IDX_JPOINTSARECONSECUTIVE
];
gridP
->
iScansNegatively
=
(
bool
)
intBuffer
[
GRID_PACK_INT_IDX_ISCANSNEGATIVELY
];
gridP
->
jScansPositively
=
(
bool
)
intBuffer
[
GRID_PACK_INT_IDX_JSCANSPOSITIVELY
];
gridP
->
jPointsAreConsecutive
=
(
bool
)
intBuffer
[
GRID_PACK_INT_IDX_JPOINTSARECONSECUTIVE
];
gridP
->
scanningMode
=
intBuffer
[
GRID_PACK_INT_IDX_SCANNINGMODE
];
}
...
...
src/grid.h
View file @
aa0b6504
...
...
@@ -113,10 +113,8 @@ struct grid_t {
struct
gridaxis_t
y
;
const
struct
gridVirtTable
*
vtable
;
cdi_atts_t
atts
;
long
iScansNegatively
;
long
jScansPositively
;
long
jPointsAreConsecutive
;
int
scanningMode
;
bool
iScansNegatively
,
jScansPositively
,
jPointsAreConsecutive
;
/* scanningMode = 128 * iScansNegatively + 64 * jScansPositively + 32 * jPointsAreConsecutive;
64 = 128 * 0 + 64 * 1 + 32 * 0
00 = 128 * 0 + 64 * 0 + 32 * 0
...
...
src/stream_gribapi.c
View file @
aa0b6504
...
...
@@ -2051,8 +2051,7 @@ void gribapiDefGrid(int editionNumber, grib_handle *gh, int gridID, int comptype
GRIB_CHECK
(
my_grib_set_double
(
gh
,
"latitudeOfLastGridPointInDegrees"
,
ylast
),
0
);
{
long
jscan
=
0
;
if
(
yfirst
<
ylast
)
jscan
=
1
;
long
jscan
=
yfirst
<
ylast
;
GRIB_CHECK
(
my_grib_set_long
(
gh
,
"jScansPositively"
,
jscan
),
0
);
}
...
...
@@ -2581,8 +2580,10 @@ int gribapiGetScanningMode(grib_handle *gh)
GRIB_CHECK
(
grib_get_long
(
gh
,
"iScansNegatively"
,
&
iScansNegatively
),
0
);
GRIB_CHECK
(
grib_get_long
(
gh
,
"jScansPositively"
,
&
jScansPositively
),
0
);
GRIB_CHECK
(
grib_get_long
(
gh
,
"jPointsAreConsecutive"
,
&
jPointsAreConsecutive
),
0
);
int
scanningMode
=
0
;
scanningMode
=
128
*
iScansNegatively
+
64
*
jScansPositively
+
32
*
jPointsAreConsecutive
;
int
scanningMode
=
128
*
(
bool
)
iScansNegatively
+
64
*
(
bool
)
jScansPositively
+
32
*
(
bool
)
jPointsAreConsecutive
;
if
(
cdiDebugExt
>=
30
)
printf
(
"gribapiGetScanningMode(): Scanning mode = %02d (%1d%1d%1d)*32;
\n
"
,
\
scanningMode
,(
int
)
jPointsAreConsecutive
,(
int
)
jScansPositively
,(
int
)
iScansNegatively
);
...
...
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