forked from ecmwf/atlas
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feature/parallel_transport
- Loading branch information
Showing
14 changed files
with
213 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.35.1 | ||
0.36.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* | ||
* (C) Copyright 2013 ECMWF. | ||
* | ||
* This software is licensed under the terms of the Apache Licence Version 2.0 | ||
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. | ||
* In applying this licence, ECMWF does not waive the privileges and immunities | ||
* granted to it by virtue of its status as an intergovernmental organisation | ||
* nor does it submit to any jurisdiction. | ||
*/ | ||
|
||
#include "atlas/grid/detail/partitioner/EqualAreaPartitioner.h" | ||
|
||
#include "atlas/grid.h" | ||
#include "atlas/grid/Iterator.h" | ||
#include "atlas/util/Constants.h" | ||
|
||
namespace atlas { | ||
namespace grid { | ||
namespace detail { | ||
namespace partitioner { | ||
|
||
EqualAreaPartitioner::EqualAreaPartitioner(): | ||
Partitioner(), partitioner_() { | ||
} | ||
|
||
EqualAreaPartitioner::EqualAreaPartitioner(int N): | ||
EqualAreaPartitioner(N, util::NoConfig()) { | ||
} | ||
|
||
EqualAreaPartitioner::EqualAreaPartitioner(int N, const eckit::Parametrisation& config): | ||
Partitioner(N,config), partitioner_(N,config) { | ||
} | ||
|
||
EqualAreaPartitioner::EqualAreaPartitioner(const eckit::Parametrisation& config): | ||
Partitioner(config), partitioner_(config) { | ||
} | ||
|
||
void EqualAreaPartitioner::partition(const Grid& grid, int part[]) const { | ||
|
||
if( partitioner_.coordinates_ == EqualRegionsPartitioner::Coordinates::XY && StructuredGrid(grid) ) { | ||
StructuredGrid g(grid); | ||
size_t n = 0; | ||
for (idx_t j=0; j<g.ny(); ++j) { | ||
const double lat = g.y(j) * util::Constants::degreesToRadians(); | ||
int b = partitioner_.band(lat); | ||
int p = 0; | ||
for (int k = 0; k < b; ++k) { | ||
p += partitioner_.nb_regions(k); | ||
} | ||
idx_t nx = g.nx(j); | ||
for (idx_t i=0; i<nx; ++i) { | ||
const double lon = g.x(i,j) * util::Constants::degreesToRadians(); | ||
part[n++] = p + partitioner_.sector(b, lon); | ||
} | ||
} | ||
} | ||
else { | ||
size_t j{0}; | ||
for (PointLonLat p : grid.lonlat()) { | ||
p.lon() *= util::Constants::degreesToRadians(); | ||
p.lat() *= util::Constants::degreesToRadians(); | ||
part[j++] = partitioner_.partition(p.lon(), p.lat()); | ||
} | ||
} | ||
|
||
} | ||
|
||
|
||
} // namespace partitioner | ||
} // namespace detail | ||
} // namespace grid | ||
} // namespace atlas | ||
|
||
namespace { | ||
atlas::grid::detail::partitioner::PartitionerBuilder<atlas::grid::detail::partitioner::EqualAreaPartitioner> | ||
__EqualArea("equal_area"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* (C) Copyright 2023 ECMWF. | ||
* | ||
* This software is licensed under the terms of the Apache Licence Version 2.0 | ||
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. | ||
* In applying this licence, ECMWF does not waive the privileges and immunities | ||
* granted to it by virtue of its status as an intergovernmental organisation | ||
* nor does it submit to any jurisdiction. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <vector> | ||
|
||
#include "atlas/grid/detail/partitioner/EqualRegionsPartitioner.h" | ||
#include "atlas/grid/detail/partitioner/Partitioner.h" | ||
|
||
namespace atlas { | ||
namespace grid { | ||
namespace detail { | ||
namespace partitioner { | ||
|
||
class EqualAreaPartitioner : public Partitioner { | ||
public: | ||
EqualAreaPartitioner(); | ||
EqualAreaPartitioner(int N); | ||
EqualAreaPartitioner(int N, const eckit::Parametrisation& config); | ||
EqualAreaPartitioner(const eckit::Parametrisation& config); | ||
|
||
using Partitioner::partition; | ||
void partition(const Grid&, int part[]) const override; | ||
|
||
std::string type() const override { return "equal_area"; } | ||
|
||
private: | ||
EqualRegionsPartitioner partitioner_; | ||
}; | ||
|
||
|
||
} // namespace partitioner | ||
} // namespace detail | ||
} // namespace grid | ||
} // namespace atlas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters