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
f1d0383a
Commit
f1d0383a
authored
9 years ago
by
Thomas Jahns
Committed by
Sergey Kosukhin
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Move cdfDefTimestep to stream_cdf_time.c.
parent
2432f661
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!34
Version 2.2.0
,
!13
Consolidation with CDI-PIO (develop)
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/stream_cdf.h
+0
-1
0 additions, 1 deletion
src/stream_cdf.h
src/stream_cdf_o.c
+0
-62
0 additions, 62 deletions
src/stream_cdf_o.c
src/stream_cdf_time.c
+64
-1
64 additions, 1 deletion
src/stream_cdf_time.c
with
64 additions
and
64 deletions
src/stream_cdf.h
+
0
−
1
View file @
f1d0383a
...
...
@@ -47,7 +47,6 @@ void cdf_write_var_slice(stream_t *streamptr, int varID, int levelID, int memtyp
void
cdf_write_var_chunk
(
stream_t
*
streamptr
,
int
varID
,
int
memtype
,
const
int
rect
[][
2
],
const
void
*
data
,
size_t
nmiss
);
void
cdfDefVarDeflate
(
int
ncid
,
int
ncvarid
,
int
deflateLevel
);
const
char
*
cdfGetTimeUnits
(
taxis_t
*
taxis
);
void
cdfDefTime
(
stream_t
*
streamptr
);
void
cdf_scale_add
(
size_t
size
,
double
*
data
,
double
addoffset
,
double
scalefactor
);
...
...
This diff is collapsed.
Click to expand it.
src/stream_cdf_o.c
+
0
−
62
View file @
f1d0383a
...
...
@@ -43,68 +43,6 @@ cdfDefRecord(stream_t *streamptr)
(
void
)
streamptr
;
}
void
cdfDefTimestep
(
stream_t
*
streamptr
,
int
tsID
)
{
const
int
time_varid
=
streamptr
->
basetime
.
ncvarid
;
if
(
time_varid
!=
CDI_UNDEFID
&&
tsID
==
0
)
{
taxis_t
*
taxis
=
taxisPtr
(
vlistInqTaxis
(
streamptr
->
vlistID
));
const
int
fileID
=
streamptr
->
fileID
;
const
char
*
unitstr
=
cdfGetTimeUnits
(
taxis
);
const
size_t
len
=
strlen
(
unitstr
);
if
(
len
)
cdf_put_att_text
(
fileID
,
time_varid
,
"units"
,
len
,
unitstr
);
}
const
int
fileID
=
streamptr
->
fileID
;
if
(
CDI_Debug
)
Message
(
"streamID = %d, fileID = %d, tsID = %d"
,
streamptr
->
self
,
fileID
,
tsID
);
taxis_t
*
taxis
=
&
streamptr
->
tsteps
[
tsID
].
taxis
;
if
(
streamptr
->
ncmode
==
1
)
{
cdf_enddef
(
fileID
);
streamptr
->
ncmode
=
2
;
}
if
(
streamptr
->
accessmode
==
0
)
{
cdfEndDef
(
streamptr
);
}
double
timeValue
=
cdi_encode_timeval
(
taxis
->
vDateTime
,
&
streamptr
->
tsteps
[
0
].
taxis
);
if
(
CDI_Debug
)
Message
(
"tsID = %d timeValue = %f"
,
tsID
,
timeValue
);
int
ncvarid
=
streamptr
->
basetime
.
ncvarid
;
size_t
index
=
(
size_t
)
tsID
;
cdf_put_var1_double
(
fileID
,
ncvarid
,
&
index
,
&
timeValue
);
if
(
taxis
->
has_bounds
)
{
ncvarid
=
streamptr
->
basetime
.
ncvarboundsid
;
if
(
ncvarid
==
CDI_UNDEFID
)
Error
(
"Call to taxisWithBounds() missing!"
);
timeValue
=
cdi_encode_timeval
(
taxis
->
vDateTime_lb
,
&
streamptr
->
tsteps
[
0
].
taxis
);
size_t
start
[
2
]
=
{
tsID
,
0
},
count
[
2
]
=
{
1
,
1
};
cdf_put_vara_double
(
fileID
,
ncvarid
,
start
,
count
,
&
timeValue
);
timeValue
=
cdi_encode_timeval
(
taxis
->
vDateTime_ub
,
&
streamptr
->
tsteps
[
0
].
taxis
);
start
[
0
]
=
(
size_t
)
tsID
;
count
[
0
]
=
1
;
start
[
1
]
=
1
;
count
[
1
]
=
1
;
cdf_put_vara_double
(
fileID
,
ncvarid
,
start
,
count
,
&
timeValue
);
}
ncvarid
=
streamptr
->
basetime
.
leadtimeid
;
if
(
taxis
->
type
==
TAXIS_FORECAST
&&
ncvarid
!=
CDI_UNDEFID
)
{
timeValue
=
taxis
->
fc_period
;
cdf_put_var1_double
(
fileID
,
ncvarid
,
&
index
,
&
timeValue
);
}
}
static
void
cdfDefComplex
(
stream_t
*
streamptr
,
int
gridID
,
int
gridIndex
)
{
...
...
This diff is collapsed.
Click to expand it.
src/stream_cdf_time.c
+
64
−
1
View file @
f1d0383a
...
...
@@ -12,6 +12,7 @@
#include
"dmemory.h"
#include
"stream_cdf.h"
#include
"cdf_int.h"
#include
"vlist.h"
static
int
cdfDefTimeBounds
(
int
fileID
,
int
nctimevarid
,
int
nctimedimid
,
const
char
*
taxis_name
,
taxis_t
*
taxis
)
...
...
@@ -53,7 +54,7 @@ cdfDefTimeBounds(int fileID, int nctimevarid, int nctimedimid, const char *taxis
return
time_bndsid
;
}
const
char
*
static
const
char
*
cdfGetTimeUnits
(
taxis_t
*
taxis
)
{
const
char
*
unitstr
;
...
...
@@ -238,6 +239,68 @@ cdfDefTime(stream_t *streamptr)
if
(
streamptr
->
ncmode
==
2
)
cdf_enddef
(
fileID
);
}
void
cdfDefTimestep
(
stream_t
*
streamptr
,
int
tsID
)
{
const
int
time_varid
=
streamptr
->
basetime
.
ncvarid
;
if
(
time_varid
!=
CDI_UNDEFID
&&
tsID
==
0
)
{
taxis_t
*
taxis
=
taxisPtr
(
vlistInqTaxis
(
streamptr
->
vlistID
));
const
int
fileID
=
streamptr
->
fileID
;
const
char
*
unitstr
=
cdfGetTimeUnits
(
taxis
);
const
size_t
len
=
strlen
(
unitstr
);
if
(
len
)
cdf_put_att_text
(
fileID
,
time_varid
,
"units"
,
len
,
unitstr
);
}
const
int
fileID
=
streamptr
->
fileID
;
if
(
CDI_Debug
)
Message
(
"streamID = %d, fileID = %d, tsID = %d"
,
streamptr
->
self
,
fileID
,
tsID
);
taxis_t
*
taxis
=
&
streamptr
->
tsteps
[
tsID
].
taxis
;
if
(
streamptr
->
ncmode
==
1
)
{
cdf_enddef
(
fileID
);
streamptr
->
ncmode
=
2
;
}
if
(
streamptr
->
accessmode
==
0
)
{
cdfEndDef
(
streamptr
);
}
double
timeValue
=
cdi_encode_timeval
(
taxis
->
vDateTime
,
&
streamptr
->
tsteps
[
0
].
taxis
);
if
(
CDI_Debug
)
Message
(
"tsID = %d timeValue = %f"
,
tsID
,
timeValue
);
int
ncvarid
=
streamptr
->
basetime
.
ncvarid
;
size_t
index
=
(
size_t
)
tsID
;
cdf_put_var1_double
(
fileID
,
ncvarid
,
&
index
,
&
timeValue
);
if
(
taxis
->
has_bounds
)
{
ncvarid
=
streamptr
->
basetime
.
ncvarboundsid
;
if
(
ncvarid
==
CDI_UNDEFID
)
Error
(
"Call to taxisWithBounds() missing!"
);
timeValue
=
cdi_encode_timeval
(
taxis
->
vDateTime_lb
,
&
streamptr
->
tsteps
[
0
].
taxis
);
size_t
start
[
2
]
=
{
tsID
,
0
},
count
[
2
]
=
{
1
,
1
};
cdf_put_vara_double
(
fileID
,
ncvarid
,
start
,
count
,
&
timeValue
);
timeValue
=
cdi_encode_timeval
(
taxis
->
vDateTime_ub
,
&
streamptr
->
tsteps
[
0
].
taxis
);
start
[
0
]
=
(
size_t
)
tsID
;
count
[
0
]
=
1
;
start
[
1
]
=
1
;
count
[
1
]
=
1
;
cdf_put_vara_double
(
fileID
,
ncvarid
,
start
,
count
,
&
timeValue
);
}
ncvarid
=
streamptr
->
basetime
.
leadtimeid
;
if
(
taxis
->
type
==
TAXIS_FORECAST
&&
ncvarid
!=
CDI_UNDEFID
)
{
timeValue
=
taxis
->
fc_period
;
cdf_put_var1_double
(
fileID
,
ncvarid
,
&
index
,
&
timeValue
);
}
}
#endif
/*
* Local Variables:
...
...
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