-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
195 changed files
with
2,678 additions
and
650 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 @@ | ||
1.23.0 | ||
1.24.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
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,114 @@ | ||
/* | ||
* (C) Copyright 1996- 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 "mir/action/filter/AdjustWindsAtPoles.h" | ||
|
||
#include <limits> | ||
#include <memory> | ||
#include <ostream> | ||
|
||
#include "mir/action/context/Context.h" | ||
#include "mir/data/MIRField.h" | ||
#include "mir/repres/Iterator.h" | ||
#include "mir/repres/Representation.h" | ||
#include "mir/util/Exceptions.h" | ||
|
||
|
||
namespace mir::action { | ||
|
||
|
||
bool AdjustWindsAtPoles::sameAs(const Action& other) const { | ||
const auto* o = dynamic_cast<const AdjustWindsAtPoles*>(&other); | ||
return (o != nullptr); | ||
} | ||
|
||
|
||
void AdjustWindsAtPoles::print(std::ostream& out) const { | ||
out << "AdjustWindsAtPoles[]"; | ||
} | ||
|
||
|
||
void AdjustWindsAtPoles::execute(context::Context& ctx) const { | ||
auto& field = ctx.field(); | ||
|
||
ASSERT(field.dimensions() > 0); | ||
|
||
const auto missingValue = field.hasMissing() ? field.missingValue() : std::numeric_limits<double>::quiet_NaN(); | ||
|
||
const auto N = field.values(0).size(); | ||
ASSERT(N > 0); | ||
|
||
// find points at pole(s) | ||
const auto* representation(field.representation()); | ||
ASSERT(representation); | ||
|
||
std::vector<size_t> north; | ||
std::vector<size_t> south; | ||
|
||
for (const std::unique_ptr<repres::Iterator> it(representation->iterator()); it->next();) { | ||
const auto lat = it->pointUnrotated().lat(); | ||
if (lat == Latitude::NORTH_POLE) { | ||
north.push_back(it->index()); | ||
} | ||
else if (lat == Latitude::SOUTH_POLE) { | ||
south.push_back(it->index()); | ||
} | ||
} | ||
|
||
if (field.dimensions() % 2 == 0) { | ||
// two-component mode: set v to zero at pole(s) | ||
for (size_t i = 0; i < field.dimensions(); i += 2) { | ||
auto& u = field.direct(i); | ||
auto& v = field.direct(i + 1); | ||
ASSERT(u.size() == N); | ||
ASSERT(v.size() == N); | ||
|
||
for (const auto& indices : {north, south}) { | ||
for (const auto& idx : indices) { | ||
if (u[idx] == missingValue || v[idx] == missingValue) { | ||
u[idx] = missingValue; | ||
v[idx] = missingValue; | ||
} | ||
else { | ||
v[idx] = 0; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
else { | ||
// single-component mode: set u, v to zero at pole(s) | ||
for (size_t i = 0; i < field.dimensions(); ++i) { | ||
auto& v = field.direct(i); | ||
ASSERT(v.size() == N); | ||
|
||
for (const auto& indices : {north, south}) { | ||
for (const auto& idx : indices) { | ||
if (v[idx] != missingValue) { | ||
v[idx] = 0.; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
||
const char* AdjustWindsAtPoles::name() const { | ||
return "AdjustWindsAtPoles"; | ||
} | ||
|
||
|
||
static const ActionBuilder<AdjustWindsAtPoles> __action("filter.adjust-winds-at-poles"); | ||
|
||
|
||
} // namespace mir::action |
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,37 @@ | ||
/* | ||
* (C) Copyright 1996- 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 "mir/action/plan/Action.h" | ||
|
||
|
||
namespace mir::action { | ||
|
||
|
||
class AdjustWindsAtPoles : public Action { | ||
public: | ||
// -- Constructors | ||
|
||
using Action::Action; | ||
|
||
private: | ||
// -- Overridden methods | ||
|
||
void execute(context::Context&) const override; | ||
bool sameAs(const Action&) const override; | ||
const char* name() const override; | ||
void print(std::ostream&) const override; | ||
}; | ||
|
||
|
||
} // namespace mir::action |
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 |
---|---|---|
@@ -1,11 +1,36 @@ | ||
/* | ||
* (C) Copyright 1996- 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 "mir/mir_ecbuild_config.h" | ||
|
||
#include "mir/api/mir_version.h" | ||
|
||
|
||
#cmakedefine01 mir_HAVE_ATLAS | ||
#cmakedefine01 mir_HAVE_NETCDF | ||
#cmakedefine01 mir_HAVE_PNG | ||
#cmakedefine01 mir_HAVE_OMP | ||
|
||
|
||
constexpr bool _to_bool(int x = 0) { | ||
return x != 0; | ||
} | ||
|
||
constexpr bool HAVE_ATLAS = _to_bool(@mir_HAVE_ATLAS@); | ||
constexpr bool HAVE_NETCDF = _to_bool(@mir_HAVE_NETCDF@); | ||
constexpr bool HAVE_PNG = _to_bool(@mir_HAVE_PNG@); | ||
constexpr bool HAVE_OMP = _to_bool(@mir_HAVE_OMP@); | ||
|
||
constexpr bool HAVE_TESSELATION = _to_bool(@atlas_HAVE_TESSELATION@); | ||
constexpr bool HAVE_PROJ = _to_bool(@atlas_HAVE_PROJ@); |
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
Oops, something went wrong.