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
8245b614
Commit
8245b614
authored
5 years ago
by
Uwe Schulzweida
Browse files
Options
Downloads
Patches
Plain Diff
cdfDefRgrid: write reduced_points.
parent
31063c1d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/stream_cdf_o.c
+69
-27
69 additions, 27 deletions
src/stream_cdf_o.c
with
69 additions
and
27 deletions
src/stream_cdf_o.c
+
69
−
27
View file @
8245b614
...
...
@@ -437,7 +437,6 @@ cdfDefAxisCommon(stream_t *streamptr, int gridID, int gridindex, int ndims,
void
(
*
finishCyclicBounds
)(
double
*
pbounds
,
size_t
dimlen
,
const
double
*
pvals
))
{
int
dimID
=
CDI_UNDEFID
;
int
ncvarid
=
CDI_UNDEFID
,
ncbvarid
=
CDI_UNDEFID
;
const
int
fileID
=
streamptr
->
fileID
;
const
size_t
dimlen
=
gridAxisInq
->
axisSize
(
gridID
);
const
nc_type
xtype
=
(
nc_type
)
cdfDefDatatype
(
gridInqDatatype
(
gridID
),
streamptr
);
...
...
@@ -477,6 +476,7 @@ cdfDefAxisCommon(stream_t *streamptr, int gridID, int gridindex, int ndims,
if
(
dimID
==
CDI_UNDEFID
)
{
int
ncvarid
=
CDI_UNDEFID
,
ncbvarid
=
CDI_UNDEFID
;
char
axisname
[
CDI_MAX_NAME
];
axisname
[
0
]
=
0
;
const
int
keyname
=
(
axisLetter
==
'X'
)
?
CDI_KEY_XNAME
:
CDI_KEY_YNAME
;
gridAxisInq
->
axisName
(
gridID
,
keyname
,
CDI_MAX_NAME
,
axisname
);
...
...
@@ -1755,39 +1755,81 @@ void cdfDefRgrid(stream_t *streamptr, int gridID, int gridindex)
{
ncgrid_t
*
ncgrid
=
streamptr
->
ncgrid
;
const
size_t
dimlen
=
gridInqSize
(
gridID
)
;
ncgrid
[
gridindex
].
gridID
=
gridID
;
struct
idSearch
search
=
cdfSearchIDBySize
(
0
,
(
size_t
)
gridindex
,
ncgrid
,
CDF_DIMID_X
,
GRID_GAUSSIAN_REDUCED
,
(
int
)
dimlen
,
gridInqType
,
gridInqSize
);
const
int
iz
=
search
.
numNonMatching
;
int
dimID
=
search
.
foundID
;
{
const
size_t
dimlen
=
gridInqSize
(
gridID
);
if
(
dimID
==
CDI_UNDEFID
)
{
const
int
fileID
=
streamptr
->
fileID
;
static
bool
lwarn
=
true
;
if
(
lwarn
)
{
Warning
(
"Creating a NetCDF file with data on a gaussian reduced grid."
);
Warning
(
"The further processing of the resulting file is unsupported!"
);
lwarn
=
false
;
}
struct
idSearch
search
=
cdfSearchIDBySize
(
0
,
(
size_t
)
gridindex
,
ncgrid
,
CDF_DIMID_X
,
GRID_GAUSSIAN_REDUCED
,
(
int
)
dimlen
,
gridInqType
,
gridInqSize
);
const
int
iz
=
search
.
numNonMatching
;
int
dimID
=
search
.
foundID
;
char
axisname
[
16
]
=
"rgridX"
;
if
(
iz
==
0
)
axisname
[
5
]
=
'\0'
;
else
sprintf
(
&
axisname
[
5
],
"%1d"
,
iz
+
1
);
if
(
dimID
==
CDI_UNDEFID
)
{
const
int
fileID
=
streamptr
->
fileID
;
static
bool
lwarn
=
true
;
if
(
lwarn
)
{
Warning
(
"Creating a NetCDF file with data on a gaussian reduced grid."
);
Warning
(
"The further processing of the resulting file is unsupported!"
);
lwarn
=
false
;
}
if
(
streamptr
->
ncmode
==
2
)
cdf_redef
(
fileID
);
char
axisname
[
16
]
=
"rgridX"
;
if
(
iz
==
0
)
axisname
[
5
]
=
'\0'
;
else
sprintf
(
&
axisname
[
5
],
"%1d"
,
iz
+
1
);
cdf_def_dim
(
fileID
,
axisname
,
dimlen
,
&
dim
ID
);
if
(
streamptr
->
ncmode
==
2
)
cdf_redef
(
file
ID
);
cdf_enddef
(
fileID
);
streamptr
->
ncmode
=
2
;
}
cdf_def_dim
(
fileID
,
axisname
,
dimlen
,
&
dimID
);
ncgrid
[
gridindex
].
gridID
=
gridID
;
ncgrid
[
gridindex
].
ncIDs
[
CDF_DIMID_X
]
=
dimID
;
cdf_enddef
(
fileID
);
streamptr
->
ncmode
=
2
;
}
ncgrid
[
gridindex
].
ncIDs
[
CDF_DIMID_X
]
=
dimID
;
}
{
const
size_t
dimlen
=
gridInqYsize
(
gridID
);
struct
idSearch
search
=
cdfSearchIDBySize
(
0
,
(
size_t
)
gridindex
,
ncgrid
,
CDF_DIMID_RP
,
GRID_GAUSSIAN_REDUCED
,
(
int
)
dimlen
,
gridInqType
,
gridInqSize
);
const
int
iz
=
search
.
numNonMatching
;
int
dimID
=
search
.
foundID
;
if
(
dimID
==
CDI_UNDEFID
)
{
const
int
fileID
=
streamptr
->
fileID
;
char
axisname
[
32
]
=
"reduced_pointsX"
;
if
(
iz
==
0
)
axisname
[
14
]
=
'\0'
;
else
sprintf
(
&
axisname
[
5
],
"%1d"
,
iz
+
1
);
if
(
streamptr
->
ncmode
==
2
)
cdf_redef
(
fileID
);
cdf_def_dim
(
fileID
,
axisname
,
dimlen
,
&
dimID
);
int
ncvarid
=
CDI_UNDEFID
;
int
ndims
=
1
;
const
nc_type
xtype
=
NC_INT
;
cdf_def_var
(
fileID
,
axisname
,
xtype
,
ndims
,
&
dimID
,
&
ncvarid
);
cdf_enddef
(
fileID
);
streamptr
->
ncmode
=
2
;
int
*
reducedPoints
=
(
int
*
)
Malloc
(
dimlen
*
sizeof
(
int
));
gridInqReducedPoints
(
gridID
,
reducedPoints
);
cdf_put_var_int
(
fileID
,
ncvarid
,
reducedPoints
);
Free
(
reducedPoints
);
ncgrid
[
gridindex
].
ncIDs
[
CDF_VARID_RP
]
=
ncvarid
;
}
ncgrid
[
gridindex
].
ncIDs
[
CDF_DIMID_RP
]
=
dimID
;
}
}
static
...
...
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