Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cdo
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Contributor 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
cdo
Commits
ca8d0cd3
Commit
ca8d0cd3
authored
2 years ago
by
Uwe Schulzweida
Browse files
Options
Downloads
Patches
Plain Diff
Add function cdo_get_healpix_params().
parent
96f4d71d
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
src/cdo_cdi_wrapper.cc
+20
-0
20 additions, 0 deletions
src/cdo_cdi_wrapper.cc
src/cdo_cdi_wrapper.h
+5
-0
5 additions, 0 deletions
src/cdo_cdi_wrapper.h
with
25 additions
and
0 deletions
src/cdo_cdi_wrapper.cc
+
20
−
0
View file @
ca8d0cd3
...
...
@@ -6,6 +6,7 @@
#include
"cdi_int.h"
#include
"cdo_default_values.h"
#include
"cdo_cdi_wrapper.h"
#include
"cdo_output.h"
const
char
*
cdi_filetype_to_str
(
int
filetype
)
...
...
@@ -168,3 +169,22 @@ cdo_inq_var_units(int vlistID, int varID)
vlistInqVarUnits
(
vlistID
,
varID
,
cstr
);
return
std
::
string
(
cstr
);
}
std
::
pair
<
int
,
HpOrder
>
cdo_get_healpix_params
(
int
gridID
)
{
auto
projection
=
"healpix"
;
auto
nside
=
cdo_inq_att_int
(
gridID
,
CDI_GLOBAL
,
"healpix_nside"
);
auto
order
=
cdo_inq_att_string
(
gridID
,
CDI_GLOBAL
,
"healpix_order"
);
if
(
nside
==
-
1
||
order
.
empty
())
{
if
(
order
.
empty
())
cdo_warning
(
"%s mapping parameter %s missing!"
,
projection
,
"healpix_order"
);
if
(
nside
==
-
1
)
cdo_warning
(
"%s mapping parameter %s missing!"
,
projection
,
"healpix_nside"
);
cdo_abort
(
"%s mapping parameter missing!"
,
"healpix"
);
}
if
(
nside
<
1
)
cdo_abort
(
"%s mapping parameter %s < 1!"
,
projection
,
"healpix_nside"
);
auto
hpOrder
=
hp_get_order
(
order
.
c_str
());
if
(
hpOrder
==
HpOrder
::
Undef
)
cdo_abort
(
"%s mapping parameter healpix_order=%s unsupported!"
,
projection
,
order
);
return
std
::
make_pair
(
nside
,
hpOrder
);
}
This diff is collapsed.
Click to expand it.
src/cdo_cdi_wrapper.h
+
5
−
0
View file @
ca8d0cd3
...
...
@@ -2,6 +2,9 @@
#define CDO_CDI_WRAPPER_H
#include
<string>
#include
<utility>
#include
"mpim_grid/grid_healpix.h"
// convert a CDI filetype to string
const
char
*
cdi_filetype_to_str
(
int
filetype
);
...
...
@@ -27,4 +30,6 @@ std::string cdo_inq_var_name(int vlistID, int varID);
std
::
string
cdo_inq_var_longname
(
int
vlistID
,
int
varID
);
std
::
string
cdo_inq_var_units
(
int
vlistID
,
int
varID
);
std
::
pair
<
int
,
HpOrder
>
cdo_get_healpix_params
(
int
gridID
);
#endif
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