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
2db5cbf4
Commit
2db5cbf4
authored
Jan 10, 2020
by
Uwe Schulzweida
Browse files
cdfDefineCoordinates(): added attributes CDI_grid_type and CDI_grid_num_LPE for Gaussian grids.
parent
1e8cd19e
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/cdf_write.c
View file @
2db5cbf4
...
...
@@ -405,7 +405,7 @@ void cdfDefineCoordinates(const stream_t *streamptr, int ncvarID, int nczvarID,
{
const
int
fileID
=
streamptr
->
fileID
;
if
(
gridtype
!=
GRID_GENERIC
&&
gridtype
!=
GRID_LONLAT
&&
gridtype
!=
GRID_GAUSSIAN
&&
if
(
gridtype
!=
GRID_GENERIC
&&
gridtype
!=
GRID_LONLAT
&&
gridtype
!=
GRID_PROJECTION
&&
gridtype
!=
GRID_CURVILINEAR
&&
gridtype
!=
GRID_CHARXY
)
{
const
size_t
len
=
strlen
(
gridNamePtr
(
gridtype
));
...
...
@@ -416,12 +416,15 @@ void cdfDefineCoordinates(const stream_t *streamptr, int ncvarID, int nczvarID,
cdf_get_gmapvarname
(
gridID
,
gmapvarname
);
if
(
gmapvarname
[
0
]
)
cdf_put_att_text
(
fileID
,
ncvarID
,
"grid_mapping"
,
strlen
(
gmapvarname
),
gmapvarname
);
if
(
gridtype
==
GRID_GAUSSIAN_REDUCED
)
if
(
gridtype
==
GRID_GAUSSIAN
||
gridtype
==
GRID_GAUSSIAN_REDUCED
)
{
const
int
numLPE
=
gridInqNP
(
gridID
);
if
(
numLPE
>
0
)
cdf_put_att_int
(
fileID
,
ncvarID
,
"CDI_grid_num_LPE"
,
NC_INT
,
1
,
&
numLPE
);
}
if
(
gridtype
==
GRID_GAUSSIAN_REDUCED
)
{
const
int
ncyvarID
=
streamptr
->
ncgrid
[
gridindex
].
ncIDs
[
CDF_VARID_Y
];
if
(
ncyvarID
!=
CDI_UNDEFID
)
{
...
...
src/gaussgrid.c
View file @
2db5cbf4
...
...
@@ -198,8 +198,7 @@ bool isGaussGrid(size_t ysize, double yinc, const double *yvals)
yv
[
i
]
=
asin
(
yv
[
i
])
/
M_PI
*
180
.
0
;
for
(
i
=
0
;
i
<
ysize
;
i
++
)
if
(
fabs
(
yv
[
i
]
-
yvals
[
i
])
>
((
yv
[
0
]
-
yv
[
1
])
/
500
)
)
break
;
if
(
fabs
(
yv
[
i
]
-
yvals
[
i
])
>
((
yv
[
0
]
-
yv
[
1
])
/
500
)
)
break
;
if
(
i
==
ysize
)
lgauss
=
true
;
...
...
@@ -207,8 +206,7 @@ bool isGaussGrid(size_t ysize, double yinc, const double *yvals)
if
(
lgauss
==
false
)
{
for
(
i
=
0
;
i
<
ysize
;
i
++
)
if
(
fabs
(
yv
[
i
]
-
yvals
[
ysize
-
i
-
1
])
>
((
yv
[
0
]
-
yv
[
1
])
/
500
)
)
break
;
if
(
fabs
(
yv
[
i
]
-
yvals
[
ysize
-
i
-
1
])
>
((
yv
[
0
]
-
yv
[
1
])
/
500
)
)
break
;
if
(
i
==
ysize
)
lgauss
=
true
;
}
...
...
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