Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
libcdi
Commits
9ed458bb
Commit
9ed458bb
authored
Mar 09, 2020
by
Uwe Schulzweida
Browse files
gribapiDefDateTimeRel: reset startDate and endDate if they are out of bounds.
parent
003ca86f
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/stream_gribapi.c
View file @
9ed458bb
...
...
@@ -1810,7 +1810,7 @@ int gribapiDefDateTimeRel(int editionNumber, grib_handle *gh, int64_t fdate, int
const
double
endStepF
=
(
days
*
86400
.
0
+
secs
)
/
factor
;
const
long
maxStep
=
(
editionNumber
>
1
)
?
INT_MAX
:
65000
;
if
(
endStepF
>
maxStep
)
return
status
;
const
long
endStep
=
(
long
)
endStepF
;
long
endStep
=
(
long
)
endStepF
;
if
(
sdate
!=
0
&&
(
tsteptype
==
TSTEP_RANGE
||
tsteptype
==
TSTEP_AVG
||
tsteptype
==
TSTEP_ACCUM
||
tsteptype
==
TSTEP_DIFF
))
{
...
...
@@ -1836,13 +1836,20 @@ int gribapiDefDateTimeRel(int editionNumber, grib_handle *gh, int64_t fdate, int
proDefTempNum
==
55
||
proDefTempNum
==
40055
)
// Tile
startStep
=
endStep
;
if
(
endStep
<
startStep
)
return
status
;
if
(
endStep
<
startStep
||
startStep
>
255
||
endStep
>
255
)
{
startStep
=
0
;
endStep
=
0
;
}
else
{
status
=
0
;
}
if
(
editionNumber
>
1
)
GRIB_CHECK
(
my_grib_set_long
(
gh
,
"forecastTime"
,
startStep
),
0
);
if
(
editionNumber
==
1
&&
startStep
>
0
)
GRIB_CHECK
(
my_grib_set_long
(
gh
,
"startStep"
,
startStep
),
0
);
//if ( editionNumber == 1 && startStep > 0) GRIB_CHECK(my_grib_set_long(gh, "startStep", startStep), 0);
if
(
editionNumber
==
1
)
GRIB_CHECK
(
my_grib_set_long
(
gh
,
"startStep"
,
startStep
),
0
);
GRIB_CHECK
(
my_grib_set_long
(
gh
,
"endStep"
,
endStep
),
0
);
status
=
0
;
}
return
status
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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