Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libcdi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mpim-sw
libcdi
Commits
ffeaa461
Commit
ffeaa461
authored
12 years ago
by
Uwe Schulzweida
Browse files
Options
Downloads
Patches
Plain Diff
grib2: added stepType support for absolute time axis
parent
79b0dfb1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ChangeLog
+4
-0
4 additions, 0 deletions
ChangeLog
src/stream_gribapi.c
+51
-39
51 additions, 39 deletions
src/stream_gribapi.c
with
55 additions
and
39 deletions
ChangeLog
+
4
−
0
View file @
ffeaa461
...
...
@@ -3,6 +3,10 @@
* Version 1.5.8 released
* using CGRIBEX library version 1.5.5
2012-10-16 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* grib2: added stepType support for absolute time axis
2012-10-15 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* pio.h remove line 'typedef int MPI_Comm;' [Bug #2882]
...
...
This diff is collapsed.
Click to expand it.
src/stream_gribapi.c
+
51
−
39
View file @
ffeaa461
...
...
@@ -236,7 +236,7 @@ int gribapiGetValidityDateTime(grib_handle *gh, int *vdate, int *vtime)
GRIB_CHECK
(
grib_get_long
(
gh
,
"dataDate"
,
&
lpar
),
0
);
rdate
=
(
int
)
lpar
;
GRIB_CHECK
(
grib_get_long
(
gh
,
"dataTime"
,
&
lpar
),
0
);
rtime
=
(
int
)
lpar
*
100
;
rtime
=
(
int
)
lpar
*
100
;
GRIB_CHECK
(
grib_get_long
(
gh
,
"forecastTime"
,
&
lpar
),
0
);
startStep
=
(
int
)
lpar
;
GRIB_CHECK
(
grib_get_long
(
gh
,
"endStep"
,
&
lpar
),
0
);
...
...
@@ -2012,27 +2012,59 @@ int gribapiDefStepUnits(grib_handle *gh, int timeunit, int gcinit)
}
static
void
gribapiDefDateTime
(
int
editionNumber
,
grib_handle
*
gh
,
int
date
,
int
time
)
int
gribapiDefSteptype
(
int
editionNumber
,
grib_handle
*
gh
,
int
tsteptype
,
int
gcinit
)
{
long
proDefTempNum
=
0
;
size_t
len
=
64
;
char
stepType
[
64
];
switch
(
tsteptype
)
{
case
TSTEP_INSTANT
:
strcpy
(
stepType
,
"instant"
);
proDefTempNum
=
0
;
break
;
case
TSTEP_AVG
:
strcpy
(
stepType
,
"avg"
);
proDefTempNum
=
8
;
break
;
case
TSTEP_ACCUM
:
strcpy
(
stepType
,
"accum"
);
proDefTempNum
=
8
;
break
;
case
TSTEP_MAX
:
strcpy
(
stepType
,
"max"
);
proDefTempNum
=
8
;
break
;
case
TSTEP_MIN
:
strcpy
(
stepType
,
"min"
);
proDefTempNum
=
8
;
break
;
case
TSTEP_DIFF
:
strcpy
(
stepType
,
"diff"
);
proDefTempNum
=
8
;
break
;
case
TSTEP_RMS
:
strcpy
(
stepType
,
"rms"
);
proDefTempNum
=
8
;
break
;
case
TSTEP_SD
:
strcpy
(
stepType
,
"sd"
);
proDefTempNum
=
8
;
break
;
case
TSTEP_COV
:
strcpy
(
stepType
,
"cov"
);
proDefTempNum
=
8
;
break
;
case
TSTEP_RATIO
:
strcpy
(
stepType
,
"ratio"
);
proDefTempNum
=
8
;
break
;
default:
strcpy
(
stepType
,
"instant"
);
proDefTempNum
=
0
;
break
;
}
if
(
!
gcinit
)
{
if
(
editionNumber
>
1
)
GRIB_CHECK
(
grib_set_long
(
gh
,
"productDefinitionTemplateNumber"
,
proDefTempNum
),
0
);
len
=
strlen
(
stepType
);
GRIB_CHECK
(
grib_set_string
(
gh
,
"stepType"
,
stepType
,
&
len
),
0
);
}
return
((
int
)
proDefTempNum
);
}
static
void
gribapiDefDateTimeAbs
(
int
editionNumber
,
grib_handle
*
gh
,
int
date
,
int
time
,
int
tsteptype
,
int
gcinit
)
{
if
(
editionNumber
>
1
)
GRIB_CHECK
(
grib_set_long
(
gh
,
"significanceOfReferenceTime"
,
0
),
0
);
GRIB_CHECK
(
grib_set_long
(
gh
,
"stepRange"
,
0
),
0
);
if
(
editionNumber
>
1
)
GRIB_CHECK
(
grib_set_long
(
gh
,
"stepRange"
,
0
),
0
);
if
(
date
==
0
)
date
=
10101
;
GRIB_CHECK
(
grib_set_long
(
gh
,
"dataDate"
,
date
),
0
);
GRIB_CHECK
(
grib_set_long
(
gh
,
"dataTime"
,
time
/
100
),
0
);
(
void
)
gribapiDefSteptype
(
editionNumber
,
gh
,
tsteptype
,
gcinit
);
}
static
int
gribapiDef
Tsteptype
(
int
editionNumber
,
grib_handle
*
gh
,
int
tsteptype
,
int
factor
,
int
calendar
,
int
rdate
,
int
rtime
,
int
vdate
,
int
vtime
,
int
gcinit
)
int
gribapiDef
DateTimeRel
(
int
editionNumber
,
grib_handle
*
gh
,
int
rdate
,
int
rtime
,
int
vdate
,
int
vtime
,
int
tsteptype
,
int
factor
,
int
calendar
,
int
gcinit
)
{
int
status
=
-
1
;
int
year
,
month
,
day
,
hour
,
minute
,
second
;
int
julday1
,
secofday1
,
julday2
,
secofday2
,
days
,
secs
;
long
startStep
=
0
,
endStep
;
long
proDefTempNum
=
0
;
size_t
len
=
64
;
char
stepType
[
64
];
cdiDecodeDate
(
rdate
,
&
year
,
&
month
,
&
day
);
cdiDecodeTime
(
rtime
,
&
hour
,
&
minute
,
&
second
);
...
...
@@ -2049,30 +2081,15 @@ int gribapiDefTsteptype(int editionNumber, grib_handle *gh, int tsteptype, int f
endStep
=
(
int
)
((
days
*
86400
.
0
+
secs
)
/
factor
);
if
(
editionNumber
>
1
)
GRIB_CHECK
(
grib_set_long
(
gh
,
"significanceOfReferenceTime"
,
1
),
0
);
if
(
editionNumber
>
1
)
GRIB_CHECK
(
grib_set_long
(
gh
,
"stepRange"
,
0
),
0
);
// printf(">>>>> tsteptype %d startStep %d endStep %d\n", tsteptype, startStep, endStep);
if
(
rdate
==
0
)
rdate
=
10101
;
GRIB_CHECK
(
grib_set_long
(
gh
,
"dataDate"
,
rdate
),
0
);
GRIB_CHECK
(
grib_set_long
(
gh
,
"dataTime"
,
rtime
/
100
),
0
);
switch
(
tsteptype
)
{
case
TSTEP_INSTANT
:
strcpy
(
stepType
,
"instant"
);
proDefTempNum
=
0
;
break
;
case
TSTEP_AVG
:
strcpy
(
stepType
,
"avg"
);
proDefTempNum
=
8
;
break
;
case
TSTEP_ACCUM
:
strcpy
(
stepType
,
"accum"
);
proDefTempNum
=
8
;
break
;
case
TSTEP_MAX
:
strcpy
(
stepType
,
"max"
);
proDefTempNum
=
8
;
break
;
case
TSTEP_MIN
:
strcpy
(
stepType
,
"min"
);
proDefTempNum
=
8
;
break
;
case
TSTEP_DIFF
:
strcpy
(
stepType
,
"diff"
);
proDefTempNum
=
8
;
break
;
case
TSTEP_RMS
:
strcpy
(
stepType
,
"rms"
);
proDefTempNum
=
8
;
break
;
case
TSTEP_SD
:
strcpy
(
stepType
,
"sd"
);
proDefTempNum
=
8
;
break
;
case
TSTEP_COV
:
strcpy
(
stepType
,
"cov"
);
proDefTempNum
=
8
;
break
;
case
TSTEP_RATIO
:
strcpy
(
stepType
,
"ratio"
);
proDefTempNum
=
8
;
break
;
default:
strcpy
(
stepType
,
"instant"
);
proDefTempNum
=
0
;
break
;
}
// printf(">>>>> tsteptype %d startStep %d endStep %d\n", tsteptype, startStep, endStep);
if
(
!
gcinit
)
{
if
(
editionNumber
>
1
)
GRIB_CHECK
(
grib_set_long
(
gh
,
"productDefinitionTemplateNumber"
,
proDefTempNum
),
0
);
len
=
strlen
(
stepType
);
GRIB_CHECK
(
grib_set_string
(
gh
,
"stepType"
,
stepType
,
&
len
),
0
);
}
proDefTempNum
=
gribapiDefSteptype
(
editionNumber
,
gh
,
tsteptype
,
gcinit
);
if
(
proDefTempNum
==
0
)
startStep
=
endStep
;
...
...
@@ -2100,25 +2117,20 @@ void gribapiDefTime(int editionNumber, grib_handle *gh , int vdate, int vtime, i
if
(
taxistype
==
TAXIS_RELATIVE
)
{
int
rdate
,
rtime
;
int
calendar
;
int
status
;
int
calendar
=
taxisInqCalendar
(
taxisID
);
int
rdate
=
taxisInqRdate
(
taxisID
);
int
rtime
=
taxisInqRtime
(
taxisID
);
calendar
=
taxisInqCalendar
(
taxisID
);
rdate
=
taxisInqRdate
(
taxisID
);
rtime
=
taxisInqRtime
(
taxisID
);
gribapiDefDateTime
(
editionNumber
,
gh
,
rdate
,
rtime
);
status
=
gribapiDefTsteptype
(
editionNumber
,
gh
,
tsteptype
,
factor
,
calendar
,
rdate
,
rtime
,
vdate
,
vtime
,
gcinit
);
status
=
gribapiDefDateTimeRel
(
editionNumber
,
gh
,
rdate
,
rtime
,
vdate
,
vtime
,
tsteptype
,
factor
,
calendar
,
gcinit
);
if
(
status
!=
0
)
taxistype
=
TAXIS_ABSOLUTE
;
}
if
(
taxistype
==
TAXIS_ABSOLUTE
)
{
gribapiDefDateTime
(
editionNumber
,
gh
,
vdate
,
vtime
);
gribapiDefDateTime
Abs
(
editionNumber
,
gh
,
vdate
,
vtime
,
tsteptype
,
gcinit
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment