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
3d22878f
Commit
3d22878f
authored
2 years ago
by
Uwe Schulzweida
Browse files
Options
Downloads
Patches
Plain Diff
Rename hp_interpolate_weights() to hp_bilinear_interpolate_weights().
parent
15d421d1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/mpim_grid/grid_healpix.cc
+17
-21
17 additions, 21 deletions
src/mpim_grid/grid_healpix.cc
src/mpim_grid/grid_healpix.h
+2
-2
2 additions, 2 deletions
src/mpim_grid/grid_healpix.h
src/remap_bilinear.cc
+1
-1
1 addition, 1 deletion
src/remap_bilinear.cc
with
20 additions
and
24 deletions
src/mpim_grid/grid_healpix.cc
+
17
−
21
View file @
3d22878f
...
...
@@ -24,32 +24,29 @@ hp_get_order(const char *orderName)
}
static
int64_t
hp_xy_to_xy
(
int64_t
i
pi
x
,
int
nside
)
hp_xy_to_xy
(
int64_t
i
nde
x
,
int
nside
)
{
(
void
)
nside
;
return
i
pi
x
;
return
i
nde
x
;
}
int64_t
hp_lonlat_to_healpixl
(
HpOrder
order
,
int
nside
,
double
xval
,
double
yval
)
{
int64_t
(
*
convert_order
)(
int64_t
i
pi
x
,
int
nside
);
int64_t
(
*
convert_order
)(
int64_t
i
nde
x
,
int
nside
);
// clang-format off
convert_order
=
(
order
==
HpOrder
::
Ring
)
?
&
healpixl_xy_to_ring
:
(
order
==
HpOrder
::
Nest
)
?
&
healpixl_xy_to_nested
:
&
hp_xy_to_xy
;
// clang-format on
auto
ipix
=
radec_to_healpixl
(
xval
,
yval
,
nside
);
auto
cpix
=
convert_order
(
ipix
,
nside
);
return
cpix
;
return
convert_order
(
radec_to_healpixl
(
xval
,
yval
,
nside
),
nside
);
}
void
hp_generate_coords
(
HpOrder
order
,
int
nside
,
int64_t
nvals
,
double
*
xvals
,
double
*
yvals
,
bool
withBounds
,
double
*
xbounds
,
double
*
ybounds
)
{
int64_t
(
*
convert_order
)(
int64_t
i
pi
x
,
int
nside
);
int64_t
(
*
convert_order
)(
int64_t
i
nde
x
,
int
nside
);
// clang-format off
convert_order
=
(
order
==
HpOrder
::
Ring
)
?
&
healpixl_ring_to_xy
:
(
order
==
HpOrder
::
Nest
)
?
&
healpixl_nested_to_xy
:
&
hp_xy_to_xy
;
...
...
@@ -58,38 +55,37 @@ hp_generate_coords(HpOrder order, int nside, int64_t nvals, double *xvals, doubl
#ifdef _OPENMP
#pragma omp parallel for if (nvals > 99999) default(shared) schedule(static)
#endif
for
(
int64_t
i
pi
x
=
0
;
i
pi
x
<
nvals
;
i
pi
x
++
)
for
(
int64_t
i
nde
x
=
0
;
i
nde
x
<
nvals
;
i
nde
x
++
)
{
auto
cpix
=
convert_order
(
i
pi
x
,
nside
);
healpixl_to_radec
(
cpix
,
nside
,
0.5
,
0.5
,
&
xvals
[
i
pi
x
],
&
yvals
[
i
pi
x
]);
auto
cpix
=
convert_order
(
i
nde
x
,
nside
);
healpixl_to_radec
(
cpix
,
nside
,
0.5
,
0.5
,
&
xvals
[
i
nde
x
],
&
yvals
[
i
nde
x
]);
if
(
withBounds
)
{
healpixl_to_radec
(
cpix
,
nside
,
0.0
,
0.0
,
&
xbounds
[
i
pi
x
*
4
+
0
],
&
ybounds
[
i
pi
x
*
4
+
0
]);
healpixl_to_radec
(
cpix
,
nside
,
1.0
,
0.0
,
&
xbounds
[
i
pi
x
*
4
+
1
],
&
ybounds
[
i
pi
x
*
4
+
1
]);
healpixl_to_radec
(
cpix
,
nside
,
1.0
,
1.0
,
&
xbounds
[
i
pi
x
*
4
+
2
],
&
ybounds
[
i
pi
x
*
4
+
2
]);
healpixl_to_radec
(
cpix
,
nside
,
0.0
,
1.0
,
&
xbounds
[
i
pi
x
*
4
+
3
],
&
ybounds
[
i
pi
x
*
4
+
3
]);
healpixl_to_radec
(
cpix
,
nside
,
0.0
,
0.0
,
&
xbounds
[
i
nde
x
*
4
+
0
],
&
ybounds
[
i
nde
x
*
4
+
0
]);
healpixl_to_radec
(
cpix
,
nside
,
1.0
,
0.0
,
&
xbounds
[
i
nde
x
*
4
+
1
],
&
ybounds
[
i
nde
x
*
4
+
1
]);
healpixl_to_radec
(
cpix
,
nside
,
1.0
,
1.0
,
&
xbounds
[
i
nde
x
*
4
+
2
],
&
ybounds
[
i
nde
x
*
4
+
2
]);
healpixl_to_radec
(
cpix
,
nside
,
0.0
,
1.0
,
&
xbounds
[
i
nde
x
*
4
+
3
],
&
ybounds
[
i
nde
x
*
4
+
3
]);
}
}
}
void
hp_index_to_lonlat
(
HpOrder
order
,
int
nside
,
int64_t
i
pi
x
,
double
*
xval
,
double
*
yval
)
hp_index_to_lonlat
(
HpOrder
order
,
int
nside
,
int64_t
i
nde
x
,
double
*
xval
,
double
*
yval
)
{
int64_t
(
*
convert_order
)(
int64_t
i
pi
x
,
int
nside
);
int64_t
(
*
convert_order
)(
int64_t
i
nde
x
,
int
nside
);
// clang-format off
convert_order
=
(
order
==
HpOrder
::
Ring
)
?
&
healpixl_ring_to_xy
:
(
order
==
HpOrder
::
Nest
)
?
&
healpixl_nested_to_xy
:
&
hp_xy_to_xy
;
// clang-format on
auto
cpix
=
convert_order
(
ipix
,
nside
);
healpixl_to_radec
(
cpix
,
nside
,
0.5
,
0.5
,
xval
,
yval
);
healpixl_to_radec
(
convert_order
(
index
,
nside
),
nside
,
0.5
,
0.5
,
xval
,
yval
);
}
void
hp_interpolate_weights
(
double
lon
,
double
lat
,
size_t
*
indices
,
double
*
weights
,
int
nside
,
HpOrder
order
)
hp_
bilinear_
interpolate_weights
(
double
lon
,
double
lat
,
size_t
*
indices
,
double
*
weights
,
int
nside
,
HpOrder
order
)
{
int64_t
(
*
convert_order
)(
int64_t
i
pi
x
,
int
nside
);
int64_t
(
*
convert_order
)(
int64_t
i
nde
x
,
int
nside
);
// clang-format off
convert_order
=
(
order
==
HpOrder
::
Ring
)
?
&
healpixl_xy_to_ring
:
(
order
==
HpOrder
::
Nest
)
?
&
healpixl_xy_to_nested
:
&
hp_xy_to_xy
;
...
...
This diff is collapsed.
Click to expand it.
src/mpim_grid/grid_healpix.h
+
2
−
2
View file @
3d22878f
...
...
@@ -15,7 +15,7 @@ HpOrder hp_get_order(const char *orderName);
int64_t
hp_lonlat_to_healpixl
(
HpOrder
order
,
int
nside
,
double
xval
,
double
yval
);
void
hp_generate_coords
(
HpOrder
order
,
int
nside
,
int64_t
nvals
,
double
*
xvals
,
double
*
yvals
,
bool
withBounds
,
double
*
xbounds
,
double
*
ybounds
);
void
hp_index_to_lonlat
(
HpOrder
order
,
int
nside
,
int64_t
i
pi
x
,
double
*
xval
,
double
*
yval
);
void
hp_interpolate_weights
(
double
lon
,
double
lat
,
size_t
*
indices
,
double
*
weights
,
int
nside
,
HpOrder
order
);
void
hp_index_to_lonlat
(
HpOrder
order
,
int
nside
,
int64_t
i
nde
x
,
double
*
xval
,
double
*
yval
);
void
hp_
bilinear_
interpolate_weights
(
double
lon
,
double
lat
,
size_t
*
indices
,
double
*
weights
,
int
nside
,
HpOrder
order
);
#endif
This diff is collapsed.
Click to expand it.
src/remap_bilinear.cc
+
1
−
1
View file @
3d22878f
...
...
@@ -422,7 +422,7 @@ remap_bilinear_healpix_kernel(const Varray<T> &srcArray, const Varray<short> &sr
double
weights
[
4
];
// bilinear weights for four corners
size_t
searchIndices
[
4
];
// address for the four source points
hp_interpolate_weights
(
llpoint
.
lon
,
llpoint
.
lat
,
searchIndices
,
weights
,
nside
,
order
);
hp_
bilinear_
interpolate_weights
(
llpoint
.
lon
,
llpoint
.
lat
,
searchIndices
,
weights
,
nside
,
order
);
int
searchResult
=
1
;
// Check to see if points are mask points
...
...
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