From 8cbccdba75a0ef5dc20e450c8f20ad608ace1192 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Tue, 25 Jul 2023 15:58:37 +0100 Subject: [PATCH 01/69] Initial commit --- .gitignore | 160 +++++++++++++++++++++++++++++++++++++++++++++++++++++ LICENSE | 21 +++++++ README.md | 1 + 3 files changed, 182 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..68bc17f9f --- /dev/null +++ b/.gitignore @@ -0,0 +1,160 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide +.pdm.toml + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ diff --git a/LICENSE b/LICENSE new file mode 100644 index 000000000..535669479 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Pedro Maciel + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 000000000..1f8d3b59f --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# healpix-ring \ No newline at end of file From 567ca55b61247b010a6e7ba8f99943e8a624d243 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Tue, 25 Jul 2023 16:06:48 +0100 Subject: [PATCH 02/69] Testing ring ordering --- healpix.py | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 healpix.py diff --git a/healpix.py b/healpix.py new file mode 100644 index 000000000..1a868eef6 --- /dev/null +++ b/healpix.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python3 + + +import numpy as np + + +class Healpix: + def __init__(self, Nside): + assert 0 < Nside + self._N = Nside + + pl = np.array([self.pl(i) for i in range(self.Nrow())], dtype=int) + self._pla = np.cumsum(pl) + + def Nside(self): + return self._N + + def Nrow(self): + return 4 * self._N - 1 + + def size(self): + return 12 * self._N * self._N + + def pl(self, i): + assert 0 <= i < self.Nrow(), f"i={i}" + if i >= self._N * 2: + return self.pl(self.Nrow() - 1 - i) + return self._N * min(4, i + 1) + + def row(self, count): + assert 0 <= count < self.size() + return np.searchsorted(self._pla, count, side="right") + + def latlon(self, count): + r = self.row(count) + dlat = 45.0 / self._N + dlon = 180.0 / self.pl(r) + + j = count - (self._pla[r - 1], 0)[r == 0] + lon = dlon * (2 * j + (0, 1)[r % 2]) + lat = 90.0 - dlat * (r + 1) + + return lat, lon + + +h = Healpix(4) + +for i in range(h.size()): + print(h.latlon(i)) From ae1f1acbbd6f078e3844c09e54ea1f2a8bd4bb05 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Tue, 25 Jul 2023 16:43:35 +0100 Subject: [PATCH 03/69] Testing ring ordering --- healpix.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/healpix.py b/healpix.py index 1a868eef6..ba0b3c2e1 100644 --- a/healpix.py +++ b/healpix.py @@ -4,7 +4,7 @@ import numpy as np -class Healpix: +class HEALPix: def __init__(self, Nside): assert 0 < Nside self._N = Nside @@ -36,14 +36,14 @@ def latlon(self, count): dlat = 45.0 / self._N dlon = 180.0 / self.pl(r) - j = count - (self._pla[r - 1], 0)[r == 0] + j = count if r == 0 else count - self._pla[r - 1] lon = dlon * (2 * j + (0, 1)[r % 2]) lat = 90.0 - dlat * (r + 1) return lat, lon -h = Healpix(4) +h = HEALPix(4) for i in range(h.size()): print(h.latlon(i)) From dead04e80944494e947006afa2c4ae4b8c8c8e28 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Thu, 3 Aug 2023 17:47:27 +0100 Subject: [PATCH 04/69] Testing ring ordering --- healpix.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/healpix.py b/healpix.py index ba0b3c2e1..65b180569 100644 --- a/healpix.py +++ b/healpix.py @@ -18,7 +18,7 @@ def Nside(self): def Nrow(self): return 4 * self._N - 1 - def size(self): + def __len__(self): return 12 * self._N * self._N def pl(self, i): @@ -27,23 +27,21 @@ def pl(self, i): return self.pl(self.Nrow() - 1 - i) return self._N * min(4, i + 1) - def row(self, count): - assert 0 <= count < self.size() - return np.searchsorted(self._pla, count, side="right") - def latlon(self, count): - r = self.row(count) + assert 0 <= count < len(self) + + i = np.searchsorted(self._pla, count, side="right") + j = count if i == 0 else count - self._pla[i - 1] dlat = 45.0 / self._N - dlon = 180.0 / self.pl(r) + dlon = 180.0 / self.pl(i) - j = count if r == 0 else count - self._pla[r - 1] - lon = dlon * (2 * j + (0, 1)[r % 2]) - lat = 90.0 - dlat * (r + 1) + lon = dlon * (2 * j + (0, 1)[i % 2]) + lat = 90.0 - dlat * (i + 1) return lat, lon h = HEALPix(4) -for i in range(h.size()): +for i in range(len(h)): print(h.latlon(i)) From f08eddabe665681e8bd8adad6dc3d316c39886d3 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Thu, 3 Aug 2023 20:46:45 +0100 Subject: [PATCH 05/69] Testing nest ordering --- .clang-format | 106 +++++++++++++++++++++++++++++ .gitignore | 3 + HEALPix.cc | 185 ++++++++++++++++++++++++++++++++++++++++++++++++++ HEALPix.h | 19 ++++++ main.cc | 28 ++++++++ 5 files changed, 341 insertions(+) create mode 100644 .clang-format create mode 100644 HEALPix.cc create mode 100644 HEALPix.h create mode 100644 main.cc diff --git a/.clang-format b/.clang-format new file mode 100644 index 000000000..3cc0f3f0c --- /dev/null +++ b/.clang-format @@ -0,0 +1,106 @@ +--- +Language: Cpp +AccessModifierOffset: -4 +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: true +AlignConsecutiveDeclarations: false +AlignEscapedNewlines: Left +AlignOperands: true +AlignTrailingComments: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortBlocksOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: Inline +AllowShortIfStatementsOnASingleLine: false +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: true +AlwaysBreakTemplateDeclarations: true +BinPackArguments: true +BinPackParameters: true +BraceWrapping: + AfterClass: false + AfterControlStatement: false + AfterEnum: true + AfterFunction: false + AfterNamespace: false + AfterObjCDeclaration: false + AfterStruct: false + AfterUnion: false + BeforeCatch: true + BeforeElse: true + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Custom +BreakBeforeInheritanceComma: false +BreakBeforeTernaryOperators: true +BreakConstructorInitializersBeforeComma: false +BreakConstructorInitializers: AfterColon +BreakAfterJavaFieldAnnotations: false +BreakStringLiterals: true +ColumnLimit: 120 +CommentPragmas: '^ IWYU pragma:' +CompactNamespaces: false +ConstructorInitializerAllOnOneLineOrOnePerLine: true +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DerivePointerAlignment: false +DisableFormat: false +ExperimentalAutoDetectBinPacking: false +FixNamespaceComments: true +ForEachMacros: + - foreach + - Q_FOREACH + - BOOST_FOREACH +IncludeCategories: + - Regex: '^<.*\.h>' + Priority: 1 + - Regex: '^<.*' + Priority: 2 + - Regex: '.*' + Priority: 3 +IncludeIsMainRegex: '([-_](test|unittest))?$' +IndentCaseLabels: true +IndentWidth: 4 +IndentWrappedFunctionNames: false +JavaScriptQuotes: Leave +JavaScriptWrapImports: true +KeepEmptyLinesAtTheStartOfBlocks: true +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 2 +NamespaceIndentation: None +ObjCBlockIndentWidth: 2 +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: false +PenaltyBreakAssignment: 2 +PenaltyBreakBeforeFirstCallParameter: 1 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 200 +PointerAlignment: Left +ReflowComments: true +SortIncludes: true +SortUsingDeclarations: true +SpaceAfterCStyleCast: false +SpaceAfterTemplateKeyword: true +SpaceBeforeAssignmentOperators: true +SpaceBeforeParens: ControlStatements +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 2 +SpacesInAngles: false +SpacesInContainerLiterals: true +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +Standard: Auto +TabWidth: 4 +UseTab: Never +... diff --git a/.gitignore b/.gitignore index 68bc17f9f..0ab393647 100644 --- a/.gitignore +++ b/.gitignore @@ -158,3 +158,6 @@ cython_debug/ # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/ + +.gitignore +CMakeLists.txt* diff --git a/HEALPix.cc b/HEALPix.cc new file mode 100644 index 000000000..8ec8a3395 --- /dev/null +++ b/HEALPix.cc @@ -0,0 +1,185 @@ +#include "HEALPix.h" + +#include +#include +#include +#include +#include +#include + + +namespace { + + +struct CodecFijNest { + static constexpr uint64_t __masks[] = {0x00000000ffffffff, 0x0000ffff0000ffff, 0x00ff00ff00ff00ff, + 0x0f0f0f0f0f0f0f0f, 0x3333333333333333, 0x5555555555555555}; + + inline static int nest_encode_bits(int n) { + auto b = static_cast(n) & __masks[0]; + b = (b ^ (b << 16)) & __masks[1]; + b = (b ^ (b << 8)) & __masks[2]; + b = (b ^ (b << 4)) & __masks[3]; + b = (b ^ (b << 2)) & __masks[4]; + b = (b ^ (b << 1)) & __masks[5]; + return static_cast(b); + } + + inline static int nest_decode_bits(int n) { + auto b = static_cast(n) & __masks[5]; + b = (b ^ (b >> 1)) & __masks[4]; + b = (b ^ (b >> 2)) & __masks[3]; + b = (b ^ (b >> 4)) & __masks[2]; + b = (b ^ (b >> 8)) & __masks[1]; + b = (b ^ (b >> 16)) & __masks[0]; + return static_cast(b); + } + + static std::tuple nest_to_fij(int n, int k) { + assert(0 <= n); + auto f = n >> (2 * k); // f = n / (Nside * Nside) + n &= (1 << (2 * k)) - 1; // n = n % (Nside * Nside) + auto i = nest_decode_bits(n); + auto j = nest_decode_bits(n >> 1); + return {f, i, j}; + } + + static int fij_to_nest(int f, int i, int j, int k) { + return (f << (2 * k)) + nest_encode_bits(i) + (nest_encode_bits(j) << 1); + } +}; + + +inline int sqrt(int n) { + return static_cast(std::sqrt(static_cast(n) + 0.5)); +} + + +// for division result within [0; 3] +inline int div_03(int a, int b) { + int t = (a >= (b << 1)) ? 1 : 0; + a -= t * (b << 1); + return (t << 1) + (a >= b ? 1 : 0); +} + + +inline bool is_power_of_2(int n) { + return std::bitset(n).count() == 1; +} + + +inline int pll(int f) { + constexpr int __pll[] = {1, 3, 5, 7, 0, 2, 4, 6, 1, 3, 5, 7}; + return __pll[f]; +} + + +} // unnamed namespace + + +HEALPix::HEALPix(int Nside) : + Nside_(Nside), + Npix_(size()), + Ncap_((Nside * (Nside - 1)) << 1), + k_(is_power_of_2(Nside_) ? static_cast(std::log2(Nside)) : -1) { + assert(0 <= k_); // (specific to nested ordering) + assert(0 < Nside_); +} + + +int HEALPix::ring_to_nest(int r) const { + auto to_nest = [&](int f, //!< base pixel index + int ring, //!< 1-based ring number + int Nring, //!< number of pixels in ring + int phi, //!< index in longitude + int shift //!< if ring's first pixel is not at phi=0 + ) -> int { + int r = ((2 + (f >> 2)) << k_) - ring - 1; + int p = 2 * phi - pll(f) * Nring - shift - 1; + if (p >= 2 * Nside_) { + p -= 8 * Nside_; + } + + int i = (r + p) >> 1; + int j = (r - p) >> 1; + + assert(f < 12 && i < Nside_ && j < Nside_); + return CodecFijNest::fij_to_nest(f, i, j, k_); + }; + + if (r < Ncap_) { + // North polar cap + int Nring = (1 + sqrt(2 * r + 1)) >> 1; + int phi = 1 + r - 2 * Nring * (Nring - 1); + int r = Nring; + int f = div_03(phi - 1, Nring); + + return to_nest(f, r, Nring, phi, 0); + } + + if (Npix_ - Ncap_ <= r) { + // South polar cap + int Nring = (1 + sqrt(2 * Npix_ - 2 * r - 1)) >> 1; + int phi = 1 + r + 2 * Nring * (Nring - 1) + 4 * Nring - Npix_; + int ring = 4 * Nside_ - Nring; // (from South pole) + int f = div_03(phi - 1, Nring) + 8; + + return to_nest(f, ring, Nring, phi, 0); + } + + // Equatorial belt + int ip = r - Ncap_; + int tmp = ip >> (k_ + 2); + + int Nring = Nside_; + int phi = ip - tmp * 4 * Nside_ + 1; + int ring = tmp + Nside_; + + int ifm = 1 + ((phi - 1 - ((1 + tmp) >> 1)) >> k_); + int ifp = 1 + ((phi - 1 - ((1 - tmp + 2 * Nside_) >> 1)) >> k_); + int f = (ifp == ifm) ? (ifp | 4) : ((ifp < ifm) ? ifp : (ifm + 8)); + + return to_nest(f, ring, Nring, phi, ring & 1); +} + + +int HEALPix::nest_to_ring(int n) const { + auto [f, i, j] = CodecFijNest::nest_to_fij(n, k_); + assert(f < 12 && i < Nside_ && j < Nside_); + + auto to_ring_local = [&](int f, int i, int j, + int Nring, //!< number of pixels in ring + int shift //!< if ring's first pixel is/is not at phi=0 + ) -> int { + Nring >>= 2; + int r = (pll(f) * Nring + i - j + 1 + shift) / 2 - 1; + assert(r < 4 * Nring); + + return r < 0 ? r + 4 * Nside_ : r; + }; + + const int ring = ((f >> 2) + 2) * Nside_ - i - j - 1; // 1-based ring number + if (ring < Nside_) { + // North polar cap + int Nring = 4 * ring; + int r0 = 2 * ring * (ring - 1); // index of first ring pixel (ring numbering) + + return r0 + to_ring_local(f, i, j, Nring, 0); + } + + if (ring < 3 * Nside_) { + // South polar cap + int Nring = 4 * Nside_; + int r0 = Ncap_ + (ring - Nside_) * Nring; // index of first ring pixel (ring numbering) + int shift = (ring - Nside_) & 1; + + return r0 + to_ring_local(f, i, j, Nring, shift); + } + + // Equatorial belt + int N = 4 * Nside_ - ring; + int Nring = 4 * N; + int r0 = Npix_ - 2 * N * (N + 1); // index of first ring pixel (ring numbering) + + return r0 + to_ring_local(f, i, j, Nring, 0); +} diff --git a/HEALPix.h b/HEALPix.h new file mode 100644 index 000000000..130d36d87 --- /dev/null +++ b/HEALPix.h @@ -0,0 +1,19 @@ +#pragma once + + +class HEALPix { +public: + explicit HEALPix(int Nside); + + int size() const { return 12 * Nside_ * Nside_; } + int nside() const { return Nside_; } + + int nest_to_ring(int) const; + int ring_to_nest(int) const; + +private: + const int Nside_; // up to 2^13 + const int Npix_; + const int Ncap_; + const int k_; +}; diff --git a/main.cc b/main.cc new file mode 100644 index 000000000..e763ff0e6 --- /dev/null +++ b/main.cc @@ -0,0 +1,28 @@ + +#include +#include +#include // for std::stoi + +#include "HEALPix.h" + + +int main(int argc, char* argv[]) { + for (int a = 1; a < argc; ++a) { + int nside = std::stoi(argv[a]); + + HEALPix h(nside); + + std::cout << "Nside=" << h.nside() << "\n" + << "r->n\t| n->r" << std::endl; + + for (int i = 0; i < h.size(); ++i) { + auto n = h.ring_to_nest(i); + auto r = h.nest_to_ring(i); + assert(i == h.ring_to_nest(r) && i == h.nest_to_ring(n)); + + std::cout << i << " -> " << n << "\t| " << i << " -> " << r << std::endl; + } + } + + return 0; +} From e846ef7224b867e7408f88eb33005c47a0373095 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Mon, 26 Feb 2024 13:55:48 +0000 Subject: [PATCH 06/69] MIR-642 GRIB2: New parameter encodings for WMO conforming snowfall water equivalent parameters --- etc/mir/parameter-class.yaml | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/etc/mir/parameter-class.yaml b/etc/mir/parameter-class.yaml index 44c06ab65..d2e462e82 100644 --- a/etc/mir/parameter-class.yaml +++ b/etc/mir/parameter-class.yaml @@ -776,7 +776,6 @@ index: - 260539 # Fire detection indicator index.associated: - - 3059 # Precipitation rate - 129029 # Type of low vegetation gradient - 129030 # Type of high vegetation gradient - 129043 # Soil type gradient @@ -786,17 +785,6 @@ index.associated: - 200029 # Type of low vegetation difference - 200030 # Type of high vegetation difference - 200043 # Soil type difference - - 228217 # Instantaneous large-scale surface precipitation fraction - - 228218 # Convective rain rate - - 228219 # Large scale rain rate - - 228220 # Convective snowfall rate water equivalent - - 228221 # Large scale snowfall rate water equivalent - - 228222 # Maximum total precipitation rate in the last 3 hours - - 228223 # Minimum total precipitation rate in the last 3 hours - - 228224 # Maximum total precipitation rate in the last 6 hours - - 228225 # Minimum total precipitation rate in the last 6 hours - - 228226 # Maximum total precipitation rate since previous post-processing - - 228227 # Minimum total precipitation rate since previous post-processing intensity: - 1 # Stream function @@ -2630,6 +2618,8 @@ numerics.accumulated: - 231041 # Time-integrated total lightning flash density - 231053 # Snow depth water equivalent on roof - 231054 # Snow depth water equivalent on road + - 231057 # Convective snowfall water equivalent + - 231058 # Large-scale snowfall water equivalent - 233000 # Time-integrated total column vertically-integrated eastward geopotential flux - 233001 # Time-integrated total column vertically-integrated northward geopotential flux - 233002 # Time-integrated total column vertically-integrated divergence of water geopotential flux @@ -3541,6 +3531,7 @@ rate.energy-flux: rate.mass-flux: - 232 # Instantaneous moisture flux + - 3059 # Precipitation rate - 3062 # large scale precipitation - 3063 # Convective precipitation (water) - 3064 # Snow fall rate water equivalent @@ -4155,6 +4146,16 @@ rate.mass-flux: - 228143 # Convective precipitation - 228144 # Snow Fall water equivalent - 228205 # Water runoff and drainage + - 228218 # Convective rain rate + - 228219 # Large scale rain rate + - 228220 # Convective snowfall rate water equivalent + - 228221 # Large scale snowfall rate water equivalent + - 228222 # Maximum total precipitation rate in the last 3 hours + - 228223 # Minimum total precipitation rate in the last 3 hours + - 228224 # Maximum total precipitation rate in the last 6 hours + - 228225 # Minimum total precipitation rate in the last 6 hours + - 228226 # Maximum total precipitation rate since previous post-processing + - 228227 # Minimum total precipitation rate since previous post-processing - 228228 # Total Precipitation - 230044 # Snow evaporation (variable resolution) - 230045 # Snowmelt (variable resolution) @@ -4172,6 +4173,8 @@ rate.mass-flux: - 231042 # Maximum total column integrated graupel (snow pellets) - 231053 # Snow depth water equivalent on roof - 231054 # Snow depth water equivalent on road + - 231057 # Convective snowfall water equivalent + - 231058 # Large-scale snowfall water equivalent - 233014 # Time integrated, vertically integrated divergence of mass flux - 233015 # Time integrated, vertically integrated eastward mass flux - 233016 # Time integrated, vertically integrated northward mass flux @@ -4877,6 +4880,7 @@ ratio.fraction: - 228034 # Fraction of convective precipitation cover - 228091 # Canopy cover fraction - 228092 # Soil texture fraction + - 228217 # Instantaneous large-scale surface precipitation fraction - 228244 # Surface albedo of direct radiation - 228245 # Surface albedo of diffuse radiation - 228248 # Surface short wave-effective total cloudiness From 1248811e8dd656b71706e5290e4c2f8ddba20537 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Tue, 27 Feb 2024 09:27:20 +0000 Subject: [PATCH 07/69] reorganize before merge --- .clang-format | 106 ------------ .gitignore | 163 ------------------ LICENSE | 21 --- README.md | 1 - healpix.py | 47 ----- main.cc | 28 --- .../mir/repres/proxy/HEALPixReorder.cc | 0 .../mir/repres/proxy/HEALPixReorder.h | 0 8 files changed, 366 deletions(-) delete mode 100644 .clang-format delete mode 100644 .gitignore delete mode 100644 LICENSE delete mode 100644 README.md delete mode 100644 healpix.py delete mode 100644 main.cc rename HEALPix.cc => src/mir/repres/proxy/HEALPixReorder.cc (100%) rename HEALPix.h => src/mir/repres/proxy/HEALPixReorder.h (100%) diff --git a/.clang-format b/.clang-format deleted file mode 100644 index 3cc0f3f0c..000000000 --- a/.clang-format +++ /dev/null @@ -1,106 +0,0 @@ ---- -Language: Cpp -AccessModifierOffset: -4 -AlignAfterOpenBracket: Align -AlignConsecutiveAssignments: true -AlignConsecutiveDeclarations: false -AlignEscapedNewlines: Left -AlignOperands: true -AlignTrailingComments: true -AllowAllParametersOfDeclarationOnNextLine: true -AllowShortBlocksOnASingleLine: false -AllowShortCaseLabelsOnASingleLine: false -AllowShortFunctionsOnASingleLine: Inline -AllowShortIfStatementsOnASingleLine: false -AllowShortLoopsOnASingleLine: false -AlwaysBreakAfterDefinitionReturnType: None -AlwaysBreakAfterReturnType: None -AlwaysBreakBeforeMultilineStrings: true -AlwaysBreakTemplateDeclarations: true -BinPackArguments: true -BinPackParameters: true -BraceWrapping: - AfterClass: false - AfterControlStatement: false - AfterEnum: true - AfterFunction: false - AfterNamespace: false - AfterObjCDeclaration: false - AfterStruct: false - AfterUnion: false - BeforeCatch: true - BeforeElse: true - IndentBraces: false - SplitEmptyFunction: true - SplitEmptyRecord: true - SplitEmptyNamespace: true -BreakBeforeBinaryOperators: None -BreakBeforeBraces: Custom -BreakBeforeInheritanceComma: false -BreakBeforeTernaryOperators: true -BreakConstructorInitializersBeforeComma: false -BreakConstructorInitializers: AfterColon -BreakAfterJavaFieldAnnotations: false -BreakStringLiterals: true -ColumnLimit: 120 -CommentPragmas: '^ IWYU pragma:' -CompactNamespaces: false -ConstructorInitializerAllOnOneLineOrOnePerLine: true -ConstructorInitializerIndentWidth: 4 -ContinuationIndentWidth: 4 -Cpp11BracedListStyle: true -DerivePointerAlignment: false -DisableFormat: false -ExperimentalAutoDetectBinPacking: false -FixNamespaceComments: true -ForEachMacros: - - foreach - - Q_FOREACH - - BOOST_FOREACH -IncludeCategories: - - Regex: '^<.*\.h>' - Priority: 1 - - Regex: '^<.*' - Priority: 2 - - Regex: '.*' - Priority: 3 -IncludeIsMainRegex: '([-_](test|unittest))?$' -IndentCaseLabels: true -IndentWidth: 4 -IndentWrappedFunctionNames: false -JavaScriptQuotes: Leave -JavaScriptWrapImports: true -KeepEmptyLinesAtTheStartOfBlocks: true -MacroBlockBegin: '' -MacroBlockEnd: '' -MaxEmptyLinesToKeep: 2 -NamespaceIndentation: None -ObjCBlockIndentWidth: 2 -ObjCSpaceAfterProperty: false -ObjCSpaceBeforeProtocolList: false -PenaltyBreakAssignment: 2 -PenaltyBreakBeforeFirstCallParameter: 1 -PenaltyBreakComment: 300 -PenaltyBreakFirstLessLess: 120 -PenaltyBreakString: 1000 -PenaltyExcessCharacter: 1000000 -PenaltyReturnTypeOnItsOwnLine: 200 -PointerAlignment: Left -ReflowComments: true -SortIncludes: true -SortUsingDeclarations: true -SpaceAfterCStyleCast: false -SpaceAfterTemplateKeyword: true -SpaceBeforeAssignmentOperators: true -SpaceBeforeParens: ControlStatements -SpaceInEmptyParentheses: false -SpacesBeforeTrailingComments: 2 -SpacesInAngles: false -SpacesInContainerLiterals: true -SpacesInCStyleCastParentheses: false -SpacesInParentheses: false -SpacesInSquareBrackets: false -Standard: Auto -TabWidth: 4 -UseTab: Never -... diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 0ab393647..000000000 --- a/.gitignore +++ /dev/null @@ -1,163 +0,0 @@ -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -wheels/ -share/python-wheels/ -*.egg-info/ -.installed.cfg -*.egg -MANIFEST - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.nox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*.cover -*.py,cover -.hypothesis/ -.pytest_cache/ -cover/ - -# Translations -*.mo -*.pot - -# Django stuff: -*.log -local_settings.py -db.sqlite3 -db.sqlite3-journal - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -.pybuilder/ -target/ - -# Jupyter Notebook -.ipynb_checkpoints - -# IPython -profile_default/ -ipython_config.py - -# pyenv -# For a library or package, you might want to ignore these files since the code is -# intended to run in multiple environments; otherwise, check them in: -# .python-version - -# pipenv -# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. -# However, in case of collaboration, if having platform-specific dependencies or dependencies -# having no cross-platform support, pipenv may install dependencies that don't work, or not -# install all needed dependencies. -#Pipfile.lock - -# poetry -# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. -# This is especially recommended for binary packages to ensure reproducibility, and is more -# commonly ignored for libraries. -# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control -#poetry.lock - -# pdm -# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. -#pdm.lock -# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it -# in version control. -# https://pdm.fming.dev/#use-with-ide -.pdm.toml - -# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm -__pypackages__/ - -# Celery stuff -celerybeat-schedule -celerybeat.pid - -# SageMath parsed files -*.sage.py - -# Environments -.env -.venv -env/ -venv/ -ENV/ -env.bak/ -venv.bak/ - -# Spyder project settings -.spyderproject -.spyproject - -# Rope project settings -.ropeproject - -# mkdocs documentation -/site - -# mypy -.mypy_cache/ -.dmypy.json -dmypy.json - -# Pyre type checker -.pyre/ - -# pytype static type analyzer -.pytype/ - -# Cython debug symbols -cython_debug/ - -# PyCharm -# JetBrains specific template is maintained in a separate JetBrains.gitignore that can -# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore -# and can be added to the global gitignore or merged into this file. For a more nuclear -# option (not recommended) you can uncomment the following to ignore the entire idea folder. -#.idea/ - -.gitignore -CMakeLists.txt* diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 535669479..000000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2023 Pedro Maciel - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/README.md b/README.md deleted file mode 100644 index 1f8d3b59f..000000000 --- a/README.md +++ /dev/null @@ -1 +0,0 @@ -# healpix-ring \ No newline at end of file diff --git a/healpix.py b/healpix.py deleted file mode 100644 index 65b180569..000000000 --- a/healpix.py +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env python3 - - -import numpy as np - - -class HEALPix: - def __init__(self, Nside): - assert 0 < Nside - self._N = Nside - - pl = np.array([self.pl(i) for i in range(self.Nrow())], dtype=int) - self._pla = np.cumsum(pl) - - def Nside(self): - return self._N - - def Nrow(self): - return 4 * self._N - 1 - - def __len__(self): - return 12 * self._N * self._N - - def pl(self, i): - assert 0 <= i < self.Nrow(), f"i={i}" - if i >= self._N * 2: - return self.pl(self.Nrow() - 1 - i) - return self._N * min(4, i + 1) - - def latlon(self, count): - assert 0 <= count < len(self) - - i = np.searchsorted(self._pla, count, side="right") - j = count if i == 0 else count - self._pla[i - 1] - dlat = 45.0 / self._N - dlon = 180.0 / self.pl(i) - - lon = dlon * (2 * j + (0, 1)[i % 2]) - lat = 90.0 - dlat * (i + 1) - - return lat, lon - - -h = HEALPix(4) - -for i in range(len(h)): - print(h.latlon(i)) diff --git a/main.cc b/main.cc deleted file mode 100644 index e763ff0e6..000000000 --- a/main.cc +++ /dev/null @@ -1,28 +0,0 @@ - -#include -#include -#include // for std::stoi - -#include "HEALPix.h" - - -int main(int argc, char* argv[]) { - for (int a = 1; a < argc; ++a) { - int nside = std::stoi(argv[a]); - - HEALPix h(nside); - - std::cout << "Nside=" << h.nside() << "\n" - << "r->n\t| n->r" << std::endl; - - for (int i = 0; i < h.size(); ++i) { - auto n = h.ring_to_nest(i); - auto r = h.nest_to_ring(i); - assert(i == h.ring_to_nest(r) && i == h.nest_to_ring(n)); - - std::cout << i << " -> " << n << "\t| " << i << " -> " << r << std::endl; - } - } - - return 0; -} diff --git a/HEALPix.cc b/src/mir/repres/proxy/HEALPixReorder.cc similarity index 100% rename from HEALPix.cc rename to src/mir/repres/proxy/HEALPixReorder.cc diff --git a/HEALPix.h b/src/mir/repres/proxy/HEALPixReorder.h similarity index 100% rename from HEALPix.h rename to src/mir/repres/proxy/HEALPixReorder.h From d3d2810ec704b540285c422500ffcf10d0e7c6c8 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Tue, 27 Feb 2024 09:39:54 +0000 Subject: [PATCH 08/69] MIR-644 HEALPix::reorder --- src/mir/repres/proxy/HEALPix.cc | 200 ++++++++++++++++++++++++- src/mir/repres/proxy/HEALPixReorder.cc | 185 ----------------------- src/mir/repres/proxy/HEALPixReorder.h | 19 --- 3 files changed, 197 insertions(+), 207 deletions(-) delete mode 100644 src/mir/repres/proxy/HEALPixReorder.cc delete mode 100644 src/mir/repres/proxy/HEALPixReorder.h diff --git a/src/mir/repres/proxy/HEALPix.cc b/src/mir/repres/proxy/HEALPix.cc index a811f25db..7fff8ef3b 100644 --- a/src/mir/repres/proxy/HEALPix.cc +++ b/src/mir/repres/proxy/HEALPix.cc @@ -12,9 +12,12 @@ #include "mir/repres/proxy/HEALPix.h" -#include -#include +#include +#include #include +#include +#include +#include #include "eckit/types/FloatCompare.h" @@ -24,13 +27,204 @@ #include "mir/util/Atlas.h" #include "mir/util/Exceptions.h" #include "mir/util/Grib.h" -#include "mir/util/Log.h" #include "mir/util/MeshGeneratorParameters.h" namespace mir::repres::proxy { +namespace { + + +struct CodecFijNest { + static constexpr uint64_t __masks[] = {0x00000000ffffffff, 0x0000ffff0000ffff, 0x00ff00ff00ff00ff, + 0x0f0f0f0f0f0f0f0f, 0x3333333333333333, 0x5555555555555555}; + + inline static int nest_encode_bits(int n) { + auto b = static_cast(n) & __masks[0]; + b = (b ^ (b << 16)) & __masks[1]; + b = (b ^ (b << 8)) & __masks[2]; + b = (b ^ (b << 4)) & __masks[3]; + b = (b ^ (b << 2)) & __masks[4]; + b = (b ^ (b << 1)) & __masks[5]; + return static_cast(b); + } + + inline static int nest_decode_bits(int n) { + auto b = static_cast(n) & __masks[5]; + b = (b ^ (b >> 1)) & __masks[4]; + b = (b ^ (b >> 2)) & __masks[3]; + b = (b ^ (b >> 4)) & __masks[2]; + b = (b ^ (b >> 8)) & __masks[1]; + b = (b ^ (b >> 16)) & __masks[0]; + return static_cast(b); + } + + static std::tuple nest_to_fij(int n, int k) { + ASSERT(0 <= n); + auto f = n >> (2 * k); // f = n / (Nside * Nside) + n &= (1 << (2 * k)) - 1; // n = n % (Nside * Nside) + auto i = nest_decode_bits(n); + auto j = nest_decode_bits(n >> 1); + return {f, i, j}; + } + + static int fij_to_nest(int f, int i, int j, int k) { + return (f << (2 * k)) + nest_encode_bits(i) + (nest_encode_bits(j) << 1); + } +}; + + +inline int sqrt(int n) { + return static_cast(std::sqrt(static_cast(n) + 0.5)); +} + + +// for division result within [0; 3] +inline int div_03(int a, int b) { + int t = (a >= (b << 1)) ? 1 : 0; + a -= t * (b << 1); + return (t << 1) + (a >= b ? 1 : 0); +} + + +inline bool is_power_of_2(int n) { + return std::bitset(n).count() == 1; +} + + +inline int pll(int f) { + constexpr int __pll[] = {1, 3, 5, 7, 0, 2, 4, 6, 1, 3, 5, 7}; + return __pll[f]; +} + + +class Reorder { +public: + explicit Reorder(int Nside) : + Nside_(Nside), + Npix_(size()), + Ncap_((Nside * (Nside - 1)) << 1), + k_(is_power_of_2(Nside_) ? static_cast(std::log2(Nside)) : -1) { + ASSERT(0 <= k_); // (specific to nested ordering) + ASSERT(0 < Nside_); + } + + int size() const { return 12 * Nside_ * Nside_; } + int nside() const { return Nside_; } + + int nest_to_ring(int) const; + int ring_to_nest(int) const; + +private: + const int Nside_; // up to 2^13 + const int Npix_; + const int Ncap_; + const int k_; +}; + + +int Reorder::ring_to_nest(int r) const { + auto to_nest = [&](int f, //!< base pixel index + int ring, //!< 1-based ring number + int Nring, //!< number of pixels in ring + int phi, //!< index in longitude + int shift //!< if ring's first pixel is not at phi=0 + ) -> int { + int r = ((2 + (f >> 2)) << k_) - ring - 1; + int p = 2 * phi - pll(f) * Nring - shift - 1; + if (p >= 2 * Nside_) { + p -= 8 * Nside_; + } + + int i = (r + p) >> 1; + int j = (r - p) >> 1; + + ASSERT(f < 12 && i < Nside_ && j < Nside_); + return CodecFijNest::fij_to_nest(f, i, j, k_); + }; + + if (r < Ncap_) { + // North polar cap + int Nring = (1 + sqrt(2 * r + 1)) >> 1; + int phi = 1 + r - 2 * Nring * (Nring - 1); + int r = Nring; + int f = div_03(phi - 1, Nring); + + return to_nest(f, r, Nring, phi, 0); + } + + if (Npix_ - Ncap_ <= r) { + // South polar cap + int Nring = (1 + sqrt(2 * Npix_ - 2 * r - 1)) >> 1; + int phi = 1 + r + 2 * Nring * (Nring - 1) + 4 * Nring - Npix_; + int ring = 4 * Nside_ - Nring; // (from South pole) + int f = div_03(phi - 1, Nring) + 8; + + return to_nest(f, ring, Nring, phi, 0); + } + + // Equatorial belt + int ip = r - Ncap_; + int tmp = ip >> (k_ + 2); + + int Nring = Nside_; + int phi = ip - tmp * 4 * Nside_ + 1; + int ring = tmp + Nside_; + + int ifm = 1 + ((phi - 1 - ((1 + tmp) >> 1)) >> k_); + int ifp = 1 + ((phi - 1 - ((1 - tmp + 2 * Nside_) >> 1)) >> k_); + int f = (ifp == ifm) ? (ifp | 4) : ((ifp < ifm) ? ifp : (ifm + 8)); + + return to_nest(f, ring, Nring, phi, ring & 1); +} + + +int Reorder::nest_to_ring(int n) const { + auto [f, i, j] = CodecFijNest::nest_to_fij(n, k_); + ASSERT(f < 12 && i < Nside_ && j < Nside_); + + auto to_ring_local = [&](int f, int i, int j, + int Nring, //!< number of pixels in ring + int shift //!< if ring's first pixel is/is not at phi=0 + ) -> int { + Nring >>= 2; + int r = (pll(f) * Nring + i - j + 1 + shift) / 2 - 1; + ASSERT(r < 4 * Nring); + + return r < 0 ? r + 4 * Nside_ : r; + }; + + const int ring = ((f >> 2) + 2) * Nside_ - i - j - 1; // 1-based ring number + if (ring < Nside_) { + // North polar cap + int Nring = 4 * ring; + int r0 = 2 * ring * (ring - 1); // index of first ring pixel (ring numbering) + + return r0 + to_ring_local(f, i, j, Nring, 0); + } + + if (ring < 3 * Nside_) { + // South polar cap + int Nring = 4 * Nside_; + int r0 = Ncap_ + (ring - Nside_) * Nring; // index of first ring pixel (ring numbering) + int shift = (ring - Nside_) & 1; + + return r0 + to_ring_local(f, i, j, Nring, shift); + } + + // Equatorial belt + int N = 4 * Nside_ - ring; + int Nring = 4 * N; + int r0 = Npix_ - 2 * N * (N + 1); // index of first ring pixel (ring numbering) + + return r0 + to_ring_local(f, i, j, Nring, 0); +} + + +} // namespace + + HEALPix::HEALPix(size_t Nside, const std::string& orderingConvention) : Nside_(Nside), orderingConvention_(orderingConvention) { ASSERT(Nside_ > 0); diff --git a/src/mir/repres/proxy/HEALPixReorder.cc b/src/mir/repres/proxy/HEALPixReorder.cc deleted file mode 100644 index 8ec8a3395..000000000 --- a/src/mir/repres/proxy/HEALPixReorder.cc +++ /dev/null @@ -1,185 +0,0 @@ -#include "HEALPix.h" - -#include -#include -#include -#include -#include -#include - - -namespace { - - -struct CodecFijNest { - static constexpr uint64_t __masks[] = {0x00000000ffffffff, 0x0000ffff0000ffff, 0x00ff00ff00ff00ff, - 0x0f0f0f0f0f0f0f0f, 0x3333333333333333, 0x5555555555555555}; - - inline static int nest_encode_bits(int n) { - auto b = static_cast(n) & __masks[0]; - b = (b ^ (b << 16)) & __masks[1]; - b = (b ^ (b << 8)) & __masks[2]; - b = (b ^ (b << 4)) & __masks[3]; - b = (b ^ (b << 2)) & __masks[4]; - b = (b ^ (b << 1)) & __masks[5]; - return static_cast(b); - } - - inline static int nest_decode_bits(int n) { - auto b = static_cast(n) & __masks[5]; - b = (b ^ (b >> 1)) & __masks[4]; - b = (b ^ (b >> 2)) & __masks[3]; - b = (b ^ (b >> 4)) & __masks[2]; - b = (b ^ (b >> 8)) & __masks[1]; - b = (b ^ (b >> 16)) & __masks[0]; - return static_cast(b); - } - - static std::tuple nest_to_fij(int n, int k) { - assert(0 <= n); - auto f = n >> (2 * k); // f = n / (Nside * Nside) - n &= (1 << (2 * k)) - 1; // n = n % (Nside * Nside) - auto i = nest_decode_bits(n); - auto j = nest_decode_bits(n >> 1); - return {f, i, j}; - } - - static int fij_to_nest(int f, int i, int j, int k) { - return (f << (2 * k)) + nest_encode_bits(i) + (nest_encode_bits(j) << 1); - } -}; - - -inline int sqrt(int n) { - return static_cast(std::sqrt(static_cast(n) + 0.5)); -} - - -// for division result within [0; 3] -inline int div_03(int a, int b) { - int t = (a >= (b << 1)) ? 1 : 0; - a -= t * (b << 1); - return (t << 1) + (a >= b ? 1 : 0); -} - - -inline bool is_power_of_2(int n) { - return std::bitset(n).count() == 1; -} - - -inline int pll(int f) { - constexpr int __pll[] = {1, 3, 5, 7, 0, 2, 4, 6, 1, 3, 5, 7}; - return __pll[f]; -} - - -} // unnamed namespace - - -HEALPix::HEALPix(int Nside) : - Nside_(Nside), - Npix_(size()), - Ncap_((Nside * (Nside - 1)) << 1), - k_(is_power_of_2(Nside_) ? static_cast(std::log2(Nside)) : -1) { - assert(0 <= k_); // (specific to nested ordering) - assert(0 < Nside_); -} - - -int HEALPix::ring_to_nest(int r) const { - auto to_nest = [&](int f, //!< base pixel index - int ring, //!< 1-based ring number - int Nring, //!< number of pixels in ring - int phi, //!< index in longitude - int shift //!< if ring's first pixel is not at phi=0 - ) -> int { - int r = ((2 + (f >> 2)) << k_) - ring - 1; - int p = 2 * phi - pll(f) * Nring - shift - 1; - if (p >= 2 * Nside_) { - p -= 8 * Nside_; - } - - int i = (r + p) >> 1; - int j = (r - p) >> 1; - - assert(f < 12 && i < Nside_ && j < Nside_); - return CodecFijNest::fij_to_nest(f, i, j, k_); - }; - - if (r < Ncap_) { - // North polar cap - int Nring = (1 + sqrt(2 * r + 1)) >> 1; - int phi = 1 + r - 2 * Nring * (Nring - 1); - int r = Nring; - int f = div_03(phi - 1, Nring); - - return to_nest(f, r, Nring, phi, 0); - } - - if (Npix_ - Ncap_ <= r) { - // South polar cap - int Nring = (1 + sqrt(2 * Npix_ - 2 * r - 1)) >> 1; - int phi = 1 + r + 2 * Nring * (Nring - 1) + 4 * Nring - Npix_; - int ring = 4 * Nside_ - Nring; // (from South pole) - int f = div_03(phi - 1, Nring) + 8; - - return to_nest(f, ring, Nring, phi, 0); - } - - // Equatorial belt - int ip = r - Ncap_; - int tmp = ip >> (k_ + 2); - - int Nring = Nside_; - int phi = ip - tmp * 4 * Nside_ + 1; - int ring = tmp + Nside_; - - int ifm = 1 + ((phi - 1 - ((1 + tmp) >> 1)) >> k_); - int ifp = 1 + ((phi - 1 - ((1 - tmp + 2 * Nside_) >> 1)) >> k_); - int f = (ifp == ifm) ? (ifp | 4) : ((ifp < ifm) ? ifp : (ifm + 8)); - - return to_nest(f, ring, Nring, phi, ring & 1); -} - - -int HEALPix::nest_to_ring(int n) const { - auto [f, i, j] = CodecFijNest::nest_to_fij(n, k_); - assert(f < 12 && i < Nside_ && j < Nside_); - - auto to_ring_local = [&](int f, int i, int j, - int Nring, //!< number of pixels in ring - int shift //!< if ring's first pixel is/is not at phi=0 - ) -> int { - Nring >>= 2; - int r = (pll(f) * Nring + i - j + 1 + shift) / 2 - 1; - assert(r < 4 * Nring); - - return r < 0 ? r + 4 * Nside_ : r; - }; - - const int ring = ((f >> 2) + 2) * Nside_ - i - j - 1; // 1-based ring number - if (ring < Nside_) { - // North polar cap - int Nring = 4 * ring; - int r0 = 2 * ring * (ring - 1); // index of first ring pixel (ring numbering) - - return r0 + to_ring_local(f, i, j, Nring, 0); - } - - if (ring < 3 * Nside_) { - // South polar cap - int Nring = 4 * Nside_; - int r0 = Ncap_ + (ring - Nside_) * Nring; // index of first ring pixel (ring numbering) - int shift = (ring - Nside_) & 1; - - return r0 + to_ring_local(f, i, j, Nring, shift); - } - - // Equatorial belt - int N = 4 * Nside_ - ring; - int Nring = 4 * N; - int r0 = Npix_ - 2 * N * (N + 1); // index of first ring pixel (ring numbering) - - return r0 + to_ring_local(f, i, j, Nring, 0); -} diff --git a/src/mir/repres/proxy/HEALPixReorder.h b/src/mir/repres/proxy/HEALPixReorder.h deleted file mode 100644 index 130d36d87..000000000 --- a/src/mir/repres/proxy/HEALPixReorder.h +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once - - -class HEALPix { -public: - explicit HEALPix(int Nside); - - int size() const { return 12 * Nside_ * Nside_; } - int nside() const { return Nside_; } - - int nest_to_ring(int) const; - int ring_to_nest(int) const; - -private: - const int Nside_; // up to 2^13 - const int Npix_; - const int Ncap_; - const int k_; -}; From f65fde8617c481736cc26980b3b00c5f56851e73 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Tue, 27 Feb 2024 09:47:56 +0000 Subject: [PATCH 09/69] MIR-644 HEALPix::reorder --- src/mir/repres/proxy/HEALPix.cc | 44 +++++++++++---------------------- src/mir/repres/proxy/HEALPix.h | 29 ++++++++++++++++++++++ 2 files changed, 43 insertions(+), 30 deletions(-) diff --git a/src/mir/repres/proxy/HEALPix.cc b/src/mir/repres/proxy/HEALPix.cc index 7fff8ef3b..b795cda20 100644 --- a/src/mir/repres/proxy/HEALPix.cc +++ b/src/mir/repres/proxy/HEALPix.cc @@ -12,12 +12,11 @@ #include "mir/repres/proxy/HEALPix.h" -#include -#include -#include #include -#include +#include +#include #include +#include #include "eckit/types/FloatCompare.h" @@ -99,32 +98,20 @@ inline int pll(int f) { } -class Reorder { -public: - explicit Reorder(int Nside) : - Nside_(Nside), - Npix_(size()), - Ncap_((Nside * (Nside - 1)) << 1), - k_(is_power_of_2(Nside_) ? static_cast(std::log2(Nside)) : -1) { - ASSERT(0 <= k_); // (specific to nested ordering) - ASSERT(0 < Nside_); - } - - int size() const { return 12 * Nside_ * Nside_; } - int nside() const { return Nside_; } +} // namespace - int nest_to_ring(int) const; - int ring_to_nest(int) const; -private: - const int Nside_; // up to 2^13 - const int Npix_; - const int Ncap_; - const int k_; -}; +HEALPix::Reorder::Reorder(int Nside) : + Nside_(Nside), + Npix_(size()), + Ncap_((Nside * (Nside - 1)) << 1), + k_(is_power_of_2(Nside_) ? static_cast(std::log2(Nside)) : -1) { + ASSERT(0 <= k_); // (specific to nested ordering) + ASSERT(0 < Nside_); +} -int Reorder::ring_to_nest(int r) const { +int HEALPix::Reorder::ring_to_nest(int r) const { auto to_nest = [&](int f, //!< base pixel index int ring, //!< 1-based ring number int Nring, //!< number of pixels in ring @@ -180,7 +167,7 @@ int Reorder::ring_to_nest(int r) const { } -int Reorder::nest_to_ring(int n) const { +int HEALPix::Reorder::nest_to_ring(int n) const { auto [f, i, j] = CodecFijNest::nest_to_fij(n, k_); ASSERT(f < 12 && i < Nside_ && j < Nside_); @@ -222,9 +209,6 @@ int Reorder::nest_to_ring(int n) const { } -} // namespace - - HEALPix::HEALPix(size_t Nside, const std::string& orderingConvention) : Nside_(Nside), orderingConvention_(orderingConvention) { ASSERT(Nside_ > 0); diff --git a/src/mir/repres/proxy/HEALPix.h b/src/mir/repres/proxy/HEALPix.h index 081117d43..c76e83fea 100644 --- a/src/mir/repres/proxy/HEALPix.h +++ b/src/mir/repres/proxy/HEALPix.h @@ -14,6 +14,7 @@ #include +#include #include "mir/param/MIRParametrisation.h" #include "mir/repres/proxy/ProxyGrid.h" @@ -25,6 +26,34 @@ namespace mir::repres::proxy { class HEALPix final : public ProxyGrid { public: + // -- Types + + enum Ordering + { + healpix_ring, + healpix_nested, + + healpix_ordering = healpix_ring, + healpix_ordering_end = healpix_nested, + }; + + class Reorder { + public: + explicit Reorder(int Nside); + + int size() const { return 12 * Nside_ * Nside_; } + int nside() const { return Nside_; } + + int nest_to_ring(int) const; + int ring_to_nest(int) const; + + private: + const int Nside_; // up to 2^13 + const int Npix_; + const int Ncap_; + const int k_; + }; + // -- Exceptions // None From 04e20fa8a0b87b39a938a15e7d57afe6a58a333e Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Tue, 27 Feb 2024 09:53:20 +0000 Subject: [PATCH 10/69] MIR-644 HEALPix::reorder --- src/tools/CMakeLists.txt | 1 + src/tools/mir-healpix-matrix.cc | 49 +++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 src/tools/mir-healpix-matrix.cc diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt index 5e9a13887..c2f225556 100644 --- a/src/tools/CMakeLists.txt +++ b/src/tools/CMakeLists.txt @@ -9,6 +9,7 @@ foreach(tool IN ITEMS mir-config-grib mir-count mir-formula + mir-healpix-matrix mir-gaussian-fractions mir-get-data mir-grid-box-area diff --git a/src/tools/mir-healpix-matrix.cc b/src/tools/mir-healpix-matrix.cc new file mode 100644 index 000000000..9ef809bfa --- /dev/null +++ b/src/tools/mir-healpix-matrix.cc @@ -0,0 +1,49 @@ +/* + * (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 "eckit/option/CmdArgs.h" +#include "eckit/option/SimpleOption.h" + +#include "mir/param/ConfigurationWrapper.h" +#include "mir/tools/MIRTool.h" +#include "mir/util/Exceptions.h" +#include "mir/util/Log.h" + + +namespace mir::tools { + + +struct MIRHEALPixMatrix : MIRTool { + MIRHEALPixMatrix(int argc, char** argv) : MIRTool(argc, argv) { using eckit::option::SimpleOption; } + + int numberOfPositionalArguments() const override { return 1; } + + void usage(const std::string& tool) const override { Log::info() << "\n" << "Usage: " << tool << std::endl; } + + void execute(const eckit::option::CmdArgs& args) override; +}; + + +void MIRHEALPixMatrix::execute(const eckit::option::CmdArgs& args) { + const param::ConfigurationWrapper param(args); + + NOTIMP; // TODO +} + + +} // namespace mir::tools + + +int main(int argc, char** argv) { + mir::tools::MIRHEALPixMatrix tool(argc, argv); + return tool.start(); +} From 78469f1ef9f23e83ec9248bdd93f4b681bd4e705 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Tue, 27 Feb 2024 10:36:49 +0000 Subject: [PATCH 11/69] MIR-644 HEALPix::reorder --- src/tools/CMakeLists.txt | 2 +- src/tools/mir-healpix-matrix.cc | 49 ------------------- src/tools/mir-matrix-reorder.cc | 87 +++++++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+), 50 deletions(-) delete mode 100644 src/tools/mir-healpix-matrix.cc create mode 100644 src/tools/mir-matrix-reorder.cc diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt index c2f225556..93dd1e1a5 100644 --- a/src/tools/CMakeLists.txt +++ b/src/tools/CMakeLists.txt @@ -9,7 +9,6 @@ foreach(tool IN ITEMS mir-config-grib mir-count mir-formula - mir-healpix-matrix mir-gaussian-fractions mir-get-data mir-grid-box-area @@ -18,6 +17,7 @@ foreach(tool IN ITEMS mir-list mir-load-matrix mir-make-lsm + mir-matrix-reorder mir-plot-lsm mir-points mir-statistics diff --git a/src/tools/mir-healpix-matrix.cc b/src/tools/mir-healpix-matrix.cc deleted file mode 100644 index 9ef809bfa..000000000 --- a/src/tools/mir-healpix-matrix.cc +++ /dev/null @@ -1,49 +0,0 @@ -/* - * (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 "eckit/option/CmdArgs.h" -#include "eckit/option/SimpleOption.h" - -#include "mir/param/ConfigurationWrapper.h" -#include "mir/tools/MIRTool.h" -#include "mir/util/Exceptions.h" -#include "mir/util/Log.h" - - -namespace mir::tools { - - -struct MIRHEALPixMatrix : MIRTool { - MIRHEALPixMatrix(int argc, char** argv) : MIRTool(argc, argv) { using eckit::option::SimpleOption; } - - int numberOfPositionalArguments() const override { return 1; } - - void usage(const std::string& tool) const override { Log::info() << "\n" << "Usage: " << tool << std::endl; } - - void execute(const eckit::option::CmdArgs& args) override; -}; - - -void MIRHEALPixMatrix::execute(const eckit::option::CmdArgs& args) { - const param::ConfigurationWrapper param(args); - - NOTIMP; // TODO -} - - -} // namespace mir::tools - - -int main(int argc, char** argv) { - mir::tools::MIRHEALPixMatrix tool(argc, argv); - return tool.start(); -} diff --git a/src/tools/mir-matrix-reorder.cc b/src/tools/mir-matrix-reorder.cc new file mode 100644 index 000000000..80633c17b --- /dev/null +++ b/src/tools/mir-matrix-reorder.cc @@ -0,0 +1,87 @@ +/* + * (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 + +#include "eckit/option/CmdArgs.h" +#include "eckit/option/FactoryOption.h" +#include "eckit/option/SimpleOption.h" + +#include "mir/key/grid/Grid.h" +#include "mir/key/grid/GridPattern.h" +#include "mir/method/Method.h" +#include "mir/param/ConfigurationWrapper.h" +#include "mir/param/SimpleParametrisation.h" +#include "mir/repres/Representation.h" +#include "mir/repres/proxy/HEALPix.h" +#include "mir/tools/MIRTool.h" +#include "mir/util/Exceptions.h" +#include "mir/util/Log.h" + + +namespace mir::tools { + + +struct MIRHEALPixMatrix : MIRTool { + MIRHEALPixMatrix(int argc, char** argv) : MIRTool(argc, argv) { + using eckit::option::FactoryOption; + using eckit::option::SimpleOption; + + options_.push_back(new FactoryOption( + "input-grid", "Interpolate from given grid (following a recognizable regular expression)")); + options_.push_back(new FactoryOption( + "grid", "Interpolate to given grid (following a recognizable regular expression)")); + options_.push_back( + new FactoryOption("interpolation", "Grid to grid interpolation method", "linear")); + options_.push_back( + new SimpleOption("ordering", "HEALPix ordering convention (ring or nested)", "ring")); + options_.push_back(new SimpleOption("output", "Interpolation matrix", "output.mat")); + } + + int numberOfPositionalArguments() const override { return 1; } + + void usage(const std::string& tool) const override { + Log::info() << "\n" + << "Usage: " << tool + << " [--interpolation=...]]" + " [--ordering=[ring|nested]]" + << std::endl; + } + + void execute(const eckit::option::CmdArgs& args) override; +}; + + +void MIRHEALPixMatrix::execute(const eckit::option::CmdArgs& args) { + const param::ConfigurationWrapper param(args); + + auto output = args.getString("output", "output.mat"); + auto ordering = args.getString("ordering", "ring") == "ring" ? repres::proxy::HEALPix::healpix_ring + : repres::proxy::HEALPix::healpix_nested; + + repres::RepresentationHandle in(key::grid::Grid::lookup(args.getString("input-grid")).representation()); + repres::RepresentationHandle out(key::grid::Grid::lookup(args.getString("grid")).representation()); + + std::string interpolation = args.getString("interpolation", "linear"); + std::unique_ptr method(method::MethodFactory::build(interpolation, param)); + + NOTIMP; // TODO +} + + +} // namespace mir::tools + + +int main(int argc, char** argv) { + mir::tools::MIRHEALPixMatrix tool(argc, argv); + return tool.start(); +} From 58088513e0d6265bec636f3863febd14190b6965 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Tue, 27 Feb 2024 12:13:25 +0000 Subject: [PATCH 12/69] MIR-644 HEALPix::reorder --- src/tools/mir-matrix-reorder.cc | 177 ++++++++++++++++++++++++++------ 1 file changed, 146 insertions(+), 31 deletions(-) diff --git a/src/tools/mir-matrix-reorder.cc b/src/tools/mir-matrix-reorder.cc index 80633c17b..bdeabfa15 100644 --- a/src/tools/mir-matrix-reorder.cc +++ b/src/tools/mir-matrix-reorder.cc @@ -11,13 +11,13 @@ #include +#include +#include #include "eckit/option/CmdArgs.h" #include "eckit/option/FactoryOption.h" #include "eckit/option/SimpleOption.h" -#include "mir/key/grid/Grid.h" -#include "mir/key/grid/GridPattern.h" #include "mir/method/Method.h" #include "mir/param/ConfigurationWrapper.h" #include "mir/param/SimpleParametrisation.h" @@ -26,53 +26,168 @@ #include "mir/tools/MIRTool.h" #include "mir/util/Exceptions.h" #include "mir/util/Log.h" +#include "mir/util/Mutex.h" namespace mir::tools { -struct MIRHEALPixMatrix : MIRTool { - MIRHEALPixMatrix(int argc, char** argv) : MIRTool(argc, argv) { +using Renumber = repres::proxy::HEALPix::Renumber; +using Ordering = repres::proxy::HEALPix::Ordering; + +static util::once_flag ONCE; +static util::recursive_mutex* MUTEX = nullptr; + +class ReorderFactory; +static std::map* M = nullptr; + + +static void init() { + MUTEX = new util::recursive_mutex(); + M = new std::map(); +} + + +struct Reorder { + Reorder() = default; + + virtual ~Reorder() = default; + + virtual Renumber reorder(Ordering) = 0; + + Reorder(const Reorder&) = delete; + Reorder(Reorder&&) = delete; + Reorder& operator=(const Reorder&) = delete; + Reorder& operator=(Reorder&&) = delete; +}; + + +class ReorderFactory { +private: + std::string name_; + virtual Reorder* make(size_t N) = 0; + +protected: + explicit ReorderFactory(const std::string& name) : name_(name) { + util::call_once(ONCE, init); + util::lock_guard lock(*MUTEX); + + if (M->find(name) == M->end()) { + (*M)[name] = this; + return; + } + + throw exception::SeriousBug("ReorderFactory: duplicated Reorder '" + name + "'"); + } + + virtual ~ReorderFactory() { + util::lock_guard lock(*MUTEX); + M->erase(name_); + } + +public: + ReorderFactory(const ReorderFactory&) = delete; + ReorderFactory(ReorderFactory&&) = delete; + ReorderFactory& operator=(const ReorderFactory&) = delete; + ReorderFactory& operator=(ReorderFactory&&) = delete; + + static Reorder* build(const std::string& name, size_t N) { + util::call_once(ONCE, init); + util::lock_guard lock(*MUTEX); + + if (auto j = M->find(name); j != M->end()) { + return j->second->make(N); + } + + list(Log::error() << "ReorderFactory: unknown '" << name << "', choices are:\n") << std::endl; + throw exception::SeriousBug("ReorderFactory: unknown '" + name + "'"); + } + + static std::ostream& list(std::ostream& out) { + util::call_once(ONCE, init); + util::lock_guard lock(*MUTEX); + + const auto* sep = ""; + for (const auto& j : *M) { + out << sep << j.first; + sep = ", "; + } + + return out; + } +}; + + +template +class ReorderBuilder : public ReorderFactory { + Reorder* make(size_t N) override { return new T(N); } + +public: + explicit ReorderBuilder(const std::string& name) : ReorderFactory(name) {} +}; + + +struct Identity final : Reorder { + explicit Identity(size_t N) : N_(N) {} + +private: + Renumber reorder(Ordering) override { + Renumber renumber(N_); + std::iota(renumber.begin(), renumber.end(), 0); + return renumber; + } + + const size_t N_; +}; + + +struct HEALPixRingToNested final : Reorder { + explicit HEALPixRingToNested(size_t N) {} + Renumber reorder(Ordering) override { NOTIMP; } +}; + + +struct HEALPixNestedToRing final : Reorder { + explicit HEALPixNestedToRing(size_t N) {} + Renumber reorder(Ordering) override { NOTIMP; } +}; + + +static const std::string IDENTITY = "identity"; + +static const ReorderBuilder __reorder1("identity"); +static const ReorderBuilder __reorder2("healpix-ring-to-nested"); +static const ReorderBuilder __reorder3("healpix-nested-to-ring"); + + +struct MIRMatrixReorder : MIRTool { + MIRMatrixReorder(int argc, char** argv) : MIRTool(argc, argv) { using eckit::option::FactoryOption; - using eckit::option::SimpleOption; - - options_.push_back(new FactoryOption( - "input-grid", "Interpolate from given grid (following a recognizable regular expression)")); - options_.push_back(new FactoryOption( - "grid", "Interpolate to given grid (following a recognizable regular expression)")); - options_.push_back( - new FactoryOption("interpolation", "Grid to grid interpolation method", "linear")); - options_.push_back( - new SimpleOption("ordering", "HEALPix ordering convention (ring or nested)", "ring")); - options_.push_back(new SimpleOption("output", "Interpolation matrix", "output.mat")); + options_.push_back(new FactoryOption("reorder-rows", "Reordering rows method", IDENTITY)); + options_.push_back(new FactoryOption("reorder-cols", "Reordering columns method", IDENTITY)); } - int numberOfPositionalArguments() const override { return 1; } + int numberOfPositionalArguments() const override { return 2; } void usage(const std::string& tool) const override { Log::info() << "\n" << "Usage: " << tool - << " [--interpolation=...]]" - " [--ordering=[ring|nested]]" + << " [--reorder-rows=...]" + " [--reorder-cols=...]" + " input-matrix output-matrix" << std::endl; } - void execute(const eckit::option::CmdArgs& args) override; + void execute(const eckit::option::CmdArgs&) override; }; -void MIRHEALPixMatrix::execute(const eckit::option::CmdArgs& args) { - const param::ConfigurationWrapper param(args); - - auto output = args.getString("output", "output.mat"); - auto ordering = args.getString("ordering", "ring") == "ring" ? repres::proxy::HEALPix::healpix_ring - : repres::proxy::HEALPix::healpix_nested; - - repres::RepresentationHandle in(key::grid::Grid::lookup(args.getString("input-grid")).representation()); - repres::RepresentationHandle out(key::grid::Grid::lookup(args.getString("grid")).representation()); +void MIRMatrixReorder::execute(const eckit::option::CmdArgs& args) { + auto matin = args(0); + auto matout = args(1); - std::string interpolation = args.getString("interpolation", "linear"); - std::unique_ptr method(method::MethodFactory::build(interpolation, param)); + std::unique_ptr rows(ReorderFactory::build(args.getString("reorder-rows"), 42)); + std::unique_ptr cols(ReorderFactory::build(args.getString("reorder-cols"), 42)); NOTIMP; // TODO } @@ -82,6 +197,6 @@ void MIRHEALPixMatrix::execute(const eckit::option::CmdArgs& args) { int main(int argc, char** argv) { - mir::tools::MIRHEALPixMatrix tool(argc, argv); + mir::tools::MIRMatrixReorder tool(argc, argv); return tool.start(); } From f88d8347f3145309d3f9c2c8f457edb77c8aacbe Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Tue, 27 Feb 2024 12:53:12 +0000 Subject: [PATCH 13/69] MIR-644 HEALPix::reorder --- src/tools/mir-matrix-reorder.cc | 56 +++++++++++++++++++++++---------- 1 file changed, 40 insertions(+), 16 deletions(-) diff --git a/src/tools/mir-matrix-reorder.cc b/src/tools/mir-matrix-reorder.cc index bdeabfa15..a220b7ea4 100644 --- a/src/tools/mir-matrix-reorder.cc +++ b/src/tools/mir-matrix-reorder.cc @@ -14,13 +14,10 @@ #include #include +#include "eckit/linalg/SparseMatrix.h" #include "eckit/option/CmdArgs.h" #include "eckit/option/FactoryOption.h" -#include "eckit/option/SimpleOption.h" -#include "mir/method/Method.h" -#include "mir/param/ConfigurationWrapper.h" -#include "mir/param/SimpleParametrisation.h" #include "mir/repres/Representation.h" #include "mir/repres/proxy/HEALPix.h" #include "mir/tools/MIRTool.h" @@ -32,7 +29,7 @@ namespace mir::tools { -using Renumber = repres::proxy::HEALPix::Renumber; +using Renumber = std::vector; using Ordering = repres::proxy::HEALPix::Ordering; static util::once_flag ONCE; @@ -141,21 +138,38 @@ struct Identity final : Reorder { }; -struct HEALPixRingToNested final : Reorder { - explicit HEALPixRingToNested(size_t N) {} +struct HEALPix : Reorder { + explicit HEALPix(size_t N) : + N_(N), Nside_([N] { + auto Nside = static_cast(std::sqrt(static_cast(N) / 12.)); + ASSERT_MSG(12 * Nside * Nside == N, "Expected N = 12 * Nside ** 2, got N=" + std::to_string(N)); + return Nside; + }()) {} + + size_t N() const { return N_; } + size_t Nside() const { return Nside_; } + +private: + const size_t N_; + const size_t Nside_; +}; + + +struct HEALPixRingToNested final : HEALPix { + explicit HEALPixRingToNested(size_t N) : HEALPix(N) {} Renumber reorder(Ordering) override { NOTIMP; } }; -struct HEALPixNestedToRing final : Reorder { - explicit HEALPixNestedToRing(size_t N) {} +struct HEALPixNestedToRing final : HEALPix { + explicit HEALPixNestedToRing(size_t N) : HEALPix(N) {} Renumber reorder(Ordering) override { NOTIMP; } }; static const std::string IDENTITY = "identity"; -static const ReorderBuilder __reorder1("identity"); +static const ReorderBuilder __reorder1(IDENTITY); static const ReorderBuilder __reorder2("healpix-ring-to-nested"); static const ReorderBuilder __reorder3("healpix-nested-to-ring"); @@ -171,7 +185,8 @@ struct MIRMatrixReorder : MIRTool { void usage(const std::string& tool) const override { Log::info() << "\n" - << "Usage: " << tool + "Usage: " + << tool << " [--reorder-rows=...]" " [--reorder-cols=...]" " input-matrix output-matrix" @@ -183,13 +198,22 @@ struct MIRMatrixReorder : MIRTool { void MIRMatrixReorder::execute(const eckit::option::CmdArgs& args) { - auto matin = args(0); - auto matout = args(1); + // access input matrix + eckit::linalg::SparseMatrix in; + in.load(args(0)); + + + // renumbering methods + std::unique_ptr rows(ReorderFactory::build(args.getString("reorder-rows"), in.rows())); + std::unique_ptr cols(ReorderFactory::build(args.getString("reorder-cols"), in.cols())); + + + // expand triplets, renumbering directly + // SparseMatrix(Size rows, Size cols, const std::vector& triplets); - std::unique_ptr rows(ReorderFactory::build(args.getString("reorder-rows"), 42)); - std::unique_ptr cols(ReorderFactory::build(args.getString("reorder-cols"), 42)); - NOTIMP; // TODO + // compress triplets + // NOTIMP; // TODO } From 424c7bb76a6922576b0d4aeb020fbb38c11efa34 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Tue, 27 Feb 2024 13:15:53 +0000 Subject: [PATCH 14/69] MIR-644 HEALPix::reorder --- src/tools/mir-matrix-reorder.cc | 62 ++++++++++++++++++++++++--------- 1 file changed, 46 insertions(+), 16 deletions(-) diff --git a/src/tools/mir-matrix-reorder.cc b/src/tools/mir-matrix-reorder.cc index a220b7ea4..9d033eecd 100644 --- a/src/tools/mir-matrix-reorder.cc +++ b/src/tools/mir-matrix-reorder.cc @@ -10,11 +10,13 @@ */ +#include #include #include #include #include "eckit/linalg/SparseMatrix.h" +#include "eckit/linalg/Triplet.h" #include "eckit/option/CmdArgs.h" #include "eckit/option/FactoryOption.h" @@ -30,7 +32,6 @@ namespace mir::tools { using Renumber = std::vector; -using Ordering = repres::proxy::HEALPix::Ordering; static util::once_flag ONCE; static util::recursive_mutex* MUTEX = nullptr; @@ -50,7 +51,7 @@ struct Reorder { virtual ~Reorder() = default; - virtual Renumber reorder(Ordering) = 0; + virtual Renumber reorder() = 0; Reorder(const Reorder&) = delete; Reorder(Reorder&&) = delete; @@ -128,7 +129,7 @@ struct Identity final : Reorder { explicit Identity(size_t N) : N_(N) {} private: - Renumber reorder(Ordering) override { + Renumber reorder() override { Renumber renumber(N_); std::iota(renumber.begin(), renumber.end(), 0); return renumber; @@ -140,30 +141,46 @@ struct Identity final : Reorder { struct HEALPix : Reorder { explicit HEALPix(size_t N) : - N_(N), Nside_([N] { + N_(N), + Nside_([N] { auto Nside = static_cast(std::sqrt(static_cast(N) / 12.)); ASSERT_MSG(12 * Nside * Nside == N, "Expected N = 12 * Nside ** 2, got N=" + std::to_string(N)); return Nside; - }()) {} + }()), + healpix_(static_cast(Nside_)) {} size_t N() const { return N_; } size_t Nside() const { return Nside_; } + const repres::proxy::HEALPix::Reorder& healpix() const { return healpix_; } private: const size_t N_; const size_t Nside_; + const repres::proxy::HEALPix::Reorder healpix_; }; struct HEALPixRingToNested final : HEALPix { explicit HEALPixRingToNested(size_t N) : HEALPix(N) {} - Renumber reorder(Ordering) override { NOTIMP; } + Renumber reorder() override { + Renumber map(N()); + for (size_t i = 0; i < N(); ++i) { + map[i] = static_cast(healpix().ring_to_nest(static_cast(i))); + } + return map; + } }; struct HEALPixNestedToRing final : HEALPix { explicit HEALPixNestedToRing(size_t N) : HEALPix(N) {} - Renumber reorder(Ordering) override { NOTIMP; } + Renumber reorder() override { + Renumber map(N()); + for (size_t i = 0; i < N(); ++i) { + map[i] = static_cast(healpix().nest_to_ring(static_cast(i))); + } + return map; + } }; @@ -198,22 +215,35 @@ struct MIRMatrixReorder : MIRTool { void MIRMatrixReorder::execute(const eckit::option::CmdArgs& args) { - // access input matrix - eckit::linalg::SparseMatrix in; - in.load(args(0)); + // load input matrix + eckit::linalg::SparseMatrix M; + M.load(args(0)); + + // renumbering maps + auto rows = std::unique_ptr(ReorderFactory::build(args.getString("reorder-rows"), M.rows()))->reorder(); + ASSERT(rows.size() == M.rows()); - // renumbering methods - std::unique_ptr rows(ReorderFactory::build(args.getString("reorder-rows"), in.rows())); - std::unique_ptr cols(ReorderFactory::build(args.getString("reorder-cols"), in.cols())); + auto cols = std::unique_ptr(ReorderFactory::build(args.getString("reorder-cols"), M.cols()))->reorder(); + ASSERT(cols.size() == M.cols()); // expand triplets, renumbering directly - // SparseMatrix(Size rows, Size cols, const std::vector& triplets); + std::vector trips; + trips.reserve(M.nonZeros()); + + for (auto i = M.begin(); i != M.end(); ++i) { + trips.emplace_back(rows.at(i.row()), cols.at(i.col()), *i); + } + + + // compress triplets, create output matrix + std::sort(trips.begin(), trips.end()); + eckit::linalg::SparseMatrix W(M.rows(), M.cols(), trips); - // compress triplets - // NOTIMP; // TODO + // create output matrix + W.save(args(1)); } From 8404fc9557b116ad7867e472e14de8207c687a29 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Tue, 27 Feb 2024 15:16:17 +0000 Subject: [PATCH 15/69] MIR-644 HEALPix::reorder --- src/tools/mir-matrix-reorder.cc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/tools/mir-matrix-reorder.cc b/src/tools/mir-matrix-reorder.cc index 9d033eecd..079e1cabd 100644 --- a/src/tools/mir-matrix-reorder.cc +++ b/src/tools/mir-matrix-reorder.cc @@ -19,6 +19,7 @@ #include "eckit/linalg/Triplet.h" #include "eckit/option/CmdArgs.h" #include "eckit/option/FactoryOption.h" +#include "eckit/option/SimpleOption.h" #include "mir/repres/Representation.h" #include "mir/repres/proxy/HEALPix.h" @@ -194,8 +195,10 @@ static const ReorderBuilder __reorder3("healpix-nested-to-r struct MIRMatrixReorder : MIRTool { MIRMatrixReorder(int argc, char** argv) : MIRTool(argc, argv) { using eckit::option::FactoryOption; + using eckit::option::SimpleOption; options_.push_back(new FactoryOption("reorder-rows", "Reordering rows method", IDENTITY)); options_.push_back(new FactoryOption("reorder-cols", "Reordering columns method", IDENTITY)); + options_.push_back(new SimpleOption("transpose", "Transpose matrix", false)); } int numberOfPositionalArguments() const override { return 2; } @@ -206,6 +209,7 @@ struct MIRMatrixReorder : MIRTool { << tool << " [--reorder-rows=...]" " [--reorder-cols=...]" + " [--transpose=[0|1]]" " input-matrix output-matrix" << std::endl; } @@ -232,8 +236,14 @@ void MIRMatrixReorder::execute(const eckit::option::CmdArgs& args) { std::vector trips; trips.reserve(M.nonZeros()); - for (auto i = M.begin(); i != M.end(); ++i) { - trips.emplace_back(rows.at(i.row()), cols.at(i.col()), *i); + auto transpose = args.getBool("transpose"); + for (auto i = M.begin(), end = M.end(); i != end; ++i) { + if (transpose) { + trips.emplace_back(cols.at(i.col()), rows.at(i.row()), *i); + } + else { + trips.emplace_back(rows.at(i.row()), cols.at(i.col()), *i); + } } From a0066c0073d52cc233e5aee96e6a2bac91fe961e Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Tue, 27 Feb 2024 15:40:56 +0000 Subject: [PATCH 16/69] MIR-643 HEALPix orderingConvention=nested minimal regridding support --- src/mir/repres/proxy/HEALPix.cc | 26 +++++++++++++++++++++++--- src/mir/repres/proxy/HEALPix.h | 10 ++++++++-- src/mir/repres/proxy/ProxyGrid.h | 8 +++----- 3 files changed, 34 insertions(+), 10 deletions(-) diff --git a/src/mir/repres/proxy/HEALPix.cc b/src/mir/repres/proxy/HEALPix.cc index b795cda20..157082937 100644 --- a/src/mir/repres/proxy/HEALPix.cc +++ b/src/mir/repres/proxy/HEALPix.cc @@ -212,7 +212,7 @@ int HEALPix::Reorder::nest_to_ring(int n) const { HEALPix::HEALPix(size_t Nside, const std::string& orderingConvention) : Nside_(Nside), orderingConvention_(orderingConvention) { ASSERT(Nside_ > 0); - ASSERT(orderingConvention_ == "ring"); + ASSERT(orderingConvention_ == "ring" || orderingConvention_ == "nested"); } @@ -220,7 +220,7 @@ HEALPix::HEALPix(const param::MIRParametrisation& param) : Nside_(0), orderingCo param.get("Nside", Nside_); ASSERT(Nside_ > 0); ASSERT(param.get("orderingConvention", orderingConvention_)); - ASSERT(orderingConvention_ == "ring"); + ASSERT(orderingConvention_ == "ring" || orderingConvention_ == "nested"); double lon1 = 0.; ASSERT(param.get("longitudeOfFirstGridPointInDegrees", lon1)); @@ -232,8 +232,11 @@ HEALPix::~HEALPix() = default; const ::atlas::Grid& HEALPix::atlasGridRef() const { + ASSERT(orderingConvention_ == "ring"); + if (!grid_) { grid_ = atlas::HealpixGrid(Nside_, orderingConvention_); + ASSERT(grid_.size() == numberOfPoints()); } return grid_; } @@ -246,7 +249,7 @@ bool HEALPix::sameAs(const Representation& other) const { std::string HEALPix::name() const { - return "H" + std::to_string(Nside_); + return "H" + std::to_string(Nside_) + (orderingConvention_ == "ring" ? "" : "n"); } @@ -284,6 +287,8 @@ void HEALPix::print(std::ostream& out) const { std::vector HEALPix::gridBoxes() const { + ASSERT(orderingConvention_ == "ring"); + ::atlas::interpolation::method::GridBoxes boxes(atlasGridRef(), false); std::vector mirBoxes(boxes.size()); std::transform(boxes.cbegin(), boxes.cend(), mirBoxes.begin(), [](const auto& other) { @@ -293,6 +298,21 @@ std::vector HEALPix::gridBoxes() const { } +size_t HEALPix::numberOfPoints() const { + return 12 * Nside_ * Nside_; +} + + +Iterator* HEALPix::iterator() const { + if (orderingConvention_ == "ring") { + return ProxyGrid::iterator(); + } + + ASSERT(orderingConvention_ == "nested"); + NOTIMP; +} + + static const RepresentationBuilder __grid("healpix"); diff --git a/src/mir/repres/proxy/HEALPix.h b/src/mir/repres/proxy/HEALPix.h index c76e83fea..f2de4de11 100644 --- a/src/mir/repres/proxy/HEALPix.h +++ b/src/mir/repres/proxy/HEALPix.h @@ -59,9 +59,11 @@ class HEALPix final : public ProxyGrid { // -- Constructors - HEALPix(size_t Nside, const std::string& orderingConvention = "ring"); - HEALPix(const param::MIRParametrisation&); + explicit HEALPix(size_t Nside, const std::string& orderingConvention = "ring"); + explicit HEALPix(const param::MIRParametrisation&); + HEALPix(const HEALPix&) = delete; + HEALPix(HEALPix&&) = delete; // -- Destructor @@ -73,6 +75,7 @@ class HEALPix final : public ProxyGrid { // -- Operators HEALPix& operator=(const HEALPix&) = delete; + HEALPix&& operator=(HEALPix&&) = delete; // -- Methods // None @@ -114,6 +117,9 @@ class HEALPix final : public ProxyGrid { std::vector gridBoxes() const override; + size_t numberOfPoints() const override; + Iterator* iterator() const override; + // -- Class members // None diff --git a/src/mir/repres/proxy/ProxyGrid.h b/src/mir/repres/proxy/ProxyGrid.h index 08e67b48a..b1f89cd77 100644 --- a/src/mir/repres/proxy/ProxyGrid.h +++ b/src/mir/repres/proxy/ProxyGrid.h @@ -66,7 +66,9 @@ class ProxyGrid : public Gridded { ::atlas::Grid atlasGrid() const override; // -- Overridden methods - // None + + size_t numberOfPoints() const override; + Iterator* iterator() const override; // -- Class members // None @@ -86,14 +88,10 @@ class ProxyGrid : public Gridded { // from Representation void validate(const MIRValuesVector& values) const override; - size_t numberOfPoints() const override; - bool includesNorthPole() const override { return true; } bool includesSouthPole() const override { return true; } bool isPeriodicWestEast() const override { return true; } - Iterator* iterator() const override; - // -- Class members // None From 7f0a62cc6785d62e0aef344a39caef6c8b88cccc Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Wed, 28 Feb 2024 08:56:27 +0000 Subject: [PATCH 17/69] Cleanup --- src/mir/repres/gauss/reduced/Classic.cc | 3 +-- src/mir/repres/gauss/reduced/Octahedral.cc | 3 +-- src/mir/repres/gauss/reduced/Reduced.cc | 3 +-- src/mir/repres/gauss/regular/Regular.cc | 6 ++---- src/mir/repres/latlon/LatLon.cc | 8 +++----- src/mir/repres/latlon/RegularLL.cc | 3 +-- src/mir/repres/proxy/ProxyGrid.h | 8 +++++--- src/mir/repres/sh/SphericalHarmonics.cc | 3 +-- src/mir/repres/unsupported/Albers.cc | 9 ++++----- src/mir/repres/unsupported/Albers.h | 11 +++++++---- src/mir/repres/unsupported/AzimuthRange.cc | 9 ++++----- src/mir/repres/unsupported/AzimuthRange.h | 11 +++++++---- .../unsupported/EquatorialAzimuthalEquidistant.cc | 9 ++++----- .../unsupported/EquatorialAzimuthalEquidistant.h | 11 +++++++---- src/mir/repres/unsupported/IrregularLatlon.cc | 6 +++--- src/mir/repres/unsupported/IrregularLatlon.h | 4 ++-- src/mir/repres/unsupported/RotatedSH.cc | 9 ++++----- src/mir/repres/unsupported/RotatedSH.h | 11 +++++++---- src/mir/repres/unsupported/StretchedGG.cc | 9 ++++----- src/mir/repres/unsupported/StretchedGG.h | 11 +++++++---- src/mir/repres/unsupported/StretchedLL.cc | 9 ++++----- src/mir/repres/unsupported/StretchedLL.h | 11 +++++++---- src/mir/repres/unsupported/StretchedRotatedGG.cc | 9 ++++----- src/mir/repres/unsupported/StretchedRotatedGG.h | 11 +++++++---- src/mir/repres/unsupported/StretchedRotatedLL.cc | 9 ++++----- src/mir/repres/unsupported/StretchedRotatedLL.h | 11 +++++++---- src/mir/repres/unsupported/StretchedRotatedSH.cc | 9 ++++----- src/mir/repres/unsupported/StretchedRotatedSH.h | 11 +++++++---- src/mir/repres/unsupported/StretchedSH.cc | 9 ++++----- src/mir/repres/unsupported/StretchedSH.h | 11 +++++++---- src/mir/repres/unsupported/TransverseMercator.cc | 9 ++++----- src/mir/repres/unsupported/TransverseMercator.h | 11 +++++++---- 32 files changed, 141 insertions(+), 126 deletions(-) diff --git a/src/mir/repres/gauss/reduced/Classic.cc b/src/mir/repres/gauss/reduced/Classic.cc index 9f0319291..4f4d4328b 100644 --- a/src/mir/repres/gauss/reduced/Classic.cc +++ b/src/mir/repres/gauss/reduced/Classic.cc @@ -37,8 +37,7 @@ Classic::Classic(size_t N, const util::BoundingBox& bbox, double angularPrecisio auto old(bbox_); bbox_ = util::BoundingBox(n, w, s, e); - Log::debug() << "Classic BoundingBox:" - << "\n\t " << old << "\n\t > " << bbox_ << std::endl; + Log::debug() << "Classic BoundingBox:" << "\n\t " << old << "\n\t > " << bbox_ << std::endl; } diff --git a/src/mir/repres/gauss/reduced/Octahedral.cc b/src/mir/repres/gauss/reduced/Octahedral.cc index 492fd939e..8146a9aef 100644 --- a/src/mir/repres/gauss/reduced/Octahedral.cc +++ b/src/mir/repres/gauss/reduced/Octahedral.cc @@ -38,8 +38,7 @@ Octahedral::Octahedral(size_t N, const util::BoundingBox& bbox, double angularPr auto old(bbox_); bbox_ = util::BoundingBox(n, w, s, e); - Log::debug() << "Octahedral BoundingBox:" - << "\n\t " << old << "\n\t > " << bbox_ << std::endl; + Log::debug() << "Octahedral BoundingBox:" << "\n\t " << old << "\n\t > " << bbox_ << std::endl; } diff --git a/src/mir/repres/gauss/reduced/Reduced.cc b/src/mir/repres/gauss/reduced/Reduced.cc index 909478639..c8a3b82b6 100644 --- a/src/mir/repres/gauss/reduced/Reduced.cc +++ b/src/mir/repres/gauss/reduced/Reduced.cc @@ -543,8 +543,7 @@ std::string Reduced::factory() const { void Reduced::json(eckit::JSON& s) const { s.startObject(); - s << "type" - << "reduced_gg"; + s << "type" << "reduced_gg"; s << "pl" << pls(); Gaussian::json(s); s.endObject(); diff --git a/src/mir/repres/gauss/regular/Regular.cc b/src/mir/repres/gauss/regular/Regular.cc index a5454c9ff..367d9396a 100644 --- a/src/mir/repres/gauss/regular/Regular.cc +++ b/src/mir/repres/gauss/regular/Regular.cc @@ -38,8 +38,7 @@ Regular::Regular(const param::MIRParametrisation& parametrisation) : Gaussian(pa auto old(bbox_); bbox_ = util::BoundingBox(n, w, s, e); - Log::debug() << "Regular::Regular: BoundingBox:" - << "\n\t " << old << "\n\t > " << bbox_ << std::endl; + Log::debug() << "Regular::Regular: BoundingBox:" << "\n\t " << old << "\n\t > " << bbox_ << std::endl; setNiNj(); } @@ -154,8 +153,7 @@ bool Regular::getLongestElementDiagonal(double& d) const { void Regular::json(eckit::JSON& s) const { s.startObject(); - s << "type" - << "regular_gg"; + s << "type" << "regular_gg"; Gaussian::json(s); s.endObject(); } diff --git a/src/mir/repres/latlon/LatLon.cc b/src/mir/repres/latlon/LatLon.cc index b910096fd..5927c2d12 100644 --- a/src/mir/repres/latlon/LatLon.cc +++ b/src/mir/repres/latlon/LatLon.cc @@ -77,8 +77,7 @@ void LatLon::reorder(long scanningMode, MIRValuesVector& values) const { void LatLon::print(std::ostream& out) const { - out << "LatLon[" - << "bbox=" << bbox_ << ",increments=" << increments_ << ",ni=" << ni_ << ",nj=" << nj_ << "]"; + out << "LatLon[" << "bbox=" << bbox_ << ",increments=" << increments_ << ",ni=" << ni_ << ",nj=" << nj_ << "]"; } @@ -307,9 +306,8 @@ LatLon::LatLonIterator::~LatLonIterator() { void LatLon::LatLonIterator::print(std::ostream& out) const { - out << "LatLonIterator[" - << "ni=" << ni_ << ",nj=" << nj_ << ",north=" << north_ << ",west=" << west_ << ",we=" << we_ << ",ns=" << ns_ - << ",i=" << i_ << ",j=" << j_ << ",count=" << count_ << "]"; + out << "LatLonIterator[" << "ni=" << ni_ << ",nj=" << nj_ << ",north=" << north_ << ",west=" << west_ + << ",we=" << we_ << ",ns=" << ns_ << ",i=" << i_ << ",j=" << j_ << ",count=" << count_ << "]"; } diff --git a/src/mir/repres/latlon/RegularLL.cc b/src/mir/repres/latlon/RegularLL.cc index 173822e89..c2388345e 100644 --- a/src/mir/repres/latlon/RegularLL.cc +++ b/src/mir/repres/latlon/RegularLL.cc @@ -63,8 +63,7 @@ void RegularLL::print(std::ostream& out) const { void RegularLL::json(eckit::JSON& json) const { json.startObject(); - json << "type" - << "regular_ll"; + json << "type" << "regular_ll"; LatLon::json(json); json.endObject(); } diff --git a/src/mir/repres/proxy/ProxyGrid.h b/src/mir/repres/proxy/ProxyGrid.h index b1f89cd77..08e67b48a 100644 --- a/src/mir/repres/proxy/ProxyGrid.h +++ b/src/mir/repres/proxy/ProxyGrid.h @@ -66,9 +66,7 @@ class ProxyGrid : public Gridded { ::atlas::Grid atlasGrid() const override; // -- Overridden methods - - size_t numberOfPoints() const override; - Iterator* iterator() const override; + // None // -- Class members // None @@ -88,10 +86,14 @@ class ProxyGrid : public Gridded { // from Representation void validate(const MIRValuesVector& values) const override; + size_t numberOfPoints() const override; + bool includesNorthPole() const override { return true; } bool includesSouthPole() const override { return true; } bool isPeriodicWestEast() const override { return true; } + Iterator* iterator() const override; + // -- Class members // None diff --git a/src/mir/repres/sh/SphericalHarmonics.cc b/src/mir/repres/sh/SphericalHarmonics.cc index 11508db87..e84d27bb2 100644 --- a/src/mir/repres/sh/SphericalHarmonics.cc +++ b/src/mir/repres/sh/SphericalHarmonics.cc @@ -37,8 +37,7 @@ SphericalHarmonics::~SphericalHarmonics() = default; void SphericalHarmonics::print(std::ostream& out) const { - out << "SphericalHarmonics[" - << "truncation=" << truncation_ << "]"; + out << "SphericalHarmonics[" << "truncation=" << truncation_ << "]"; } diff --git a/src/mir/repres/unsupported/Albers.cc b/src/mir/repres/unsupported/Albers.cc index aa9533bae..e51a93433 100644 --- a/src/mir/repres/unsupported/Albers.cc +++ b/src/mir/repres/unsupported/Albers.cc @@ -15,19 +15,18 @@ #include -namespace mir::repres { +namespace mir::repres::unsupported { -Albers::Albers(const param::MIRParametrisation& /*parametrisation*/) {} +Albers::Albers(const param::MIRParametrisation&) {} void Albers::print(std::ostream& out) const { - out << "Albers[" - << "]"; + out << "Albers[]"; } static const RepresentationBuilder __repres("albers"); -} // namespace mir::repres +} // namespace mir::repres::unsupported diff --git a/src/mir/repres/unsupported/Albers.h b/src/mir/repres/unsupported/Albers.h index f593a89c2..d9a5ea738 100644 --- a/src/mir/repres/unsupported/Albers.h +++ b/src/mir/repres/unsupported/Albers.h @@ -15,18 +15,20 @@ #include "mir/repres/Gridded.h" -namespace mir::repres { +namespace mir::repres::unsupported { -class Albers : public Gridded { +class Albers final : public Gridded { public: // -- Exceptions // None // -- Constructors - Albers(const param::MIRParametrisation&); + explicit Albers(const param::MIRParametrisation&); + Albers(const Albers&) = delete; + Albers(Albers&&) = delete; // -- Destructor // None @@ -37,6 +39,7 @@ class Albers : public Gridded { // -- Operators Albers& operator=(const Albers&) = delete; + Albers& operator=(Albers&&) = delete; // -- Methods // // None @@ -88,4 +91,4 @@ class Albers : public Gridded { }; -} // namespace mir::repres +} // namespace mir::repres::unsupported diff --git a/src/mir/repres/unsupported/AzimuthRange.cc b/src/mir/repres/unsupported/AzimuthRange.cc index 44fc96309..d6e6ccf09 100644 --- a/src/mir/repres/unsupported/AzimuthRange.cc +++ b/src/mir/repres/unsupported/AzimuthRange.cc @@ -15,19 +15,18 @@ #include -namespace mir::repres { +namespace mir::repres::unsupported { -AzimuthRange::AzimuthRange(const param::MIRParametrisation& /*parametrisation*/) {} +AzimuthRange::AzimuthRange(const param::MIRParametrisation&) {} void AzimuthRange::print(std::ostream& out) const { - out << "AzimuthRange[" - << "]"; + out << "AzimuthRange[]"; } static const RepresentationBuilder __repres("azimuth_range"); -} // namespace mir::repres +} // namespace mir::repres::unsupported diff --git a/src/mir/repres/unsupported/AzimuthRange.h b/src/mir/repres/unsupported/AzimuthRange.h index 44c75fae2..cb868a095 100644 --- a/src/mir/repres/unsupported/AzimuthRange.h +++ b/src/mir/repres/unsupported/AzimuthRange.h @@ -15,18 +15,20 @@ #include "mir/repres/Gridded.h" -namespace mir::repres { +namespace mir::repres::unsupported { -class AzimuthRange : public Gridded { +class AzimuthRange final : public Gridded { public: // -- Exceptions // None // -- Constructors - AzimuthRange(const param::MIRParametrisation&); + explicit AzimuthRange(const param::MIRParametrisation&); + AzimuthRange(const AzimuthRange&) = delete; + AzimuthRange(AzimuthRange&&) = delete; // -- Destructor // None @@ -37,6 +39,7 @@ class AzimuthRange : public Gridded { // -- Operators AzimuthRange& operator=(const AzimuthRange&) = delete; + AzimuthRange& operator=(AzimuthRange&&) = delete; // -- Methods // // None @@ -88,4 +91,4 @@ class AzimuthRange : public Gridded { }; -} // namespace mir::repres +} // namespace mir::repres::unsupported diff --git a/src/mir/repres/unsupported/EquatorialAzimuthalEquidistant.cc b/src/mir/repres/unsupported/EquatorialAzimuthalEquidistant.cc index be2d4d956..4a1aca603 100644 --- a/src/mir/repres/unsupported/EquatorialAzimuthalEquidistant.cc +++ b/src/mir/repres/unsupported/EquatorialAzimuthalEquidistant.cc @@ -15,19 +15,18 @@ #include -namespace mir::repres { +namespace mir::repres::unsupported { -EquatorialAzimuthalEquidistant::EquatorialAzimuthalEquidistant(const param::MIRParametrisation& /*parametrisation*/) {} +EquatorialAzimuthalEquidistant::EquatorialAzimuthalEquidistant(const param::MIRParametrisation&) {} void EquatorialAzimuthalEquidistant::print(std::ostream& out) const { - out << "EquatorialAzimuthalEquidistant[" - << "]"; + out << "EquatorialAzimuthalEquidistant[]"; } static const RepresentationBuilder __repres("equatorial_azimuthal_equidistant"); -} // namespace mir::repres +} // namespace mir::repres::unsupported diff --git a/src/mir/repres/unsupported/EquatorialAzimuthalEquidistant.h b/src/mir/repres/unsupported/EquatorialAzimuthalEquidistant.h index 04b218bcb..5843b04ca 100644 --- a/src/mir/repres/unsupported/EquatorialAzimuthalEquidistant.h +++ b/src/mir/repres/unsupported/EquatorialAzimuthalEquidistant.h @@ -15,18 +15,20 @@ #include "mir/repres/Gridded.h" -namespace mir::repres { +namespace mir::repres::unsupported { -class EquatorialAzimuthalEquidistant : public Gridded { +class EquatorialAzimuthalEquidistant final : public Gridded { public: // -- Exceptions // None // -- Constructors - EquatorialAzimuthalEquidistant(const param::MIRParametrisation&); + explicit EquatorialAzimuthalEquidistant(const param::MIRParametrisation&); + EquatorialAzimuthalEquidistant(const EquatorialAzimuthalEquidistant&) = delete; + EquatorialAzimuthalEquidistant(EquatorialAzimuthalEquidistant&&) = delete; // -- Destructor // None @@ -37,6 +39,7 @@ class EquatorialAzimuthalEquidistant : public Gridded { // -- Operators EquatorialAzimuthalEquidistant& operator=(const EquatorialAzimuthalEquidistant&) = delete; + EquatorialAzimuthalEquidistant& operator=(EquatorialAzimuthalEquidistant&&) = delete; // -- Methods // // None @@ -88,4 +91,4 @@ class EquatorialAzimuthalEquidistant : public Gridded { }; -} // namespace mir::repres +} // namespace mir::repres::unsupported diff --git a/src/mir/repres/unsupported/IrregularLatlon.cc b/src/mir/repres/unsupported/IrregularLatlon.cc index c1e905e7c..e39b2bfbe 100644 --- a/src/mir/repres/unsupported/IrregularLatlon.cc +++ b/src/mir/repres/unsupported/IrregularLatlon.cc @@ -1,4 +1,4 @@ -/* +/*::unsupported * (C) Copyright 1996- ECMWF. * * This software is licensed under the terms of the Apache Licence Version 2.0 @@ -26,7 +26,7 @@ #include "mir/util/Types.h" -namespace mir::repres { +namespace mir::repres::unsupported { static void range(const std::vector& v, double& mn, double& mx, double& dmax) { @@ -259,4 +259,4 @@ atlas::Grid IrregularLatlon::atlasGrid() const { static const RepresentationBuilder irregularLatlon("irregular_latlon"); -} // namespace mir::repres +} // namespace mir::repres::unsupported diff --git a/src/mir/repres/unsupported/IrregularLatlon.h b/src/mir/repres/unsupported/IrregularLatlon.h index c19ded841..cf03c809f 100644 --- a/src/mir/repres/unsupported/IrregularLatlon.h +++ b/src/mir/repres/unsupported/IrregularLatlon.h @@ -15,7 +15,7 @@ #include "mir/repres/Gridded.h" -namespace mir::repres { +namespace mir::repres::unsupported { class IrregularLatlon : public Gridded { @@ -113,4 +113,4 @@ class IrregularLatlon : public Gridded { }; -} // namespace mir::repres +} // namespace mir::repres::unsupported diff --git a/src/mir/repres/unsupported/RotatedSH.cc b/src/mir/repres/unsupported/RotatedSH.cc index 0595b87d9..643f8b1c0 100644 --- a/src/mir/repres/unsupported/RotatedSH.cc +++ b/src/mir/repres/unsupported/RotatedSH.cc @@ -15,19 +15,18 @@ #include -namespace mir::repres { +namespace mir::repres::unsupported { -RotatedSH::RotatedSH(const param::MIRParametrisation& /*parametrisation*/) {} +RotatedSH::RotatedSH(const param::MIRParametrisation&) {} void RotatedSH::print(std::ostream& out) const { - out << "RotatedSH[" - << "]"; + out << "RotatedSH[]"; } static const RepresentationBuilder __repres("rotated_sh"); -} // namespace mir::repres +} // namespace mir::repres::unsupported diff --git a/src/mir/repres/unsupported/RotatedSH.h b/src/mir/repres/unsupported/RotatedSH.h index 820390b5c..b5a92c62f 100644 --- a/src/mir/repres/unsupported/RotatedSH.h +++ b/src/mir/repres/unsupported/RotatedSH.h @@ -15,18 +15,20 @@ #include "mir/repres/Gridded.h" -namespace mir::repres { +namespace mir::repres::unsupported { -class RotatedSH : public Gridded { +class RotatedSH final : public Gridded { public: // -- Exceptions // None // -- Constructors - RotatedSH(const param::MIRParametrisation&); + explicit RotatedSH(const param::MIRParametrisation&); + RotatedSH(const RotatedSH&) = delete; + RotatedSH(RotatedSH&&) = delete; // -- Destructor // None @@ -37,6 +39,7 @@ class RotatedSH : public Gridded { // -- Operators RotatedSH& operator=(const RotatedSH&) = delete; + RotatedSH& operator=(RotatedSH&&) = delete; // -- Methods // // None @@ -88,4 +91,4 @@ class RotatedSH : public Gridded { }; -} // namespace mir::repres +} // namespace mir::repres::unsupported diff --git a/src/mir/repres/unsupported/StretchedGG.cc b/src/mir/repres/unsupported/StretchedGG.cc index 9ec71d759..23b54fbdd 100644 --- a/src/mir/repres/unsupported/StretchedGG.cc +++ b/src/mir/repres/unsupported/StretchedGG.cc @@ -15,19 +15,18 @@ #include -namespace mir::repres { +namespace mir::repres::unsupported { -StretchedGG::StretchedGG(const param::MIRParametrisation& /*parametrisation*/) {} +StretchedGG::StretchedGG(const param::MIRParametrisation&) {} void StretchedGG::print(std::ostream& out) const { - out << "StretchedGG[" - << "]"; + out << "StretchedGG[]"; } static const RepresentationBuilder __repres("stretched_gg"); -} // namespace mir::repres +} // namespace mir::repres::unsupported diff --git a/src/mir/repres/unsupported/StretchedGG.h b/src/mir/repres/unsupported/StretchedGG.h index aff5b4bb6..33be8207a 100644 --- a/src/mir/repres/unsupported/StretchedGG.h +++ b/src/mir/repres/unsupported/StretchedGG.h @@ -15,18 +15,20 @@ #include "mir/repres/Gridded.h" -namespace mir::repres { +namespace mir::repres::unsupported { -class StretchedGG : public Gridded { +class StretchedGG final : public Gridded { public: // -- Exceptions // None // -- Constructors - StretchedGG(const param::MIRParametrisation&); + explicit StretchedGG(const param::MIRParametrisation&); + StretchedGG(const StretchedGG&) = delete; + StretchedGG(StretchedGG&&) = delete; // -- Destructor // None @@ -37,6 +39,7 @@ class StretchedGG : public Gridded { // -- Operators StretchedGG& operator=(const StretchedGG&) = delete; + StretchedGG& operator=(StretchedGG&&) = delete; // -- Methods // // None @@ -88,4 +91,4 @@ class StretchedGG : public Gridded { }; -} // namespace mir::repres +} // namespace mir::repres::unsupported diff --git a/src/mir/repres/unsupported/StretchedLL.cc b/src/mir/repres/unsupported/StretchedLL.cc index c4aebe46e..bbe189cf7 100644 --- a/src/mir/repres/unsupported/StretchedLL.cc +++ b/src/mir/repres/unsupported/StretchedLL.cc @@ -15,19 +15,18 @@ #include -namespace mir::repres { +namespace mir::repres::unsupported { -StretchedLL::StretchedLL(const param::MIRParametrisation& /*parametrisation*/) {} +StretchedLL::StretchedLL(const param::MIRParametrisation&) {} void StretchedLL::print(std::ostream& out) const { - out << "StretchedLL[" - << "]"; + out << "StretchedLL[]"; } static const RepresentationBuilder __repres("stretched_ll"); -} // namespace mir::repres +} // namespace mir::repres::unsupported diff --git a/src/mir/repres/unsupported/StretchedLL.h b/src/mir/repres/unsupported/StretchedLL.h index 4b6dc1714..e280a05cb 100644 --- a/src/mir/repres/unsupported/StretchedLL.h +++ b/src/mir/repres/unsupported/StretchedLL.h @@ -15,18 +15,20 @@ #include "mir/repres/Gridded.h" -namespace mir::repres { +namespace mir::repres::unsupported { -class StretchedLL : public Gridded { +class StretchedLL final : public Gridded { public: // -- Exceptions // None // -- Constructors - StretchedLL(const param::MIRParametrisation&); + explicit StretchedLL(const param::MIRParametrisation&); + StretchedLL(const StretchedLL&) = delete; + StretchedLL(StretchedLL&&) = delete; // -- Destructor // None @@ -37,6 +39,7 @@ class StretchedLL : public Gridded { // -- Operators StretchedLL& operator=(const StretchedLL&) = delete; + StretchedLL& operator=(StretchedLL&&) = delete; // -- Methods // // None @@ -88,4 +91,4 @@ class StretchedLL : public Gridded { }; -} // namespace mir::repres +} // namespace mir::repres::unsupported diff --git a/src/mir/repres/unsupported/StretchedRotatedGG.cc b/src/mir/repres/unsupported/StretchedRotatedGG.cc index 81d628194..4b3d60ce8 100644 --- a/src/mir/repres/unsupported/StretchedRotatedGG.cc +++ b/src/mir/repres/unsupported/StretchedRotatedGG.cc @@ -15,19 +15,18 @@ #include -namespace mir::repres { +namespace mir::repres::unsupported { -StretchedRotatedGG::StretchedRotatedGG(const param::MIRParametrisation& /*parametrisation*/) {} +StretchedRotatedGG::StretchedRotatedGG(const param::MIRParametrisation&) {} void StretchedRotatedGG::print(std::ostream& out) const { - out << "StretchedRotatedGG[" - << "]"; + out << "StretchedRotatedGG[]"; } static const RepresentationBuilder __repres("stretched_rotated_gg"); -} // namespace mir::repres +} // namespace mir::repres::unsupported diff --git a/src/mir/repres/unsupported/StretchedRotatedGG.h b/src/mir/repres/unsupported/StretchedRotatedGG.h index 4d539d746..940ce7101 100644 --- a/src/mir/repres/unsupported/StretchedRotatedGG.h +++ b/src/mir/repres/unsupported/StretchedRotatedGG.h @@ -15,18 +15,20 @@ #include "mir/repres/Gridded.h" -namespace mir::repres { +namespace mir::repres::unsupported { -class StretchedRotatedGG : public Gridded { +class StretchedRotatedGG final : public Gridded { public: // -- Exceptions // None // -- Constructors - StretchedRotatedGG(const param::MIRParametrisation&); + explicit StretchedRotatedGG(const param::MIRParametrisation&); + StretchedRotatedGG(const StretchedRotatedGG&) = delete; + StretchedRotatedGG(StretchedRotatedGG&&) = delete; // -- Destructor // None @@ -37,6 +39,7 @@ class StretchedRotatedGG : public Gridded { // -- Operators StretchedRotatedGG& operator=(const StretchedRotatedGG&) = delete; + StretchedRotatedGG& operator=(StretchedRotatedGG&&) = delete; // -- Methods // // None @@ -88,4 +91,4 @@ class StretchedRotatedGG : public Gridded { }; -} // namespace mir::repres +} // namespace mir::repres::unsupported diff --git a/src/mir/repres/unsupported/StretchedRotatedLL.cc b/src/mir/repres/unsupported/StretchedRotatedLL.cc index 8c7d6937a..3b1513200 100644 --- a/src/mir/repres/unsupported/StretchedRotatedLL.cc +++ b/src/mir/repres/unsupported/StretchedRotatedLL.cc @@ -15,19 +15,18 @@ #include -namespace mir::repres { +namespace mir::repres::unsupported { -StretchedRotatedLL::StretchedRotatedLL(const param::MIRParametrisation& /*parametrisation*/) {} +StretchedRotatedLL::StretchedRotatedLL(const param::MIRParametrisation&) {} void StretchedRotatedLL::print(std::ostream& out) const { - out << "StretchedRotatedLL[" - << "]"; + out << "StretchedRotatedLL[]"; } static const RepresentationBuilder __repres("stretched_rotated_ll"); -} // namespace mir::repres +} // namespace mir::repres::unsupported diff --git a/src/mir/repres/unsupported/StretchedRotatedLL.h b/src/mir/repres/unsupported/StretchedRotatedLL.h index 009f62f9e..9b490c12a 100644 --- a/src/mir/repres/unsupported/StretchedRotatedLL.h +++ b/src/mir/repres/unsupported/StretchedRotatedLL.h @@ -15,18 +15,20 @@ #include "mir/repres/Gridded.h" -namespace mir::repres { +namespace mir::repres::unsupported { -class StretchedRotatedLL : public Gridded { +class StretchedRotatedLL final : public Gridded { public: // -- Exceptions // None // -- Constructors - StretchedRotatedLL(const param::MIRParametrisation&); + explicit StretchedRotatedLL(const param::MIRParametrisation&); + StretchedRotatedLL(const StretchedRotatedLL&) = delete; + StretchedRotatedLL(StretchedRotatedLL&&) = delete; // -- Destructor // None @@ -37,6 +39,7 @@ class StretchedRotatedLL : public Gridded { // -- Operators StretchedRotatedLL& operator=(const StretchedRotatedLL&) = delete; + StretchedRotatedLL& operator=(StretchedRotatedLL&&) = delete; // -- Methods // // None @@ -88,4 +91,4 @@ class StretchedRotatedLL : public Gridded { }; -} // namespace mir::repres +} // namespace mir::repres::unsupported diff --git a/src/mir/repres/unsupported/StretchedRotatedSH.cc b/src/mir/repres/unsupported/StretchedRotatedSH.cc index 86afb070c..9c3f7cf20 100644 --- a/src/mir/repres/unsupported/StretchedRotatedSH.cc +++ b/src/mir/repres/unsupported/StretchedRotatedSH.cc @@ -15,19 +15,18 @@ #include -namespace mir::repres { +namespace mir::repres::unsupported { -StretchedRotatedSH::StretchedRotatedSH(const param::MIRParametrisation& /*parametrisation*/) {} +StretchedRotatedSH::StretchedRotatedSH(const param::MIRParametrisation&) {} void StretchedRotatedSH::print(std::ostream& out) const { - out << "StretchedRotatedSH[" - << "]"; + out << "StretchedRotatedSH[]"; } static const RepresentationBuilder __repres("stretched_rotated_sh"); -} // namespace mir::repres +} // namespace mir::repres::unsupported diff --git a/src/mir/repres/unsupported/StretchedRotatedSH.h b/src/mir/repres/unsupported/StretchedRotatedSH.h index 0577e6dfe..ec04fdb75 100644 --- a/src/mir/repres/unsupported/StretchedRotatedSH.h +++ b/src/mir/repres/unsupported/StretchedRotatedSH.h @@ -15,18 +15,20 @@ #include "mir/repres/Gridded.h" -namespace mir::repres { +namespace mir::repres::unsupported { -class StretchedRotatedSH : public Gridded { +class StretchedRotatedSH final : public Gridded { public: // -- Exceptions // None // -- Constructors - StretchedRotatedSH(const param::MIRParametrisation&); + explicit StretchedRotatedSH(const param::MIRParametrisation&); + StretchedRotatedSH(const StretchedRotatedSH&) = delete; + StretchedRotatedSH(StretchedRotatedSH&&) = delete; // -- Destructor // None @@ -37,6 +39,7 @@ class StretchedRotatedSH : public Gridded { // -- Operators StretchedRotatedSH& operator=(const StretchedRotatedSH&) = delete; + StretchedRotatedSH& operator=(StretchedRotatedSH&&) = delete; // -- Methods // // None @@ -88,4 +91,4 @@ class StretchedRotatedSH : public Gridded { }; -} // namespace mir::repres +} // namespace mir::repres::unsupported diff --git a/src/mir/repres/unsupported/StretchedSH.cc b/src/mir/repres/unsupported/StretchedSH.cc index 95ced8c1f..3f2afeab9 100644 --- a/src/mir/repres/unsupported/StretchedSH.cc +++ b/src/mir/repres/unsupported/StretchedSH.cc @@ -15,19 +15,18 @@ #include -namespace mir::repres { +namespace mir::repres::unsupported { -StretchedSH::StretchedSH(const param::MIRParametrisation& /*parametrisation*/) {} +StretchedSH::StretchedSH(const param::MIRParametrisation&) {} void StretchedSH::print(std::ostream& out) const { - out << "StretchedSH[" - << "]"; + out << "StretchedSH[]"; } static const RepresentationBuilder __repres("stretched_sh"); -} // namespace mir::repres +} // namespace mir::repres::unsupported diff --git a/src/mir/repres/unsupported/StretchedSH.h b/src/mir/repres/unsupported/StretchedSH.h index aab219728..8e2a44470 100644 --- a/src/mir/repres/unsupported/StretchedSH.h +++ b/src/mir/repres/unsupported/StretchedSH.h @@ -15,18 +15,20 @@ #include "mir/repres/Gridded.h" -namespace mir::repres { +namespace mir::repres::unsupported { -class StretchedSH : public Gridded { +class StretchedSH final : public Gridded { public: // -- Exceptions // None // -- Constructors - StretchedSH(const param::MIRParametrisation&); + explicit StretchedSH(const param::MIRParametrisation&); + StretchedSH(const StretchedSH&) = delete; + StretchedSH(StretchedSH&&) = delete; // -- Destructor // None @@ -37,6 +39,7 @@ class StretchedSH : public Gridded { // -- Operators StretchedSH& operator=(const StretchedSH&) = delete; + StretchedSH& operator=(StretchedSH&&) = delete; // -- Methods // // None @@ -88,4 +91,4 @@ class StretchedSH : public Gridded { }; -} // namespace mir::repres +} // namespace mir::repres::unsupported diff --git a/src/mir/repres/unsupported/TransverseMercator.cc b/src/mir/repres/unsupported/TransverseMercator.cc index 97b1277ba..1c6828950 100644 --- a/src/mir/repres/unsupported/TransverseMercator.cc +++ b/src/mir/repres/unsupported/TransverseMercator.cc @@ -15,19 +15,18 @@ #include -namespace mir::repres { +namespace mir::repres::unsupported { -TransverseMercator::TransverseMercator(const param::MIRParametrisation& /*parametrisation*/) {} +TransverseMercator::TransverseMercator(const param::MIRParametrisation&) {} void TransverseMercator::print(std::ostream& out) const { - out << "TransverseMercator[" - << "]"; + out << "TransverseMercator[]"; } static const RepresentationBuilder __repres("transverse_mercator"); -} // namespace mir::repres +} // namespace mir::repres::unsupported diff --git a/src/mir/repres/unsupported/TransverseMercator.h b/src/mir/repres/unsupported/TransverseMercator.h index 294b547aa..69f60fa1c 100644 --- a/src/mir/repres/unsupported/TransverseMercator.h +++ b/src/mir/repres/unsupported/TransverseMercator.h @@ -15,18 +15,20 @@ #include "mir/repres/Gridded.h" -namespace mir::repres { +namespace mir::repres::unsupported { -class TransverseMercator : public Gridded { +class TransverseMercator final : public Gridded { public: // -- Exceptions // None // -- Constructors - TransverseMercator(const param::MIRParametrisation&); + explicit TransverseMercator(const param::MIRParametrisation&); + TransverseMercator(const TransverseMercator&) = delete; + TransverseMercator(TransverseMercator&&) = delete; // -- Destructor // None @@ -37,6 +39,7 @@ class TransverseMercator : public Gridded { // -- Operators TransverseMercator& operator=(const TransverseMercator&) = delete; + TransverseMercator& operator=(TransverseMercator&&) = delete; // -- Methods // // None @@ -88,4 +91,4 @@ class TransverseMercator : public Gridded { }; -} // namespace mir::repres +} // namespace mir::repres::unsupported From c387e9f59b180f7dfdd28b716fdfc8b4a65c7ffa Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Wed, 28 Feb 2024 09:18:50 +0000 Subject: [PATCH 18/69] MIR-643 HEALPix orderingConvention=nested minimal regridding support --- src/mir/CMakeLists.txt | 16 +-- src/mir/repres/Representation.h | 6 +- src/mir/repres/proxy/HEALPix.cc | 42 ++++---- src/mir/repres/proxy/HEALPix.h | 24 ++--- src/mir/repres/unsupported/HEALPixNested.cc | 93 +++++++++++++++++ src/mir/repres/unsupported/HEALPixNested.h | 106 ++++++++++++++++++++ 6 files changed, 238 insertions(+), 49 deletions(-) create mode 100644 src/mir/repres/unsupported/HEALPixNested.cc create mode 100644 src/mir/repres/unsupported/HEALPixNested.h diff --git a/src/mir/CMakeLists.txt b/src/mir/CMakeLists.txt index 0b4a332c9..c4d1353a1 100644 --- a/src/mir/CMakeLists.txt +++ b/src/mir/CMakeLists.txt @@ -770,10 +770,10 @@ if(mir_HAVE_ATLAS) caching/legendre/NoLoader.h caching/legendre/SharedMemoryLoader.cc caching/legendre/SharedMemoryLoader.h - key/grid/NamedHEALPix.cc - key/grid/NamedHEALPix.h key/grid/HEALPixPattern.cc key/grid/HEALPixPattern.h + key/grid/NamedHEALPix.cc + key/grid/NamedHEALPix.h key/grid/NamedORCA.cc key/grid/NamedORCA.h key/grid/ORCAPattern.cc @@ -800,12 +800,14 @@ if(mir_HAVE_ATLAS) method/structured/StructuredMethod.h output/GmshOutput.cc output/GmshOutput.h - repres/proxy/ProxyGrid.h - repres/proxy/ProxyGrid.cc - repres/proxy/ORCA.h - repres/proxy/ORCA.cc - repres/proxy/HEALPix.h repres/proxy/HEALPix.cc + repres/proxy/HEALPix.h + repres/proxy/ORCA.cc + repres/proxy/ORCA.h + repres/proxy/ProxyGrid.cc + repres/proxy/ProxyGrid.h + repres/unsupported/HEALPixNested.cc + repres/unsupported/HEALPixNested.h stats/statistics/Integral.cc stats/statistics/Integral.h) else() diff --git a/src/mir/repres/Representation.h b/src/mir/repres/Representation.h index 9e9423cb9..1b3b3327a 100644 --- a/src/mir/repres/Representation.h +++ b/src/mir/repres/Representation.h @@ -199,7 +199,7 @@ class RepresentationHandle { public: RepresentationHandle(const Representation*); - RepresentationHandle(const RepresentationHandle&); + explicit RepresentationHandle(const RepresentationHandle&); ~RepresentationHandle(); const Representation* operator->() const { return representation_; } operator const Representation*() const { return representation_; } @@ -217,7 +217,7 @@ class RepresentationFactory { RepresentationFactory& operator=(const RepresentationFactory&) = delete; protected: - RepresentationFactory(const std::string&); + explicit RepresentationFactory(const std::string&); virtual ~RepresentationFactory(); public: @@ -233,7 +233,7 @@ class RepresentationBuilder : public RepresentationFactory { Representation* make(const param::MIRParametrisation& param) override { return new T(param); } public: - RepresentationBuilder(const std::string& name) : RepresentationFactory(name) {} + explicit RepresentationBuilder(const std::string& name) : RepresentationFactory(name) {} }; diff --git a/src/mir/repres/proxy/HEALPix.cc b/src/mir/repres/proxy/HEALPix.cc index 157082937..466463669 100644 --- a/src/mir/repres/proxy/HEALPix.cc +++ b/src/mir/repres/proxy/HEALPix.cc @@ -21,11 +21,11 @@ #include "eckit/types/FloatCompare.h" #include "atlas/interpolation/method/knn/GridBox.h" - -#include "mir/repres/Iterator.h" -#include "mir/util/Atlas.h" +#include "mir/param/MIRParametrisation.h" +#include "mir/repres/unsupported/HEALPixNested.h" #include "mir/util/Exceptions.h" #include "mir/util/Grib.h" +#include "mir/util/GridBox.h" #include "mir/util/MeshGeneratorParameters.h" @@ -212,7 +212,7 @@ int HEALPix::Reorder::nest_to_ring(int n) const { HEALPix::HEALPix(size_t Nside, const std::string& orderingConvention) : Nside_(Nside), orderingConvention_(orderingConvention) { ASSERT(Nside_ > 0); - ASSERT(orderingConvention_ == "ring" || orderingConvention_ == "nested"); + ASSERT(orderingConvention_ == "ring"); } @@ -220,7 +220,7 @@ HEALPix::HEALPix(const param::MIRParametrisation& param) : Nside_(0), orderingCo param.get("Nside", Nside_); ASSERT(Nside_ > 0); ASSERT(param.get("orderingConvention", orderingConvention_)); - ASSERT(orderingConvention_ == "ring" || orderingConvention_ == "nested"); + ASSERT(orderingConvention_ == "ring"); double lon1 = 0.; ASSERT(param.get("longitudeOfFirstGridPointInDegrees", lon1)); @@ -232,11 +232,8 @@ HEALPix::~HEALPix() = default; const ::atlas::Grid& HEALPix::atlasGridRef() const { - ASSERT(orderingConvention_ == "ring"); - if (!grid_) { grid_ = atlas::HealpixGrid(Nside_, orderingConvention_); - ASSERT(grid_.size() == numberOfPoints()); } return grid_; } @@ -249,7 +246,7 @@ bool HEALPix::sameAs(const Representation& other) const { std::string HEALPix::name() const { - return "H" + std::to_string(Nside_) + (orderingConvention_ == "ring" ? "" : "n"); + return "H" + std::to_string(Nside_); } @@ -287,8 +284,6 @@ void HEALPix::print(std::ostream& out) const { std::vector HEALPix::gridBoxes() const { - ASSERT(orderingConvention_ == "ring"); - ::atlas::interpolation::method::GridBoxes boxes(atlasGridRef(), false); std::vector mirBoxes(boxes.size()); std::transform(boxes.cbegin(), boxes.cend(), mirBoxes.begin(), [](const auto& other) { @@ -298,22 +293,23 @@ std::vector HEALPix::gridBoxes() const { } -size_t HEALPix::numberOfPoints() const { - return 12 * Nside_ * Nside_; -} - +static const struct HEALPixRepresentationBuilder : public RepresentationFactory { + Representation* make(const param::MIRParametrisation& param) override { + std::string orderingConvention; + param.get("orderingConvention", orderingConvention); -Iterator* HEALPix::iterator() const { - if (orderingConvention_ == "ring") { - return ProxyGrid::iterator(); - } + if (orderingConvention == "nested") { + size_t Nside = 0; + ASSERT(param.get("Nside", Nside) && Nside > 0); - ASSERT(orderingConvention_ == "nested"); - NOTIMP; -} + return new unsupported::HEALPixNested(Nside); + } + return new HEALPix(param); + } -static const RepresentationBuilder __grid("healpix"); + explicit HEALPixRepresentationBuilder(const std::string& name) : RepresentationFactory(name) {} +} __grid("healpix"); } // namespace mir::repres::proxy diff --git a/src/mir/repres/proxy/HEALPix.h b/src/mir/repres/proxy/HEALPix.h index f2de4de11..37cf8b21c 100644 --- a/src/mir/repres/proxy/HEALPix.h +++ b/src/mir/repres/proxy/HEALPix.h @@ -16,9 +16,12 @@ #include #include -#include "mir/param/MIRParametrisation.h" #include "mir/repres/proxy/ProxyGrid.h" -#include "mir/util/GridBox.h" + + +namespace mir::repres::unsupported { +class HEALPixNested; +} namespace mir::repres::proxy { @@ -28,15 +31,6 @@ class HEALPix final : public ProxyGrid { public: // -- Types - enum Ordering - { - healpix_ring, - healpix_nested, - - healpix_ordering = healpix_ring, - healpix_ordering_end = healpix_nested, - }; - class Reorder { public: explicit Reorder(int Nside); @@ -75,10 +69,11 @@ class HEALPix final : public ProxyGrid { // -- Operators HEALPix& operator=(const HEALPix&) = delete; - HEALPix&& operator=(HEALPix&&) = delete; + HEALPix& operator=(HEALPix&&) = delete; // -- Methods - // None + + size_t Nside() const { return Nside_; } // -- Overridden methods // None @@ -117,9 +112,6 @@ class HEALPix final : public ProxyGrid { std::vector gridBoxes() const override; - size_t numberOfPoints() const override; - Iterator* iterator() const override; - // -- Class members // None diff --git a/src/mir/repres/unsupported/HEALPixNested.cc b/src/mir/repres/unsupported/HEALPixNested.cc new file mode 100644 index 000000000..9b3a1b3be --- /dev/null +++ b/src/mir/repres/unsupported/HEALPixNested.cc @@ -0,0 +1,93 @@ +/* + * (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/repres/unsupported/HEALPixNested.h" + +// #include +// #include +// #include +// #include +// #include +// +// #include "eckit/types/FloatCompare.h" +// +// #include "mir/repres/proxy/HEALPix.h" +// #include "mir/repres/Iterator.h" +// #include "mir/util/Atlas.h" +// #include "mir/util/Grib.h" +// #include "mir/util/MeshGeneratorParameters.h" +// +// +// #include "atlas/interpolation/method/knn/GridBox.h" +// +// #include "mir/util/Exceptions.h" + + +namespace mir::repres::unsupported { + + +bool HEALPixNested::sameAs(const Representation&) const { + NOTIMP; +} + + +void HEALPixNested::makeName(std::ostream&) const { + NOTIMP; +} + + +void HEALPixNested::fillGrib(grib_info&) const { + NOTIMP; +} + + +void HEALPixNested::fillMeshGen(util::MeshGeneratorParameters&) const { + NOTIMP; +} + + +void HEALPixNested::fillJob(api::MIRJob&) const { + NOTIMP; +} + + +void HEALPixNested::print(std::ostream&) const { + NOTIMP; +} + + +std::vector HEALPixNested::gridBoxes() const { + NOTIMP; +} + + +::atlas::Grid HEALPixNested::atlasGrid() const { + NOTIMP; +} + + +void HEALPixNested::validate(const MIRValuesVector& values) const { + NOTIMP; +} + + +size_t HEALPixNested::numberOfPoints() const { + NOTIMP; +} + + +Iterator* HEALPixNested::iterator() const { + NOTIMP; +} + + +} // namespace mir::repres::unsupported diff --git a/src/mir/repres/unsupported/HEALPixNested.h b/src/mir/repres/unsupported/HEALPixNested.h new file mode 100644 index 000000000..06ac9e0d9 --- /dev/null +++ b/src/mir/repres/unsupported/HEALPixNested.h @@ -0,0 +1,106 @@ +/* + * (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/repres/Gridded.h" + +#include "mir/repres/proxy/HEALPix.h" + + +namespace mir::repres::unsupported { + + +class HEALPixNested final : public Gridded { +public: + // -- Types + // None + + // -- Exceptions + // None + + // -- Constructors + + explicit HEALPixNested(size_t Nside) : ring_(Nside) {} + explicit HEALPixNested(const param::MIRParametrisation& param) : ring_(param) {} + + HEALPixNested(const HEALPixNested&) = delete; + HEALPixNested(HEALPixNested&&) = delete; + + // -- Destructor + // None + + // -- Convertors + // None + + // -- Operators + + HEALPixNested& operator=(const HEALPixNested&) = delete; + HEALPixNested& operator=(HEALPixNested&&) = delete; + + // -- Methods + // None + + // -- Overridden methods + // None + + // -- Class members + // None + + // -- Class methods + // None + +private: + // -- Members + + proxy::HEALPix ring_; + + // -- Methods + // None + + // -- Overridden methods + + bool sameAs(const Representation&) const override; + void makeName(std::ostream&) const override; + + void fillGrib(grib_info&) const override; + void fillMeshGen(util::MeshGeneratorParameters&) const override; + void fillJob(api::MIRJob&) const override; + + void print(std::ostream&) const override; + + std::vector gridBoxes() const override; + + ::atlas::Grid atlasGrid() const override; + + void validate(const MIRValuesVector&) const override; + + size_t numberOfPoints() const override; + + bool includesNorthPole() const override { return true; } + bool includesSouthPole() const override { return true; } + bool isPeriodicWestEast() const override { return true; } + + Iterator* iterator() const override; + + // -- Class members + // None + + // -- Class methods + // None + + // -- Friends + // None +}; + + +} // namespace mir::repres::unsupported From c214797f06f26668cba2fd7ce117f646aab18f9f Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Wed, 28 Feb 2024 11:32:42 +0000 Subject: [PATCH 19/69] MIR-643 HEALPix orderingConvention=nested minimal regridding support --- src/mir/repres/unsupported/HEALPixNested.cc | 90 +++++++++------------ src/mir/repres/unsupported/HEALPixNested.h | 37 ++++----- 2 files changed, 57 insertions(+), 70 deletions(-) diff --git a/src/mir/repres/unsupported/HEALPixNested.cc b/src/mir/repres/unsupported/HEALPixNested.cc index 9b3a1b3be..5b6dcd465 100644 --- a/src/mir/repres/unsupported/HEALPixNested.cc +++ b/src/mir/repres/unsupported/HEALPixNested.cc @@ -12,81 +12,67 @@ #include "mir/repres/unsupported/HEALPixNested.h" -// #include -// #include -// #include -// #include -// #include -// -// #include "eckit/types/FloatCompare.h" -// -// #include "mir/repres/proxy/HEALPix.h" -// #include "mir/repres/Iterator.h" -// #include "mir/util/Atlas.h" -// #include "mir/util/Grib.h" -// #include "mir/util/MeshGeneratorParameters.h" -// -// -// #include "atlas/interpolation/method/knn/GridBox.h" -// -// #include "mir/util/Exceptions.h" +#include - -namespace mir::repres::unsupported { - - -bool HEALPixNested::sameAs(const Representation&) const { - NOTIMP; -} - - -void HEALPixNested::makeName(std::ostream&) const { - NOTIMP; -} - - -void HEALPixNested::fillGrib(grib_info&) const { - NOTIMP; -} +#include "mir/iterator/UnstructuredIterator.h" +#include "mir/util/Exceptions.h" +#include "mir/util/GridBox.h" -void HEALPixNested::fillMeshGen(util::MeshGeneratorParameters&) const { - NOTIMP; -} +namespace mir::repres::unsupported { -void HEALPixNested::fillJob(api::MIRJob&) const { - NOTIMP; +void HEALPixNested::makeName(std::ostream& out) const { + out << "H" << std::to_string(ring_.Nside()) << "_nested"; } -void HEALPixNested::print(std::ostream&) const { - NOTIMP; +void HEALPixNested::print(std::ostream& out) const { + out << "HEALPixNested[name=" << "H" << std::to_string(ring_.Nside()) << "_nested" << "]"; } std::vector HEALPixNested::gridBoxes() const { - NOTIMP; -} + const proxy::HEALPix::Reorder reorder(static_cast(ring_.Nside())); + const auto N = numberOfPoints(); + std::vector boxes(N); -::atlas::Grid HEALPixNested::atlasGrid() const { - NOTIMP; -} - + int i = 0; + for (const auto& box : ring().gridBoxes()) { + auto j = reorder.ring_to_nest(i++); + boxes.at(j) = box; + } + ASSERT(i == N); -void HEALPixNested::validate(const MIRValuesVector& values) const { - NOTIMP; + return boxes; } -size_t HEALPixNested::numberOfPoints() const { +::atlas::Grid HEALPixNested::atlasGrid() const { + // NOTE: delete class altogether once we can build HEALPix nested-ordering atlas::Grid NOTIMP; } Iterator* HEALPixNested::iterator() const { - NOTIMP; + if (longitudes_.empty()) { + const proxy::HEALPix::Reorder reorder(static_cast(ring_.Nside())); + const auto N = numberOfPoints(); + + longitudes_.resize(N); + latitudes_.resize(N); + + int i = 0; + for (const auto& point : ring().atlasGrid().lonlat()) { + auto j = reorder.ring_to_nest(i++); + longitudes_.at(j) = point.lon(); + latitudes_.at(j) = point.lat(); + } + ASSERT(i == N); + } + + return new iterator::UnstructuredIterator(latitudes_, longitudes_); } diff --git a/src/mir/repres/unsupported/HEALPixNested.h b/src/mir/repres/unsupported/HEALPixNested.h index 06ac9e0d9..1c64ebb27 100644 --- a/src/mir/repres/unsupported/HEALPixNested.h +++ b/src/mir/repres/unsupported/HEALPixNested.h @@ -31,10 +31,6 @@ class HEALPixNested final : public Gridded { // -- Constructors explicit HEALPixNested(size_t Nside) : ring_(Nside) {} - explicit HEALPixNested(const param::MIRParametrisation& param) : ring_(param) {} - - HEALPixNested(const HEALPixNested&) = delete; - HEALPixNested(HEALPixNested&&) = delete; // -- Destructor // None @@ -43,9 +39,7 @@ class HEALPixNested final : public Gridded { // None // -- Operators - - HEALPixNested& operator=(const HEALPixNested&) = delete; - HEALPixNested& operator=(HEALPixNested&&) = delete; + // None // -- Methods // None @@ -63,18 +57,25 @@ class HEALPixNested final : public Gridded { // -- Members proxy::HEALPix ring_; + mutable std::vector longitudes_; + mutable std::vector latitudes_; // -- Methods - // None + + inline const Representation& ring() const { return static_cast(ring_); } // -- Overridden methods - bool sameAs(const Representation&) const override; - void makeName(std::ostream&) const override; + bool sameAs(const Representation& other) const override { + const auto* o = dynamic_cast(&other); + return (o != nullptr) && ring_.Nside() == o->ring_.Nside(); + } + + void makeName(std::ostream& out) const override; - void fillGrib(grib_info&) const override; - void fillMeshGen(util::MeshGeneratorParameters&) const override; - void fillJob(api::MIRJob&) const override; + void fillGrib(grib_info& info) const override { ring().fillGrib(info); } + void fillMeshGen(util::MeshGeneratorParameters& param) const override { ring().fillMeshGen(param); } + void fillJob(api::MIRJob& job) const override { ring().fillJob(job); } void print(std::ostream&) const override; @@ -82,13 +83,13 @@ class HEALPixNested final : public Gridded { ::atlas::Grid atlasGrid() const override; - void validate(const MIRValuesVector&) const override; + void validate(const MIRValuesVector& values) const override { ring().validate(values); } - size_t numberOfPoints() const override; + size_t numberOfPoints() const override { return ring().numberOfPoints(); } - bool includesNorthPole() const override { return true; } - bool includesSouthPole() const override { return true; } - bool isPeriodicWestEast() const override { return true; } + bool includesNorthPole() const override { return ring().includesNorthPole(); } + bool includesSouthPole() const override { return ring().includesSouthPole(); } + bool isPeriodicWestEast() const override { return ring().isPeriodicWestEast(); } Iterator* iterator() const override; From 986a918b337f61ce046f9a58b057fe6243808462 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Wed, 28 Feb 2024 11:32:46 +0000 Subject: [PATCH 20/69] Cleanup --- src/mir/repres/proxy/HEALPix.cc | 5 +---- src/mir/repres/proxy/HEALPix.h | 15 +++++---------- src/mir/repres/proxy/ORCA.cc | 3 --- src/mir/repres/proxy/ORCA.h | 11 ++++------- src/mir/repres/proxy/ProxyGrid.cc | 13 ++++--------- src/mir/repres/proxy/ProxyGrid.h | 4 +++- 6 files changed, 17 insertions(+), 34 deletions(-) diff --git a/src/mir/repres/proxy/HEALPix.cc b/src/mir/repres/proxy/HEALPix.cc index 466463669..1b612e680 100644 --- a/src/mir/repres/proxy/HEALPix.cc +++ b/src/mir/repres/proxy/HEALPix.cc @@ -228,12 +228,9 @@ HEALPix::HEALPix(const param::MIRParametrisation& param) : Nside_(0), orderingCo } -HEALPix::~HEALPix() = default; - - const ::atlas::Grid& HEALPix::atlasGridRef() const { if (!grid_) { - grid_ = atlas::HealpixGrid(Nside_, orderingConvention_); + grid_ = atlas::HealpixGrid(static_cast(Nside_), orderingConvention_); } return grid_; } diff --git a/src/mir/repres/proxy/HEALPix.h b/src/mir/repres/proxy/HEALPix.h index 37cf8b21c..db00dd4c4 100644 --- a/src/mir/repres/proxy/HEALPix.h +++ b/src/mir/repres/proxy/HEALPix.h @@ -56,20 +56,14 @@ class HEALPix final : public ProxyGrid { explicit HEALPix(size_t Nside, const std::string& orderingConvention = "ring"); explicit HEALPix(const param::MIRParametrisation&); - HEALPix(const HEALPix&) = delete; - HEALPix(HEALPix&&) = delete; - // -- Destructor - - ~HEALPix() override; + // None // -- Convertors // None // -- Operators - - HEALPix& operator=(const HEALPix&) = delete; - HEALPix& operator=(HEALPix&&) = delete; + // None // -- Methods @@ -108,10 +102,11 @@ class HEALPix final : public ProxyGrid { void print(std::ostream&) const override; - const ::atlas::Grid& atlasGridRef() const override; - std::vector gridBoxes() const override; + // from ProxyGrid + const ::atlas::Grid& atlasGridRef() const override; + // -- Class members // None diff --git a/src/mir/repres/proxy/ORCA.cc b/src/mir/repres/proxy/ORCA.cc index 02c799021..3531e473c 100644 --- a/src/mir/repres/proxy/ORCA.cc +++ b/src/mir/repres/proxy/ORCA.cc @@ -42,9 +42,6 @@ ORCA::ORCA(const param::MIRParametrisation& param) : }()) {} -ORCA::~ORCA() = default; - - bool ORCA::sameAs(const Representation& other) const { const auto* o = dynamic_cast(&other); return (o != nullptr) && spec_.getString("uid") == o->spec_.getString("uid"); diff --git a/src/mir/repres/proxy/ORCA.h b/src/mir/repres/proxy/ORCA.h index 13d8894cc..e8b097607 100644 --- a/src/mir/repres/proxy/ORCA.h +++ b/src/mir/repres/proxy/ORCA.h @@ -29,20 +29,17 @@ class ORCA final : public ProxyGrid { // -- Constructors - ORCA(const std::string& uid); - ORCA(const param::MIRParametrisation&); - ORCA(const ORCA&) = delete; + explicit ORCA(const std::string& uid); + explicit ORCA(const param::MIRParametrisation&); // -- Destructor - - ~ORCA() override; + // None // -- Convertors // None // -- Operators - - ORCA& operator=(const ORCA&) = delete; + // None // -- Methods // None diff --git a/src/mir/repres/proxy/ProxyGrid.cc b/src/mir/repres/proxy/ProxyGrid.cc index a20af37d4..2cc6c17d4 100644 --- a/src/mir/repres/proxy/ProxyGrid.cc +++ b/src/mir/repres/proxy/ProxyGrid.cc @@ -54,8 +54,8 @@ Iterator* ProxyGrid::iterator() const { decltype(lonlat_)::iterator::value_type p_; const size_t total_; - size_t index_; - bool first_; + size_t index_{0}; + bool first_{true}; void print(std::ostream& out) const override { out << "AtlasIterator["; @@ -87,13 +87,8 @@ Iterator* ProxyGrid::iterator() const { size_t index() const override { return index_; } public: - AtlasIterator(const ::atlas::Grid& grid) : - grid_(grid), - lonlat_(grid.lonlat()), - it_(lonlat_.begin()), - total_(size_t(grid.size())), - index_(0), - first_(true) {} + explicit AtlasIterator(const ::atlas::Grid& grid) : + grid_(grid), lonlat_(grid.lonlat()), it_(lonlat_.begin()), total_(static_cast(grid.size())) {} ~AtlasIterator() override = default; diff --git a/src/mir/repres/proxy/ProxyGrid.h b/src/mir/repres/proxy/ProxyGrid.h index 08e67b48a..59177064b 100644 --- a/src/mir/repres/proxy/ProxyGrid.h +++ b/src/mir/repres/proxy/ProxyGrid.h @@ -28,10 +28,11 @@ class ProxyGrid : public Gridded { // -- Constructors ProxyGrid(const ProxyGrid&) = delete; + ProxyGrid(ProxyGrid&&) = delete; // -- Destructor - ~ProxyGrid() = default; + ~ProxyGrid() override = default; // -- Convertors // None @@ -39,6 +40,7 @@ class ProxyGrid : public Gridded { // -- Operators ProxyGrid& operator=(const ProxyGrid&) = delete; + ProxyGrid& operator=(ProxyGrid&&) = delete; // -- Methods // None From 87bb31668a41e55fd55884216928a0292160ad6c Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Wed, 28 Feb 2024 14:21:18 +0000 Subject: [PATCH 21/69] MIR-643 HEALPix orderingConvention=nested unit tests --- tests/assertions/MIR-643.001.test | 10 ++++++++++ tests/assertions/MIR-643.002.test | 10 ++++++++++ tests/assertions/MIR-643.003.test | 10 ++++++++++ tests/assertions/MIR-643.004.test | 9 +++++++++ tests/assertions/MIR-643.005.test | 9 +++++++++ ...pix,Nside=32,orderingConvention=nested.grib2 | 1 + ...pix,Nside=32,orderingConvention=nested.grib2 | Bin 0 -> 23910 bytes tests/plans/MIR-643.001.test | 6 ++++++ tests/plans/MIR-643.002.test | 6 ++++++ tests/plans/MIR-643.003.test | 6 ++++++ tests/plans/MIR-643.004.test | 6 ++++++ tests/plans/MIR-643.005.test | 6 ++++++ ...pix,Nside=32,orderingConvention=nested.grib2 | 1 + 13 files changed, 80 insertions(+) create mode 100644 tests/assertions/MIR-643.001.test create mode 100644 tests/assertions/MIR-643.002.test create mode 100644 tests/assertions/MIR-643.003.test create mode 100644 tests/assertions/MIR-643.004.test create mode 100644 tests/assertions/MIR-643.005.test create mode 120000 tests/assertions/gridType=healpix,Nside=32,orderingConvention=nested.grib2 create mode 100644 tests/data/gridType=healpix,Nside=32,orderingConvention=nested.grib2 create mode 100644 tests/plans/MIR-643.001.test create mode 100644 tests/plans/MIR-643.002.test create mode 100644 tests/plans/MIR-643.003.test create mode 100644 tests/plans/MIR-643.004.test create mode 100644 tests/plans/MIR-643.005.test create mode 120000 tests/plans/gridType=healpix,Nside=32,orderingConvention=nested.grib2 diff --git a/tests/assertions/MIR-643.001.test b/tests/assertions/MIR-643.001.test new file mode 100644 index 000000000..002ac5ef4 --- /dev/null +++ b/tests/assertions/MIR-643.001.test @@ -0,0 +1,10 @@ +# mars +gridType=healpix,Nside=32,orderingConvention=nested.grib2 +# mir +--grid=1/1 --interpolation=nn +# grib_get +gridType=regular_ll +Ni=360 +Nj=181 +packingType=grid_ccsds +edition=2 diff --git a/tests/assertions/MIR-643.002.test b/tests/assertions/MIR-643.002.test new file mode 100644 index 000000000..3a644e676 --- /dev/null +++ b/tests/assertions/MIR-643.002.test @@ -0,0 +1,10 @@ +# mars +gridType=healpix,Nside=32,orderingConvention=nested.grib2 +# mir +--grid=h32 --interpolation=nn +# grib_get +gridType=healpix +orderingConvention=ring +Nside=32 +packingType=grid_ccsds +edition=2 diff --git a/tests/assertions/MIR-643.003.test b/tests/assertions/MIR-643.003.test new file mode 100644 index 000000000..d7b9146de --- /dev/null +++ b/tests/assertions/MIR-643.003.test @@ -0,0 +1,10 @@ +# mars +gridType=healpix,Nside=32,orderingConvention=nested.grib2 +# mir +--grid=h16_nested --interpolation=grid-box-average +# grib_get +gridType=healpix +orderingConvention=nested +Nside=16 +packingType=grid_ccsds +edition=2 diff --git a/tests/assertions/MIR-643.004.test b/tests/assertions/MIR-643.004.test new file mode 100644 index 000000000..09df5cfe7 --- /dev/null +++ b/tests/assertions/MIR-643.004.test @@ -0,0 +1,9 @@ +# mars +regular_ll.2-2.grib2 +# mir +--grid=h16 --interpolation=nn +# grib_get +gridType=healpix +orderingConvention=ring +Nside=16 +edition=2 diff --git a/tests/assertions/MIR-643.005.test b/tests/assertions/MIR-643.005.test new file mode 100644 index 000000000..cbdafb955 --- /dev/null +++ b/tests/assertions/MIR-643.005.test @@ -0,0 +1,9 @@ +# mars +regular_ll.2-2.grib2 +# mir +--grid=h16_nested --interpolation=nn +# grib_get +gridType=healpix +orderingConvention=nested +Nside=16 +edition=2 diff --git a/tests/assertions/gridType=healpix,Nside=32,orderingConvention=nested.grib2 b/tests/assertions/gridType=healpix,Nside=32,orderingConvention=nested.grib2 new file mode 120000 index 000000000..ffce060ce --- /dev/null +++ b/tests/assertions/gridType=healpix,Nside=32,orderingConvention=nested.grib2 @@ -0,0 +1 @@ +../data/gridType=healpix,Nside=32,orderingConvention=nested.grib2 \ No newline at end of file diff --git a/tests/data/gridType=healpix,Nside=32,orderingConvention=nested.grib2 b/tests/data/gridType=healpix,Nside=32,orderingConvention=nested.grib2 new file mode 100644 index 0000000000000000000000000000000000000000..6642c56d54287ac38cc5a4a462517a0eecfff59f GIT binary patch literal 23910 zcmb_^2Rv2p|M+w6z4p3hGOxX7lFVxrEh9-qE-gtJQ3^R$NrVVZRCY>Aq~Y4yGD4DT zBqc@J>--<0_388Ze!jo&|Lx^G?|q*0oM*hBaqdcMb0ZAH;lLa??1Tv~0-OOL0feC! zC&&sJ82snN0R;Zx2#Bhxsv2a-O67E_WnSjj7#R;=l2-sPuH^)ML zGJt}`baSrcXO+-J0Pq8L5^HU&@eILo$+;Odb%{6_*xdS6jl>@~m#lsViNs z^#>>9{L+eu6p%orJBZ5F08MHgt0xe;; zB=tUeK390}o6Z(;wdj3y5rsuzw239rQ`NZjwagcHlVc@%0eE#r&7x*(nkPb>Wb3!qyU7Gr&~4rD3SJE{tI$^%GO-|p%m#G6LGS@y33ry zGjpj756ri5t)$HHy?0!`tO!66phv&y{kYou;@$`y4(@t^e7-vLctgeowd;wSHaI(; zVB4R)ld|l+L}+O{*0lQ>vi91B60Gu+FJnyvL2eW8#?nVxjJlmR{Q6}rX;wj9R|yO$ zN4t(%YSQ6G&4T#($^E2PRIx3TWB9)*vcK4Z{vEa??_HDiVsk9LeE!J&~3wJByc3F9?S6Lh0GBTn{6=0?f=44MOpuTj!6QrO5%n_nlg&!=#>h5 z@~W1kcM5&cbtS9xL-Mj!Tof)IA0}%9>-&nPYt(L>uqyo6`zSgbqnhE!zMhkxp1}GF z_y8aRgvWu?I2(wkK&SMUU?-rj1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vm6ut)Aj8bUhrarCAVLfBxbo|dAW=Ch;#v&;6?2Xw1961J~;{}Rm$9^ zZJB5&y=s`BgJ*&uz1qoJ3?g(}bO er|ctBE9 Date: Wed, 28 Feb 2024 14:21:49 +0000 Subject: [PATCH 22/69] MIR-643 HEALPix orderingConvention=nested unit tests fixes --- src/mir/input/GribInput.cc | 46 ++++++++++++++++++--- src/mir/repres/unsupported/HEALPixNested.cc | 11 +++++ src/mir/repres/unsupported/HEALPixNested.h | 2 +- 3 files changed, 53 insertions(+), 6 deletions(-) diff --git a/src/mir/input/GribInput.cc b/src/mir/input/GribInput.cc index add72e7b7..16bd55321 100644 --- a/src/mir/input/GribInput.cc +++ b/src/mir/input/GribInput.cc @@ -329,10 +329,11 @@ static const char* get_key(const std::string& name, grib_handle* h) { {"gridded_regular_ll", "Ni", _or(is("gridType", "regular_ll"), is("gridType", "rotated_ll"))}, {"grid", "gridName", - _or(_or(_or(_or(_or(is("gridType", "regular_gg"), is("gridType", "reduced_gg")), is("gridType", "rotated_gg")), - is("gridType", "reduced_rotated_gg")), - is("gridType", "unstructured_grid")), - is("gridType", "healpix"))}, + _or(_or(_or(_or(is("gridType", "regular_gg"), is("gridType", "reduced_gg")), is("gridType", "rotated_gg")), + is("gridType", "reduced_rotated_gg")), + is("gridType", "unstructured_grid"))}, + + {"grid", "gridName_fix_for_healpix_grids", is("gridType", "healpix")}, {"spectral", "pentagonalResolutionParameterJ"}, @@ -598,6 +599,40 @@ static ProcessingT* packing() { } +static ProcessingT* gridName_fix_for_healpix_grids() { + return new ProcessingT([](grib_handle* h, std::string& value) { + std::string gridName; + + char buffer[64]; + size_t size = sizeof(buffer); + + GRIB_CALL(codes_get_string(h, "gridName", buffer, &size)); + ASSERT(size < sizeof(buffer) - 1); + + if (::strcmp(buffer, "MISSING") != 0) { + gridName += buffer; + } + + size = sizeof(buffer); + GRIB_CALL(codes_get_string(h, "orderingConvention", buffer, &size)); + ASSERT(size < sizeof(buffer) - 1); + + if (::strcmp(buffer, "MISSING") != 0) { + if (::strcmp(buffer, "nested") == 0) { + gridName += "_nested"; + } + } + + if (!gridName.empty()) { + value = gridName; + return true; + } + + return false; + }); +} + + template struct ConditionedProcessingT { const std::string name; @@ -1002,7 +1037,8 @@ bool GribInput::get(const std::string& name, std::string& value) const { int err = codes_get_string(grib_, key, buffer, &size); if (err == CODES_NOT_FOUND) { - static const ProcessingList process{{"packing", packing()}}; + static const ProcessingList process{ + {"packing", packing()}, {"gridName_fix_for_healpix_grids", gridName_fix_for_healpix_grids()}}; return get_value(key, grib_, value, process) || FieldParametrisation::get(name, value); } diff --git a/src/mir/repres/unsupported/HEALPixNested.cc b/src/mir/repres/unsupported/HEALPixNested.cc index 5b6dcd465..385e0a092 100644 --- a/src/mir/repres/unsupported/HEALPixNested.cc +++ b/src/mir/repres/unsupported/HEALPixNested.cc @@ -16,6 +16,7 @@ #include "mir/iterator/UnstructuredIterator.h" #include "mir/util/Exceptions.h" +#include "mir/util/Grib.h" #include "mir/util/GridBox.h" @@ -27,6 +28,16 @@ void HEALPixNested::makeName(std::ostream& out) const { } +void HEALPixNested::fillGrib(grib_info& info) const { + info.grid.grid_type = GRIB_UTIL_GRID_SPEC_HEALPIX; + info.grid.N = static_cast(ring_.Nside()); + + info.grid.longitudeOfFirstGridPointInDegrees = 45.; // Not sure what this should be + + info.extra_set("orderingConvention", "nested"); +} + + void HEALPixNested::print(std::ostream& out) const { out << "HEALPixNested[name=" << "H" << std::to_string(ring_.Nside()) << "_nested" << "]"; } diff --git a/src/mir/repres/unsupported/HEALPixNested.h b/src/mir/repres/unsupported/HEALPixNested.h index 1c64ebb27..e982ad2e1 100644 --- a/src/mir/repres/unsupported/HEALPixNested.h +++ b/src/mir/repres/unsupported/HEALPixNested.h @@ -73,7 +73,7 @@ class HEALPixNested final : public Gridded { void makeName(std::ostream& out) const override; - void fillGrib(grib_info& info) const override { ring().fillGrib(info); } + void fillGrib(grib_info& info) const override; void fillMeshGen(util::MeshGeneratorParameters& param) const override { ring().fillMeshGen(param); } void fillJob(api::MIRJob& job) const override { ring().fillJob(job); } From 2d6afb2a7338e59b18fef162501b12ea217f4521 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Wed, 28 Feb 2024 14:22:01 +0000 Subject: [PATCH 23/69] MIR-643 HEALPix orderingConvention=nested unit tests fixes --- src/mir/key/grid/HEALPixPattern.cc | 12 ++++++++++-- src/mir/key/grid/HEALPixPattern.h | 5 ++++- src/mir/key/grid/NamedHEALPix.cc | 9 +++++++-- src/mir/key/grid/NamedHEALPix.h | 14 +++++++++++--- src/mir/repres/proxy/HEALPix.h | 6 ++++++ 5 files changed, 38 insertions(+), 8 deletions(-) diff --git a/src/mir/key/grid/HEALPixPattern.cc b/src/mir/key/grid/HEALPixPattern.cc index c342f9399..ac2380a15 100644 --- a/src/mir/key/grid/HEALPixPattern.cc +++ b/src/mir/key/grid/HEALPixPattern.cc @@ -14,11 +14,12 @@ #include +#include "eckit/utils/StringTools.h" #include "eckit/utils/Translator.h" + #include "mir/key/grid/NamedHEALPix.h" #include "mir/util/Exceptions.h" - namespace mir::key::grid { @@ -34,7 +35,13 @@ void HEALPixPattern::print(std::ostream& out) const { const Grid* HEALPixPattern::make(const std::string& name) const { - return new NamedHEALPix(name, eckit::Translator()(name.substr(1))); + auto nested = eckit::StringTools::endsWith(name, "_nested"); + ASSERT(!nested || name.size() > 8); + + auto Nside = eckit::Translator()(nested ? name.substr(1, name.size() - 8) : name.substr(1)); + + return new NamedHEALPix(name, Nside, + nested ? NamedHEALPix::Ordering::healpix_nested : NamedHEALPix::Ordering::healpix_ring); } @@ -45,6 +52,7 @@ std::string HEALPixPattern::canonical(const std::string& name, const param::MIRP static const HEALPixPattern __pattern1("^[hH][1-9][0-9]*$"); +static const HEALPixPattern __pattern2("^[hH][1-9][0-9]*_nested$"); } // namespace mir::key::grid diff --git a/src/mir/key/grid/HEALPixPattern.h b/src/mir/key/grid/HEALPixPattern.h index 0a980ff8e..b15660bf9 100644 --- a/src/mir/key/grid/HEALPixPattern.h +++ b/src/mir/key/grid/HEALPixPattern.h @@ -26,8 +26,10 @@ class HEALPixPattern : public GridPattern { // -- Constructors - HEALPixPattern(const std::string& name); + explicit HEALPixPattern(const std::string& name); + HEALPixPattern(const HEALPixPattern&) = delete; + HEALPixPattern(HEALPixPattern&&) = delete; // -- Destructor @@ -39,6 +41,7 @@ class HEALPixPattern : public GridPattern { // -- Operators HEALPixPattern& operator=(const HEALPixPattern&) = delete; + HEALPixPattern& operator=(HEALPixPattern&&) = delete; // -- Methods // None diff --git a/src/mir/key/grid/NamedHEALPix.cc b/src/mir/key/grid/NamedHEALPix.cc index 99061764e..501cceafe 100644 --- a/src/mir/key/grid/NamedHEALPix.cc +++ b/src/mir/key/grid/NamedHEALPix.cc @@ -14,14 +14,15 @@ #include -#include "mir/repres/proxy/HEALPix.h" +#include "mir/repres/unsupported/HEALPixNested.h" #include "mir/util/Exceptions.h" namespace mir::key::grid { -NamedHEALPix::NamedHEALPix(const std::string& name, size_t Nside) : NamedGrid(name), Nside_(Nside) {} +NamedHEALPix::NamedHEALPix(const std::string& name, size_t Nside, Ordering ordering) : + NamedGrid(name), Nside_(Nside), ordering_(ordering) {} void NamedHEALPix::print(std::ostream& out) const { @@ -30,6 +31,10 @@ void NamedHEALPix::print(std::ostream& out) const { const repres::Representation* NamedHEALPix::representation() const { + if (ordering_ == Ordering::healpix_nested) { + return new repres::unsupported::HEALPixNested(Nside_); + } + return new repres::proxy::HEALPix(Nside_); } diff --git a/src/mir/key/grid/NamedHEALPix.h b/src/mir/key/grid/NamedHEALPix.h index 07d9d96bc..0a978655e 100644 --- a/src/mir/key/grid/NamedHEALPix.h +++ b/src/mir/key/grid/NamedHEALPix.h @@ -14,6 +14,7 @@ #include "mir/key/grid/NamedGrid.h" +#include "mir/repres/proxy/HEALPix.h" namespace mir::key::grid { @@ -21,13 +22,19 @@ namespace mir::key::grid { class NamedHEALPix : public NamedGrid { public: + // -- Types + + using Ordering = repres::proxy::HEALPix::Ordering; + // -- Exceptions // None // -- Constructors - NamedHEALPix(const std::string& name, size_t Nside); + NamedHEALPix(const std::string& name, size_t Nside, Ordering); + NamedHEALPix(const NamedHEALPix&) = delete; + NamedHEALPix(NamedHEALPix&&) = delete; // -- Destructor // None @@ -38,6 +45,7 @@ class NamedHEALPix : public NamedGrid { // -- Operators NamedHEALPix& operator=(const NamedHEALPix&) = delete; + NamedHEALPix& operator=(NamedHEALPix&&) = delete; // -- Methods // None @@ -73,9 +81,9 @@ class NamedHEALPix : public NamedGrid { private: // -- Members - // None - size_t Nside_; + const size_t Nside_; + const Ordering ordering_; // -- Methods // None diff --git a/src/mir/repres/proxy/HEALPix.h b/src/mir/repres/proxy/HEALPix.h index db00dd4c4..c81bd5eb4 100644 --- a/src/mir/repres/proxy/HEALPix.h +++ b/src/mir/repres/proxy/HEALPix.h @@ -31,6 +31,12 @@ class HEALPix final : public ProxyGrid { public: // -- Types + enum Ordering + { + healpix_ring, + healpix_nested, + }; + class Reorder { public: explicit Reorder(int Nside); From 6e26f3ac8dfb6b9e70b8200bbacd4b46c3993017 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Wed, 28 Feb 2024 17:12:59 +0000 Subject: [PATCH 24/69] Cleanup --- src/mir/action/io/EndAction.cc | 2 +- src/mir/action/io/EndAction.h | 2 +- src/mir/repres/unsupported/IrregularLatlon.cc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mir/action/io/EndAction.cc b/src/mir/action/io/EndAction.cc index b43de85f2..257f26356 100644 --- a/src/mir/action/io/EndAction.cc +++ b/src/mir/action/io/EndAction.cc @@ -1,5 +1,5 @@ /* - * (C) EndActionright 1996- ECMWF. + * (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. diff --git a/src/mir/action/io/EndAction.h b/src/mir/action/io/EndAction.h index 9d241727a..690386a7d 100644 --- a/src/mir/action/io/EndAction.h +++ b/src/mir/action/io/EndAction.h @@ -1,5 +1,5 @@ /* - * (C) EndActionright 1996- ECMWF. + * (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. diff --git a/src/mir/repres/unsupported/IrregularLatlon.cc b/src/mir/repres/unsupported/IrregularLatlon.cc index e39b2bfbe..1bde2301e 100644 --- a/src/mir/repres/unsupported/IrregularLatlon.cc +++ b/src/mir/repres/unsupported/IrregularLatlon.cc @@ -1,4 +1,4 @@ -/*::unsupported +/* * (C) Copyright 1996- ECMWF. * * This software is licensed under the terms of the Apache Licence Version 2.0 From f15a0e5293bdd4820fc0f6a3069c77be54252c9e Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Wed, 28 Feb 2024 17:12:59 +0000 Subject: [PATCH 25/69] Cleanup --- src/mir/key/grid/HEALPixPattern.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mir/key/grid/HEALPixPattern.cc b/src/mir/key/grid/HEALPixPattern.cc index ac2380a15..cf9abf00d 100644 --- a/src/mir/key/grid/HEALPixPattern.cc +++ b/src/mir/key/grid/HEALPixPattern.cc @@ -20,6 +20,7 @@ #include "mir/key/grid/NamedHEALPix.h" #include "mir/util/Exceptions.h" + namespace mir::key::grid { From 07077385ceafaf8eda463e8016c413757053010c Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Thu, 29 Feb 2024 08:47:52 +0000 Subject: [PATCH 26/69] MIR-645 HEALPix support for earthkit-regrid --- src/mir/repres/proxy/HEALPix.cc | 6 ++++++ src/mir/repres/proxy/HEALPix.h | 1 + src/mir/repres/unsupported/HEALPixNested.cc | 16 ++++++++++++++-- src/mir/repres/unsupported/HEALPixNested.h | 2 ++ 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/mir/repres/proxy/HEALPix.cc b/src/mir/repres/proxy/HEALPix.cc index 1b612e680..670f06a37 100644 --- a/src/mir/repres/proxy/HEALPix.cc +++ b/src/mir/repres/proxy/HEALPix.cc @@ -18,6 +18,7 @@ #include #include +#include "eckit/log/JSON.h" #include "eckit/types/FloatCompare.h" #include "atlas/interpolation/method/knn/GridBox.h" @@ -275,6 +276,11 @@ void HEALPix::fillJob(api::MIRJob&) const { } +void HEALPix::json(eckit::JSON& j) const { + j << "grid" << name(); +} + + void HEALPix::print(std::ostream& out) const { out << "HEALPix[name=" << name() << "]"; } diff --git a/src/mir/repres/proxy/HEALPix.h b/src/mir/repres/proxy/HEALPix.h index c81bd5eb4..e62f48aef 100644 --- a/src/mir/repres/proxy/HEALPix.h +++ b/src/mir/repres/proxy/HEALPix.h @@ -106,6 +106,7 @@ class HEALPix final : public ProxyGrid { void fillMeshGen(util::MeshGeneratorParameters&) const override; void fillJob(api::MIRJob&) const override; + void json(eckit::JSON&) const override; void print(std::ostream&) const override; std::vector gridBoxes() const override; diff --git a/src/mir/repres/unsupported/HEALPixNested.cc b/src/mir/repres/unsupported/HEALPixNested.cc index 385e0a092..3100a237e 100644 --- a/src/mir/repres/unsupported/HEALPixNested.cc +++ b/src/mir/repres/unsupported/HEALPixNested.cc @@ -14,6 +14,8 @@ #include +#include "eckit/log/JSON.h" + #include "mir/iterator/UnstructuredIterator.h" #include "mir/util/Exceptions.h" #include "mir/util/Grib.h" @@ -23,8 +25,13 @@ namespace mir::repres::unsupported { +std::string HEALPixNested::name() const { + return "H" + std::to_string(ring_.Nside()) + "_nested"; +} + + void HEALPixNested::makeName(std::ostream& out) const { - out << "H" << std::to_string(ring_.Nside()) << "_nested"; + out << name(); } @@ -38,8 +45,13 @@ void HEALPixNested::fillGrib(grib_info& info) const { } +void HEALPixNested::json(eckit::JSON& j) const { + j << "grid" << name(); +} + + void HEALPixNested::print(std::ostream& out) const { - out << "HEALPixNested[name=" << "H" << std::to_string(ring_.Nside()) << "_nested" << "]"; + out << "HEALPixNested[name=" << name() << "]"; } diff --git a/src/mir/repres/unsupported/HEALPixNested.h b/src/mir/repres/unsupported/HEALPixNested.h index e982ad2e1..78507106b 100644 --- a/src/mir/repres/unsupported/HEALPixNested.h +++ b/src/mir/repres/unsupported/HEALPixNested.h @@ -63,6 +63,7 @@ class HEALPixNested final : public Gridded { // -- Methods inline const Representation& ring() const { return static_cast(ring_); } + std::string name() const; // -- Overridden methods @@ -77,6 +78,7 @@ class HEALPixNested final : public Gridded { void fillMeshGen(util::MeshGeneratorParameters& param) const override { ring().fillMeshGen(param); } void fillJob(api::MIRJob& job) const override { ring().fillJob(job); } + void json(eckit::JSON&) const override; void print(std::ostream&) const override; std::vector gridBoxes() const override; From 36f3b97876b9daa2a158b69237fb037a91160577 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Thu, 29 Feb 2024 08:58:55 +0000 Subject: [PATCH 27/69] MIR-645 HEALPix support for earthkit-regrid --- src/mir/method/MethodWeighted.cc | 21 +++++++++------------ src/mir/repres/proxy/HEALPix.cc | 2 ++ src/mir/repres/unsupported/HEALPixNested.cc | 2 ++ 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/mir/method/MethodWeighted.cc b/src/mir/method/MethodWeighted.cc index acf1fc578..08d1db00f 100644 --- a/src/mir/method/MethodWeighted.cc +++ b/src/mir/method/MethodWeighted.cc @@ -232,19 +232,16 @@ const WeightMatrix& MethodWeighted::getMatrix(context::Context& ctx, const repre log << "Matrix footprint " << w.owner() << " " << usage << " W -> " << W.owner() << std::endl; - std::string filename; - if (parametrisation_.get("dump-weights-info", filename)) { - + if (std::string filename;parametrisation_.get("dump-weights-info", filename)) { std::ofstream file(filename); - eckit::JSON json(file); - json.startObject(); - json << "input" << in; - json << "output" << out; - json << "rows" << w.rows(); - json << "columns" << w.cols(); - json << "cache_file" << cacheFile; - json.endObject(); - file.close(); + eckit::JSON j(file); + j.startObject(); + j << "input" << in; + j << "output" << out; + j << "rows" << w.rows(); + j << "columns" << w.cols(); + j << "cache_file" << cacheFile; + j.endObject(); } matrix_cache.footprint(memory_key, usage); diff --git a/src/mir/repres/proxy/HEALPix.cc b/src/mir/repres/proxy/HEALPix.cc index 670f06a37..f8a506700 100644 --- a/src/mir/repres/proxy/HEALPix.cc +++ b/src/mir/repres/proxy/HEALPix.cc @@ -277,7 +277,9 @@ void HEALPix::fillJob(api::MIRJob&) const { void HEALPix::json(eckit::JSON& j) const { + j.startObject(); j << "grid" << name(); + j.endObject(); } diff --git a/src/mir/repres/unsupported/HEALPixNested.cc b/src/mir/repres/unsupported/HEALPixNested.cc index 3100a237e..9da7b9bbf 100644 --- a/src/mir/repres/unsupported/HEALPixNested.cc +++ b/src/mir/repres/unsupported/HEALPixNested.cc @@ -46,7 +46,9 @@ void HEALPixNested::fillGrib(grib_info& info) const { void HEALPixNested::json(eckit::JSON& j) const { + j.startObject(); j << "grid" << name(); + j.endObject(); } From 90cdfd6777747f15a9dbf942698ae709f1c2f7e1 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Thu, 29 Feb 2024 10:04:03 +0000 Subject: [PATCH 28/69] clang-format --- src/mir/action/filter/ShTruncate.cc | 3 +- src/mir/action/interpolate/Gridded2GridDef.cc | 3 +- .../action/interpolate/Gridded2RegularLL.cc | 3 +- .../action/interpolate/Gridded2RotatedLL.cc | 3 +- src/mir/action/plan/Action.cc | 3 +- src/mir/action/plan/ActionPlan.cc | 33 ++++--------------- src/mir/action/transform/ShToGridded.cc | 9 +++-- src/mir/caching/InMemoryCache.cc | 5 ++- src/mir/compare/FieldComparator.cc | 30 +++++++---------- src/mir/data/CartesianVector2DField.cc | 3 +- src/mir/method/MethodWeighted.cc | 5 ++- src/mir/output/GribOutput.cc | 3 +- src/mir/tools/Count.cc | 7 ++-- src/mir/util/BoundingBox.cc | 3 +- src/mir/util/Domain.cc | 3 +- src/mir/util/Increments.cc | 3 +- src/mir/util/MeshGeneratorParameters.cc | 3 +- src/mir/util/Rotation.cc | 4 +-- src/mir/util/Trace.cc | 3 +- src/tools/mir-climate-filter.cc | 6 ++-- src/tools/mir-compare.cc | 3 +- src/tools/mir-list.cc | 3 +- src/tools/mir-load-legendre.cc | 3 +- src/tools/mir-load-matrix.cc | 3 +- src/tools/mir-make-lsm.cc | 3 +- src/tools/mir-plot-lsm.cc | 3 +- tests/unit/bounding_box.cc | 3 +- tests/unit/grib_encoding.cc | 23 +++++++------ tests/unit/increments.cc | 18 ++++------ tests/unit/wind.cc | 7 ++-- 30 files changed, 74 insertions(+), 130 deletions(-) diff --git a/src/mir/action/filter/ShTruncate.cc b/src/mir/action/filter/ShTruncate.cc index ec62134a2..a0e8427d8 100644 --- a/src/mir/action/filter/ShTruncate.cc +++ b/src/mir/action/filter/ShTruncate.cc @@ -43,8 +43,7 @@ bool ShTruncate::sameAs(const Action& other) const { void ShTruncate::print(std::ostream& out) const { - out << "ShTruncate[" - << "truncation=" << truncation_ << "]"; + out << "ShTruncate[" << "truncation=" << truncation_ << "]"; } diff --git a/src/mir/action/interpolate/Gridded2GridDef.cc b/src/mir/action/interpolate/Gridded2GridDef.cc index 4ebf1c6f3..95e0b131b 100644 --- a/src/mir/action/interpolate/Gridded2GridDef.cc +++ b/src/mir/action/interpolate/Gridded2GridDef.cc @@ -47,8 +47,7 @@ void Gridded2GridDef::custom(std::ostream& out) const { void Gridded2GridDef::print(std::ostream& out) const { - out << "Gridded2GridDef[" - << "griddef=" << griddef_ << ","; + out << "Gridded2GridDef[" << "griddef=" << griddef_ << ","; Gridded2UnrotatedGrid::print(out); out << "]"; } diff --git a/src/mir/action/interpolate/Gridded2RegularLL.cc b/src/mir/action/interpolate/Gridded2RegularLL.cc index a202d19b2..d3dca5836 100644 --- a/src/mir/action/interpolate/Gridded2RegularLL.cc +++ b/src/mir/action/interpolate/Gridded2RegularLL.cc @@ -40,8 +40,7 @@ Gridded2RegularLL::Gridded2RegularLL(const param::MIRParametrisation& parametris repres::latlon::LatLon::globaliseBoundingBox(bbox_, increments_, reference_); - Log::debug() << "Gridded2RegularLL: globalise:" - << "\n\t" << increments_ << "\n\t" << bbox_ + Log::debug() << "Gridded2RegularLL: globalise:" << "\n\t" << increments_ << "\n\t" << bbox_ << "\n\t" "shifted in latitude? " << increments_.isLatitudeShifted(bbox_) diff --git a/src/mir/action/interpolate/Gridded2RotatedLL.cc b/src/mir/action/interpolate/Gridded2RotatedLL.cc index bfdf83dbe..a91d9c306 100644 --- a/src/mir/action/interpolate/Gridded2RotatedLL.cc +++ b/src/mir/action/interpolate/Gridded2RotatedLL.cc @@ -40,8 +40,7 @@ Gridded2RotatedLL::Gridded2RotatedLL(const param::MIRParametrisation& parametris repres::latlon::LatLon::globaliseBoundingBox(bbox_, increments_, reference_); - Log::debug() << "Gridded2RotatedLL: globalise:" - << "\n\t" << increments_ << "\n\t" << bbox_ + Log::debug() << "Gridded2RotatedLL: globalise:" << "\n\t" << increments_ << "\n\t" << bbox_ << "\n\t" "shifted in latitude? " << increments_.isLatitudeShifted(bbox_) diff --git a/src/mir/action/plan/Action.cc b/src/mir/action/plan/Action.cc index c0598e837..ab0d4c0ea 100644 --- a/src/mir/action/plan/Action.cc +++ b/src/mir/action/plan/Action.cc @@ -172,8 +172,7 @@ Action* ActionFactory::build(const std::string& name, const param::MIRParametris if (j != m->end()) { std::ostringstream oss; - oss << "ActionFactory: ambiguous '" << name << "'" - << ", could be '" << j->first << "'" + oss << "ActionFactory: ambiguous '" << name << "'" << ", could be '" << j->first << "'" << " or '" << p->first << "'"; Log::error() << " " << j->first << std::endl; throw exception::SeriousBug(oss.str()); diff --git a/src/mir/action/plan/ActionPlan.cc b/src/mir/action/plan/ActionPlan.cc index 755521eb2..40a771fe0 100644 --- a/src/mir/action/plan/ActionPlan.cc +++ b/src/mir/action/plan/ActionPlan.cc @@ -144,21 +144,13 @@ void ActionPlan::execute(context::Context& ctx) const { for (const auto& p : *this) { if (Log::debug_active()) { - Log::debug() << "Executing:" - << "\n" - << sep << "\n" - << *p << "\n" - << sep << std::endl; + Log::debug() << "Executing:" << "\n" << sep << "\n" << *p << "\n" << sep << std::endl; } p->perform(ctx); if (Log::debug_active()) { - Log::debug() << "Result:" - << "\n" - << sep << "\n" - << ctx << "\n" - << sep << std::endl; + Log::debug() << "Result:" << "\n" << sep << "\n" << ctx << "\n" << sep << std::endl; } } @@ -188,11 +180,7 @@ void ActionPlan::estimate(context::Context& ctx, api::MIREstimation& estimation) void ActionPlan::compress() { const char* sep = "#########"; - Log::debug() << "Compress:" - << "\n" - << sep << "\n" - << *this << "\n" - << sep << std::endl; + Log::debug() << "Compress:" << "\n" << sep << "\n" << *this << "\n" << sep << std::endl; bool hasCompressed = false; bool more = true; @@ -205,9 +193,8 @@ void ActionPlan::compress() { if (action(i).mergeWithNext(action(i + 1))) { - Log::debug() << "ActionPlan::compress: " - << "\n " << oldAction.str() << "\n + " << action(i + 1) << "\n = " << action(i) - << std::endl; + Log::debug() << "ActionPlan::compress: " << "\n " << oldAction.str() << "\n + " << action(i + 1) + << "\n = " << action(i) << std::endl; delete at(i + 1); erase(begin() + long(i + 1)); @@ -230,16 +217,10 @@ void ActionPlan::compress() { } if (hasCompressed) { - Log::debug() << "Compress result:" - << "\n" - << sep << "\n" - << *this << "\n" - << sep << std::endl; + Log::debug() << "Compress result:" << "\n" << sep << "\n" << *this << "\n" << sep << std::endl; } else { - Log::debug() << "Compress result: unable to compress" - << "\n" - << sep << std::endl; + Log::debug() << "Compress result: unable to compress" << "\n" << sep << std::endl; } } diff --git a/src/mir/action/transform/ShToGridded.cc b/src/mir/action/transform/ShToGridded.cc index 48d3a3cfd..043d47bfd 100644 --- a/src/mir/action/transform/ShToGridded.cc +++ b/src/mir/action/transform/ShToGridded.cc @@ -187,8 +187,8 @@ void ShToGridded::transform(data::MIRField& field, const repres::Representation& } else if (!creator.supported()) { - Log::warning() << "ShToGridded: LegendreCacheCreator is not supported for:" - << "\n representation: " << representation << "\n options: " << options_ << std::endl + Log::warning() << "ShToGridded: LegendreCacheCreator is not supported for:" << "\n representation: " + << representation << "\n options: " << options_ << std::endl << "ShToGridded: continuing with hindered performance" << std::endl; trans = atlas_trans_t(grid, domain, truncation, options_); @@ -317,9 +317,8 @@ bool ShToGridded::mergeWithNext(const Action& next) { repres::RepresentationHandle out(outputRepresentation()); cropping_.boundingBox(out->extendBoundingBox(bbox)); - Log::debug() << "ShToGridded::mergeWithNext: " - << "\n " << oldAction.str() << "\n + " << next << "\n = " << *this << "\n + " - << "(...)" << std::endl; + Log::debug() << "ShToGridded::mergeWithNext: " << "\n " << oldAction.str() << "\n + " << next + << "\n = " << *this << "\n + " << "(...)" << std::endl; } return false; } diff --git a/src/mir/caching/InMemoryCache.cc b/src/mir/caching/InMemoryCache.cc index ff460e51c..975fb92b2 100644 --- a/src/mir/caching/InMemoryCache.cc +++ b/src/mir/caching/InMemoryCache.cc @@ -113,9 +113,8 @@ void InMemoryCache::reserve(const InMemoryCacheUsage& usage) { auto u = usage; auto p = (f + u) - c; - Log::debug() << "CACHE-RESERVE-" << name_ << " " - << " => " << u << " footprint: " << f << " capacity: " << c << " f+u: " << f + u << " f+u-c: " << p - << std::endl; + Log::debug() << "CACHE-RESERVE-" << name_ << " " << " => " << u << " footprint: " << f << " capacity: " << c + << " f+u: " << f + u << " f+u-c: " << p << std::endl; if (p) { diff --git a/src/mir/compare/FieldComparator.cc b/src/mir/compare/FieldComparator.cc index e99fc1350..650c8268a 100644 --- a/src/mir/compare/FieldComparator.cc +++ b/src/mir/compare/FieldComparator.cc @@ -569,16 +569,14 @@ void FieldComparator::compareFieldStatistics(const MultiFile& multi1, const Mult constexpr double relativeErrorMax = 0.01; if (s1.values_ != s2.values_) { - Log::info() << "Number of data values mismatch:" - << "\n " << multi1 << ": " << s1.values_ << " " << field1 << "\n " << multi2 << ": " << s2.values_ - << " " << field2 << std::endl; + Log::info() << "Number of data values mismatch:" << "\n " << multi1 << ": " << s1.values_ << " " << field1 + << "\n " << multi2 << ": " << s2.values_ << " " << field2 << std::endl; error("statistics-mismatches"); } if (s1.missing_ != s2.missing_) { - Log::info() << "Number of missing values mismatch:" - << "\n " << multi1 << ": " << s1.missing_ << " " << field1 << "\n " << multi2 << ": " - << s2.missing_ << " " << field2 << std::endl; + Log::info() << "Number of missing values mismatch:" << "\n " << multi1 << ": " << s1.missing_ << " " << field1 + << "\n " << multi2 << ": " << s2.missing_ << " " << field2 << std::endl; error("statistics-mismatches"); } @@ -643,9 +641,8 @@ void FieldComparator::compareFieldValues(const FieldComparator::MultiFile& multi auto problems = comp->execute(input1->field(), input2->field()); if (!problems.empty()) { - Log::info() << "Value compare failed between:" - << "\n " << multi1 << ": " << field1 << "\n " << multi2 << ": " << field2 << "\n reporting " - << *comp << "\n failed because" << problems << std::endl; + Log::info() << "Value compare failed between:" << "\n " << multi1 << ": " << field1 << "\n " << multi2 + << ": " << field2 << "\n reporting " << *comp << "\n failed because" << problems << std::endl; error("values-mismatches"); } } @@ -672,9 +669,8 @@ void FieldComparator::compareFieldMissingValues(const FieldComparator::MultiFile auto problems = comp->execute(input1->field(), input2->field()); if (!problems.empty()) { - Log::info() << "Value compare failed between:" - << "\n " << multi1 << ": " << field1 << "\n " << multi2 << ": " << field2 << "\n reporting " - << *comp << "\n failed because" << problems << std::endl; + Log::info() << "Value compare failed between:" << "\n " << multi1 << ": " << field1 << "\n " << multi2 << ": " + << field2 << "\n reporting " << *comp << "\n failed because" << problems << std::endl; error("values-mismatches"); } } @@ -737,8 +733,7 @@ void FieldComparator::missingField(const MultiFile& multi1, const MultiFile& mul std::vector matches = field.bestMatches(fields); if (!matches.empty()) { - Log::info() << " ? " - << "No match found in " << multi2 << std::endl; + Log::info() << " ? " << "No match found in " << multi2 << std::endl; size_t cnt = 0; auto flds = field.sortByDifference(fields); @@ -786,8 +781,7 @@ void FieldComparator::missingField(const MultiFile& multi1, const MultiFile& mul } else { - Log::info() << " + " - << "Possible matched in " << multi2 << std::endl; + Log::info() << " + " << "Possible matched in " << multi2 << std::endl; size_t cnt = 0; for (const auto& other : matches) { @@ -851,8 +845,8 @@ void FieldComparator::compareCounts(const std::string& name, const MultiFile& mu size_t n2 = count(multi2, fields2); if (n1 != n2) { - Log::info() << name << " count mismatch" - << "\n " << n1 << " " << multi1 << "\n " << n2 << " " << multi2 << std::endl; + Log::info() << name << " count mismatch" << "\n " << n1 << " " << multi1 << "\n " << n2 << " " << multi2 + << std::endl; error("count-mismatches"); } } diff --git a/src/mir/data/CartesianVector2DField.cc b/src/mir/data/CartesianVector2DField.cc index 46d49dc96..27d501fe8 100644 --- a/src/mir/data/CartesianVector2DField.cc +++ b/src/mir/data/CartesianVector2DField.cc @@ -95,8 +95,7 @@ void CartesianVector2DField::rotate(const util::Rotation& rotation, MIRValuesVec void CartesianVector2DField::print(std::ostream& out) const { - out << "CartesianVector2DField[" - << "]"; + out << "CartesianVector2DField[" << "]"; } diff --git a/src/mir/method/MethodWeighted.cc b/src/mir/method/MethodWeighted.cc index 08d1db00f..e54fb1be6 100644 --- a/src/mir/method/MethodWeighted.cc +++ b/src/mir/method/MethodWeighted.cc @@ -232,7 +232,7 @@ const WeightMatrix& MethodWeighted::getMatrix(context::Context& ctx, const repre log << "Matrix footprint " << w.owner() << " " << usage << " W -> " << W.owner() << std::endl; - if (std::string filename;parametrisation_.get("dump-weights-info", filename)) { + if (std::string filename; parametrisation_.get("dump-weights-info", filename)) { std::ofstream file(filename); eckit::JSON j(file); j.startObject(); @@ -427,8 +427,7 @@ void MethodWeighted::execute(context::Context& ctx, const repres::Representation if (check_stats) { // compute some statistics on the result auto ostats = field.statistics(i); - log << "Input field statistics: " << istats << "\n" - << "Output field statistics: " << ostats << std::endl; + log << "Input field statistics: " << istats << "\n" << "Output field statistics: " << ostats << std::endl; } } } diff --git a/src/mir/output/GribOutput.cc b/src/mir/output/GribOutput.cc index e9b15059b..a2fdd0a89 100644 --- a/src/mir/output/GribOutput.cc +++ b/src/mir/output/GribOutput.cc @@ -430,8 +430,7 @@ size_t GribOutput::save(const param::MIRParametrisation& param, context::Context // util::BoundingBox after(g); if (user != before /*|| user != after || before != after*/) { - Log::info() << "MIR_CHECK_AREA:" - << " request=" << user << " result=" + Log::info() << "MIR_CHECK_AREA:" << " request=" << user << " result=" << before // << " grib=" << after << std::endl; diff --git a/src/mir/tools/Count.cc b/src/mir/tools/Count.cc index 9d5ff9943..e604b3fe9 100644 --- a/src/mir/tools/Count.cc +++ b/src/mir/tools/Count.cc @@ -114,10 +114,9 @@ void Count::count(const PointLatLon& point) { void Count::print(std::ostream& out) const { out << Log::Pretty(count_) << " out of " << Log::Pretty(countTotal_) << ", north=" << n_ << " (bbox.n - n " - << bbox_.north() - n_ << ")" - << ", west=" << w_ << " (w - bbox.w " << w_ - bbox_.west() << ")" - << ", south=" << s_ << " (s - bbox.s " << s_ - bbox_.south() << ")" - << ", east=" << e_ << " (bbox.e - e " << bbox_.east() - e_ << ")" + << bbox_.north() - n_ << ")" << ", west=" << w_ << " (w - bbox.w " << w_ - bbox_.west() << ")" + << ", south=" << s_ << " (s - bbox.s " << s_ - bbox_.south() << ")" << ", east=" << e_ << " (bbox.e - e " + << bbox_.east() - e_ << ")" << "\n" "N " << bbox_.north() << ":" << nn_ diff --git a/src/mir/util/BoundingBox.cc b/src/mir/util/BoundingBox.cc index c19ac8615..d25bbc23f 100644 --- a/src/mir/util/BoundingBox.cc +++ b/src/mir/util/BoundingBox.cc @@ -73,8 +73,7 @@ BoundingBox::~BoundingBox() = default; void BoundingBox::print(std::ostream& out) const { - out << "BoundingBox[" - << "north=" << north_ << ",west=" << west_ << ",south=" << south_ << ",east=" << east_ << "]"; + out << "BoundingBox[" << "north=" << north_ << ",west=" << west_ << ",south=" << south_ << ",east=" << east_ << "]"; } diff --git a/src/mir/util/Domain.cc b/src/mir/util/Domain.cc index f6ce17fec..aa06d8e7b 100644 --- a/src/mir/util/Domain.cc +++ b/src/mir/util/Domain.cc @@ -34,8 +34,7 @@ Domain::operator atlas::RectangularDomain() const { void Domain::print(std::ostream& os) const { - os << "Domain[" - << "north=" << north() << ",west=" << west() << ",south=" << south() << ",east=" << east() + os << "Domain[" << "north=" << north() << ",west=" << west() << ",south=" << south() << ",east=" << east() << ",isGlobal=" << isGlobal() << "]"; } diff --git a/src/mir/util/Increments.cc b/src/mir/util/Increments.cc index a7a528c05..e61835378 100644 --- a/src/mir/util/Increments.cc +++ b/src/mir/util/Increments.cc @@ -122,8 +122,7 @@ bool Increments::isLongitudeShifted(const PointLatLon& p) const { void Increments::print(std::ostream& out) const { - out << "Increments[" - << "west_east=" << west_east_.longitude() << ",south_north=" << south_north_.latitude() << "]"; + out << "Increments[" << "west_east=" << west_east_.longitude() << ",south_north=" << south_north_.latitude() << "]"; } void Increments::json(eckit::JSON& json) const { diff --git a/src/mir/util/MeshGeneratorParameters.cc b/src/mir/util/MeshGeneratorParameters.cc index 0bfbc6be3..668dbd26a 100644 --- a/src/mir/util/MeshGeneratorParameters.cc +++ b/src/mir/util/MeshGeneratorParameters.cc @@ -87,8 +87,7 @@ void MeshGeneratorParameters::hash(eckit::Hash& hash) const { } void MeshGeneratorParameters::print(std::ostream& s) const { - s << "MeshGeneratorParameters[" - << "meshGenerator=" << meshGenerator_ << ",meshCellCentres=" << meshCellCentres_ + s << "MeshGeneratorParameters[" << "meshGenerator=" << meshGenerator_ << ",meshCellCentres=" << meshCellCentres_ << ",meshCellLongestDiagonal=" << meshCellLongestDiagonal_ << ",meshNodeLumpedMassMatrix=" << meshNodeLumpedMassMatrix_ << ",meshNodeToCellConnectivity=" << meshNodeToCellConnectivity_ << ","; diff --git a/src/mir/util/Rotation.cc b/src/mir/util/Rotation.cc index 6a92c5fc7..ed0c647de 100644 --- a/src/mir/util/Rotation.cc +++ b/src/mir/util/Rotation.cc @@ -61,8 +61,8 @@ void Rotation::normalize() { void Rotation::print(std::ostream& out) const { - out << "Rotation[" - << "south_pole_latitude=" << south_pole_latitude_ << ",south_pole_longitude=" << south_pole_longitude_ + out << "Rotation[" << "south_pole_latitude=" << south_pole_latitude_ + << ",south_pole_longitude=" << south_pole_longitude_ << ",south_pole_rotation_angle=" << south_pole_rotation_angle_ << "]"; } diff --git a/src/mir/util/Trace.cc b/src/mir/util/Trace.cc index 5a5d62448..86fef5ea9 100644 --- a/src/mir/util/Trace.cc +++ b/src/mir/util/Trace.cc @@ -50,8 +50,7 @@ bool ProgressTimer::operator++() { lastTime_ = elapsed(); double rate = double(counter_) / lastTime_; output() << Log::Pretty(counter_, units_) << " in " << Log::Seconds(lastTime_) << ", rate: " << rate << " " - << units_(counter_) << "/s" - << ", ETA: " << eckit::ETA(double(limit_ - counter_) / rate) << std::endl; + << units_(counter_) << "/s" << ", ETA: " << eckit::ETA(double(limit_ - counter_) / rate) << std::endl; } if (counter_ < limit_) { diff --git a/src/tools/mir-climate-filter.cc b/src/tools/mir-climate-filter.cc index f861e36f9..f8c36a9cf 100644 --- a/src/tools/mir-climate-filter.cc +++ b/src/tools/mir-climate-filter.cc @@ -206,8 +206,7 @@ void MIRClimateFilter::execute(const eckit::option::CmdArgs& args) { for (size_t j = 0; j < Nj; ++j) { if (++progress) { - log << " latitude: " << lat[j] << " degree" - << "\n farthest: " << farthest << " m" + log << " latitude: " << lat[j] << " degree" << "\n farthest: " << farthest << " m" << "\n closest: " << Log::Seconds(tClosest) << "\n matrix A: " << Log::Seconds(tMatrixA) << "\n vector Y: " << Log::Seconds(tVectorY) << "\n vector X: " << Log::Seconds(tVectorX) << "\n" @@ -321,8 +320,7 @@ void MIRClimateFilter::execute(const eckit::option::CmdArgs& args) { log << Log::Pretty(field, {"field"}) << " in " << timer.elapsedSeconds() - << ", rate: " << double(field) / timer.elapsed() << " " - << "field/s" << std::endl; + << ", rate: " << double(field) / timer.elapsed() << " " << "field/s" << std::endl; } } diff --git a/src/tools/mir-compare.cc b/src/tools/mir-compare.cc index a518a67d3..53724cdbf 100644 --- a/src/tools/mir-compare.cc +++ b/src/tools/mir-compare.cc @@ -26,8 +26,7 @@ struct MIRCompare : MIRTool { int numberOfPositionalArguments() const override { return 2; } void usage(const std::string& tool) const override { - Log::info() << "\n" - << "Usage: " << tool << " [options] file1 file2" << std::endl; + Log::info() << "\n" << "Usage: " << tool << " [options] file1 file2" << std::endl; } void execute(const eckit::option::CmdArgs& args) override; diff --git a/src/tools/mir-list.cc b/src/tools/mir-list.cc index 33067573a..6722bb771 100644 --- a/src/tools/mir-list.cc +++ b/src/tools/mir-list.cc @@ -31,8 +31,7 @@ struct MIRList : MIRTool { int minimumPositionalArguments() const override { return 1; } void usage(const std::string& tool) const override { - Log::info() << "\n" - << "Usage: " << tool << " ..." << std::endl; + Log::info() << "\n" << "Usage: " << tool << " ..." << std::endl; } void execute(const eckit::option::CmdArgs& args) override; diff --git a/src/tools/mir-load-legendre.cc b/src/tools/mir-load-legendre.cc index f131120db..8f8b6b962 100644 --- a/src/tools/mir-load-legendre.cc +++ b/src/tools/mir-load-legendre.cc @@ -48,8 +48,7 @@ struct MIRLoadLegendre : MIRTool { int minimumPositionalArguments() const override { return 1; } void usage(const std::string& tool) const override { - Log::info() << "\n" - << "Usage: " << tool << " [--load] [--unload] " << std::endl; + Log::info() << "\n" << "Usage: " << tool << " [--load] [--unload] " << std::endl; } void execute(const eckit::option::CmdArgs& /*args*/) override; diff --git a/src/tools/mir-load-matrix.cc b/src/tools/mir-load-matrix.cc index 0cb4b5500..2a57fe567 100644 --- a/src/tools/mir-load-matrix.cc +++ b/src/tools/mir-load-matrix.cc @@ -60,8 +60,7 @@ struct MIRLoadMatrix : MIRTool { int minimumPositionalArguments() const override { return 1; } void usage(const std::string& tool) const override { - Log::info() << "\n" - << "Usage: " << tool << " [--load] [--unload] [--dump=path] " << std::endl; + Log::info() << "\n" << "Usage: " << tool << " [--load] [--unload] [--dump=path] " << std::endl; } void execute(const eckit::option::CmdArgs& args) override; diff --git a/src/tools/mir-make-lsm.cc b/src/tools/mir-make-lsm.cc index a91d7cbb8..32723ce63 100644 --- a/src/tools/mir-make-lsm.cc +++ b/src/tools/mir-make-lsm.cc @@ -28,8 +28,7 @@ struct MIRMakeLSM : MIRTool { int minimumPositionalArguments() const override { return 2; } void usage(const std::string& tool) const override { - Log::info() << "\n" - << "Usage: " << tool << " file.grib file.lsm" << std::endl; + Log::info() << "\n" << "Usage: " << tool << " file.grib file.lsm" << std::endl; } void execute(const eckit::option::CmdArgs& /*unused*/) override; diff --git a/src/tools/mir-plot-lsm.cc b/src/tools/mir-plot-lsm.cc index 824d3f859..2229af381 100644 --- a/src/tools/mir-plot-lsm.cc +++ b/src/tools/mir-plot-lsm.cc @@ -51,8 +51,7 @@ struct MIRPlotLSM : MIRTool { int numberOfPositionalArguments() const override { return 1; } void usage(const std::string& tool) const override { - Log::info() << "\n" - << "Usage: " << tool << " --grid=1/1 output.pbm" << std::endl; + Log::info() << "\n" << "Usage: " << tool << " --grid=1/1 output.pbm" << std::endl; } void execute(const eckit::option::CmdArgs& args) override; diff --git a/tests/unit/bounding_box.cc b/tests/unit/bounding_box.cc index b26e5539c..d3ed08c8e 100644 --- a/tests/unit/bounding_box.cc +++ b/tests/unit/bounding_box.cc @@ -314,8 +314,7 @@ CASE("Representation::extendBoundingBox") { for (const auto& bbox : _bbox) { BoundingBox extended = repres->extendBoundingBox(bbox); - log << name << "\t > " << *repres << " + extendBoundingBox(" - << "\n\t " << bbox << ")" + log << name << "\t > " << *repres << " + extendBoundingBox(" << "\n\t " << bbox << ")" << "\n\t = " << extended << std::endl; EXPECT(extended.contains(bbox)); diff --git a/tests/unit/grib_encoding.cc b/tests/unit/grib_encoding.cc index dc5230fb3..c71c35b58 100644 --- a/tests/unit/grib_encoding.cc +++ b/tests/unit/grib_encoding.cc @@ -334,23 +334,22 @@ CASE("GRIB1/GRIB2 encoding of sub-area of reduced Gaussian grids") { size_t count; }; - std::vector _test { + std::vector _test{ // pgen test_t{"O640", {51.941, 7.005, 43.084, 27.693}, 4512}, - test_t{"O640", {51.9406, 7.00599, 43.0847, 27.6923}, 4443}, - test_t{"O640", {57.9852, 230, 25.0918, 300}, 63479}, test_t{"O640", {11.8782, 279, -49.9727, 325}, 111068}, - test_t{"O640", {-25.0918, 135, -46.8801, 179}, 29294}, test_t{"O640", {43.9281, 91, 21.0152, 143}, 38990}, - test_t{"O640", {59.9531, 23, 35.0722, 80}, 34426}, + test_t{"O640", {51.9406, 7.00599, 43.0847, 27.6923}, 4443}, test_t{"O640", {57.9852, 230, 25.0918, 300}, 63479}, + test_t{"O640", {11.8782, 279, -49.9727, 325}, 111068}, test_t{"O640", {-25.0918, 135, -46.8801, 179}, 29294}, + test_t{"O640", {43.9281, 91, 21.0152, 143}, 38990}, test_t{"O640", {59.9531, 23, 35.0722, 80}, 34426}, - // ECC-445 - test_t{"O1280", {-10.017, -85, -38.981, -56}, 124577}, - test_t{"O1280", {-10.017, 275, -38.981, 304}, 124577}, test_t{"O1280", {-10, -85, -39, -56.1}, 124143}, + // ECC-445 + test_t{"O1280", {-10.017, -85, -38.981, -56}, 124577}, test_t{"O1280", {-10.017, 275, -38.981, 304}, 124577}, + test_t{"O1280", {-10, -85, -39, -56.1}, 124143}, #if mir_HAVE_ATLAS - // ECC-576 - test_t{"N256", {90, 0, -90, 359.6489}, 348528}, test_t{"N256", {90, 0, -90, 359.9}, 348528}, - test_t{"N640", {90, 0, -90, 359.9}, 2140702}, test_t{"N640", {90, 0, -90, 359.99}, 2140702}, - test_t{"N640", {90, -180, -90, 179.99}, 2140702}, test_t{"O640", {90, 0, -90, 359.999}, 1661440}, + // ECC-576 + test_t{"N256", {90, 0, -90, 359.6489}, 348528}, test_t{"N256", {90, 0, -90, 359.9}, 348528}, + test_t{"N640", {90, 0, -90, 359.9}, 2140702}, test_t{"N640", {90, 0, -90, 359.99}, 2140702}, + test_t{"N640", {90, -180, -90, 179.99}, 2140702}, test_t{"O640", {90, 0, -90, 359.999}, 1661440}, #endif #if 0 diff --git a/tests/unit/increments.cc b/tests/unit/increments.cc index efada351c..7086eae66 100644 --- a/tests/unit/increments.cc +++ b/tests/unit/increments.cc @@ -189,11 +189,10 @@ CASE("Increments::correctBoundingBox") { repres::latlon::LatLon::correctBoundingBox(corrected, ni, nj, inc, reference); static size_t c = 1; - log << "Test " << c++ << ":" - << "\n\t " << inc << "\n\t + " << box << "\n\t > " << corrected << " corrected with reference " - << reference << "\n\t > ni = " << ni << "\n\t > nj = " << nj << "\n\t = shifted in latitude? " - << inc.isLatitudeShifted(corrected) << "\n\t = shifted in longitude? " - << inc.isLongitudeShifted(corrected) << std::endl; + log << "Test " << c++ << ":" << "\n\t " << inc << "\n\t + " << box << "\n\t > " << corrected + << " corrected with reference " << reference << "\n\t > ni = " << ni << "\n\t > nj = " << nj + << "\n\t = shifted in latitude? " << inc.isLatitudeShifted(corrected) + << "\n\t = shifted in longitude? " << inc.isLongitudeShifted(corrected) << std::endl; EXPECT(box.contains(corrected)); EXPECT(ni >= 1); @@ -246,8 +245,7 @@ CASE("Increments::correctBoundingBox") { repres::latlon::LatLon::correctBoundingBox(corrected, ni, nj, inc, reference); static size_t c = 1; - log << "Test " << c++ << ":" - << "\n\t " << inc << "\n\t + " << equator << "\n\t > " << corrected + log << "Test " << c++ << ":" << "\n\t " << inc << "\n\t + " << equator << "\n\t > " << corrected << " corrected with reference " << reference << "\n\t > ni = " << ni << "\n\t > nj = " << nj << "\n\t = shifted in latitude? " << inc.isLatitudeShifted(corrected) << "\n\t = shifted in longitude? " << inc.isLongitudeShifted(corrected) << std::endl; @@ -387,8 +385,7 @@ struct UserAndGlobalisedCase { repres::RepresentationHandle maybe = new RegularLL(increments_, maybe_box, ref); const auto& maybe_ll = dynamic_cast(*maybe); - log << "globaliseBoundingBox should maybe result in (CONFIRM FIRST!):" - << "\n\t" << maybe_box + log << "globaliseBoundingBox should maybe result in (CONFIRM FIRST!):" << "\n\t" << maybe_box << "\n\t" "Ni=" << maybe_ll.Ni() @@ -631,8 +628,7 @@ CASE("MIR-309") { const BoundingBox& corrected = rep->boundingBox(); static size_t c = 1; - log << "Test " << c++ << ":" - << "\n\t " << t.bbox << "\n\t > " << corrected << "\n\t = " << t.corrected + log << "Test " << c++ << ":" << "\n\t " << t.bbox << "\n\t > " << corrected << "\n\t = " << t.corrected << "\n\t = shifted in latitude? " << t.increments.isLatitudeShifted(corrected) << (t.allowLatitudeShift ? "" : " (should be false)") << "\n\t = shifted in longitude? " << t.increments.isLongitudeShifted(corrected) << (t.allowLongitudeShift ? "" : " (should be false)") diff --git a/tests/unit/wind.cc b/tests/unit/wind.cc index 705df5796..511f6d6c5 100644 --- a/tests/unit/wind.cc +++ b/tests/unit/wind.cc @@ -76,11 +76,10 @@ CASE("MIR-324") { Wind::paramIds(input, u, v); static size_t c = 1; - log << "Test " << c++ << ":" - << "\n\t input paramId = " << input.paramId() << "\n\t + paramId.u " + log << "Test " << c++ << ":" << "\n\t input paramId = " << input.paramId() << "\n\t + paramId.u " << (user_u != 0 ? "(set)" : "(not set)") << " = " << user_u << "\n\t + paramId.v " - << (user_v != 0 ? "(set)" : "(not set)") << " = " << user_v << "\n\t = " - << "\n\t u = " << u << "\n\t v = " << v << std::endl; + << (user_v != 0 ? "(set)" : "(not set)") << " = " << user_v << "\n\t = " << "\n\t u = " << u + << "\n\t v = " << v << std::endl; EXPECTV(u == (user_u != 0 ? user_u : PARAMID_U + table * 1000)); EXPECTV(v == (user_v != 0 ? user_v : PARAMID_V + table * 1000)); From d7309c3671f6a4d0f1a6d1efe7f0ef22c1c3f265 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Thu, 29 Feb 2024 12:01:56 +0000 Subject: [PATCH 29/69] MIR-645 HEALPix support for earthkit-regrid --- src/mir/repres/proxy/HEALPix.cc | 2 ++ src/mir/repres/unsupported/HEALPixNested.cc | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/mir/repres/proxy/HEALPix.cc b/src/mir/repres/proxy/HEALPix.cc index f8a506700..27a0da477 100644 --- a/src/mir/repres/proxy/HEALPix.cc +++ b/src/mir/repres/proxy/HEALPix.cc @@ -279,6 +279,8 @@ void HEALPix::fillJob(api::MIRJob&) const { void HEALPix::json(eckit::JSON& j) const { j.startObject(); j << "grid" << name(); + j << "type" << "healpix"; + j << "ordering" << orderingConvention_; j.endObject(); } diff --git a/src/mir/repres/unsupported/HEALPixNested.cc b/src/mir/repres/unsupported/HEALPixNested.cc index 9da7b9bbf..284e0cb38 100644 --- a/src/mir/repres/unsupported/HEALPixNested.cc +++ b/src/mir/repres/unsupported/HEALPixNested.cc @@ -48,6 +48,8 @@ void HEALPixNested::fillGrib(grib_info& info) const { void HEALPixNested::json(eckit::JSON& j) const { j.startObject(); j << "grid" << name(); + j << "type" << "healpix"; + j << "ordering" << "nested"; j.endObject(); } From 01a89b394b0be6b3e9f8d83204c97f1ae42a3a09 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Thu, 29 Feb 2024 12:41:41 +0000 Subject: [PATCH 30/69] MIR-645 HEALPix support for earthkit-regrid --- src/mir/repres/proxy/HEALPix.cc | 2 +- src/mir/repres/unsupported/HEALPixNested.cc | 11 +++-------- src/mir/repres/unsupported/HEALPixNested.h | 1 - 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/mir/repres/proxy/HEALPix.cc b/src/mir/repres/proxy/HEALPix.cc index 27a0da477..394e25974 100644 --- a/src/mir/repres/proxy/HEALPix.cc +++ b/src/mir/repres/proxy/HEALPix.cc @@ -286,7 +286,7 @@ void HEALPix::json(eckit::JSON& j) const { void HEALPix::print(std::ostream& out) const { - out << "HEALPix[name=" << name() << "]"; + out << "HEALPix[name=" << name() << ",ordering=" << orderingConvention_ << "]"; } diff --git a/src/mir/repres/unsupported/HEALPixNested.cc b/src/mir/repres/unsupported/HEALPixNested.cc index 284e0cb38..f1f3f4090 100644 --- a/src/mir/repres/unsupported/HEALPixNested.cc +++ b/src/mir/repres/unsupported/HEALPixNested.cc @@ -25,13 +25,8 @@ namespace mir::repres::unsupported { -std::string HEALPixNested::name() const { - return "H" + std::to_string(ring_.Nside()) + "_nested"; -} - - void HEALPixNested::makeName(std::ostream& out) const { - out << name(); + out << "H" << std::to_string(ring_.Nside()) << "_nested"; } @@ -47,7 +42,7 @@ void HEALPixNested::fillGrib(grib_info& info) const { void HEALPixNested::json(eckit::JSON& j) const { j.startObject(); - j << "grid" << name(); + j << "grid" << ring_.uniqueName(); j << "type" << "healpix"; j << "ordering" << "nested"; j.endObject(); @@ -55,7 +50,7 @@ void HEALPixNested::json(eckit::JSON& j) const { void HEALPixNested::print(std::ostream& out) const { - out << "HEALPixNested[name=" << name() << "]"; + out << "HEALPixNested[name=" << ring_.uniqueName() << "]"; } diff --git a/src/mir/repres/unsupported/HEALPixNested.h b/src/mir/repres/unsupported/HEALPixNested.h index 78507106b..f9a7e2dbe 100644 --- a/src/mir/repres/unsupported/HEALPixNested.h +++ b/src/mir/repres/unsupported/HEALPixNested.h @@ -63,7 +63,6 @@ class HEALPixNested final : public Gridded { // -- Methods inline const Representation& ring() const { return static_cast(ring_); } - std::string name() const; // -- Overridden methods From 1107394bc0d0ad81d598217102fb5b5cca26fdef Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Thu, 29 Feb 2024 16:33:01 +0000 Subject: [PATCH 31/69] MIR-646 earthkit-regrid support with interpolationspec --- src/mir/method/knn/pick/Distance.cc | 9 +++++++++ src/mir/method/knn/pick/Distance.h | 2 ++ src/mir/method/knn/pick/DistanceAndNClosest.cc | 10 ++++++++++ src/mir/method/knn/pick/DistanceAndNClosest.h | 2 ++ src/mir/method/knn/pick/DistanceOrNClosest.cc | 10 ++++++++++ src/mir/method/knn/pick/DistanceOrNClosest.h | 2 ++ .../knn/pick/LongestElementDiagonalAndNClosest.cc | 10 ++++++++++ .../knn/pick/LongestElementDiagonalAndNClosest.h | 2 ++ src/mir/method/knn/pick/NClosest.cc | 9 +++++++++ src/mir/method/knn/pick/NClosest.h | 2 ++ src/mir/method/knn/pick/NClosestOrNearest.cc | 10 ++++++++++ src/mir/method/knn/pick/NClosestOrNearest.h | 2 ++ .../knn/pick/NearestNeighbourWithLowestIndex.cc | 9 +++++++++ .../knn/pick/NearestNeighbourWithLowestIndex.h | 1 + src/mir/method/knn/pick/Pick.h | 14 ++++++++++++-- src/mir/method/knn/pick/Sample.cc | 10 ++++++++++ src/mir/method/knn/pick/Sample.h | 2 ++ src/mir/method/knn/pick/SortedSample.cc | 9 +++++++++ src/mir/method/knn/pick/SortedSample.h | 2 ++ 19 files changed, 115 insertions(+), 2 deletions(-) diff --git a/src/mir/method/knn/pick/Distance.cc b/src/mir/method/knn/pick/Distance.cc index 562a2c67f..0a310dbb8 100644 --- a/src/mir/method/knn/pick/Distance.cc +++ b/src/mir/method/knn/pick/Distance.cc @@ -12,6 +12,7 @@ #include "mir/method/knn/pick/Distance.h" +#include "eckit/log/JSON.h" #include "eckit/types/FloatCompare.h" #include "eckit/utils/MD5.h" @@ -46,6 +47,14 @@ bool Distance::sameAs(const Pick& other) const { } +void Distance::json(eckit::JSON& j) const { + j.startObject(); + j << "type" << "distance"; + j << "distance" << distance_; + j.endObject(); +} + + void Distance::print(std::ostream& out) const { out << "Distance[" << distance_ << "]"; } diff --git a/src/mir/method/knn/pick/Distance.h b/src/mir/method/knn/pick/Distance.h index 7352665d6..9c8720872 100644 --- a/src/mir/method/knn/pick/Distance.h +++ b/src/mir/method/knn/pick/Distance.h @@ -25,8 +25,10 @@ struct Distance : Pick { bool sameAs(const Pick&) const override; private: + void json(eckit::JSON&) const override; void print(std::ostream&) const override; void hash(eckit::MD5&) const override; + double distance_; }; diff --git a/src/mir/method/knn/pick/DistanceAndNClosest.cc b/src/mir/method/knn/pick/DistanceAndNClosest.cc index baf31f9fd..817527f07 100644 --- a/src/mir/method/knn/pick/DistanceAndNClosest.cc +++ b/src/mir/method/knn/pick/DistanceAndNClosest.cc @@ -12,6 +12,7 @@ #include "mir/method/knn/pick/DistanceAndNClosest.h" +#include "eckit/log/JSON.h" #include "eckit/types/FloatCompare.h" #include "eckit/utils/MD5.h" @@ -50,6 +51,15 @@ bool DistanceAndNClosest::sameAs(const Pick& other) const { } +void DistanceAndNClosest::json(eckit::JSON& j) const { + j.startObject(); + j << "type" << "distance-and-nclosest"; + j << "nclosest" << nClosest_; + j << "distance" << distance_; + j.endObject(); +} + + void DistanceAndNClosest::print(std::ostream& out) const { out << "DistanceAndNClosest[nclosest=" << nClosest_ << ",distance=" << distance_ << "]"; } diff --git a/src/mir/method/knn/pick/DistanceAndNClosest.h b/src/mir/method/knn/pick/DistanceAndNClosest.h index 3265f80e2..d98570d50 100644 --- a/src/mir/method/knn/pick/DistanceAndNClosest.h +++ b/src/mir/method/knn/pick/DistanceAndNClosest.h @@ -26,8 +26,10 @@ struct DistanceAndNClosest : Pick { bool sameAs(const Pick&) const override; private: + void json(eckit::JSON&) const override; void print(std::ostream&) const override; void hash(eckit::MD5&) const override; + NClosestOrNearest nClosest_; double distance_; }; diff --git a/src/mir/method/knn/pick/DistanceOrNClosest.cc b/src/mir/method/knn/pick/DistanceOrNClosest.cc index 5d9d27cf8..2e0641a9a 100644 --- a/src/mir/method/knn/pick/DistanceOrNClosest.cc +++ b/src/mir/method/knn/pick/DistanceOrNClosest.cc @@ -12,6 +12,7 @@ #include "mir/method/knn/pick/DistanceOrNClosest.h" +#include "eckit/log/JSON.h" #include "eckit/types/FloatCompare.h" #include "eckit/utils/MD5.h" @@ -50,6 +51,15 @@ bool DistanceOrNClosest::sameAs(const Pick& other) const { } +void DistanceOrNClosest::json(eckit::JSON& j) const { + j.startObject(); + j << "type" << "distance-or-nclosest"; + j << "nclosest" << nClosest_; + j << "distance" << distance_; + j.endObject(); +} + + void DistanceOrNClosest::print(std::ostream& out) const { out << "DistanceOrNClosest[nclosest=" << nClosest_ << ",distance=" << distance_ << "]"; } diff --git a/src/mir/method/knn/pick/DistanceOrNClosest.h b/src/mir/method/knn/pick/DistanceOrNClosest.h index c18f40942..a75579b6d 100644 --- a/src/mir/method/knn/pick/DistanceOrNClosest.h +++ b/src/mir/method/knn/pick/DistanceOrNClosest.h @@ -26,8 +26,10 @@ struct DistanceOrNClosest : Pick { bool sameAs(const Pick&) const override; private: + void json(eckit::JSON&) const override; void print(std::ostream&) const override; void hash(eckit::MD5&) const override; + NClosestOrNearest nClosest_; double distance_; }; diff --git a/src/mir/method/knn/pick/LongestElementDiagonalAndNClosest.cc b/src/mir/method/knn/pick/LongestElementDiagonalAndNClosest.cc index 81d6195ff..48cede5fd 100644 --- a/src/mir/method/knn/pick/LongestElementDiagonalAndNClosest.cc +++ b/src/mir/method/knn/pick/LongestElementDiagonalAndNClosest.cc @@ -12,6 +12,7 @@ #include "mir/method/knn/pick/LongestElementDiagonalAndNClosest.h" +#include "eckit/log/JSON.h" #include "eckit/types/FloatCompare.h" #include "eckit/utils/MD5.h" @@ -78,6 +79,15 @@ void LongestElementDiagonalAndNClosest::distance(const repres::Representation& i } +void LongestElementDiagonalAndNClosest::json(eckit::JSON& j) const { + j.startObject(); + j << "type" << "longest-element-diagonal-and-nclosest"; + j << "nclosest" << nClosest_; + j << "distance" << distance_; + j.endObject(); +} + + void LongestElementDiagonalAndNClosest::print(std::ostream& out) const { out << "LongestElementDistanceAndNClosest[nclosest=" << nClosest_ << ",distance=" << distance_ << "]"; } diff --git a/src/mir/method/knn/pick/LongestElementDiagonalAndNClosest.h b/src/mir/method/knn/pick/LongestElementDiagonalAndNClosest.h index 39c9dce5e..ccc9f68b3 100644 --- a/src/mir/method/knn/pick/LongestElementDiagonalAndNClosest.h +++ b/src/mir/method/knn/pick/LongestElementDiagonalAndNClosest.h @@ -26,8 +26,10 @@ struct LongestElementDiagonalAndNClosest : Pick { private: void distance(const repres::Representation&) const override; + void json(eckit::JSON&) const override; void print(std::ostream&) const override; void hash(eckit::MD5&) const override; + size_t nClosest_; mutable double distance_; mutable double distance2_; diff --git a/src/mir/method/knn/pick/NClosest.cc b/src/mir/method/knn/pick/NClosest.cc index fc582e16b..3e3ec1b59 100644 --- a/src/mir/method/knn/pick/NClosest.cc +++ b/src/mir/method/knn/pick/NClosest.cc @@ -12,6 +12,7 @@ #include "mir/method/knn/pick/NClosest.h" +#include "eckit/log/JSON.h" #include "eckit/utils/MD5.h" #include "mir/param/MIRParametrisation.h" @@ -45,6 +46,14 @@ bool NClosest::sameAs(const Pick& other) const { } +void NClosest::json(eckit::JSON& j) const { + j.startObject(); + j << "type" << "nclosest"; + j << "nclosest" << nClosest_; + j.endObject(); +} + + void NClosest::print(std::ostream& out) const { out << "NClosest[" << nClosest_ << "]"; } diff --git a/src/mir/method/knn/pick/NClosest.h b/src/mir/method/knn/pick/NClosest.h index 3479caf46..6b8453408 100644 --- a/src/mir/method/knn/pick/NClosest.h +++ b/src/mir/method/knn/pick/NClosest.h @@ -25,8 +25,10 @@ struct NClosest : Pick { bool sameAs(const Pick&) const override; private: + void json(eckit::JSON&) const override; void print(std::ostream&) const override; void hash(eckit::MD5&) const override; + size_t nClosest_; }; diff --git a/src/mir/method/knn/pick/NClosestOrNearest.cc b/src/mir/method/knn/pick/NClosestOrNearest.cc index b4edb52a9..d26b06fe3 100644 --- a/src/mir/method/knn/pick/NClosestOrNearest.cc +++ b/src/mir/method/knn/pick/NClosestOrNearest.cc @@ -14,6 +14,7 @@ #include +#include "eckit/log/JSON.h" #include "eckit/types/FloatCompare.h" #include "eckit/utils/MD5.h" @@ -80,6 +81,15 @@ bool NClosestOrNearest::sameAs(const Pick& other) const { } +void NClosestOrNearest::json(eckit::JSON& j) const { + j.startObject(); + j << "type" << "nclosest-or-nearest"; + j << "nclosest" << nClosest_; + j << "distanceTolerance" << distanceTolerance_; + j.endObject(); +} + + void NClosestOrNearest::print(std::ostream& out) const { out << "NClosestOrNearest[nclosest=" << nClosest_ << ",distanceTolerance=" << distanceTolerance_ << "]"; } diff --git a/src/mir/method/knn/pick/NClosestOrNearest.h b/src/mir/method/knn/pick/NClosestOrNearest.h index 796e419d3..beb70ee7d 100644 --- a/src/mir/method/knn/pick/NClosestOrNearest.h +++ b/src/mir/method/knn/pick/NClosestOrNearest.h @@ -27,7 +27,9 @@ struct NClosestOrNearest : Pick { void hash(eckit::MD5&) const override; private: + void json(eckit::JSON&) const override; void print(std::ostream&) const override; + size_t nClosest_; double distanceTolerance_; double distanceTolerance2_; diff --git a/src/mir/method/knn/pick/NearestNeighbourWithLowestIndex.cc b/src/mir/method/knn/pick/NearestNeighbourWithLowestIndex.cc index c0488f6ba..388187504 100644 --- a/src/mir/method/knn/pick/NearestNeighbourWithLowestIndex.cc +++ b/src/mir/method/knn/pick/NearestNeighbourWithLowestIndex.cc @@ -15,6 +15,7 @@ #include #include +#include "eckit/log/JSON.h" #include "eckit/types/FloatCompare.h" #include "eckit/utils/MD5.h" @@ -73,6 +74,14 @@ bool NearestNeighbourWithLowestIndex::sameAs(const Pick& other) const { } +void NearestNeighbourWithLowestIndex::json(eckit::JSON& j) const { + j.startObject(); + j << "type" << "nearest-neighbour-with-lowest-index"; + j << "nclosest" << nClosest_; + j.endObject(); +} + + void NearestNeighbourWithLowestIndex::print(std::ostream& out) const { out << "NearestNeighbourWithLowestIndex[nclosest=" << nClosest_ << "]"; } diff --git a/src/mir/method/knn/pick/NearestNeighbourWithLowestIndex.h b/src/mir/method/knn/pick/NearestNeighbourWithLowestIndex.h index a52fcaee1..29d0b6062 100644 --- a/src/mir/method/knn/pick/NearestNeighbourWithLowestIndex.h +++ b/src/mir/method/knn/pick/NearestNeighbourWithLowestIndex.h @@ -29,6 +29,7 @@ struct NearestNeighbourWithLowestIndex : Pick { bool sameAs(const Pick&) const override; private: + void json(eckit::JSON&) const override; void print(std::ostream&) const override; void hash(eckit::MD5&) const override; diff --git a/src/mir/method/knn/pick/Pick.h b/src/mir/method/knn/pick/Pick.h index 71d3bb999..30b842c47 100644 --- a/src/mir/method/knn/pick/Pick.h +++ b/src/mir/method/knn/pick/Pick.h @@ -18,8 +18,9 @@ namespace eckit { +class JSON; class MD5; -} +} // namespace eckit namespace mir::repres { class Representation; @@ -36,8 +37,11 @@ class Pick { Pick(); virtual ~Pick(); - Pick(const Pick&) = delete; + Pick(const Pick&) = delete; + Pick(Pick&&) = delete; + Pick& operator=(const Pick&) = delete; + Pick& operator=(Pick&&) = delete; virtual void pick(const search::PointSearch&, const Point3&, neighbours_t&) const = 0; virtual size_t n() const = 0; @@ -47,12 +51,18 @@ class Pick { virtual void distance(const repres::Representation&) const; private: + virtual void json(eckit::JSON&) const = 0; virtual void print(std::ostream&) const = 0; friend std::ostream& operator<<(std::ostream& s, const Pick& p) { p.print(s); return s; } + + friend eckit::JSON& operator<<(eckit::JSON& s, const Pick& p) { + p.json(s); + return s; + } }; diff --git a/src/mir/method/knn/pick/Sample.cc b/src/mir/method/knn/pick/Sample.cc index 394b52148..b40d12eb7 100644 --- a/src/mir/method/knn/pick/Sample.cc +++ b/src/mir/method/knn/pick/Sample.cc @@ -14,6 +14,7 @@ #include +#include "eckit/log/JSON.h" #include "eckit/types/FloatCompare.h" #include "eckit/utils/MD5.h" @@ -65,6 +66,15 @@ bool Sample::sameAs(const Pick& other) const { } +void Sample::json(eckit::JSON& j) const { + j.startObject(); + j << "type" << "sample"; + j << "nclosest" << nClosest_; + j << "distance" << distance_; + j.endObject(); +} + + void Sample::print(std::ostream& out) const { out << "Sample[nclosest=" << nClosest_ << ",distance=" << distance_ << "]"; } diff --git a/src/mir/method/knn/pick/Sample.h b/src/mir/method/knn/pick/Sample.h index b924ccb87..65b4832cf 100644 --- a/src/mir/method/knn/pick/Sample.h +++ b/src/mir/method/knn/pick/Sample.h @@ -26,7 +26,9 @@ struct Sample : Pick { void hash(eckit::MD5&) const override; private: + void json(eckit::JSON&) const override; void print(std::ostream&) const override; + size_t nClosest_; double distance_; }; diff --git a/src/mir/method/knn/pick/SortedSample.cc b/src/mir/method/knn/pick/SortedSample.cc index 87ff2afa0..efc0abd2b 100644 --- a/src/mir/method/knn/pick/SortedSample.cc +++ b/src/mir/method/knn/pick/SortedSample.cc @@ -14,6 +14,7 @@ #include +#include "eckit/log/JSON.h" #include "eckit/utils/MD5.h" @@ -49,6 +50,14 @@ void SortedSample::hash(eckit::MD5& h) const { } +void SortedSample::json(eckit::JSON& j) const { + j.startObject(); + j << "type" << "sorted-sample"; + j << "sample" << sample_; + j.endObject(); +} + + void SortedSample::print(std::ostream& out) const { out << "SortedSample[sample=" << sample_ << "]"; } diff --git a/src/mir/method/knn/pick/SortedSample.h b/src/mir/method/knn/pick/SortedSample.h index ee9f10b99..a2a7f1748 100644 --- a/src/mir/method/knn/pick/SortedSample.h +++ b/src/mir/method/knn/pick/SortedSample.h @@ -27,7 +27,9 @@ struct SortedSample : Pick { void hash(eckit::MD5&) const override; private: + void json(eckit::JSON&) const override; void print(std::ostream&) const override; + Sample sample_; }; From eba0ab2d417b0e4e86835df710c6e79fa2a672c6 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Thu, 29 Feb 2024 16:37:46 +0000 Subject: [PATCH 32/69] MIR-646 earthkit-regrid support with interpolationspec --- src/mir/CMakeLists.txt | 4 +-- src/mir/method/nonlinear/Heaviest.cc | 8 +++++ src/mir/method/nonlinear/Heaviest.h | 1 + .../method/nonlinear/MissingIfAllMissing.cc | 8 +++++ .../method/nonlinear/MissingIfAllMissing.h | 1 + .../method/nonlinear/MissingIfAnyMissing.cc | 8 +++++ .../method/nonlinear/MissingIfAnyMissing.h | 1 + .../nonlinear/MissingIfHeaviestMissing.cc | 8 +++++ .../nonlinear/MissingIfHeaviestMissing.h | 1 + src/mir/method/nonlinear/NoNonLinear.cc | 8 +++++ src/mir/method/nonlinear/NoNonLinear.h | 1 + src/mir/method/nonlinear/NonLinear.h | 12 +++++-- ...ssingValue.cc => SimulatedMissingValue.cc} | 32 ++++++++++++------- ...MissingValue.h => SimulatedMissingValue.h} | 5 +-- 14 files changed, 80 insertions(+), 18 deletions(-) rename src/mir/method/nonlinear/{SimulateMissingValue.cc => SimulatedMissingValue.cc} (74%) rename src/mir/method/nonlinear/{SimulateMissingValue.h => SimulatedMissingValue.h} (86%) diff --git a/src/mir/CMakeLists.txt b/src/mir/CMakeLists.txt index c4d1353a1..114421c7c 100644 --- a/src/mir/CMakeLists.txt +++ b/src/mir/CMakeLists.txt @@ -426,8 +426,8 @@ list(APPEND mir_srcs method/nonlinear/NoNonLinear.h method/nonlinear/NonLinear.cc method/nonlinear/NonLinear.h - method/nonlinear/SimulateMissingValue.cc - method/nonlinear/SimulateMissingValue.h + method/nonlinear/SimulatedMissingValue.cc + method/nonlinear/SimulatedMissingValue.h method/solver/Multiply.cc method/solver/Multiply.h method/solver/Solver.h diff --git a/src/mir/method/nonlinear/Heaviest.cc b/src/mir/method/nonlinear/Heaviest.cc index 25c0d0098..36e18d523 100644 --- a/src/mir/method/nonlinear/Heaviest.cc +++ b/src/mir/method/nonlinear/Heaviest.cc @@ -15,6 +15,7 @@ #include #include +#include "eckit/log/JSON.h" #include "eckit/utils/MD5.h" @@ -74,6 +75,13 @@ void Heaviest::hash(eckit::MD5& h) const { } +void Heaviest::json(eckit::JSON& j) const { + j.startObject(); + j << "type" << "heaviest"; + j.endObject(); +} + + static const NonLinearBuilder __nonlinear("heaviest"); diff --git a/src/mir/method/nonlinear/Heaviest.h b/src/mir/method/nonlinear/Heaviest.h index d8f7ef7b0..234d3bcad 100644 --- a/src/mir/method/nonlinear/Heaviest.h +++ b/src/mir/method/nonlinear/Heaviest.h @@ -25,6 +25,7 @@ struct Heaviest : NonLinear { bool treatment(MethodWeighted::Matrix& A, MethodWeighted::WeightMatrix& W, MethodWeighted::Matrix& B, const MIRValuesVector&, const double& missingValue) const override; bool sameAs(const NonLinear&) const override; + void json(eckit::JSON&) const override; void print(std::ostream&) const override; void hash(eckit::MD5&) const override; diff --git a/src/mir/method/nonlinear/MissingIfAllMissing.cc b/src/mir/method/nonlinear/MissingIfAllMissing.cc index 8318d22f9..5dd9b4054 100644 --- a/src/mir/method/nonlinear/MissingIfAllMissing.cc +++ b/src/mir/method/nonlinear/MissingIfAllMissing.cc @@ -15,6 +15,7 @@ #include #include +#include "eckit/log/JSON.h" #include "eckit/types/FloatCompare.h" #include "eckit/utils/MD5.h" @@ -108,6 +109,13 @@ void MissingIfAllMissing::hash(eckit::MD5& h) const { } +void MissingIfAllMissing::json(eckit::JSON& j) const { + j.startObject(); + j << "type" << "missing-if-all-missing"; + j.endObject(); +} + + static const NonLinearBuilder __nonlinear("missing-if-all-missing"); diff --git a/src/mir/method/nonlinear/MissingIfAllMissing.h b/src/mir/method/nonlinear/MissingIfAllMissing.h index e1161e8d5..af750fe4b 100644 --- a/src/mir/method/nonlinear/MissingIfAllMissing.h +++ b/src/mir/method/nonlinear/MissingIfAllMissing.h @@ -25,6 +25,7 @@ struct MissingIfAllMissing : NonLinear { bool treatment(MethodWeighted::Matrix& A, MethodWeighted::WeightMatrix& W, MethodWeighted::Matrix& B, const MIRValuesVector&, const double& missingValue) const override; bool sameAs(const NonLinear&) const override; + void json(eckit::JSON&) const override; void print(std::ostream&) const override; void hash(eckit::MD5&) const override; diff --git a/src/mir/method/nonlinear/MissingIfAnyMissing.cc b/src/mir/method/nonlinear/MissingIfAnyMissing.cc index 669260deb..d4493caea 100644 --- a/src/mir/method/nonlinear/MissingIfAnyMissing.cc +++ b/src/mir/method/nonlinear/MissingIfAnyMissing.cc @@ -15,6 +15,7 @@ #include #include +#include "eckit/log/JSON.h" #include "eckit/utils/MD5.h" #include "mir/util/Exceptions.h" @@ -90,6 +91,13 @@ void MissingIfAnyMissing::hash(eckit::MD5& h) const { } +void MissingIfAnyMissing::json(eckit::JSON& j) const { + j.startObject(); + j << "type" << "missing-if-any-missing"; + j.endObject(); +} + + static const NonLinearBuilder __nonlinear("missing-if-any-missing"); diff --git a/src/mir/method/nonlinear/MissingIfAnyMissing.h b/src/mir/method/nonlinear/MissingIfAnyMissing.h index fb62ec10d..c2a4aa80b 100644 --- a/src/mir/method/nonlinear/MissingIfAnyMissing.h +++ b/src/mir/method/nonlinear/MissingIfAnyMissing.h @@ -25,6 +25,7 @@ struct MissingIfAnyMissing : NonLinear { bool treatment(MethodWeighted::Matrix& A, MethodWeighted::WeightMatrix& W, MethodWeighted::Matrix& B, const MIRValuesVector&, const double& missingValue) const override; bool sameAs(const NonLinear&) const override; + void json(eckit::JSON&) const override; void print(std::ostream&) const override; void hash(eckit::MD5&) const override; diff --git a/src/mir/method/nonlinear/MissingIfHeaviestMissing.cc b/src/mir/method/nonlinear/MissingIfHeaviestMissing.cc index 4bd8affc4..16454002d 100644 --- a/src/mir/method/nonlinear/MissingIfHeaviestMissing.cc +++ b/src/mir/method/nonlinear/MissingIfHeaviestMissing.cc @@ -15,6 +15,7 @@ #include #include +#include "eckit/log/JSON.h" #include "eckit/types/FloatCompare.h" #include "eckit/utils/MD5.h" @@ -113,6 +114,13 @@ void MissingIfHeaviestMissing::hash(eckit::MD5& h) const { } +void MissingIfHeaviestMissing::json(eckit::JSON& j) const { + j.startObject(); + j << "type" << "missing-if-heaviest-missing"; + j.endObject(); +} + + static const NonLinearBuilder __nonlinear("missing-if-heaviest-missing"); diff --git a/src/mir/method/nonlinear/MissingIfHeaviestMissing.h b/src/mir/method/nonlinear/MissingIfHeaviestMissing.h index 7a54ac0b5..3a8a96cc4 100644 --- a/src/mir/method/nonlinear/MissingIfHeaviestMissing.h +++ b/src/mir/method/nonlinear/MissingIfHeaviestMissing.h @@ -25,6 +25,7 @@ struct MissingIfHeaviestMissing : NonLinear { bool treatment(MethodWeighted::Matrix& A, MethodWeighted::WeightMatrix& W, MethodWeighted::Matrix& B, const MIRValuesVector&, const double& missingValue) const override; bool sameAs(const NonLinear&) const override; + void json(eckit::JSON&) const override; void print(std::ostream&) const override; void hash(eckit::MD5&) const override; diff --git a/src/mir/method/nonlinear/NoNonLinear.cc b/src/mir/method/nonlinear/NoNonLinear.cc index da2e1428d..9e25513d7 100644 --- a/src/mir/method/nonlinear/NoNonLinear.cc +++ b/src/mir/method/nonlinear/NoNonLinear.cc @@ -15,6 +15,7 @@ #include #include +#include "eckit/log/JSON.h" #include "eckit/utils/MD5.h" @@ -50,6 +51,13 @@ void NoNonLinear::hash(eckit::MD5& h) const { } +void NoNonLinear::json(eckit::JSON& j) const { + j.startObject(); + j << "type" << "no"; + j.endObject(); +} + + static const NonLinearBuilder __nonlinear("no"); diff --git a/src/mir/method/nonlinear/NoNonLinear.h b/src/mir/method/nonlinear/NoNonLinear.h index c550c25d3..27cff4471 100644 --- a/src/mir/method/nonlinear/NoNonLinear.h +++ b/src/mir/method/nonlinear/NoNonLinear.h @@ -25,6 +25,7 @@ struct NoNonLinear : NonLinear { bool treatment(MethodWeighted::Matrix& A, MethodWeighted::WeightMatrix& W, MethodWeighted::Matrix& B, const MIRValuesVector&, const double& missingValue) const override; bool sameAs(const NonLinear&) const override; + void json(eckit::JSON&) const override; void print(std::ostream&) const override; void hash(eckit::MD5&) const override; diff --git a/src/mir/method/nonlinear/NonLinear.h b/src/mir/method/nonlinear/NonLinear.h index dff05422e..b72ff439b 100644 --- a/src/mir/method/nonlinear/NonLinear.h +++ b/src/mir/method/nonlinear/NonLinear.h @@ -19,6 +19,7 @@ namespace eckit { +class JSON; class MD5; namespace linalg { class Matrix; @@ -40,7 +41,7 @@ namespace mir::method::nonlinear { class NonLinear { public: - NonLinear(const param::MIRParametrisation&); + explicit NonLinear(const param::MIRParametrisation&); NonLinear(const NonLinear&) = delete; void operator=(const NonLinear&) = delete; @@ -52,8 +53,8 @@ class NonLinear { const MIRValuesVector&, const double& missingValue) const = 0; virtual bool sameAs(const NonLinear&) const = 0; - - virtual void hash(eckit::MD5&) const = 0; + virtual void hash(eckit::MD5&) const = 0; + virtual void json(eckit::JSON&) const = 0; virtual bool modifiesMatrix(bool fieldHasMissingValues) const = 0; @@ -64,6 +65,11 @@ class NonLinear { p.print(s); return s; } + + friend eckit::JSON& operator<<(eckit::JSON& s, const NonLinear& p) { + p.json(s); + return s; + } }; diff --git a/src/mir/method/nonlinear/SimulateMissingValue.cc b/src/mir/method/nonlinear/SimulatedMissingValue.cc similarity index 74% rename from src/mir/method/nonlinear/SimulateMissingValue.cc rename to src/mir/method/nonlinear/SimulatedMissingValue.cc index c8cf96dfd..14b954f26 100644 --- a/src/mir/method/nonlinear/SimulateMissingValue.cc +++ b/src/mir/method/nonlinear/SimulatedMissingValue.cc @@ -10,11 +10,12 @@ */ -#include "mir/method/nonlinear/SimulateMissingValue.h" +#include "mir/method/nonlinear/SimulatedMissingValue.h" #include #include +#include "eckit/log/JSON.h" #include "eckit/types/FloatCompare.h" #include "eckit/utils/MD5.h" @@ -25,15 +26,15 @@ namespace mir::method::nonlinear { -SimulateMissingValue::SimulateMissingValue(const param::MIRParametrisation& param) : NonLinear(param) { +SimulatedMissingValue::SimulatedMissingValue(const param::MIRParametrisation& param) : NonLinear(param) { param.get("simulated-missing-value", missingValue_ = 9999.); param.get("simulated-missing-value-epsilon", epsilon_ = 0.); } -bool SimulateMissingValue::treatment(MethodWeighted::Matrix& /*A*/, MethodWeighted::WeightMatrix& W, - MethodWeighted::Matrix& /*B*/, const MIRValuesVector& values, - const double& /*ignored*/) const { +bool SimulatedMissingValue::treatment(MethodWeighted::Matrix& /*A*/, MethodWeighted::WeightMatrix& W, + MethodWeighted::Matrix& /*B*/, const MIRValuesVector& values, + const double& /*ignored*/) const { using eckit::types::is_approximately_equal; auto missingValue = [this](double value) { return is_approximately_equal(value, missingValue_, epsilon_); }; @@ -104,26 +105,35 @@ bool SimulateMissingValue::treatment(MethodWeighted::Matrix& /*A*/, MethodWeight } -bool SimulateMissingValue::sameAs(const NonLinear& other) const { - const auto* o = dynamic_cast(&other); +bool SimulatedMissingValue::sameAs(const NonLinear& other) const { + const auto* o = dynamic_cast(&other); return (o != nullptr) && eckit::types::is_approximately_equal(missingValue_, o->missingValue_) && eckit::types::is_approximately_equal(epsilon_, o->epsilon_); } -void SimulateMissingValue::print(std::ostream& out) const { - out << "SimulateMissingValue[missingValue=" << missingValue_ << ",epsilon=" << epsilon_ << "]"; +void SimulatedMissingValue::print(std::ostream& out) const { + out << "SimulatedMissingValue[missingValue=" << missingValue_ << ",epsilon=" << epsilon_ << "]"; } -void SimulateMissingValue::hash(eckit::MD5& h) const { +void SimulatedMissingValue::hash(eckit::MD5& h) const { std::ostringstream s; s << *this; h.add(s.str()); } -static const NonLinearBuilder __nonlinear("simulated-missing-value"); +void SimulatedMissingValue::json(eckit::JSON& j) const { + j.startObject(); + j << "type" << "simulated-missing-value"; + j << "missingValue" << missingValue_; + j << "epsilon" << epsilon_; + j.endObject(); +} + + +static const NonLinearBuilder __nonlinear("simulated-missing-value"); } // namespace mir::method::nonlinear diff --git a/src/mir/method/nonlinear/SimulateMissingValue.h b/src/mir/method/nonlinear/SimulatedMissingValue.h similarity index 86% rename from src/mir/method/nonlinear/SimulateMissingValue.h rename to src/mir/method/nonlinear/SimulatedMissingValue.h index 7676b7a0b..dae41e3ec 100644 --- a/src/mir/method/nonlinear/SimulateMissingValue.h +++ b/src/mir/method/nonlinear/SimulatedMissingValue.h @@ -18,13 +18,14 @@ namespace mir::method::nonlinear { -struct SimulateMissingValue : NonLinear { - SimulateMissingValue(const param::MIRParametrisation&); +struct SimulatedMissingValue : NonLinear { + SimulatedMissingValue(const param::MIRParametrisation&); private: bool treatment(MethodWeighted::Matrix& A, MethodWeighted::WeightMatrix& W, MethodWeighted::Matrix& B, const MIRValuesVector&, const double&) const override; bool sameAs(const NonLinear&) const override; + void json(eckit::JSON&) const override; void print(std::ostream&) const override; void hash(eckit::MD5&) const override; From c2818b6e04dafa5a619c273b4baea969f3f20d15 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Thu, 29 Feb 2024 16:39:17 +0000 Subject: [PATCH 33/69] MIR-646 earthkit-regrid support with interpolationspec --- src/mir/method/solver/Multiply.cc | 8 ++++++++ src/mir/method/solver/Multiply.h | 1 + src/mir/method/solver/Solver.h | 21 +++++++++++++++------ src/mir/method/solver/Statistics.cc | 8 ++++++++ src/mir/method/solver/Statistics.h | 5 +++-- 5 files changed, 35 insertions(+), 8 deletions(-) diff --git a/src/mir/method/solver/Multiply.cc b/src/mir/method/solver/Multiply.cc index e236a60f2..f9a94f856 100644 --- a/src/mir/method/solver/Multiply.cc +++ b/src/mir/method/solver/Multiply.cc @@ -17,6 +17,7 @@ #include "eckit/linalg/LinearAlgebraSparse.h" #include "eckit/linalg/Vector.h" +#include "eckit/log/JSON.h" #include "eckit/utils/MD5.h" #include "mir/util/Exceptions.h" @@ -66,4 +67,11 @@ void Multiply::hash(eckit::MD5& h) const { } +void Multiply::json(eckit::JSON& j) const { + j.startObject(); + j << "type" << "multiply"; + j.endObject(); +} + + } // namespace mir::method::solver diff --git a/src/mir/method/solver/Multiply.h b/src/mir/method/solver/Multiply.h index 3c501b765..430740818 100644 --- a/src/mir/method/solver/Multiply.h +++ b/src/mir/method/solver/Multiply.h @@ -34,6 +34,7 @@ struct Multiply : Solver { bool sameAs(const Solver&) const override; void print(std::ostream&) const override; void hash(eckit::MD5&) const override; + void json(eckit::JSON&) const override; const eckit::linalg::LinearAlgebraSparse& backend_; }; diff --git a/src/mir/method/solver/Solver.h b/src/mir/method/solver/Solver.h index 9921c28f3..35e311d15 100644 --- a/src/mir/method/solver/Solver.h +++ b/src/mir/method/solver/Solver.h @@ -19,8 +19,9 @@ namespace eckit { +class JSON; class MD5; -} +} // namespace eckit namespace mir::param { class MIRParametrisation; @@ -33,19 +34,22 @@ namespace mir::method::solver { /// Solve linear system (B = W A) class Solver { public: - Solver(const param::MIRParametrisation&) {} + explicit Solver(const param::MIRParametrisation&) {} - Solver(const Solver&) = delete; - void operator=(const Solver&) = delete; + Solver(const Solver&) = delete; + Solver(Solver&&) = delete; virtual ~Solver() = default; + void operator=(const Solver&) = delete; + void operator=(Solver&&) = delete; + virtual void solve(const MethodWeighted::Matrix& A, const MethodWeighted::WeightMatrix& W, MethodWeighted::Matrix& B, const double& missingValue) const = 0; virtual bool sameAs(const Solver&) const = 0; - - virtual void hash(eckit::MD5&) const = 0; + virtual void hash(eckit::MD5&) const = 0; + virtual void json(eckit::JSON&) const = 0; private: virtual void print(std::ostream&) const = 0; @@ -54,6 +58,11 @@ class Solver { p.print(s); return s; } + + friend eckit::JSON& operator<<(eckit::JSON& s, const Solver& p) { + p.json(s); + return s; + } }; diff --git a/src/mir/method/solver/Statistics.cc b/src/mir/method/solver/Statistics.cc index e0a8a2706..673dc0e61 100644 --- a/src/mir/method/solver/Statistics.cc +++ b/src/mir/method/solver/Statistics.cc @@ -72,4 +72,12 @@ void Statistics::hash(eckit::MD5& h) const { } +void Statistics::json(eckit::JSON& j) const { + j.startObject(); + j << "type" << "statistics"; + j << "statistics" << *stats_; + j.endObject(); +} + + } // namespace mir::method::solver diff --git a/src/mir/method/solver/Statistics.h b/src/mir/method/solver/Statistics.h index 26d02f92e..660eb246d 100644 --- a/src/mir/method/solver/Statistics.h +++ b/src/mir/method/solver/Statistics.h @@ -14,6 +14,8 @@ #include +#include "eckit/log/JSON.h" + #include "mir/method/solver/Solver.h" @@ -37,10 +39,9 @@ struct Statistics final : solver::Solver { private: bool sameAs(const Solver&) const override; - void print(std::ostream&) const override; - void hash(eckit::MD5&) const override; + void json(eckit::JSON&) const override; std::unique_ptr stats_; }; From cbe9b93ac2847b27d2ca4843012a13216805d147 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Thu, 29 Feb 2024 18:06:18 +0000 Subject: [PATCH 34/69] MIR-646 earthkit-regrid support with interpolationspec --- src/mir/method/Method.h | 3 + src/mir/method/MethodWeighted.cc | 23 ++++++ src/mir/method/MethodWeighted.h | 13 +++- src/mir/method/fe/FEBilinear.h | 68 +---------------- src/mir/method/fe/FELinear.h | 68 +---------------- src/mir/method/fe/FiniteElement.cc | 15 ++++ src/mir/method/fe/FiniteElement.h | 1 + src/mir/method/fe/L2Projection.cc | 13 +++- src/mir/method/fe/L2Projection.h | 74 ++----------------- src/mir/method/gridbox/GridBoxAverage.h | 67 +---------------- src/mir/method/gridbox/GridBoxMethod.cc | 19 +++-- src/mir/method/gridbox/GridBoxMethod.h | 67 +---------------- src/mir/method/gridbox/GridBoxStatistics.h | 2 - src/mir/method/knn/KNearest.cc | 3 - src/mir/method/knn/KNearest.h | 7 +- src/mir/method/knn/KNearestNeighbours.cc | 10 +++ src/mir/method/knn/KNearestNeighbours.h | 1 + src/mir/method/knn/KNearestStatistics.cc | 3 - src/mir/method/knn/KNearestStatistics.h | 7 +- src/mir/method/knn/NearestLSM.cc | 3 - src/mir/method/knn/NearestLSM.h | 7 +- src/mir/method/knn/NearestNeighbour.cc | 3 - src/mir/method/knn/NearestNeighbour.h | 7 +- .../structured/StructuredBilinearLatLon.cc | 13 +++- .../structured/StructuredBilinearLatLon.h | 10 +-- .../method/structured/StructuredLinear3D.cc | 11 ++- .../method/structured/StructuredLinear3D.h | 10 +-- src/mir/method/structured/StructuredMethod.cc | 7 +- src/mir/method/structured/StructuredMethod.h | 2 - src/mir/method/voronoi/VoronoiMethod.cc | 9 +++ src/mir/method/voronoi/VoronoiMethod.h | 68 +---------------- src/mir/method/voronoi/VoronoiStatistics.h | 2 - 32 files changed, 145 insertions(+), 471 deletions(-) diff --git a/src/mir/method/Method.h b/src/mir/method/Method.h index b44568d43..7c6b49f68 100644 --- a/src/mir/method/Method.h +++ b/src/mir/method/Method.h @@ -42,11 +42,14 @@ namespace mir::method { class Method { public: Method(const param::MIRParametrisation&); + Method(const Method&) = delete; + Method(Method&&) = delete; virtual ~Method(); void operator=(const Method&) = delete; + void operator=(Method&&) = delete; virtual void hash(eckit::MD5&) const = 0; diff --git a/src/mir/method/MethodWeighted.cc b/src/mir/method/MethodWeighted.cc index e54fb1be6..dd461081a 100644 --- a/src/mir/method/MethodWeighted.cc +++ b/src/mir/method/MethodWeighted.cc @@ -79,6 +79,22 @@ MethodWeighted::MethodWeighted(const param::MIRParametrisation& parametrisation) MethodWeighted::~MethodWeighted() = default; +void MethodWeighted::json(eckit::JSON& j) const { + j << "nonLinear"; + j.startList(); + for (const auto& n : nonLinear_) { + j << *n; + } + j.endList(); + + j << "solver" << *solver_; + j << "cropping" << cropping_; + j << "lsmWeightAdjustment" << lsmWeightAdjustment_; + j << "pruneEpsilon" << pruneEpsilon_; + j << "poleDisplacement" << poleDisplacement_; +} + + void MethodWeighted::print(std::ostream& out) const { out << "nonLinear["; const auto* sep = ""; @@ -238,10 +254,17 @@ const WeightMatrix& MethodWeighted::getMatrix(context::Context& ctx, const repre j.startObject(); j << "input" << in; j << "output" << out; + j << "interpolation" << *this; + + j << "matrix"; + j.startObject(); j << "rows" << w.rows(); j << "columns" << w.cols(); + j << "nnz" << w.nonZeros(); j << "cache_file" << cacheFile; j.endObject(); + + j.endObject(); } matrix_cache.footprint(memory_key, usage); diff --git a/src/mir/method/MethodWeighted.h b/src/mir/method/MethodWeighted.h index 0a6d5084f..cc0e3b0bc 100644 --- a/src/mir/method/MethodWeighted.h +++ b/src/mir/method/MethodWeighted.h @@ -20,6 +20,10 @@ #include "mir/method/WeightMatrix.h" +namespace eckit { +class JSON; +} + namespace mir { namespace data { class Space; @@ -95,7 +99,8 @@ class MethodWeighted : public Method { // -- Methods - virtual const char* name() const = 0; + virtual void json(eckit::JSON&) const = 0; + virtual const char* name() const = 0; const solver::Solver& solver() const; void addNonLinearTreatment(const nonlinear::NonLinear*); void setSolver(const solver::Solver*); @@ -165,7 +170,13 @@ class MethodWeighted : public Method { // None // -- Friends + friend class MatrixCacheCreator; + + friend eckit::JSON& operator<<(eckit::JSON& s, const MethodWeighted& o) { + o.json(s); + return s; + } }; diff --git a/src/mir/method/fe/FEBilinear.h b/src/mir/method/fe/FEBilinear.h index f1b9b6dd4..8f461fcf9 100644 --- a/src/mir/method/fe/FEBilinear.h +++ b/src/mir/method/fe/FEBilinear.h @@ -18,75 +18,11 @@ namespace mir::method::fe { -class FEBilinear : public FiniteElement { -public: - // -- Types - // None - - // -- Exceptions - // None - - // -- Constructors - - FEBilinear(const param::MIRParametrisation&, const std::string& label = "input"); - - // -- Destructor - // None - - // -- Convertors - // None - - // -- Operators - // None - - // -- Methods - // None - - // -- Overridden methods - // None - - // -- Class members - // None - - // -- Class methods - // None - -protected: - // -- Members - // None - - // -- Methods - // None - - // -- Overridden methods - // None - - // -- Class members - // None - - // -- Class methods - // None +struct FEBilinear final : FiniteElement { + explicit FEBilinear(const param::MIRParametrisation&, const std::string& label = "input"); private: - // -- Members - // None - - // -- Methods - // None - - // -- Overridden methods - - // From MethodWeighted const char* name() const override; - - // -- Class members - // None - - // -- Class methods - // None - - // -- Friends - // None }; diff --git a/src/mir/method/fe/FELinear.h b/src/mir/method/fe/FELinear.h index c594f2aba..159f47e72 100644 --- a/src/mir/method/fe/FELinear.h +++ b/src/mir/method/fe/FELinear.h @@ -18,75 +18,11 @@ namespace mir::method::fe { -class FELinear : public FiniteElement { -public: - // -- Types - // None - - // -- Exceptions - // None - - // -- Constructors - - FELinear(const param::MIRParametrisation&, const std::string& label = "input"); - - // -- Destructor - // None - - // -- Convertors - // None - - // -- Operators - // None - - // -- Methods - // None - - // -- Overridden methods - // None - - // -- Class members - // None - - // -- Class methods - // None - -protected: - // -- Members - // None - - // -- Methods - // None - - // -- Overridden methods - // None - - // -- Class members - // None - - // -- Class methods - // None +struct FELinear final : FiniteElement { + explicit FELinear(const param::MIRParametrisation&, const std::string& label = "input"); private: - // -- Members - // None - - // -- Methods - // None - - // -- Overridden methods - - // From MethodWeighted const char* name() const override; - - // -- Class members - // None - - // -- Class methods - // None - - // -- Friends - // None }; diff --git a/src/mir/method/fe/FiniteElement.cc b/src/mir/method/fe/FiniteElement.cc index bab926242..8010714d0 100644 --- a/src/mir/method/fe/FiniteElement.cc +++ b/src/mir/method/fe/FiniteElement.cc @@ -22,6 +22,7 @@ #include #include +#include "eckit/log/JSON.h" #include "eckit/utils/MD5.h" #include "eckit/utils/StringTools.h" @@ -244,6 +245,20 @@ bool FiniteElement::sameAs(const Method& other) const { } +void FiniteElement::json(eckit::JSON& j) const { + j.startObject(); + j << "name" << name(); + MethodWeighted::json(j); + j << "validateMesh" << validateMesh_; + j << "projectionFail" + << (projectionFail_ == ProjectionFail::failure ? "fail" + : projectionFail_ == ProjectionFail::increaseEpsilon ? "increase-epsilon" + : projectionFail_ == ProjectionFail::missingValue ? "missing-value" + : NOTIMP); + j.endObject(); +} + + void FiniteElement::hash(eckit::MD5& md5) const { MethodWeighted::hash(md5); meshGeneratorParams_.hash(md5); diff --git a/src/mir/method/fe/FiniteElement.h b/src/mir/method/fe/FiniteElement.h index 4764fad45..637443245 100644 --- a/src/mir/method/fe/FiniteElement.h +++ b/src/mir/method/fe/FiniteElement.h @@ -102,6 +102,7 @@ class FiniteElement : public MethodWeighted { void assemble(util::MIRStatistics&, WeightMatrix&, const repres::Representation& in, const repres::Representation& out) const override; bool sameAs(const Method&) const override; + void json(eckit::JSON&) const override; void print(std::ostream&) const override; // -- Overridden methods diff --git a/src/mir/method/fe/L2Projection.cc b/src/mir/method/fe/L2Projection.cc index 5fff1dcc7..d7088eefc 100644 --- a/src/mir/method/fe/L2Projection.cc +++ b/src/mir/method/fe/L2Projection.cc @@ -14,6 +14,7 @@ #include "eckit/linalg/LinearAlgebraSparse.h" #include "eckit/linalg/Vector.h" +#include "eckit/log/JSON.h" #include "eckit/types/FloatCompare.h" #include "eckit/utils/MD5.h" @@ -45,9 +46,6 @@ L2Projection::L2Projection(const param::MIRParametrisation& param) : MethodWeigh } -L2Projection::~L2Projection() = default; - - bool L2Projection::sameAs(const Method& other) const { const auto* o = dynamic_cast(&other); return (o != nullptr) && inputMethod_->sameAs(*(o->inputMethod_)) && outputMethod_->sameAs(*(o->outputMethod_)) && @@ -55,6 +53,15 @@ bool L2Projection::sameAs(const Method& other) const { } +void L2Projection::json(eckit::JSON& j) const { + j.startObject(); + j << "type" << "l2-projection"; + j << "input", *inputMethod_; + j << "output", *outputMethod_; + j.endObject(); +} + + void L2Projection::assemble(util::MIRStatistics& statistics, WeightMatrix& W, const repres::Representation& in, const repres::Representation& out) const { auto& log = Log::debug(); diff --git a/src/mir/method/fe/L2Projection.h b/src/mir/method/fe/L2Projection.h index 51d1ab906..b150ead61 100644 --- a/src/mir/method/fe/L2Projection.h +++ b/src/mir/method/fe/L2Projection.h @@ -29,86 +29,22 @@ namespace mir::method::fe { * @brief The L2 Projection interpolation method * See */ -class L2Projection : public MethodWeighted { -public: - // -- Types - // None - - // -- Exceptions - // None - - // -- Constructors - - L2Projection(const param::MIRParametrisation&); - - // -- Destructor - - ~L2Projection() override; - - // -- Convertors - // None - - // -- Operators - // None - - // -- Methods - // None - - // -- Overridden methods - // None - - // -- Class members - // None - - // -- Class methods - // None - -protected: - // -- Members - // None - - // -- Methods - // None - - // -- Overridden methods - // None - - // -- Class members - // None - - // -- Class methods - // None +struct L2Projection final : MethodWeighted { + explicit L2Projection(const param::MIRParametrisation&); private: - // -- Members - - std::unique_ptr inputMethod_; - std::unique_ptr outputMethod_; - - // -- Methods - // None - - // -- Overridden methods - - // From Method void hash(eckit::MD5&) const override; int version() const override; bool sameAs(const Method&) const override; + void json(eckit::JSON&) const override; void print(std::ostream&) const override; - // From MethodWeighted void assemble(util::MIRStatistics&, WeightMatrix&, const repres::Representation& in, const repres::Representation& out) const override; const char* name() const override; - // -- Class members - // None - - // -- Class methods - // None - - // -- Friends - // None + std::unique_ptr inputMethod_; + std::unique_ptr outputMethod_; }; diff --git a/src/mir/method/gridbox/GridBoxAverage.h b/src/mir/method/gridbox/GridBoxAverage.h index 78d5fdcc9..cba662fe1 100644 --- a/src/mir/method/gridbox/GridBoxAverage.h +++ b/src/mir/method/gridbox/GridBoxAverage.h @@ -18,73 +18,8 @@ namespace mir::method::gridbox { -class GridBoxAverage : public GridBoxMethod { -public: - // -- Types - // None - - // -- Exceptions - // None - - // -- Constructors - +struct GridBoxAverage final : GridBoxMethod { using GridBoxMethod::GridBoxMethod; - - // -- Destructor - // None - - // -- Convertors - // None - - // -- Operators - // None - - // -- Methods - // None - - // -- Overridden methods - // None - - // -- Class members - // None - - // -- Class methods - // None - -protected: - // -- Members - // None - - // -- Methods - // None - - // -- Overridden methods - // None - - // -- Class members - // None - - // -- Class methods - // None - -private: - // -- Members - // None - - // -- Methods - // None - - // -- Overridden methods - // None - - // -- Class members - // None - - // -- Class methods - // None - - // -- Friends - // None }; diff --git a/src/mir/method/gridbox/GridBoxMethod.cc b/src/mir/method/gridbox/GridBoxMethod.cc index 5cdb8b8f8..106cbf99f 100644 --- a/src/mir/method/gridbox/GridBoxMethod.cc +++ b/src/mir/method/gridbox/GridBoxMethod.cc @@ -17,6 +17,7 @@ #include #include +#include "eckit/log/JSON.h" #include "eckit/types/FloatCompare.h" #include "eckit/utils/MD5.h" @@ -44,9 +45,6 @@ GridBoxMethod::GridBoxMethod(const param::MIRParametrisation& parametrisation) : } -GridBoxMethod::~GridBoxMethod() = default; - - bool GridBoxMethod::sameAs(const Method& other) const { const auto* o = dynamic_cast(&other); return (o != nullptr) && name() == o->name() && MethodWeighted::sameAs(*o); @@ -79,9 +77,10 @@ void GridBoxMethod::assemble(util::MIRStatistics& /*unused*/, WeightMatrix& W, c // set input and output grid boxes struct GridBoxes : std::vector { - GridBoxes(const repres::Representation& rep) : std::vector(rep.gridBoxes()) { + explicit GridBoxes(const repres::Representation& rep) : vector(rep.gridBoxes()) { ASSERT(size() == rep.numberOfPoints()); } + double getLongestGridBoxDiagonal() const { double R = 0.; for (const auto& box : *this) { @@ -143,7 +142,7 @@ void GridBoxMethod::assemble(util::MIRStatistics& /*unused*/, WeightMatrix& W, c double smallArea = smallBox.area(); ASSERT(smallArea > 0.); - triplets.emplace_back(WeightMatrix::Triplet(i, j, smallArea / area)); + triplets.emplace_back(i, j, smallArea / area); sumSmallAreas += smallArea; if ((areaMatch = eckit::types::is_approximately_equal(area, sumSmallAreas, 1. /*m^2*/))) { @@ -159,7 +158,7 @@ void GridBoxMethod::assemble(util::MIRStatistics& /*unused*/, WeightMatrix& W, c } else { ++nbFailures; - failures.push_front({i, it->pointUnrotated()}); + failures.emplace_front(i, it->pointUnrotated()); } } } @@ -192,6 +191,14 @@ void GridBoxMethod::hash(eckit::MD5& md5) const { } +void GridBoxMethod::json(eckit::JSON& j) const { + j.startObject(); + j << "type" << "grid-box-method"; + MethodWeighted::json(j); + j.endObject(); +} + + void GridBoxMethod::print(std::ostream& out) const { out << "GridBoxMethod[name=" << name() << ","; MethodWeighted::print(out); diff --git a/src/mir/method/gridbox/GridBoxMethod.h b/src/mir/method/gridbox/GridBoxMethod.h index 35afcece9..c9a7f7e39 100644 --- a/src/mir/method/gridbox/GridBoxMethod.h +++ b/src/mir/method/gridbox/GridBoxMethod.h @@ -20,81 +20,18 @@ namespace mir::method::gridbox { class GridBoxMethod : public MethodWeighted { public: - // -- Types - // None - - // -- Exceptions - // None - - // -- Constructors - - GridBoxMethod(const param::MIRParametrisation&); - - // -- Destructor - - ~GridBoxMethod() override; - - // -- Convertors - // None - - // -- Operators - // None - - // -- Methods - // None - - // -- Overridden methods - // None - - // -- Class members - // None - - // -- Class methods - // None - -protected: - // -- Members - // None - - // -- Methods - // None - - // -- Overridden methods - // None - - // -- Class members - // None - - // -- Class methods - // None + explicit GridBoxMethod(const param::MIRParametrisation&); private: - // -- Members - // None - - // -- Methods - // None - - // -- Overridden methods - - // From MethodWeighted void hash(eckit::MD5&) const override; void assemble(util::MIRStatistics&, WeightMatrix&, const repres::Representation& in, const repres::Representation& out) const override; bool sameAs(const Method&) const override; + void json(eckit::JSON&) const override; void print(std::ostream&) const override; bool validateMatrixWeights() const override; const char* name() const override; int version() const override; - - // -- Class members - // None - - // -- Class methods - // None - - // -- Friends - // None }; diff --git a/src/mir/method/gridbox/GridBoxStatistics.h b/src/mir/method/gridbox/GridBoxStatistics.h index cd2fbf52c..dd60a5409 100644 --- a/src/mir/method/gridbox/GridBoxStatistics.h +++ b/src/mir/method/gridbox/GridBoxStatistics.h @@ -20,8 +20,6 @@ namespace mir::method::gridbox { struct GridBoxStatistics final : GridBoxMethod { explicit GridBoxStatistics(const param::MIRParametrisation&); - GridBoxStatistics(const GridBoxStatistics&) = delete; - void operator=(const GridBoxStatistics&) = delete; }; diff --git a/src/mir/method/knn/KNearest.cc b/src/mir/method/knn/KNearest.cc index 61685ac35..9c9d2f06f 100644 --- a/src/mir/method/knn/KNearest.cc +++ b/src/mir/method/knn/KNearest.cc @@ -35,9 +35,6 @@ KNearest::KNearest(const param::MIRParametrisation& param) : KNearestNeighbours( } -KNearest::~KNearest() = default; - - bool KNearest::sameAs(const Method& other) const { const auto* o = dynamic_cast(&other); return (o != nullptr) && KNearestNeighbours::sameAs(other); diff --git a/src/mir/method/knn/KNearest.h b/src/mir/method/knn/KNearest.h index b7168df27..2943cd5dd 100644 --- a/src/mir/method/knn/KNearest.h +++ b/src/mir/method/knn/KNearest.h @@ -20,11 +20,8 @@ namespace mir::method::knn { -class KNearest : public KNearestNeighbours { -public: - KNearest(const param::MIRParametrisation&); - - ~KNearest() override; +struct KNearest final : KNearestNeighbours { + explicit KNearest(const param::MIRParametrisation&); private: const char* name() const override; diff --git a/src/mir/method/knn/KNearestNeighbours.cc b/src/mir/method/knn/KNearestNeighbours.cc index 69248194b..15994d3b1 100644 --- a/src/mir/method/knn/KNearestNeighbours.cc +++ b/src/mir/method/knn/KNearestNeighbours.cc @@ -144,6 +144,16 @@ void KNearestNeighbours::assemble(util::MIRStatistics& /*unused*/, WeightMatrix& } +void KNearestNeighbours::json(eckit::JSON& j) const { + j.startObject(); + j << "type" << name(); + MethodWeighted::json(j); + j << "nearestMethod" << pick(); + j << "distanceWeighting" << distanceWeighting(); + j.endObject(); +} + + void KNearestNeighbours::print(std::ostream& out) const { out << "KNearestNeighbours["; MethodWeighted::print(out); diff --git a/src/mir/method/knn/KNearestNeighbours.h b/src/mir/method/knn/KNearestNeighbours.h index 49891486e..d222bb565 100644 --- a/src/mir/method/knn/KNearestNeighbours.h +++ b/src/mir/method/knn/KNearestNeighbours.h @@ -48,6 +48,7 @@ class KNearestNeighbours : public MethodWeighted { bool sameAs(const Method&) const override = 0; private: + void json(eckit::JSON&) const override; void print(std::ostream&) const override; const char* name() const override = 0; diff --git a/src/mir/method/knn/KNearestStatistics.cc b/src/mir/method/knn/KNearestStatistics.cc index 5d8520773..2d60b51ca 100644 --- a/src/mir/method/knn/KNearestStatistics.cc +++ b/src/mir/method/knn/KNearestStatistics.cc @@ -41,9 +41,6 @@ const char* KNearestStatistics::name() const { } -KNearestStatistics::~KNearestStatistics() = default; - - bool KNearestStatistics::sameAs(const Method& other) const { const auto* o = dynamic_cast(&other); return (o != nullptr) && KNearestStatistics::sameAs(other); diff --git a/src/mir/method/knn/KNearestStatistics.h b/src/mir/method/knn/KNearestStatistics.h index 598c85815..b34767bc2 100644 --- a/src/mir/method/knn/KNearestStatistics.h +++ b/src/mir/method/knn/KNearestStatistics.h @@ -21,11 +21,8 @@ namespace mir::method::knn { -class KNearestStatistics : public KNearestNeighbours { -public: - KNearestStatistics(const param::MIRParametrisation&); - - ~KNearestStatistics() override; +struct KNearestStatistics final : KNearestNeighbours { + explicit KNearestStatistics(const param::MIRParametrisation&); private: const char* name() const override; diff --git a/src/mir/method/knn/NearestLSM.cc b/src/mir/method/knn/NearestLSM.cc index 164f44316..fdaf98988 100644 --- a/src/mir/method/knn/NearestLSM.cc +++ b/src/mir/method/knn/NearestLSM.cc @@ -30,9 +30,6 @@ NearestLSM::NearestLSM(const param::MIRParametrisation& param) : KNearestNeighbo } -NearestLSM::~NearestLSM() = default; - - void NearestLSM::assemble(util::MIRStatistics& stats, WeightMatrix& W, const repres::Representation& in, const repres::Representation& out) const { diff --git a/src/mir/method/knn/NearestLSM.h b/src/mir/method/knn/NearestLSM.h index 9a029a248..e3b895777 100644 --- a/src/mir/method/knn/NearestLSM.h +++ b/src/mir/method/knn/NearestLSM.h @@ -20,11 +20,8 @@ namespace mir::method::knn { -class NearestLSM : public KNearestNeighbours { -public: - NearestLSM(const param::MIRParametrisation&); - - ~NearestLSM() override; +struct NearestLSM final : KNearestNeighbours { + explicit NearestLSM(const param::MIRParametrisation&); private: void assemble(util::MIRStatistics&, WeightMatrix&, const repres::Representation& in, diff --git a/src/mir/method/knn/NearestNeighbour.cc b/src/mir/method/knn/NearestNeighbour.cc index 38ca2f740..1f2d35c70 100644 --- a/src/mir/method/knn/NearestNeighbour.cc +++ b/src/mir/method/knn/NearestNeighbour.cc @@ -29,9 +29,6 @@ NearestNeighbour::NearestNeighbour(const param::MIRParametrisation& param) : } -NearestNeighbour::~NearestNeighbour() = default; - - bool NearestNeighbour::sameAs(const Method& other) const { const auto* o = dynamic_cast(&other); return (o != nullptr) && KNearestNeighbours::sameAs(other); diff --git a/src/mir/method/knn/NearestNeighbour.h b/src/mir/method/knn/NearestNeighbour.h index 42fb32955..58d9d20dd 100644 --- a/src/mir/method/knn/NearestNeighbour.h +++ b/src/mir/method/knn/NearestNeighbour.h @@ -20,11 +20,8 @@ namespace mir::method::knn { -class NearestNeighbour : public KNearestNeighbours { -public: - NearestNeighbour(const param::MIRParametrisation&); - - ~NearestNeighbour() override; +struct NearestNeighbour final : KNearestNeighbours { + explicit NearestNeighbour(const param::MIRParametrisation&); private: const char* name() const override; diff --git a/src/mir/method/structured/StructuredBilinearLatLon.cc b/src/mir/method/structured/StructuredBilinearLatLon.cc index 55840a7b8..cad899f09 100644 --- a/src/mir/method/structured/StructuredBilinearLatLon.cc +++ b/src/mir/method/structured/StructuredBilinearLatLon.cc @@ -34,9 +34,6 @@ static const MethodBuilder __method("structured-biline StructuredBilinearLatLon::StructuredBilinearLatLon(const param::MIRParametrisation& param) : StructuredMethod(param) {} -StructuredBilinearLatLon::~StructuredBilinearLatLon() = default; - - bool StructuredBilinearLatLon::sameAs(const Method& other) const { const auto* o = dynamic_cast(&other); return (o != nullptr) && StructuredMethod::sameAs(other); @@ -285,9 +282,17 @@ void StructuredBilinearLatLon::hash(eckit::MD5& md5) const { } +void StructuredBilinearLatLon::json(eckit::JSON& j) const { + j.startObject(); + j << "type" << "structured-bilinear-latlon"; + MethodWeighted::json(j); + j.endObject(); +} + + void StructuredBilinearLatLon::print(std::ostream& out) const { out << "StructuredBilinearLatLon["; - StructuredMethod::print(out); + MethodWeighted::print(out); out << "]"; } diff --git a/src/mir/method/structured/StructuredBilinearLatLon.h b/src/mir/method/structured/StructuredBilinearLatLon.h index 204cc5b84..cd84ec96f 100644 --- a/src/mir/method/structured/StructuredBilinearLatLon.h +++ b/src/mir/method/structured/StructuredBilinearLatLon.h @@ -18,21 +18,17 @@ namespace mir::method::structured { -class StructuredBilinearLatLon : public StructuredMethod { -public: - StructuredBilinearLatLon(const param::MIRParametrisation&); - ~StructuredBilinearLatLon() override; +struct StructuredBilinearLatLon final : StructuredMethod { + explicit StructuredBilinearLatLon(const param::MIRParametrisation&); private: void assembleStructuredInput(WeightMatrix&, const repres::Representation& in, const repres::Representation& out) const override; const char* name() const override; - void hash(eckit::MD5&) const override; - + void json(eckit::JSON&) const override; void print(std::ostream&) const override; - bool sameAs(const Method&) const override; }; diff --git a/src/mir/method/structured/StructuredLinear3D.cc b/src/mir/method/structured/StructuredLinear3D.cc index 1f4c79cb2..c237ad8c7 100644 --- a/src/mir/method/structured/StructuredLinear3D.cc +++ b/src/mir/method/structured/StructuredLinear3D.cc @@ -40,9 +40,6 @@ static const MethodBuilder __method("structured-linear-3d"); StructuredLinear3D::StructuredLinear3D(const param::MIRParametrisation& param) : StructuredMethod(param) {} -StructuredLinear3D::~StructuredLinear3D() = default; - - bool StructuredLinear3D::sameAs(const Method& other) const { const auto* o = dynamic_cast(&other); return (o != nullptr) && StructuredMethod::sameAs(other); @@ -219,6 +216,14 @@ void StructuredLinear3D::hash(eckit::MD5& md5) const { } +void StructuredLinear3D::json(eckit::JSON& j) const { + j.startObject(); + j << "type" << "structured-linear-3d"; + MethodWeighted::json(j); + j.endObject(); +} + + void StructuredLinear3D::print(std::ostream& out) const { out << "StructuredLinear3D["; StructuredMethod::print(out); diff --git a/src/mir/method/structured/StructuredLinear3D.h b/src/mir/method/structured/StructuredLinear3D.h index 3cb002d1a..69f4c8e9e 100644 --- a/src/mir/method/structured/StructuredLinear3D.h +++ b/src/mir/method/structured/StructuredLinear3D.h @@ -18,21 +18,17 @@ namespace mir::method::structured { -class StructuredLinear3D : public StructuredMethod { -public: - StructuredLinear3D(const param::MIRParametrisation&); - ~StructuredLinear3D() override; +struct StructuredLinear3D final : StructuredMethod { + explicit StructuredLinear3D(const param::MIRParametrisation&); private: void assembleStructuredInput(WeightMatrix&, const repres::Representation& in, const repres::Representation& out) const override; const char* name() const override; - void hash(eckit::MD5&) const override; - + void json(eckit::JSON&) const override; void print(std::ostream&) const override; - bool sameAs(const Method&) const override; }; diff --git a/src/mir/method/structured/StructuredMethod.cc b/src/mir/method/structured/StructuredMethod.cc index e53de3aef..ac1f1bf78 100644 --- a/src/mir/method/structured/StructuredMethod.cc +++ b/src/mir/method/structured/StructuredMethod.cc @@ -14,6 +14,8 @@ #include +#include "eckit/log/JSON.h" + #include "mir/repres/Iterator.h" #include "mir/repres/Representation.h" #include "mir/util/Exceptions.h" @@ -174,10 +176,5 @@ void StructuredMethod::assemble(util::MIRStatistics& /*unused*/, WeightMatrix& W Log::debug() << "StructuredMethod::assemble." << std::endl; } -void StructuredMethod::print(std::ostream& out) const { - out << "StructuredMethod["; - MethodWeighted::print(out); - out << "]"; -} } // namespace mir::method::structured diff --git a/src/mir/method/structured/StructuredMethod.h b/src/mir/method/structured/StructuredMethod.h index 5003884c2..973655e31 100644 --- a/src/mir/method/structured/StructuredMethod.h +++ b/src/mir/method/structured/StructuredMethod.h @@ -62,8 +62,6 @@ class StructuredMethod : public MethodWeighted { bool sameAs(const Method&) const override = 0; - void print(std::ostream&) const override; - private: void assemble(util::MIRStatistics&, WeightMatrix&, const repres::Representation& in, const repres::Representation& out) const override; diff --git a/src/mir/method/voronoi/VoronoiMethod.cc b/src/mir/method/voronoi/VoronoiMethod.cc index 7a54dd6b6..36a5877d9 100644 --- a/src/mir/method/voronoi/VoronoiMethod.cc +++ b/src/mir/method/voronoi/VoronoiMethod.cc @@ -18,6 +18,7 @@ #include #include +#include "eckit/log/JSON.h" #include "eckit/utils/MD5.h" #include "mir/repres/Iterator.h" @@ -153,6 +154,14 @@ void VoronoiMethod::hash(eckit::MD5& md5) const { } +void VoronoiMethod::json(eckit::JSON& j) const { + j.startObject(); + j << "type" << "voronoi-method"; + MethodWeighted::json(j); + j.endObject(); +} + + void VoronoiMethod::print(std::ostream& out) const { out << "VoronoiMethod[name=" << name() << ","; MethodWeighted::print(out); diff --git a/src/mir/method/voronoi/VoronoiMethod.h b/src/mir/method/voronoi/VoronoiMethod.h index 8168deb14..7a2dbd76c 100644 --- a/src/mir/method/voronoi/VoronoiMethod.h +++ b/src/mir/method/voronoi/VoronoiMethod.h @@ -21,81 +21,19 @@ namespace mir::method::voronoi { class VoronoiMethod : public MethodWeighted { public: - // -- Types - // None - - // -- Exceptions - // None - - // -- Constructors - - explicit VoronoiMethod(const param::MIRParametrisation& param); - - // -- Destructor - - virtual ~VoronoiMethod() override = default; - - // -- Convertors - // None - - // -- Operators - // None - - // -- Methods - // None - - // -- Overridden methods - // None - - // -- Class members - // None - - // -- Class methods - // None - -protected: - // -- Members - // None - - // -- Methods - // None - - // -- Overridden methods - // None - - // -- Class members - // None - - // -- Class methods - // None + explicit VoronoiMethod(const param::MIRParametrisation&); private: - // -- Members - - knn::pick::NClosestOrNearest pick_; - - // -- Methods - // None - - // -- Overridden methods - - // From MethodWeighted void hash(eckit::MD5&) const override; void assemble(util::MIRStatistics&, WeightMatrix&, const repres::Representation& in, const repres::Representation& out) const override; bool sameAs(const Method&) const override; + void json(eckit::JSON&) const override; void print(std::ostream&) const override; bool validateMatrixWeights() const override; const char* name() const override; - // -- Class members - // None - - // -- Class methods - // None - - // -- Friends - // None + knn::pick::NClosestOrNearest pick_; }; diff --git a/src/mir/method/voronoi/VoronoiStatistics.h b/src/mir/method/voronoi/VoronoiStatistics.h index 61d982a8c..488393ffe 100644 --- a/src/mir/method/voronoi/VoronoiStatistics.h +++ b/src/mir/method/voronoi/VoronoiStatistics.h @@ -20,8 +20,6 @@ namespace mir::method::voronoi { struct VoronoiStatistics final : VoronoiMethod { explicit VoronoiStatistics(const param::MIRParametrisation&); - VoronoiStatistics(const VoronoiStatistics&) = delete; - void operator=(const VoronoiStatistics&) = delete; }; From d1089facafcff00a3a9fa9f9526a0986d793ce50 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Thu, 29 Feb 2024 18:06:18 +0000 Subject: [PATCH 35/69] MIR-646 earthkit-regrid support with interpolationspec --- src/mir/method/knn/distance/ClimateFilter.cc | 9 ++++++ src/mir/method/knn/distance/ClimateFilter.h | 2 ++ src/mir/method/knn/distance/Cressman.cc | 8 +++++ src/mir/method/knn/distance/Cressman.h | 12 ++++--- .../method/knn/distance/DistanceWeighting.h | 31 +++++++++++++------ .../knn/distance/DistanceWeightingWithLSM.cc | 9 ++++++ .../knn/distance/DistanceWeightingWithLSM.h | 23 ++++++++------ .../knn/distance/GaussianDistanceWeighting.cc | 11 ++++++- .../knn/distance/GaussianDistanceWeighting.h | 6 ++-- .../knn/distance/InverseDistanceWeighting.cc | 13 ++++++-- .../knn/distance/InverseDistanceWeighting.h | 6 ++-- .../InverseDistanceWeightingSquared.cc | 10 +++++- .../InverseDistanceWeightingSquared.h | 1 + src/mir/method/knn/distance/NearestLSM.cc | 10 +++++- src/mir/method/knn/distance/NearestLSM.h | 6 ++-- .../knn/distance/NearestLSMWithLowestIndex.cc | 10 +++++- .../knn/distance/NearestLSMWithLowestIndex.h | 6 ++-- .../method/knn/distance/NearestNeighbour.cc | 10 +++++- .../method/knn/distance/NearestNeighbour.h | 1 + .../knn/distance/NoDistanceWeighting.cc | 12 +++++-- .../method/knn/distance/NoDistanceWeighting.h | 1 + src/mir/method/knn/distance/PseudoLaplace.cc | 9 ++++++ src/mir/method/knn/distance/PseudoLaplace.h | 1 + 23 files changed, 167 insertions(+), 40 deletions(-) diff --git a/src/mir/method/knn/distance/ClimateFilter.cc b/src/mir/method/knn/distance/ClimateFilter.cc index a7f5ae80e..a2e7a03e9 100644 --- a/src/mir/method/knn/distance/ClimateFilter.cc +++ b/src/mir/method/knn/distance/ClimateFilter.cc @@ -15,6 +15,7 @@ #include #include +#include "eckit/log/JSON.h" #include "eckit/types/FloatCompare.h" #include "eckit/utils/MD5.h" @@ -91,6 +92,14 @@ bool ClimateFilter::sameAs(const DistanceWeighting& other) const { } +void ClimateFilter::json(eckit::JSON& j) const { + j.startObject(); + j << "type" << "climate-filter"; + j << "climate-filter-delta" << delta_; + j.endObject(); +} + + void ClimateFilter::print(std::ostream& out) const { out << "ClimateFilter[halfDelta=" << halfDelta_ << ",delta=" << delta_ << "]"; } diff --git a/src/mir/method/knn/distance/ClimateFilter.h b/src/mir/method/knn/distance/ClimateFilter.h index dc0ebc5df..d0dab7bf8 100644 --- a/src/mir/method/knn/distance/ClimateFilter.h +++ b/src/mir/method/knn/distance/ClimateFilter.h @@ -25,8 +25,10 @@ struct ClimateFilter : DistanceWeighting { private: bool sameAs(const DistanceWeighting&) const override; + void json(eckit::JSON&) const override; void print(std::ostream&) const override; void hash(eckit::MD5&) const override; + double halfDelta_; double delta_; }; diff --git a/src/mir/method/knn/distance/Cressman.cc b/src/mir/method/knn/distance/Cressman.cc index ce1ea5b5f..8dcf72513 100644 --- a/src/mir/method/knn/distance/Cressman.cc +++ b/src/mir/method/knn/distance/Cressman.cc @@ -14,6 +14,7 @@ #include +#include "eckit/log/JSON.h" #include "eckit/types/FloatCompare.h" #include "eckit/utils/MD5.h" @@ -69,6 +70,13 @@ bool Cressman::sameAs(const DistanceWeighting& other) const { } +void Cressman::json(eckit::JSON& j) const { + j.startObject(); + j << "type" << "cressman"; + j.endList(); +} + + void Cressman::print(std::ostream& out) const { out << "Cressman[radius=" << r_ << "]"; } diff --git a/src/mir/method/knn/distance/Cressman.h b/src/mir/method/knn/distance/Cressman.h index ce3be6822..cb8dd92a2 100644 --- a/src/mir/method/knn/distance/Cressman.h +++ b/src/mir/method/knn/distance/Cressman.h @@ -22,18 +22,20 @@ namespace mir::method::knn::distance { * Cressman, George P., An operational objective analysis system. Mon. Wea. Rev., 87, 367-374 (01 Oct 1959), * @ref http://dx.doi.org/10.1175/1520-0493(1959)087<0367:AOOAS>2.0.CO;2 */ -struct Cressman : DistanceWeighting { - Cressman(const param::MIRParametrisation&); +struct Cressman final : DistanceWeighting { + explicit Cressman(const param::MIRParametrisation&); void operator()(size_t ip, const Point3& point, const std::vector& neighbours, std::vector& triplets) const override; private: - double r_; - double r2_; - double power_; bool sameAs(const DistanceWeighting&) const override; + void json(eckit::JSON&) const override; void print(std::ostream&) const override; void hash(eckit::MD5&) const override; + + double r_; + double r2_; + double power_; }; diff --git a/src/mir/method/knn/distance/DistanceWeighting.h b/src/mir/method/knn/distance/DistanceWeighting.h index cdaaefc94..5970a8c6b 100644 --- a/src/mir/method/knn/distance/DistanceWeighting.h +++ b/src/mir/method/knn/distance/DistanceWeighting.h @@ -19,8 +19,9 @@ namespace eckit { +class JSON; class MD5; -} +} // namespace eckit namespace mir::method::knn::distance { @@ -30,6 +31,12 @@ class DistanceWeighting { public: DistanceWeighting(); + DistanceWeighting(const DistanceWeighting&) = delete; + DistanceWeighting(DistanceWeighting&&) = delete; + + DistanceWeighting& operator=(const DistanceWeighting&) = delete; + DistanceWeighting& operator=(DistanceWeighting&&) = delete; + virtual ~DistanceWeighting(); virtual void operator()(size_t ip, const Point3& point, @@ -41,15 +48,18 @@ class DistanceWeighting { virtual void hash(eckit::MD5&) const = 0; private: - DistanceWeighting(const DistanceWeighting&) = delete; - DistanceWeighting& operator=(const DistanceWeighting&) = delete; - + virtual void json(eckit::JSON&) const = 0; virtual void print(std::ostream&) const = 0; friend std::ostream& operator<<(std::ostream& s, const DistanceWeighting& p) { p.print(s); return s; } + + friend eckit::JSON& operator<<(eckit::JSON& s, const DistanceWeighting& p) { + p.json(s); + return s; + } }; @@ -58,14 +68,17 @@ class DistanceWeightingFactory { std::string name_; virtual DistanceWeighting* make(const param::MIRParametrisation&) = 0; - DistanceWeightingFactory(const DistanceWeightingFactory&) = delete; - DistanceWeightingFactory& operator=(const DistanceWeightingFactory&) = delete; - protected: - DistanceWeightingFactory(const std::string& name); + explicit DistanceWeightingFactory(const std::string& name); virtual ~DistanceWeightingFactory(); public: + DistanceWeightingFactory(const DistanceWeightingFactory&) = delete; + DistanceWeightingFactory(DistanceWeightingFactory&&) = delete; + + DistanceWeightingFactory& operator=(const DistanceWeightingFactory&) = delete; + DistanceWeightingFactory& operator=(DistanceWeightingFactory&&) = delete; + static const DistanceWeighting* build(const std::string& name, const param::MIRParametrisation&); static void list(std::ostream&); }; @@ -76,7 +89,7 @@ class DistanceWeightingBuilder : public DistanceWeightingFactory { DistanceWeighting* make(const param::MIRParametrisation& param) override { return new T(param); } public: - DistanceWeightingBuilder(const std::string& name) : DistanceWeightingFactory(name) {} + explicit DistanceWeightingBuilder(const std::string& name) : DistanceWeightingFactory(name) {} }; diff --git a/src/mir/method/knn/distance/DistanceWeightingWithLSM.cc b/src/mir/method/knn/distance/DistanceWeightingWithLSM.cc index 9ccf9c7ce..cbd05057a 100644 --- a/src/mir/method/knn/distance/DistanceWeightingWithLSM.cc +++ b/src/mir/method/knn/distance/DistanceWeightingWithLSM.cc @@ -15,6 +15,7 @@ #include #include +#include "eckit/log/JSON.h" #include "eckit/utils/MD5.h" #include "mir/param/MIRParametrisation.h" @@ -62,6 +63,14 @@ bool DistanceWeightingWithLSM::sameAs(const DistanceWeighting& other) const { } +void DistanceWeightingWithLSM::json(eckit::JSON& j) const { + j.startObject(); + j << "type" << "distance-weighting-with-lsm"; + j << "distance-weighting-with-lsm" << method_; + j.endObject(); +} + + void DistanceWeightingWithLSM::print(std::ostream& out) const { out << "DistanceWeightingWithLSM[method=" << method_ << "]"; } diff --git a/src/mir/method/knn/distance/DistanceWeightingWithLSM.h b/src/mir/method/knn/distance/DistanceWeightingWithLSM.h index 11ea61237..a7c73eb4d 100644 --- a/src/mir/method/knn/distance/DistanceWeightingWithLSM.h +++ b/src/mir/method/knn/distance/DistanceWeightingWithLSM.h @@ -25,9 +25,9 @@ class LandSeaMasks; namespace mir::method::knn::distance { -struct DistanceWeightingWithLSM : DistanceWeighting { - - DistanceWeightingWithLSM(const param::MIRParametrisation&); +class DistanceWeightingWithLSM : public DistanceWeighting { +public: + explicit DistanceWeightingWithLSM(const param::MIRParametrisation&); void operator()(size_t, const Point3&, const std::vector&, std::vector&) const override { @@ -37,10 +37,12 @@ struct DistanceWeightingWithLSM : DistanceWeighting { const DistanceWeighting* distanceWeighting(const param::MIRParametrisation&, const lsm::LandSeaMasks& lsm) const; private: - std::string method_; bool sameAs(const DistanceWeighting&) const override; + void json(eckit::JSON&) const override; void print(std::ostream&) const override; void hash(eckit::MD5&) const override; + + std::string method_; }; @@ -49,14 +51,17 @@ class DistanceWeightingWithLSMFactory { std::string name_; virtual DistanceWeighting* make(const param::MIRParametrisation&, const lsm::LandSeaMasks&) = 0; - DistanceWeightingWithLSMFactory(const DistanceWeightingWithLSMFactory&) = delete; - DistanceWeightingWithLSMFactory& operator=(const DistanceWeightingWithLSMFactory&) = delete; - protected: - DistanceWeightingWithLSMFactory(const std::string& name); + explicit DistanceWeightingWithLSMFactory(const std::string& name); virtual ~DistanceWeightingWithLSMFactory(); public: + DistanceWeightingWithLSMFactory(const DistanceWeightingWithLSMFactory&) = delete; + DistanceWeightingWithLSMFactory(DistanceWeightingWithLSMFactory&&) = delete; + + DistanceWeightingWithLSMFactory& operator=(const DistanceWeightingWithLSMFactory&) = delete; + DistanceWeightingWithLSMFactory& operator=(DistanceWeightingWithLSMFactory&&) = delete; + static const DistanceWeighting* build(const std::string& name, const param::MIRParametrisation&, const lsm::LandSeaMasks&); static void list(std::ostream&); @@ -71,7 +76,7 @@ class DistanceWeightingWithLSMBuilder : public DistanceWeightingWithLSMFactory { } public: - DistanceWeightingWithLSMBuilder(const std::string& name) : DistanceWeightingWithLSMFactory(name) {} + explicit DistanceWeightingWithLSMBuilder(const std::string& name) : DistanceWeightingWithLSMFactory(name) {} }; diff --git a/src/mir/method/knn/distance/GaussianDistanceWeighting.cc b/src/mir/method/knn/distance/GaussianDistanceWeighting.cc index f035f8838..c162a2550 100644 --- a/src/mir/method/knn/distance/GaussianDistanceWeighting.cc +++ b/src/mir/method/knn/distance/GaussianDistanceWeighting.cc @@ -15,6 +15,7 @@ #include #include +#include "eckit/log/JSON.h" #include "eckit/types/FloatCompare.h" #include "eckit/utils/MD5.h" @@ -54,7 +55,7 @@ void GaussianDistanceWeighting::operator()(size_t ip, const Point3& point, const double d2 = Point3::distance2(point, n.point()); const double weight = std::exp(d2 * exponentFactor_); - triplets.emplace_back(WeightMatrix::Triplet(ip, n.payload(), weight)); + triplets.emplace_back(ip, n.payload(), weight); sum += weight; } @@ -72,6 +73,14 @@ bool GaussianDistanceWeighting::sameAs(const DistanceWeighting& other) const { } +void GaussianDistanceWeighting::json(eckit::JSON& j) const { + j.startObject(); + j << "type" << "gaussian"; + j << "distance-weighting-gaussian-stddev" << stddev_; + j.endObject(); +} + + void GaussianDistanceWeighting::print(std::ostream& out) const { out << "GaussianDistanceWeighting[stddev=" << stddev_ << "]"; } diff --git a/src/mir/method/knn/distance/GaussianDistanceWeighting.h b/src/mir/method/knn/distance/GaussianDistanceWeighting.h index 3bfe26182..d9620fc7b 100644 --- a/src/mir/method/knn/distance/GaussianDistanceWeighting.h +++ b/src/mir/method/knn/distance/GaussianDistanceWeighting.h @@ -24,11 +24,13 @@ struct GaussianDistanceWeighting : DistanceWeighting { std::vector& triplets) const override; private: - double stddev_; - double exponentFactor_; bool sameAs(const DistanceWeighting&) const override; + void json(eckit::JSON&) const override; void print(std::ostream&) const override; void hash(eckit::MD5&) const override; + + double stddev_; + double exponentFactor_; }; diff --git a/src/mir/method/knn/distance/InverseDistanceWeighting.cc b/src/mir/method/knn/distance/InverseDistanceWeighting.cc index 36d4ac327..4ab703eab 100644 --- a/src/mir/method/knn/distance/InverseDistanceWeighting.cc +++ b/src/mir/method/knn/distance/InverseDistanceWeighting.cc @@ -14,6 +14,7 @@ #include +#include "eckit/log/JSON.h" #include "eckit/types/FloatCompare.h" #include "eckit/utils/MD5.h" @@ -57,7 +58,7 @@ void InverseDistanceWeighting::operator()(size_t ip, const Point3& point, const double d2 = Point3::distance2(point, neighbours[j].point()); if (eckit::types::is_approximately_equal(d2, 0.)) { // exact match found, use this neighbour only (inverse distance tends to infinity) - triplets.assign(1, WeightMatrix::Triplet(ip, neighbours[j].payload(), 1.)); + triplets.assign(1, {ip, neighbours[j].payload(), 1.}); return; } @@ -70,7 +71,7 @@ void InverseDistanceWeighting::operator()(size_t ip, const Point3& point, // normalise all weights according to the total, and set sparse matrix triplets for (size_t j = 0; j < nbPoints; ++j) { size_t jp = neighbours[j].payload(); - triplets.emplace_back(WeightMatrix::Triplet(ip, jp, weights[j] / sum)); + triplets.emplace_back(ip, jp, weights[j] / sum); } } @@ -81,6 +82,14 @@ bool InverseDistanceWeighting::sameAs(const DistanceWeighting& other) const { } +void InverseDistanceWeighting::json(eckit::JSON& j) const { + j.startObject(); + j << "type" << "inverse-distance-weighting"; + j << "inverse-distance-weighting-power" << power_; + j.endObject(); +} + + void InverseDistanceWeighting::print(std::ostream& out) const { out << "InverseDistanceWeighting[power=" << power_ << "]"; } diff --git a/src/mir/method/knn/distance/InverseDistanceWeighting.h b/src/mir/method/knn/distance/InverseDistanceWeighting.h index fe22fa262..4540b8cc4 100644 --- a/src/mir/method/knn/distance/InverseDistanceWeighting.h +++ b/src/mir/method/knn/distance/InverseDistanceWeighting.h @@ -25,11 +25,13 @@ struct InverseDistanceWeighting : DistanceWeighting { std::vector& triplets) const override; private: - double power_; - double halfPower_; bool sameAs(const DistanceWeighting&) const override; + void json(eckit::JSON& j) const override; void print(std::ostream&) const override; void hash(eckit::MD5&) const override; + + double power_; + double halfPower_; }; diff --git a/src/mir/method/knn/distance/InverseDistanceWeightingSquared.cc b/src/mir/method/knn/distance/InverseDistanceWeightingSquared.cc index 979815750..54882c00a 100644 --- a/src/mir/method/knn/distance/InverseDistanceWeightingSquared.cc +++ b/src/mir/method/knn/distance/InverseDistanceWeightingSquared.cc @@ -14,6 +14,7 @@ #include +#include "eckit/log/JSON.h" #include "eckit/utils/MD5.h" #include "mir/util/Exceptions.h" @@ -50,7 +51,7 @@ void InverseDistanceWeightingSquared::operator()(size_t ip, const Point3& point, // normalise all weights according to the total, and set sparse matrix triplets for (size_t i = 0; i < nbPoints; ++i) { size_t jp = neighbours[i].payload(); - triplets.emplace_back(WeightMatrix::Triplet(ip, jp, weights[i] / sum)); + triplets.emplace_back(ip, jp, weights[i] / sum); } } @@ -61,6 +62,13 @@ bool InverseDistanceWeightingSquared::sameAs(const DistanceWeighting& other) con } +void InverseDistanceWeightingSquared::json(eckit::JSON& j) const { + j.startObject(); + j << "type" << "inverse-distance-weighting-squared"; + j.endObject(); +} + + void InverseDistanceWeightingSquared::print(std::ostream& out) const { out << "InverseDistanceWeightingSquared[]"; } diff --git a/src/mir/method/knn/distance/InverseDistanceWeightingSquared.h b/src/mir/method/knn/distance/InverseDistanceWeightingSquared.h index 8b2a741cf..2af5a7dd7 100644 --- a/src/mir/method/knn/distance/InverseDistanceWeightingSquared.h +++ b/src/mir/method/knn/distance/InverseDistanceWeightingSquared.h @@ -25,6 +25,7 @@ struct InverseDistanceWeightingSquared : DistanceWeighting { private: bool sameAs(const DistanceWeighting&) const override; + void json(eckit::JSON&) const override; void print(std::ostream&) const override; void hash(eckit::MD5&) const override; }; diff --git a/src/mir/method/knn/distance/NearestLSM.cc b/src/mir/method/knn/distance/NearestLSM.cc index 96a5f6e89..11a877483 100644 --- a/src/mir/method/knn/distance/NearestLSM.cc +++ b/src/mir/method/knn/distance/NearestLSM.cc @@ -14,6 +14,7 @@ #include +#include "eckit/log/JSON.h" #include "eckit/utils/MD5.h" #include "mir/lsm/LandSeaMasks.h" @@ -56,7 +57,7 @@ void NearestLSM::operator()(size_t ip, const Point3& /*unused*/, jp = neighbours.front().payload(); } - triplets.assign(1, WeightMatrix::Triplet(ip, jp, 1.)); + triplets.assign(1, {ip, jp, 1.}); } @@ -66,6 +67,13 @@ bool NearestLSM::sameAs(const DistanceWeighting& other) const { } +void NearestLSM::json(eckit::JSON& j) const { + j.startObject(); + j << "type" << "nearest-lsm"; + j.endObject(); +} + + void NearestLSM::print(std::ostream& out) const { out << "NearestLSM[]"; } diff --git a/src/mir/method/knn/distance/NearestLSM.h b/src/mir/method/knn/distance/NearestLSM.h index 8107037b3..af53ef76b 100644 --- a/src/mir/method/knn/distance/NearestLSM.h +++ b/src/mir/method/knn/distance/NearestLSM.h @@ -31,11 +31,13 @@ struct NearestLSM : DistanceWeightingWithLSM { std::vector& triplets) const override; private: - const std::vector& imask_; - const std::vector& omask_; bool sameAs(const DistanceWeighting&) const override; + void json(eckit::JSON&) const override; void print(std::ostream&) const override; void hash(eckit::MD5&) const override; + + const std::vector& imask_; + const std::vector& omask_; }; diff --git a/src/mir/method/knn/distance/NearestLSMWithLowestIndex.cc b/src/mir/method/knn/distance/NearestLSMWithLowestIndex.cc index c49b158f2..96c091c81 100644 --- a/src/mir/method/knn/distance/NearestLSMWithLowestIndex.cc +++ b/src/mir/method/knn/distance/NearestLSMWithLowestIndex.cc @@ -15,6 +15,7 @@ #include #include +#include "eckit/log/JSON.h" #include "eckit/types/FloatCompare.h" #include "eckit/utils/MD5.h" @@ -74,7 +75,7 @@ void NearestLSMWithLowestIndex::operator()(size_t ip, const Point3& point, ASSERT(choice.index() < imask_.size()); size_t jp = choice.index(); - triplets.assign(1, WeightMatrix::Triplet(ip, jp, 1.)); + triplets.assign(1, {ip, jp, 1.}); } @@ -84,6 +85,13 @@ bool NearestLSMWithLowestIndex::sameAs(const DistanceWeighting& other) const { } +void NearestLSMWithLowestIndex::json(eckit::JSON& j) const { + j.startObject(); + j << "type" << "nearest-lsm-with-lowest-index"; + j.endObject(); +} + + void NearestLSMWithLowestIndex::print(std::ostream& out) const { out << "NearestLSMWithLowestIndex[]"; } diff --git a/src/mir/method/knn/distance/NearestLSMWithLowestIndex.h b/src/mir/method/knn/distance/NearestLSMWithLowestIndex.h index 00141ccf8..12f8d8eea 100644 --- a/src/mir/method/knn/distance/NearestLSMWithLowestIndex.h +++ b/src/mir/method/knn/distance/NearestLSMWithLowestIndex.h @@ -31,11 +31,13 @@ struct NearestLSMWithLowestIndex : DistanceWeightingWithLSM { std::vector& triplets) const override; private: - const std::vector& imask_; - const std::vector& omask_; bool sameAs(const DistanceWeighting&) const override; + void json(eckit::JSON&) const override; void print(std::ostream&) const override; void hash(eckit::MD5&) const override; + + const std::vector& imask_; + const std::vector& omask_; }; diff --git a/src/mir/method/knn/distance/NearestNeighbour.cc b/src/mir/method/knn/distance/NearestNeighbour.cc index 161fa0247..f7d06dec1 100644 --- a/src/mir/method/knn/distance/NearestNeighbour.cc +++ b/src/mir/method/knn/distance/NearestNeighbour.cc @@ -14,6 +14,7 @@ #include +#include "eckit/log/JSON.h" #include "eckit/utils/MD5.h" #include "mir/util/Exceptions.h" @@ -30,7 +31,7 @@ void NearestNeighbour::operator()(size_t ip, const Point3& /*point*/, std::vector& triplets) const { ASSERT(!neighbours.empty()); - triplets.assign(1, WeightMatrix::Triplet(ip, neighbours.front().payload(), 1.)); + triplets.assign(1, {ip, neighbours.front().payload(), 1.}); } @@ -40,6 +41,13 @@ bool NearestNeighbour::sameAs(const DistanceWeighting& other) const { } +void NearestNeighbour::json(eckit::JSON& j) const { + j.startObject(); + j << "type" << "nearest-neighbour"; + j.endObject(); +} + + void NearestNeighbour::print(std::ostream& out) const { out << "NearestNeighbour[]"; } diff --git a/src/mir/method/knn/distance/NearestNeighbour.h b/src/mir/method/knn/distance/NearestNeighbour.h index 4ccce4952..ae12560cc 100644 --- a/src/mir/method/knn/distance/NearestNeighbour.h +++ b/src/mir/method/knn/distance/NearestNeighbour.h @@ -25,6 +25,7 @@ struct NearestNeighbour : DistanceWeighting { private: bool sameAs(const DistanceWeighting&) const override; + void json(eckit::JSON&) const override; void print(std::ostream&) const override; void hash(eckit::MD5&) const override; }; diff --git a/src/mir/method/knn/distance/NoDistanceWeighting.cc b/src/mir/method/knn/distance/NoDistanceWeighting.cc index b69964a00..0c0b8eee1 100644 --- a/src/mir/method/knn/distance/NoDistanceWeighting.cc +++ b/src/mir/method/knn/distance/NoDistanceWeighting.cc @@ -14,6 +14,7 @@ #include +#include "eckit/log/JSON.h" #include "eckit/utils/MD5.h" #include "mir/util/Exceptions.h" @@ -34,9 +35,9 @@ void NoDistanceWeighting::operator()(size_t ip, const Point3& /*point*/, triplets.reserve(neighbours.size()); // average neighbour points - auto weight = 1. / double(neighbours.size()); + auto weight = 1. / static_cast(neighbours.size()); for (const auto& n : neighbours) { - triplets.emplace_back(WeightMatrix::Triplet(ip, n.payload(), weight)); + triplets.emplace_back(ip, n.payload(), weight); } } @@ -47,6 +48,13 @@ bool NoDistanceWeighting::sameAs(const DistanceWeighting& other) const { } +void NoDistanceWeighting::json(eckit::JSON& j) const { + j.startObject(); + j << "type" << "no"; + j.endObject(); +} + + void NoDistanceWeighting::print(std::ostream& out) const { out << "NoDistanceWeighting[]"; } diff --git a/src/mir/method/knn/distance/NoDistanceWeighting.h b/src/mir/method/knn/distance/NoDistanceWeighting.h index dff82ba3f..6f7530157 100644 --- a/src/mir/method/knn/distance/NoDistanceWeighting.h +++ b/src/mir/method/knn/distance/NoDistanceWeighting.h @@ -25,6 +25,7 @@ struct NoDistanceWeighting : DistanceWeighting { private: bool sameAs(const DistanceWeighting&) const override; + void json(eckit::JSON&) const override; void print(std::ostream&) const override; void hash(eckit::MD5&) const override; }; diff --git a/src/mir/method/knn/distance/PseudoLaplace.cc b/src/mir/method/knn/distance/PseudoLaplace.cc index 0cb6b2a44..270e1935c 100644 --- a/src/mir/method/knn/distance/PseudoLaplace.cc +++ b/src/mir/method/knn/distance/PseudoLaplace.cc @@ -14,6 +14,8 @@ #include +#include "eckit/log/JSON.h" + #include "eckit/types/FloatCompare.h" #include "eckit/utils/MD5.h" @@ -105,6 +107,13 @@ bool PseudoLaplace::sameAs(const DistanceWeighting& other) const { } +void PseudoLaplace::json(eckit::JSON& j) const { + j.startObject(); + j << "type" << "pseudo-laplace"; + j.endObject(); +} + + void PseudoLaplace::print(std::ostream& out) const { out << "PseudoLaplace[]"; } diff --git a/src/mir/method/knn/distance/PseudoLaplace.h b/src/mir/method/knn/distance/PseudoLaplace.h index 6ab316c92..b8343cc7a 100644 --- a/src/mir/method/knn/distance/PseudoLaplace.h +++ b/src/mir/method/knn/distance/PseudoLaplace.h @@ -25,6 +25,7 @@ struct PseudoLaplace : DistanceWeighting { private: bool sameAs(const DistanceWeighting&) const override; + void json(eckit::JSON&) const override; void print(std::ostream&) const override; void hash(eckit::MD5&) const override; }; From 806d4c74a5e6d0ae92f5d9b06925374fbdadbc9d Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Thu, 29 Feb 2024 18:06:34 +0000 Subject: [PATCH 36/69] MIR-646 earthkit-regrid support with interpolationspec --- src/mir/stats/Field.cc | 13 +++++++++++++ src/mir/stats/Field.h | 17 ++++++++++++++++- src/mir/stats/field/CentralMomentStats.cc | 10 +++++++++- src/mir/stats/field/CentralMomentStats.h | 4 +++- src/mir/stats/field/CounterStats.cc | 7 +++++++ src/mir/stats/field/CounterStats.h | 5 +++-- src/mir/stats/field/ModeStats.cc | 6 ++++++ src/mir/stats/field/ModeStats.h | 5 +++-- 8 files changed, 60 insertions(+), 7 deletions(-) diff --git a/src/mir/stats/Field.cc b/src/mir/stats/Field.cc index 43a6c7cda..7e553a079 100644 --- a/src/mir/stats/Field.cc +++ b/src/mir/stats/Field.cc @@ -12,9 +12,12 @@ #include "mir/stats/Field.h" +#include #include #include +#include "eckit/log/JSON.h" + #include "mir/util/Exceptions.h" #include "mir/util/Log.h" #include "mir/util/Mutex.h" @@ -35,6 +38,16 @@ static void init() { Field::Field(const param::MIRParametrisation& /*unused*/) {} +void Field::json_tv(eckit::JSON& j, const std::string& type, double value) { + j.startObject(); + j << "type" << type; + if (!std::isnan(value)) { + j << "value" << value; + } + j.endObject(); +} + + Field::~Field() = default; diff --git a/src/mir/stats/Field.h b/src/mir/stats/Field.h index 570fa842c..ecce61dec 100644 --- a/src/mir/stats/Field.h +++ b/src/mir/stats/Field.h @@ -16,6 +16,10 @@ #include +namespace eckit { +class JSON; +} + namespace mir::param { class MIRParametrisation; } // namespace mir::param @@ -31,8 +35,10 @@ class Field { // -- Constructors - Field(const param::MIRParametrisation&); + explicit Field(const param::MIRParametrisation&); + Field(const Field&) = delete; + Field(Field&&) = delete; // -- Destructor @@ -44,6 +50,7 @@ class Field { // -- Operators void operator=(const Field&) = delete; + void operator=(Field&&) = delete; // -- Methods @@ -66,8 +73,11 @@ class Field { // -- Methods + virtual void json(eckit::JSON&) const = 0; virtual void print(std::ostream&) const = 0; + static void json_tv(eckit::JSON&, const std::string& type, double value); + // -- Overridden methods // None @@ -99,6 +109,11 @@ class Field { r.print(out); return out; } + + friend eckit::JSON& operator<<(eckit::JSON& out, const Field& r) { + r.json(out); + return out; + } }; diff --git a/src/mir/stats/field/CentralMomentStats.cc b/src/mir/stats/field/CentralMomentStats.cc index 5c218951f..230941a6b 100644 --- a/src/mir/stats/field/CentralMomentStats.cc +++ b/src/mir/stats/field/CentralMomentStats.cc @@ -13,6 +13,8 @@ #include +#include "eckit/log/JSON.h" + #include "mir/stats/Field.h" #include "mir/stats/detail/CentralMomentsT.h" @@ -23,6 +25,7 @@ namespace mir::stats::field { struct Mean final : CentralMomentStatsT> { using CentralMomentStatsT::CentralMomentStatsT; double value() const override { return mean(); } + void json(eckit::JSON& j) const override { json_tv(j, "mean", value()); } void print(std::ostream& out) const override { out << "Mean[]"; } }; @@ -30,6 +33,7 @@ struct Mean final : CentralMomentStatsT> { struct Variance final : CentralMomentStatsT> { using CentralMomentStatsT::CentralMomentStatsT; double value() const override { return variance(); } + void json(eckit::JSON& j) const override { json_tv(j, "variance", value()); } void print(std::ostream& out) const override { out << "Variance[]"; } }; @@ -37,6 +41,7 @@ struct Variance final : CentralMomentStatsT> { struct Skewness final : CentralMomentStatsT> { using CentralMomentStatsT::CentralMomentStatsT; double value() const override { return skewness(); } + void json(eckit::JSON& j) const override { json_tv(j, "skewness", value()); } void print(std::ostream& out) const override { out << "Skewness[]"; } }; @@ -44,6 +49,7 @@ struct Skewness final : CentralMomentStatsT> { struct Kurtosis final : CentralMomentStatsT> { using CentralMomentStatsT::CentralMomentStatsT; double value() const override { return kurtosis(); } + void json(eckit::JSON& j) const override { json_tv(j, "kurtosis", value()); } void print(std::ostream& out) const override { out << "Kurtosis[]"; } }; @@ -51,13 +57,15 @@ struct Kurtosis final : CentralMomentStatsT> { struct StandardDeviation final : CentralMomentStatsT> { using CentralMomentStatsT::CentralMomentStatsT; double value() const override { return standardDeviation(); } + void json(eckit::JSON& j) const override { json_tv(j, "stddev", value()); } void print(std::ostream& out) const override { out << "StandardDeviation[]"; } }; struct Sum final : CentralMomentStatsT> { using CentralMomentStatsT::CentralMomentStatsT; - double value() const override { return mean() * double(Counter::count()); } + double value() const override { return mean() * static_cast(Counter::count()); } + void json(eckit::JSON& j) const override { json_tv(j, "sum", value()); } void print(std::ostream& out) const override { out << "Sum[]"; } }; diff --git a/src/mir/stats/field/CentralMomentStats.h b/src/mir/stats/field/CentralMomentStats.h index fbd23647f..c8160a9e1 100644 --- a/src/mir/stats/field/CentralMomentStats.h +++ b/src/mir/stats/field/CentralMomentStats.h @@ -25,7 +25,9 @@ struct CentralMomentStatsT : detail::Counter, Field, STATS { CentralMomentStatsT(const param::MIRParametrisation& param) : Counter(param), Field(param) {} ~CentralMomentStatsT() override = default; - virtual double value() const override = 0; + double value() const override = 0; + void json(eckit::JSON&) const override = 0; + void print(std::ostream&) const override = 0; void count(const double& value) override { if (Counter::count(value)) { diff --git a/src/mir/stats/field/CounterStats.cc b/src/mir/stats/field/CounterStats.cc index 8e16000aa..a15ba8011 100644 --- a/src/mir/stats/field/CounterStats.cc +++ b/src/mir/stats/field/CounterStats.cc @@ -14,6 +14,8 @@ #include +#include "eckit/log/JSON.h" + namespace mir::stats::field { @@ -21,6 +23,7 @@ namespace mir::stats::field { struct Count final : CounterStats { using CounterStats::CounterStats; double value() const override { return double(Counter::count() - Counter::missing()); } + void json(eckit::JSON& j) const override { json_tv(j, "count", value()); } void print(std::ostream& out) const override { out << "Count[" << value() << "]"; } }; @@ -28,6 +31,7 @@ struct Count final : CounterStats { struct CountAboveUpperLimit final : CounterStats { using CounterStats::CounterStats; double value() const override { return double(countAboveUpperLimit()); } + void json(eckit::JSON& j) const override { json_tv(j, "count-above-upper-limit", value()); } void print(std::ostream& out) const override { out << "CountAboveUpperLimit[" << value() << "]"; } }; @@ -35,6 +39,7 @@ struct CountAboveUpperLimit final : CounterStats { struct CountBelowLowerLimit final : CounterStats { using CounterStats::CounterStats; double value() const override { return double(countBelowLowerLimit()); } + void json(eckit::JSON& j) const override { json_tv(j, "count-below-upper-limit", value()); } void print(std::ostream& out) const override { out << "CountBelowLowerLimit[" << value() << "]"; } }; @@ -42,6 +47,7 @@ struct CountBelowLowerLimit final : CounterStats { struct Maximum final : CounterStats { using CounterStats::CounterStats; double value() const override { return max(); } + void json(eckit::JSON& j) const override { json_tv(j, "maximum", value()); } void print(std::ostream& out) const override { out << "Maximum[" << value() << "]"; } }; @@ -49,6 +55,7 @@ struct Maximum final : CounterStats { struct Minimum final : CounterStats { using CounterStats::CounterStats; double value() const override { return min(); } + void json(eckit::JSON& j) const override { json_tv(j, "minimum", value()); } void print(std::ostream& out) const override { out << "Minimum[" << value() << "]"; } }; diff --git a/src/mir/stats/field/CounterStats.h b/src/mir/stats/field/CounterStats.h index b7476626c..9c01e2a5d 100644 --- a/src/mir/stats/field/CounterStats.h +++ b/src/mir/stats/field/CounterStats.h @@ -23,8 +23,9 @@ namespace mir::stats::field { struct CounterStats : detail::Counter, Field { CounterStats(const param::MIRParametrisation& param) : Counter(param), Field(param) {} - virtual double value() const override = 0; - virtual void print(std::ostream&) const override = 0; + double value() const override = 0; + void json(eckit::JSON&) const override = 0; + void print(std::ostream&) const override = 0; void count(const double& value) override { Counter::count(value); } void reset(double missingValue, bool hasMissing) override { Counter::reset(missingValue, hasMissing); } diff --git a/src/mir/stats/field/ModeStats.cc b/src/mir/stats/field/ModeStats.cc index 37c796708..94c678df9 100644 --- a/src/mir/stats/field/ModeStats.cc +++ b/src/mir/stats/field/ModeStats.cc @@ -14,6 +14,8 @@ #include +#include "eckit/log/JSON.h" + #include "mir/stats/detail/ModeT.h" @@ -23,6 +25,7 @@ namespace mir::stats::field { struct ModeReal final : ModeStatsT { using ModeStatsT::ModeStatsT; double value() const override { return mode(); } + void json(eckit::JSON& j) const override { json_tv(j, "mode-real", value()); } void print(std::ostream& out) const override { out << "ModeReal[" << value() << "]"; } }; @@ -30,6 +33,7 @@ struct ModeReal final : ModeStatsT { struct ModeIntegral final : ModeStatsT { using ModeStatsT::ModeStatsT; double value() const override { return mode(); } + void json(eckit::JSON& j) const override { json_tv(j, "mode-integral", value()); } void print(std::ostream& out) const override { out << "ModeIntegral[" << value() << "]"; } }; @@ -37,6 +41,7 @@ struct ModeIntegral final : ModeStatsT { struct ModeBoolean final : ModeStatsT { using ModeStatsT::ModeStatsT; double value() const override { return mode(); } + void json(eckit::JSON& j) const override { json_tv(j, "mode-boolean", value()); } void print(std::ostream& out) const override { out << "ModeBoolean[" << value() << "]"; } }; @@ -44,6 +49,7 @@ struct ModeBoolean final : ModeStatsT { struct MedianIntegral final : ModeStatsT { using ModeStatsT::ModeStatsT; double value() const override { return median(); } + void json(eckit::JSON& j) const override { json_tv(j, "median-integral", value()); } void print(std::ostream& out) const override { out << "MedianIntegral[" << value() << "]"; } }; diff --git a/src/mir/stats/field/ModeStats.h b/src/mir/stats/field/ModeStats.h index a23608ae2..2a5aab012 100644 --- a/src/mir/stats/field/ModeStats.h +++ b/src/mir/stats/field/ModeStats.h @@ -24,8 +24,9 @@ template struct ModeStatsT : detail::Counter, Field, STATS { ModeStatsT(const param::MIRParametrisation& param) : Counter(param), Field(param), STATS(param) {} - virtual double value() const override = 0; - virtual void print(std::ostream&) const override = 0; + double value() const override = 0; + void json(eckit::JSON&) const override = 0; + void print(std::ostream&) const override = 0; void count(const double& value) override { if (Counter::count(value)) { From 2f23c9c56a4250b989943f06abf4e73680fd1248 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Fri, 1 Mar 2024 07:07:40 +0000 Subject: [PATCH 37/69] MIR-647 earthkit-regrid support for linear interpolation from HEALPix orderingConvention=nested --- src/mir/CMakeLists.txt | 10 +- src/mir/reorder/HEALPix.cc | 75 +++++++++++++ src/mir/reorder/HEALPix.h | 65 ++++++++++++ src/mir/reorder/Identity.cc | 38 +++++++ src/mir/reorder/Identity.h | 38 +++++++ src/mir/reorder/Reorder.cc | 84 +++++++++++++++ src/mir/reorder/Reorder.h | 68 ++++++++++++ src/tools/mir-matrix-reorder.cc | 180 +++----------------------------- 8 files changed, 388 insertions(+), 170 deletions(-) create mode 100644 src/mir/reorder/HEALPix.cc create mode 100644 src/mir/reorder/HEALPix.h create mode 100644 src/mir/reorder/Identity.cc create mode 100644 src/mir/reorder/Identity.h create mode 100644 src/mir/reorder/Reorder.cc create mode 100644 src/mir/reorder/Reorder.h diff --git a/src/mir/CMakeLists.txt b/src/mir/CMakeLists.txt index c4d1353a1..f13d1ac7e 100644 --- a/src/mir/CMakeLists.txt +++ b/src/mir/CMakeLists.txt @@ -218,10 +218,10 @@ list(APPEND mir_srcs data/space/SpaceLogarithmic.h grib/BasicAngle.cc grib/BasicAngle.h - grib/Packing.cc - grib/Packing.h grib/Config.cc grib/Config.h + grib/Packing.cc + grib/Packing.h input/ArtificialInput.cc input/ArtificialInput.h input/ConstantInput.cc @@ -487,6 +487,10 @@ list(APPEND mir_srcs param/SameParametrisation.h param/SimpleParametrisation.cc param/SimpleParametrisation.h + reorder/Identity.cc + reorder/Identity.h + reorder/Reorder.cc + reorder/Reorder.h repres/Gridded.cc repres/Gridded.h repres/Iterator.cc @@ -800,6 +804,8 @@ if(mir_HAVE_ATLAS) method/structured/StructuredMethod.h output/GmshOutput.cc output/GmshOutput.h + reorder/HEALPix.cc + reorder/HEALPix.h repres/proxy/HEALPix.cc repres/proxy/HEALPix.h repres/proxy/ORCA.cc diff --git a/src/mir/reorder/HEALPix.cc b/src/mir/reorder/HEALPix.cc new file mode 100644 index 000000000..9abd4c129 --- /dev/null +++ b/src/mir/reorder/HEALPix.cc @@ -0,0 +1,75 @@ +/* + * (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 +#include + +#include "mir/reorder/Reorder.h" +#include "mir/repres/proxy/HEALPix.h" +#include "mir/util/Exceptions.h" + + +namespace mir::reorder { + + +struct HEALPix : Reorder { + explicit HEALPix(size_t N) : + N_(N), + Nside_([N] { + auto Nside = static_cast(std::sqrt(static_cast(N) / 12.)); + ASSERT_MSG(12 * Nside * Nside == N, "Expected N = 12 * Nside ** 2, got N=" + std::to_string(N)); + return Nside; + }()), + healpix_(static_cast(Nside_)) {} + + size_t N() const { return N_; } + size_t Nside() const { return Nside_; } + const repres::proxy::HEALPix::Reorder& healpix() const { return healpix_; } + +private: + const size_t N_; + const size_t Nside_; + const repres::proxy::HEALPix::Reorder healpix_; +}; + + +struct HEALPixRingToNested final : HEALPix { + using HEALPix::HEALPix; + + Renumber reorder() const override { + Renumber map(N()); + for (size_t i = 0; i < N(); ++i) { + map[i] = static_cast(healpix().ring_to_nest(static_cast(i))); + } + return map; + } +}; + + +struct HEALPixNestedToRing final : HEALPix { + using HEALPix::HEALPix; + + Renumber reorder() const override { + Renumber map(N()); + for (size_t i = 0; i < N(); ++i) { + map[i] = static_cast(healpix().nest_to_ring(static_cast(i))); + } + return map; + } +}; + + +static const ReorderBuilder __reorder1("healpix-ring-to-nested"); +static const ReorderBuilder __reorder2("healpix-nested-to-ring"); + + +} // namespace mir::reorder diff --git a/src/mir/reorder/HEALPix.h b/src/mir/reorder/HEALPix.h new file mode 100644 index 000000000..a252244c3 --- /dev/null +++ b/src/mir/reorder/HEALPix.h @@ -0,0 +1,65 @@ +/* + * (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/reorder/Reorder.h" + + +namespace mir::reorder { + + +class HEALPixReorder : public Reorder { +public: + explicit HEALPixReorder(size_t N); + + size_t N() const { return Npix_; } + size_t Nside() const { return Nside_; } + + int nest_to_ring(int n) const; + int ring_to_nest(int r) const; + +private: + const int Nside_; // up to 2^13 + const int Npix_; + const int Ncap_; + const int k_; +}; + + +class HEALPixRingToNested final : public HEALPixReorder { +public: + using HEALPixReorder::HEALPixReorder; + + Renumber reorder() const override { + Renumber map(N()); + for (size_t i = 0; i < N(); ++i) { + map[i] = static_cast(ring_to_nest(static_cast(i))); + } + return map; + } +}; + + +class HEALPixNestedToRing final : public HEALPixReorder { +public: + using HEALPixReorder::HEALPixReorder; + + Renumber reorder() const override { + Renumber map(N()); + for (size_t i = 0; i < N(); ++i) { + map[i] = static_cast(nest_to_ring(static_cast(i))); + } + return map; + } +}; + + +} // namespace mir::reorder diff --git a/src/mir/reorder/Identity.cc b/src/mir/reorder/Identity.cc new file mode 100644 index 000000000..a008e5b9b --- /dev/null +++ b/src/mir/reorder/Identity.cc @@ -0,0 +1,38 @@ +/* + * (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/reorder/Reorder.h" + +#include + + +namespace mir::reorder { + + +struct Identity final : Reorder { + explicit Identity(size_t N) : N_(N) {} + +private: + Renumber reorder() const override { + Renumber renumber(N_); + std::iota(renumber.begin(), renumber.end(), 0); + return renumber; + } + + const size_t N_; +}; + + +static const ReorderBuilder __reorder("identity"); + + +} // namespace mir::reorder diff --git a/src/mir/reorder/Identity.h b/src/mir/reorder/Identity.h new file mode 100644 index 000000000..a008e5b9b --- /dev/null +++ b/src/mir/reorder/Identity.h @@ -0,0 +1,38 @@ +/* + * (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/reorder/Reorder.h" + +#include + + +namespace mir::reorder { + + +struct Identity final : Reorder { + explicit Identity(size_t N) : N_(N) {} + +private: + Renumber reorder() const override { + Renumber renumber(N_); + std::iota(renumber.begin(), renumber.end(), 0); + return renumber; + } + + const size_t N_; +}; + + +static const ReorderBuilder __reorder("identity"); + + +} // namespace mir::reorder diff --git a/src/mir/reorder/Reorder.cc b/src/mir/reorder/Reorder.cc new file mode 100644 index 000000000..ac536119f --- /dev/null +++ b/src/mir/reorder/Reorder.cc @@ -0,0 +1,84 @@ +/* + * (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/reorder/Reorder.h" + +#include +#include + +#include "mir/util/Exceptions.h" +#include "mir/util/Log.h" +#include "mir/util/Mutex.h" + + +namespace mir::reorder { + + +static util::once_flag ONCE; +static util::recursive_mutex* MUTEX = nullptr; + +static std::map* M = nullptr; + + +static void init() { + MUTEX = new util::recursive_mutex(); + M = new std::map(); +} + + +ReorderFactory::ReorderFactory(const std::string& name) : name_(name) { + util::call_once(ONCE, init); + util::lock_guard lock(*MUTEX); + + if (M->find(name) == M->end()) { + (*M)[name] = this; + return; + } + + throw exception::SeriousBug("ReorderFactory: duplicated Reorder '" + name + "'"); +} + + +ReorderFactory::~ReorderFactory() { + util::lock_guard lock(*MUTEX); + M->erase(name_); +} + + +Reorder* ReorderFactory::build(const std::string& name, size_t N) { + util::call_once(ONCE, init); + util::lock_guard lock(*MUTEX); + + if (auto j = M->find(name); j != M->end()) { + return j->second->make(N); + } + + list(Log::error() << "ReorderFactory: unknown '" << name << "', choices are:\n") << std::endl; + throw exception::SeriousBug("ReorderFactory: unknown '" + name + "'"); +} + + +std::ostream& ReorderFactory::list(std::ostream& out) { + util::call_once(ONCE, init); + util::lock_guard lock(*MUTEX); + + const auto* sep = ""; + for (const auto& j : *M) { + out << sep << j.first; + sep = ", "; + } + + return out; +} + + +} // namespace mir::reorder diff --git a/src/mir/reorder/Reorder.h b/src/mir/reorder/Reorder.h new file mode 100644 index 000000000..ed16c3bab --- /dev/null +++ b/src/mir/reorder/Reorder.h @@ -0,0 +1,68 @@ +/* + * (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 +#include +#include + + +namespace mir::reorder { + + +using Renumber = std::vector; + + +struct Reorder { + Reorder() = default; + + virtual ~Reorder() = default; + + virtual Renumber reorder() const = 0; + + Reorder(const Reorder&) = delete; + Reorder(Reorder&&) = delete; + Reorder& operator=(const Reorder&) = delete; + Reorder& operator=(Reorder&&) = delete; +}; + + +class ReorderFactory { +private: + std::string name_; + virtual Reorder* make(size_t N) = 0; + +protected: + explicit ReorderFactory(const std::string& name); + + virtual ~ReorderFactory(); + +public: + ReorderFactory(const ReorderFactory&) = delete; + ReorderFactory(ReorderFactory&&) = delete; + ReorderFactory& operator=(const ReorderFactory&) = delete; + ReorderFactory& operator=(ReorderFactory&&) = delete; + + static Reorder* build(const std::string& name, size_t N); + static std::ostream& list(std::ostream& out); +}; + + +template +class ReorderBuilder : public ReorderFactory { + Reorder* make(size_t N) override { return new T(N); } + +public: + explicit ReorderBuilder(const std::string& name) : ReorderFactory(name) {} +}; + + +} // namespace mir::reorder diff --git a/src/tools/mir-matrix-reorder.cc b/src/tools/mir-matrix-reorder.cc index 079e1cabd..6b0efde2f 100644 --- a/src/tools/mir-matrix-reorder.cc +++ b/src/tools/mir-matrix-reorder.cc @@ -12,7 +12,7 @@ #include #include -#include +#include #include #include "eckit/linalg/SparseMatrix.h" @@ -21,184 +21,26 @@ #include "eckit/option/FactoryOption.h" #include "eckit/option/SimpleOption.h" +#include "mir/reorder/Reorder.h" #include "mir/repres/Representation.h" -#include "mir/repres/proxy/HEALPix.h" #include "mir/tools/MIRTool.h" #include "mir/util/Exceptions.h" #include "mir/util/Log.h" -#include "mir/util/Mutex.h" namespace mir::tools { -using Renumber = std::vector; - -static util::once_flag ONCE; -static util::recursive_mutex* MUTEX = nullptr; - -class ReorderFactory; -static std::map* M = nullptr; - - -static void init() { - MUTEX = new util::recursive_mutex(); - M = new std::map(); -} - - -struct Reorder { - Reorder() = default; - - virtual ~Reorder() = default; - - virtual Renumber reorder() = 0; - - Reorder(const Reorder&) = delete; - Reorder(Reorder&&) = delete; - Reorder& operator=(const Reorder&) = delete; - Reorder& operator=(Reorder&&) = delete; -}; - - -class ReorderFactory { -private: - std::string name_; - virtual Reorder* make(size_t N) = 0; - -protected: - explicit ReorderFactory(const std::string& name) : name_(name) { - util::call_once(ONCE, init); - util::lock_guard lock(*MUTEX); - - if (M->find(name) == M->end()) { - (*M)[name] = this; - return; - } - - throw exception::SeriousBug("ReorderFactory: duplicated Reorder '" + name + "'"); - } - - virtual ~ReorderFactory() { - util::lock_guard lock(*MUTEX); - M->erase(name_); - } - -public: - ReorderFactory(const ReorderFactory&) = delete; - ReorderFactory(ReorderFactory&&) = delete; - ReorderFactory& operator=(const ReorderFactory&) = delete; - ReorderFactory& operator=(ReorderFactory&&) = delete; - - static Reorder* build(const std::string& name, size_t N) { - util::call_once(ONCE, init); - util::lock_guard lock(*MUTEX); - - if (auto j = M->find(name); j != M->end()) { - return j->second->make(N); - } - - list(Log::error() << "ReorderFactory: unknown '" << name << "', choices are:\n") << std::endl; - throw exception::SeriousBug("ReorderFactory: unknown '" + name + "'"); - } - - static std::ostream& list(std::ostream& out) { - util::call_once(ONCE, init); - util::lock_guard lock(*MUTEX); - - const auto* sep = ""; - for (const auto& j : *M) { - out << sep << j.first; - sep = ", "; - } - - return out; - } -}; - - -template -class ReorderBuilder : public ReorderFactory { - Reorder* make(size_t N) override { return new T(N); } - -public: - explicit ReorderBuilder(const std::string& name) : ReorderFactory(name) {} -}; - - -struct Identity final : Reorder { - explicit Identity(size_t N) : N_(N) {} - -private: - Renumber reorder() override { - Renumber renumber(N_); - std::iota(renumber.begin(), renumber.end(), 0); - return renumber; - } - - const size_t N_; -}; - - -struct HEALPix : Reorder { - explicit HEALPix(size_t N) : - N_(N), - Nside_([N] { - auto Nside = static_cast(std::sqrt(static_cast(N) / 12.)); - ASSERT_MSG(12 * Nside * Nside == N, "Expected N = 12 * Nside ** 2, got N=" + std::to_string(N)); - return Nside; - }()), - healpix_(static_cast(Nside_)) {} - - size_t N() const { return N_; } - size_t Nside() const { return Nside_; } - const repres::proxy::HEALPix::Reorder& healpix() const { return healpix_; } - -private: - const size_t N_; - const size_t Nside_; - const repres::proxy::HEALPix::Reorder healpix_; -}; - - -struct HEALPixRingToNested final : HEALPix { - explicit HEALPixRingToNested(size_t N) : HEALPix(N) {} - Renumber reorder() override { - Renumber map(N()); - for (size_t i = 0; i < N(); ++i) { - map[i] = static_cast(healpix().ring_to_nest(static_cast(i))); - } - return map; - } -}; - - -struct HEALPixNestedToRing final : HEALPix { - explicit HEALPixNestedToRing(size_t N) : HEALPix(N) {} - Renumber reorder() override { - Renumber map(N()); - for (size_t i = 0; i < N(); ++i) { - map[i] = static_cast(healpix().nest_to_ring(static_cast(i))); - } - return map; - } -}; - - -static const std::string IDENTITY = "identity"; - -static const ReorderBuilder __reorder1(IDENTITY); -static const ReorderBuilder __reorder2("healpix-ring-to-nested"); -static const ReorderBuilder __reorder3("healpix-nested-to-ring"); +using Reorder = reorder::Reorder; struct MIRMatrixReorder : MIRTool { MIRMatrixReorder(int argc, char** argv) : MIRTool(argc, argv) { - using eckit::option::FactoryOption; - using eckit::option::SimpleOption; - options_.push_back(new FactoryOption("reorder-rows", "Reordering rows method", IDENTITY)); - options_.push_back(new FactoryOption("reorder-cols", "Reordering columns method", IDENTITY)); - options_.push_back(new SimpleOption("transpose", "Transpose matrix", false)); + options_.push_back(new eckit::option::FactoryOption( + "reorder-rows", "Reordering rows method", "identity")); + options_.push_back(new eckit::option::FactoryOption( + "reorder-cols", "Reordering columns method", "identity")); + options_.push_back(new eckit::option::SimpleOption("transpose", "Transpose matrix", false)); } int numberOfPositionalArguments() const override { return 2; } @@ -225,10 +67,12 @@ void MIRMatrixReorder::execute(const eckit::option::CmdArgs& args) { // renumbering maps - auto rows = std::unique_ptr(ReorderFactory::build(args.getString("reorder-rows"), M.rows()))->reorder(); + auto rows = + std::unique_ptr(reorder::ReorderFactory::build(args.getString("reorder-rows"), M.rows()))->reorder(); ASSERT(rows.size() == M.rows()); - auto cols = std::unique_ptr(ReorderFactory::build(args.getString("reorder-cols"), M.cols()))->reorder(); + auto cols = + std::unique_ptr(reorder::ReorderFactory::build(args.getString("reorder-cols"), M.cols()))->reorder(); ASSERT(cols.size() == M.cols()); From eeef003323707c62d3d36c96ef0060d0accb03be Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Fri, 1 Mar 2024 12:17:21 +0000 Subject: [PATCH 38/69] MIR-647 earthkit-regrid support for linear interpolation from HEALPix orderingConvention=nested --- src/mir/reorder/HEALPix.cc | 228 ++++++++++++++++---- src/mir/reorder/HEALPix.h | 31 +-- src/mir/reorder/Identity.cc | 19 +- src/mir/reorder/Identity.h | 14 +- src/mir/repres/proxy/HEALPix.cc | 179 --------------- src/mir/repres/proxy/HEALPix.h | 22 -- src/mir/repres/unsupported/HEALPixNested.cc | 13 +- 7 files changed, 216 insertions(+), 290 deletions(-) diff --git a/src/mir/reorder/HEALPix.cc b/src/mir/reorder/HEALPix.cc index 9abd4c129..162948a3f 100644 --- a/src/mir/reorder/HEALPix.cc +++ b/src/mir/reorder/HEALPix.cc @@ -10,62 +10,216 @@ */ +#include "mir/reorder/HEALPix.h" + +#include #include #include +#include -#include "mir/reorder/Reorder.h" -#include "mir/repres/proxy/HEALPix.h" #include "mir/util/Exceptions.h" namespace mir::reorder { -struct HEALPix : Reorder { - explicit HEALPix(size_t N) : - N_(N), - Nside_([N] { - auto Nside = static_cast(std::sqrt(static_cast(N) / 12.)); - ASSERT_MSG(12 * Nside * Nside == N, "Expected N = 12 * Nside ** 2, got N=" + std::to_string(N)); - return Nside; - }()), - healpix_(static_cast(Nside_)) {} - - size_t N() const { return N_; } - size_t Nside() const { return Nside_; } - const repres::proxy::HEALPix::Reorder& healpix() const { return healpix_; } - -private: - const size_t N_; - const size_t Nside_; - const repres::proxy::HEALPix::Reorder healpix_; -}; +namespace { -struct HEALPixRingToNested final : HEALPix { - using HEALPix::HEALPix; +struct CodecFijNest { + static constexpr uint64_t __masks[] = {0x00000000ffffffff, 0x0000ffff0000ffff, 0x00ff00ff00ff00ff, + 0x0f0f0f0f0f0f0f0f, 0x3333333333333333, 0x5555555555555555}; - Renumber reorder() const override { - Renumber map(N()); - for (size_t i = 0; i < N(); ++i) { - map[i] = static_cast(healpix().ring_to_nest(static_cast(i))); - } - return map; + inline static int nest_encode_bits(int n) { + auto b = static_cast(n) & __masks[0]; + b = (b ^ (b << 16)) & __masks[1]; + b = (b ^ (b << 8)) & __masks[2]; + b = (b ^ (b << 4)) & __masks[3]; + b = (b ^ (b << 2)) & __masks[4]; + b = (b ^ (b << 1)) & __masks[5]; + return static_cast(b); + } + + inline static int nest_decode_bits(int n) { + auto b = static_cast(n) & __masks[5]; + b = (b ^ (b >> 1)) & __masks[4]; + b = (b ^ (b >> 2)) & __masks[3]; + b = (b ^ (b >> 4)) & __masks[2]; + b = (b ^ (b >> 8)) & __masks[1]; + b = (b ^ (b >> 16)) & __masks[0]; + return static_cast(b); + } + + static std::tuple nest_to_fij(int n, int k) { + ASSERT(0 <= n); + auto f = n >> (2 * k); // f = n / (Nside * Nside) + n &= (1 << (2 * k)) - 1; // n = n % (Nside * Nside) + auto i = nest_decode_bits(n); + auto j = nest_decode_bits(n >> 1); + return {f, i, j}; + } + + static int fij_to_nest(int f, int i, int j, int k) { + return (f << (2 * k)) + nest_encode_bits(i) + (nest_encode_bits(j) << 1); } }; -struct HEALPixNestedToRing final : HEALPix { - using HEALPix::HEALPix; +inline int sqrt(int n) { + return static_cast(std::sqrt(static_cast(n) + 0.5)); +} + + +// for division result within [0; 3] +inline int div_03(int a, int b) { + int t = (a >= (b << 1)) ? 1 : 0; + a -= t * (b << 1); + return (t << 1) + (a >= b ? 1 : 0); +} + + +inline bool is_power_of_2(int n) { + return std::bitset(n).count() == 1; +} + + +inline int pll(int f) { + constexpr int __pll[] = {1, 3, 5, 7, 0, 2, 4, 6, 1, 3, 5, 7}; + return __pll[f]; +} + + +} // namespace + + +HEALPixReorder::HEALPixReorder(size_t N) : + Nside_([N] { + auto Nside = static_cast(std::sqrt(static_cast(N) / 12.)); + ASSERT_MSG(12 * Nside * Nside == N, "Expected N = 12 * Nside ** 2, got N=" + std::to_string(N)); + return Nside; + }()), + Npix_(N), + Ncap_((Nside_ * (Nside_ - 1)) << 1), + k_(is_power_of_2(Nside_) ? static_cast(std::log2(Nside_)) : -1) { + ASSERT(0 <= k_); // (specific to nested ordering) + ASSERT(0 < Nside_); +} + + +int HEALPixReorder::nest_to_ring(int n) const { + auto [f, i, j] = CodecFijNest::nest_to_fij(n, k_); + ASSERT(f < 12 && i < Nside_ && j < Nside_); + + auto to_ring_local = [&](int f, int i, int j, + int Nring, //!< number of pixels in ring + int shift //!< if ring's first pixel is/is not at phi=0 + ) -> int { + Nring >>= 2; + int r = (pll(f) * Nring + i - j + 1 + shift) / 2 - 1; + ASSERT(r < 4 * Nring); + + return r < 0 ? r + 4 * Nside_ : r; + }; + + const int ring = ((f >> 2) + 2) * Nside_ - i - j - 1; // 1-based ring number + if (ring < Nside_) { + // North polar cap + int Nring = 4 * ring; + int r0 = 2 * ring * (ring - 1); // index of first ring pixel (ring numbering) - Renumber reorder() const override { - Renumber map(N()); - for (size_t i = 0; i < N(); ++i) { - map[i] = static_cast(healpix().nest_to_ring(static_cast(i))); + return r0 + to_ring_local(f, i, j, Nring, 0); + } + + if (ring < 3 * Nside_) { + // South polar cap + int Nring = 4 * Nside_; + int r0 = Ncap_ + (ring - Nside_) * Nring; // index of first ring pixel (ring numbering) + int shift = (ring - Nside_) & 1; + + return r0 + to_ring_local(f, i, j, Nring, shift); + } + + // Equatorial belt + int N = 4 * Nside_ - ring; + int Nring = 4 * N; + int r0 = Npix_ - 2 * N * (N + 1); // index of first ring pixel (ring numbering) + + return r0 + to_ring_local(f, i, j, Nring, 0); +} + + +int HEALPixReorder::ring_to_nest(int r) const { + auto to_nest = [&](int f, //!< base pixel index + int ring, //!< 1-based ring number + int Nring, //!< number of pixels in ring + int phi, //!< index in longitude + int shift //!< if ring's first pixel is not at phi=0 + ) -> int { + int r = ((2 + (f >> 2)) << k_) - ring - 1; + int p = 2 * phi - pll(f) * Nring - shift - 1; + if (p >= 2 * Nside_) { + p -= 8 * Nside_; } - return map; + + int i = (r + p) >> 1; + int j = (r - p) >> 1; + + ASSERT(f < 12 && i < Nside_ && j < Nside_); + return CodecFijNest::fij_to_nest(f, i, j, k_); + }; + + if (r < Ncap_) { + // North polar cap + int Nring = (1 + sqrt(2 * r + 1)) >> 1; + int phi = 1 + r - 2 * Nring * (Nring - 1); + int r = Nring; + int f = div_03(phi - 1, Nring); + + return to_nest(f, r, Nring, phi, 0); } -}; + + if (Npix_ - Ncap_ <= r) { + // South polar cap + int Nring = (1 + sqrt(2 * Npix_ - 2 * r - 1)) >> 1; + int phi = 1 + r + 2 * Nring * (Nring - 1) + 4 * Nring - Npix_; + int ring = 4 * Nside_ - Nring; // (from South pole) + int f = div_03(phi - 1, Nring) + 8; + + return to_nest(f, ring, Nring, phi, 0); + } + + // Equatorial belt + int ip = r - Ncap_; + int tmp = ip >> (k_ + 2); + + int Nring = Nside_; + int phi = ip - tmp * 4 * Nside_ + 1; + int ring = tmp + Nside_; + + int ifm = 1 + ((phi - 1 - ((1 + tmp) >> 1)) >> k_); + int ifp = 1 + ((phi - 1 - ((1 - tmp + 2 * Nside_) >> 1)) >> k_); + int f = (ifp == ifm) ? (ifp | 4) : ((ifp < ifm) ? ifp : (ifm + 8)); + + return to_nest(f, ring, Nring, phi, ring & 1); +} + + +Renumber HEALPixRingToNested::reorder() const { + Renumber map(N()); + for (size_t i = 0; i < N(); ++i) { + map[i] = static_cast(ring_to_nest(static_cast(i))); + } + return map; +} + + +Renumber HEALPixNestedToRing::reorder() const { + Renumber map(N()); + for (size_t i = 0; i < N(); ++i) { + map[i] = static_cast(nest_to_ring(static_cast(i))); + } + return map; +} static const ReorderBuilder __reorder1("healpix-ring-to-nested"); diff --git a/src/mir/reorder/HEALPix.h b/src/mir/reorder/HEALPix.h index a252244c3..b092356a6 100644 --- a/src/mir/reorder/HEALPix.h +++ b/src/mir/reorder/HEALPix.h @@ -10,6 +10,8 @@ */ +#pragma once + #include "mir/reorder/Reorder.h" @@ -20,11 +22,12 @@ class HEALPixReorder : public Reorder { public: explicit HEALPixReorder(size_t N); +protected: size_t N() const { return Npix_; } size_t Nside() const { return Nside_; } - int nest_to_ring(int n) const; - int ring_to_nest(int r) const; + int nest_to_ring(int) const; + int ring_to_nest(int) const; private: const int Nside_; // up to 2^13 @@ -34,31 +37,15 @@ class HEALPixReorder : public Reorder { }; -class HEALPixRingToNested final : public HEALPixReorder { -public: +struct HEALPixRingToNested final : HEALPixReorder { using HEALPixReorder::HEALPixReorder; - - Renumber reorder() const override { - Renumber map(N()); - for (size_t i = 0; i < N(); ++i) { - map[i] = static_cast(ring_to_nest(static_cast(i))); - } - return map; - } + Renumber reorder() const override; }; -class HEALPixNestedToRing final : public HEALPixReorder { -public: +struct HEALPixNestedToRing final : HEALPixReorder { using HEALPixReorder::HEALPixReorder; - - Renumber reorder() const override { - Renumber map(N()); - for (size_t i = 0; i < N(); ++i) { - map[i] = static_cast(nest_to_ring(static_cast(i))); - } - return map; - } + Renumber reorder() const override; }; diff --git a/src/mir/reorder/Identity.cc b/src/mir/reorder/Identity.cc index a008e5b9b..6bd088060 100644 --- a/src/mir/reorder/Identity.cc +++ b/src/mir/reorder/Identity.cc @@ -10,7 +10,7 @@ */ -#include "mir/reorder/Reorder.h" +#include "mir/reorder/Identity.h" #include @@ -18,18 +18,11 @@ namespace mir::reorder { -struct Identity final : Reorder { - explicit Identity(size_t N) : N_(N) {} - -private: - Renumber reorder() const override { - Renumber renumber(N_); - std::iota(renumber.begin(), renumber.end(), 0); - return renumber; - } - - const size_t N_; -}; +Renumber Identity::reorder() const { + Renumber renumber(N_); + std::iota(renumber.begin(), renumber.end(), 0); + return renumber; +} static const ReorderBuilder __reorder("identity"); diff --git a/src/mir/reorder/Identity.h b/src/mir/reorder/Identity.h index a008e5b9b..54e2d02f5 100644 --- a/src/mir/reorder/Identity.h +++ b/src/mir/reorder/Identity.h @@ -10,9 +10,9 @@ */ -#include "mir/reorder/Reorder.h" +#pragma once -#include +#include "mir/reorder/Reorder.h" namespace mir::reorder { @@ -22,17 +22,9 @@ struct Identity final : Reorder { explicit Identity(size_t N) : N_(N) {} private: - Renumber reorder() const override { - Renumber renumber(N_); - std::iota(renumber.begin(), renumber.end(), 0); - return renumber; - } - + Renumber reorder() const override; const size_t N_; }; -static const ReorderBuilder __reorder("identity"); - - } // namespace mir::reorder diff --git a/src/mir/repres/proxy/HEALPix.cc b/src/mir/repres/proxy/HEALPix.cc index 394e25974..d086bebde 100644 --- a/src/mir/repres/proxy/HEALPix.cc +++ b/src/mir/repres/proxy/HEALPix.cc @@ -13,10 +13,8 @@ #include "mir/repres/proxy/HEALPix.h" #include -#include #include #include -#include #include "eckit/log/JSON.h" #include "eckit/types/FloatCompare.h" @@ -33,183 +31,6 @@ namespace mir::repres::proxy { -namespace { - - -struct CodecFijNest { - static constexpr uint64_t __masks[] = {0x00000000ffffffff, 0x0000ffff0000ffff, 0x00ff00ff00ff00ff, - 0x0f0f0f0f0f0f0f0f, 0x3333333333333333, 0x5555555555555555}; - - inline static int nest_encode_bits(int n) { - auto b = static_cast(n) & __masks[0]; - b = (b ^ (b << 16)) & __masks[1]; - b = (b ^ (b << 8)) & __masks[2]; - b = (b ^ (b << 4)) & __masks[3]; - b = (b ^ (b << 2)) & __masks[4]; - b = (b ^ (b << 1)) & __masks[5]; - return static_cast(b); - } - - inline static int nest_decode_bits(int n) { - auto b = static_cast(n) & __masks[5]; - b = (b ^ (b >> 1)) & __masks[4]; - b = (b ^ (b >> 2)) & __masks[3]; - b = (b ^ (b >> 4)) & __masks[2]; - b = (b ^ (b >> 8)) & __masks[1]; - b = (b ^ (b >> 16)) & __masks[0]; - return static_cast(b); - } - - static std::tuple nest_to_fij(int n, int k) { - ASSERT(0 <= n); - auto f = n >> (2 * k); // f = n / (Nside * Nside) - n &= (1 << (2 * k)) - 1; // n = n % (Nside * Nside) - auto i = nest_decode_bits(n); - auto j = nest_decode_bits(n >> 1); - return {f, i, j}; - } - - static int fij_to_nest(int f, int i, int j, int k) { - return (f << (2 * k)) + nest_encode_bits(i) + (nest_encode_bits(j) << 1); - } -}; - - -inline int sqrt(int n) { - return static_cast(std::sqrt(static_cast(n) + 0.5)); -} - - -// for division result within [0; 3] -inline int div_03(int a, int b) { - int t = (a >= (b << 1)) ? 1 : 0; - a -= t * (b << 1); - return (t << 1) + (a >= b ? 1 : 0); -} - - -inline bool is_power_of_2(int n) { - return std::bitset(n).count() == 1; -} - - -inline int pll(int f) { - constexpr int __pll[] = {1, 3, 5, 7, 0, 2, 4, 6, 1, 3, 5, 7}; - return __pll[f]; -} - - -} // namespace - - -HEALPix::Reorder::Reorder(int Nside) : - Nside_(Nside), - Npix_(size()), - Ncap_((Nside * (Nside - 1)) << 1), - k_(is_power_of_2(Nside_) ? static_cast(std::log2(Nside)) : -1) { - ASSERT(0 <= k_); // (specific to nested ordering) - ASSERT(0 < Nside_); -} - - -int HEALPix::Reorder::ring_to_nest(int r) const { - auto to_nest = [&](int f, //!< base pixel index - int ring, //!< 1-based ring number - int Nring, //!< number of pixels in ring - int phi, //!< index in longitude - int shift //!< if ring's first pixel is not at phi=0 - ) -> int { - int r = ((2 + (f >> 2)) << k_) - ring - 1; - int p = 2 * phi - pll(f) * Nring - shift - 1; - if (p >= 2 * Nside_) { - p -= 8 * Nside_; - } - - int i = (r + p) >> 1; - int j = (r - p) >> 1; - - ASSERT(f < 12 && i < Nside_ && j < Nside_); - return CodecFijNest::fij_to_nest(f, i, j, k_); - }; - - if (r < Ncap_) { - // North polar cap - int Nring = (1 + sqrt(2 * r + 1)) >> 1; - int phi = 1 + r - 2 * Nring * (Nring - 1); - int r = Nring; - int f = div_03(phi - 1, Nring); - - return to_nest(f, r, Nring, phi, 0); - } - - if (Npix_ - Ncap_ <= r) { - // South polar cap - int Nring = (1 + sqrt(2 * Npix_ - 2 * r - 1)) >> 1; - int phi = 1 + r + 2 * Nring * (Nring - 1) + 4 * Nring - Npix_; - int ring = 4 * Nside_ - Nring; // (from South pole) - int f = div_03(phi - 1, Nring) + 8; - - return to_nest(f, ring, Nring, phi, 0); - } - - // Equatorial belt - int ip = r - Ncap_; - int tmp = ip >> (k_ + 2); - - int Nring = Nside_; - int phi = ip - tmp * 4 * Nside_ + 1; - int ring = tmp + Nside_; - - int ifm = 1 + ((phi - 1 - ((1 + tmp) >> 1)) >> k_); - int ifp = 1 + ((phi - 1 - ((1 - tmp + 2 * Nside_) >> 1)) >> k_); - int f = (ifp == ifm) ? (ifp | 4) : ((ifp < ifm) ? ifp : (ifm + 8)); - - return to_nest(f, ring, Nring, phi, ring & 1); -} - - -int HEALPix::Reorder::nest_to_ring(int n) const { - auto [f, i, j] = CodecFijNest::nest_to_fij(n, k_); - ASSERT(f < 12 && i < Nside_ && j < Nside_); - - auto to_ring_local = [&](int f, int i, int j, - int Nring, //!< number of pixels in ring - int shift //!< if ring's first pixel is/is not at phi=0 - ) -> int { - Nring >>= 2; - int r = (pll(f) * Nring + i - j + 1 + shift) / 2 - 1; - ASSERT(r < 4 * Nring); - - return r < 0 ? r + 4 * Nside_ : r; - }; - - const int ring = ((f >> 2) + 2) * Nside_ - i - j - 1; // 1-based ring number - if (ring < Nside_) { - // North polar cap - int Nring = 4 * ring; - int r0 = 2 * ring * (ring - 1); // index of first ring pixel (ring numbering) - - return r0 + to_ring_local(f, i, j, Nring, 0); - } - - if (ring < 3 * Nside_) { - // South polar cap - int Nring = 4 * Nside_; - int r0 = Ncap_ + (ring - Nside_) * Nring; // index of first ring pixel (ring numbering) - int shift = (ring - Nside_) & 1; - - return r0 + to_ring_local(f, i, j, Nring, shift); - } - - // Equatorial belt - int N = 4 * Nside_ - ring; - int Nring = 4 * N; - int r0 = Npix_ - 2 * N * (N + 1); // index of first ring pixel (ring numbering) - - return r0 + to_ring_local(f, i, j, Nring, 0); -} - - HEALPix::HEALPix(size_t Nside, const std::string& orderingConvention) : Nside_(Nside), orderingConvention_(orderingConvention) { ASSERT(Nside_ > 0); diff --git a/src/mir/repres/proxy/HEALPix.h b/src/mir/repres/proxy/HEALPix.h index e62f48aef..558d248e8 100644 --- a/src/mir/repres/proxy/HEALPix.h +++ b/src/mir/repres/proxy/HEALPix.h @@ -19,11 +19,6 @@ #include "mir/repres/proxy/ProxyGrid.h" -namespace mir::repres::unsupported { -class HEALPixNested; -} - - namespace mir::repres::proxy { @@ -37,23 +32,6 @@ class HEALPix final : public ProxyGrid { healpix_nested, }; - class Reorder { - public: - explicit Reorder(int Nside); - - int size() const { return 12 * Nside_ * Nside_; } - int nside() const { return Nside_; } - - int nest_to_ring(int) const; - int ring_to_nest(int) const; - - private: - const int Nside_; // up to 2^13 - const int Npix_; - const int Ncap_; - const int k_; - }; - // -- Exceptions // None diff --git a/src/mir/repres/unsupported/HEALPixNested.cc b/src/mir/repres/unsupported/HEALPixNested.cc index f1f3f4090..97457579d 100644 --- a/src/mir/repres/unsupported/HEALPixNested.cc +++ b/src/mir/repres/unsupported/HEALPixNested.cc @@ -17,6 +17,7 @@ #include "eckit/log/JSON.h" #include "mir/iterator/UnstructuredIterator.h" +#include "mir/reorder/HEALPix.h" #include "mir/util/Exceptions.h" #include "mir/util/Grib.h" #include "mir/util/GridBox.h" @@ -55,14 +56,14 @@ void HEALPixNested::print(std::ostream& out) const { std::vector HEALPixNested::gridBoxes() const { - const proxy::HEALPix::Reorder reorder(static_cast(ring_.Nside())); - const auto N = numberOfPoints(); + const auto N = numberOfPoints(); + const auto reorder = reorder::HEALPixRingToNested(N).reorder(); std::vector boxes(N); int i = 0; for (const auto& box : ring().gridBoxes()) { - auto j = reorder.ring_to_nest(i++); + auto j = reorder.at(i++); boxes.at(j) = box; } ASSERT(i == N); @@ -79,15 +80,15 @@ ::atlas::Grid HEALPixNested::atlasGrid() const { Iterator* HEALPixNested::iterator() const { if (longitudes_.empty()) { - const proxy::HEALPix::Reorder reorder(static_cast(ring_.Nside())); - const auto N = numberOfPoints(); + const auto N = numberOfPoints(); + const auto reorder = reorder::HEALPixRingToNested(N).reorder(); longitudes_.resize(N); latitudes_.resize(N); int i = 0; for (const auto& point : ring().atlasGrid().lonlat()) { - auto j = reorder.ring_to_nest(i++); + auto j = reorder.at(i++); longitudes_.at(j) = point.lon(); latitudes_.at(j) = point.lat(); } From ad42516350791ccb891022634240af5159b92454 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Fri, 1 Mar 2024 17:59:39 +0000 Subject: [PATCH 39/69] MIR-647 earthkit-regrid support for linear interpolation from HEALPix orderingConvention=nested --- etc/mir/grib-input.yaml | 4 ++ src/mir/method/MethodWeighted.cc | 36 +++++++++++++ src/mir/method/MethodWeighted.h | 9 +++- src/mir/reorder/HEALPix.cc | 58 +++++++++++++++------ src/mir/reorder/HEALPix.h | 29 ++--------- src/mir/reorder/Identity.cc | 4 +- src/mir/reorder/Identity.h | 5 +- src/mir/reorder/Reorder.cc | 4 +- src/mir/reorder/Reorder.h | 8 +-- src/mir/repres/proxy/HEALPix.h | 8 ++- src/mir/repres/unsupported/HEALPixNested.cc | 11 ++-- src/mir/repres/unsupported/HEALPixNested.h | 1 + src/tools/mir-matrix-reorder.cc | 4 +- 13 files changed, 118 insertions(+), 63 deletions(-) diff --git a/etc/mir/grib-input.yaml b/etc/mir/grib-input.yaml index cd258c02f..cc163f32b 100644 --- a/etc/mir/grib-input.yaml +++ b/etc/mir/grib-input.yaml @@ -24,3 +24,7 @@ gridType=space_view: - interpolation: k-nearest - nearest-method: longest-element-diagonal-and-nclosest - reset-missing-values: true + +# gridType=healpix,orderingConvention=nested isn't fully supported, this is a patch +gridType=healpix, orderingConvention=nested: + - matrix-reorder-cols: healpix-ring-to-nested diff --git a/src/mir/method/MethodWeighted.cc b/src/mir/method/MethodWeighted.cc index e54fb1be6..078dc1209 100644 --- a/src/mir/method/MethodWeighted.cc +++ b/src/mir/method/MethodWeighted.cc @@ -34,6 +34,7 @@ #include "mir/method/nonlinear/NonLinear.h" #include "mir/method/solver/Multiply.h" #include "mir/param/MIRParametrisation.h" +#include "mir/reorder/Reorder.h" #include "mir/repres/Representation.h" #include "mir/util/Log.h" #include "mir/util/MIRStatistics.h" @@ -73,6 +74,14 @@ MethodWeighted::MethodWeighted(const param::MIRParametrisation& parametrisation) addNonLinearTreatment(nonlinear::NonLinearFactory::build(n, parametrisation_)); ASSERT(nonLinear_.back()); } + + if (std::string name; parametrisation_.get("matrix-reorder-rows", name)) { + reorderRows_.reset(reorder::ReorderFactory::build(name)); + } + + if (std::string name; parametrisation_.get("matrix-reorder-cols", name)) { + reorderCols_.reset(reorder::ReorderFactory::build(name)); + } } @@ -219,6 +228,33 @@ const WeightMatrix& MethodWeighted::getMatrix(context::Context& ctx, const repre } } + if (reorderRows_ || reorderCols_) { + std::unique_ptr identity(reorder::ReorderFactory::build("identity")); + + auto rows = reorderRows_ ? reorderRows_->reorder(out.numberOfPoints()) : identity->reorder(out.numberOfPoints()); + ASSERT(rows.size() == W.rows()); + + auto cols = reorderCols_ ? reorderCols_->reorder(in.numberOfPoints()) : identity->reorder(out.numberOfPoints()); + ASSERT(cols.size() == W.cols()); + + std::cout << rows.size(); + + // expand triplets, renumbering directly + std::vector trips; + trips.reserve(W.nonZeros()); + + for (auto i = W.begin(), end = W.end(); i != end; ++i) { + trips.emplace_back(cols.at(i.col()), rows.at(i.row()), *i); + } + + // compress triplets, replace matrix + std::sort(trips.begin(), trips.end()); + + eckit::linalg::SparseMatrix w(W.rows(), W.cols(), trips); + W.swap(w); + } + + log << "MethodWeighted::getMatrix create weights matrix: " << timer.elapsedSeconds(here) << std::endl; log << "MethodWeighted::getMatrix matrix W " << W << std::endl; diff --git a/src/mir/method/MethodWeighted.h b/src/mir/method/MethodWeighted.h index 0a6d5084f..95feefb66 100644 --- a/src/mir/method/MethodWeighted.h +++ b/src/mir/method/MethodWeighted.h @@ -35,6 +35,9 @@ namespace solver { class Solver; } } // namespace method +namespace reorder { +class Reorder; +} namespace repres { class Representation; } @@ -77,8 +80,8 @@ class MethodWeighted : public Method { int version() const override; - virtual const WeightMatrix& getMatrix(context::Context&, const repres::Representation& in, - const repres::Representation& out) const; + const WeightMatrix& getMatrix(context::Context&, const repres::Representation& in, + const repres::Representation& out) const; // -- Overridden methods // None @@ -123,6 +126,8 @@ class MethodWeighted : public Method { std::vector> nonLinear_; std::unique_ptr solver_; + std::unique_ptr reorderRows_; + std::unique_ptr reorderCols_; bool matrixValidate_; bool matrixAssemble_; diff --git a/src/mir/reorder/HEALPix.cc b/src/mir/reorder/HEALPix.cc index 162948a3f..2671ced55 100644 --- a/src/mir/reorder/HEALPix.cc +++ b/src/mir/reorder/HEALPix.cc @@ -92,18 +92,40 @@ inline int pll(int f) { } // namespace -HEALPixReorder::HEALPixReorder(size_t N) : - Nside_([N] { +class HEALPixReorder { +public: + explicit HEALPixReorder(size_t N) : + Nside_([N] { + auto Nside = static_cast(std::sqrt(static_cast(N) / 12.)); + ASSERT_MSG(12 * Nside * Nside == static_cast(N), + "Expected N = 12 * Nside ** 2, got N=" + std::to_string(N)); + return Nside; + }()), + Npix_(size()), + Ncap_((Nside_ * (Nside_ - 1)) << 1), + k_(is_power_of_2(Nside_) ? static_cast(std::log2(Nside_)) : -1) { + ASSERT(0 <= k_); // (specific to nested ordering) + ASSERT(0 < Nside_); + } + + static int Nside(int N) { auto Nside = static_cast(std::sqrt(static_cast(N) / 12.)); ASSERT_MSG(12 * Nside * Nside == N, "Expected N = 12 * Nside ** 2, got N=" + std::to_string(N)); return Nside; - }()), - Npix_(N), - Ncap_((Nside_ * (Nside_ - 1)) << 1), - k_(is_power_of_2(Nside_) ? static_cast(std::log2(Nside_)) : -1) { - ASSERT(0 <= k_); // (specific to nested ordering) - ASSERT(0 < Nside_); -} + } + + int size() const { return 12 * Nside_ * Nside_; } + int nside() const { return Nside_; } + + int nest_to_ring(int) const; + int ring_to_nest(int) const; + +private: + const int Nside_; // up to 2^13 + const int Npix_; + const int Ncap_; + const int k_; +}; int HEALPixReorder::nest_to_ring(int n) const { @@ -204,19 +226,21 @@ int HEALPixReorder::ring_to_nest(int r) const { } -Renumber HEALPixRingToNested::reorder() const { - Renumber map(N()); - for (size_t i = 0; i < N(); ++i) { - map[i] = static_cast(ring_to_nest(static_cast(i))); +Renumber HEALPixRingToNested::reorder(size_t N) const { + HEALPixReorder reorder(N); + Renumber map(N); + for (size_t i = 0; i < N; ++i) { + map[i] = static_cast(reorder.ring_to_nest(static_cast(i))); } return map; } -Renumber HEALPixNestedToRing::reorder() const { - Renumber map(N()); - for (size_t i = 0; i < N(); ++i) { - map[i] = static_cast(nest_to_ring(static_cast(i))); +Renumber HEALPixNestedToRing::reorder(size_t N) const { + HEALPixReorder reorder(N); + Renumber map(N); + for (size_t i = 0; i < N; ++i) { + map[i] = static_cast(reorder.nest_to_ring(static_cast(i))); } return map; } diff --git a/src/mir/reorder/HEALPix.h b/src/mir/reorder/HEALPix.h index b092356a6..2aa185143 100644 --- a/src/mir/reorder/HEALPix.h +++ b/src/mir/reorder/HEALPix.h @@ -18,34 +18,13 @@ namespace mir::reorder { -class HEALPixReorder : public Reorder { -public: - explicit HEALPixReorder(size_t N); - -protected: - size_t N() const { return Npix_; } - size_t Nside() const { return Nside_; } - - int nest_to_ring(int) const; - int ring_to_nest(int) const; - -private: - const int Nside_; // up to 2^13 - const int Npix_; - const int Ncap_; - const int k_; +struct HEALPixRingToNested final : Reorder { + Renumber reorder(size_t N) const override; }; -struct HEALPixRingToNested final : HEALPixReorder { - using HEALPixReorder::HEALPixReorder; - Renumber reorder() const override; -}; - - -struct HEALPixNestedToRing final : HEALPixReorder { - using HEALPixReorder::HEALPixReorder; - Renumber reorder() const override; +struct HEALPixNestedToRing final : Reorder { + Renumber reorder(size_t N) const override; }; diff --git a/src/mir/reorder/Identity.cc b/src/mir/reorder/Identity.cc index 6bd088060..c73bd822a 100644 --- a/src/mir/reorder/Identity.cc +++ b/src/mir/reorder/Identity.cc @@ -18,8 +18,8 @@ namespace mir::reorder { -Renumber Identity::reorder() const { - Renumber renumber(N_); +Renumber Identity::reorder(size_t N) const { + Renumber renumber(N); std::iota(renumber.begin(), renumber.end(), 0); return renumber; } diff --git a/src/mir/reorder/Identity.h b/src/mir/reorder/Identity.h index 54e2d02f5..c65f551d9 100644 --- a/src/mir/reorder/Identity.h +++ b/src/mir/reorder/Identity.h @@ -19,11 +19,8 @@ namespace mir::reorder { struct Identity final : Reorder { - explicit Identity(size_t N) : N_(N) {} - private: - Renumber reorder() const override; - const size_t N_; + Renumber reorder(size_t N) const override; }; diff --git a/src/mir/reorder/Reorder.cc b/src/mir/reorder/Reorder.cc index ac536119f..371e2625a 100644 --- a/src/mir/reorder/Reorder.cc +++ b/src/mir/reorder/Reorder.cc @@ -54,12 +54,12 @@ ReorderFactory::~ReorderFactory() { } -Reorder* ReorderFactory::build(const std::string& name, size_t N) { +Reorder* ReorderFactory::build(const std::string& name) { util::call_once(ONCE, init); util::lock_guard lock(*MUTEX); if (auto j = M->find(name); j != M->end()) { - return j->second->make(N); + return j->second->make(); } list(Log::error() << "ReorderFactory: unknown '" << name << "', choices are:\n") << std::endl; diff --git a/src/mir/reorder/Reorder.h b/src/mir/reorder/Reorder.h index ed16c3bab..07c887b45 100644 --- a/src/mir/reorder/Reorder.h +++ b/src/mir/reorder/Reorder.h @@ -26,7 +26,7 @@ struct Reorder { virtual ~Reorder() = default; - virtual Renumber reorder() const = 0; + virtual Renumber reorder(size_t N) const = 0; Reorder(const Reorder&) = delete; Reorder(Reorder&&) = delete; @@ -38,7 +38,7 @@ struct Reorder { class ReorderFactory { private: std::string name_; - virtual Reorder* make(size_t N) = 0; + virtual Reorder* make() = 0; protected: explicit ReorderFactory(const std::string& name); @@ -51,14 +51,14 @@ class ReorderFactory { ReorderFactory& operator=(const ReorderFactory&) = delete; ReorderFactory& operator=(ReorderFactory&&) = delete; - static Reorder* build(const std::string& name, size_t N); + static Reorder* build(const std::string& name); static std::ostream& list(std::ostream& out); }; template class ReorderBuilder : public ReorderFactory { - Reorder* make(size_t N) override { return new T(N); } + Reorder* make() override { return new T; } public: explicit ReorderBuilder(const std::string& name) : ReorderFactory(name) {} diff --git a/src/mir/repres/proxy/HEALPix.h b/src/mir/repres/proxy/HEALPix.h index 558d248e8..f4abed914 100644 --- a/src/mir/repres/proxy/HEALPix.h +++ b/src/mir/repres/proxy/HEALPix.h @@ -19,6 +19,11 @@ #include "mir/repres/proxy/ProxyGrid.h" +namespace mir::repres::unsupported { +class HEALPixNested; +} + + namespace mir::repres::proxy { @@ -99,7 +104,8 @@ class HEALPix final : public ProxyGrid { // None // -- Friends - // None + + friend class unsupported::HEALPixNested; }; diff --git a/src/mir/repres/unsupported/HEALPixNested.cc b/src/mir/repres/unsupported/HEALPixNested.cc index 97457579d..6685868be 100644 --- a/src/mir/repres/unsupported/HEALPixNested.cc +++ b/src/mir/repres/unsupported/HEALPixNested.cc @@ -21,6 +21,7 @@ #include "mir/util/Exceptions.h" #include "mir/util/Grib.h" #include "mir/util/GridBox.h" +#include "mir/util/Log.h" namespace mir::repres::unsupported { @@ -57,7 +58,8 @@ void HEALPixNested::print(std::ostream& out) const { std::vector HEALPixNested::gridBoxes() const { const auto N = numberOfPoints(); - const auto reorder = reorder::HEALPixRingToNested(N).reorder(); + const auto reorder = reorder::HEALPixRingToNested().reorder(N); + ASSERT(reorder.size() == N); std::vector boxes(N); @@ -73,15 +75,16 @@ std::vector HEALPixNested::gridBoxes() const { ::atlas::Grid HEALPixNested::atlasGrid() const { - // NOTE: delete class altogether once we can build HEALPix nested-ordering atlas::Grid - NOTIMP; + Log::warning() << "HEALPixNested::atlasGrid() unsupported" << std::endl; + return ring_.atlasGrid(); } Iterator* HEALPixNested::iterator() const { if (longitudes_.empty()) { const auto N = numberOfPoints(); - const auto reorder = reorder::HEALPixRingToNested(N).reorder(); + const auto reorder = reorder::HEALPixRingToNested().reorder(N); + ASSERT(reorder.size() == N); longitudes_.resize(N); latitudes_.resize(N); diff --git a/src/mir/repres/unsupported/HEALPixNested.h b/src/mir/repres/unsupported/HEALPixNested.h index f9a7e2dbe..0a93756bb 100644 --- a/src/mir/repres/unsupported/HEALPixNested.h +++ b/src/mir/repres/unsupported/HEALPixNested.h @@ -20,6 +20,7 @@ namespace mir::repres::unsupported { +// NOTE: delete class altogether once we can build HEALPix nested-ordering atlas::Grid class HEALPixNested final : public Gridded { public: // -- Types diff --git a/src/tools/mir-matrix-reorder.cc b/src/tools/mir-matrix-reorder.cc index 6b0efde2f..e6e5b2742 100644 --- a/src/tools/mir-matrix-reorder.cc +++ b/src/tools/mir-matrix-reorder.cc @@ -68,11 +68,11 @@ void MIRMatrixReorder::execute(const eckit::option::CmdArgs& args) { // renumbering maps auto rows = - std::unique_ptr(reorder::ReorderFactory::build(args.getString("reorder-rows"), M.rows()))->reorder(); + std::unique_ptr(reorder::ReorderFactory::build(args.getString("reorder-rows")))->reorder(M.rows()); ASSERT(rows.size() == M.rows()); auto cols = - std::unique_ptr(reorder::ReorderFactory::build(args.getString("reorder-cols"), M.cols()))->reorder(); + std::unique_ptr(reorder::ReorderFactory::build(args.getString("reorder-cols")))->reorder(M.cols()); ASSERT(cols.size() == M.cols()); From 465a66cee7b80a78c81afc65b17a3f3441fe00af Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Fri, 1 Mar 2024 21:29:03 +0000 Subject: [PATCH 40/69] MIR-647 earthkit-regrid support for linear interpolation from HEALPix orderingConvention=nested --- etc/mir/grib-input.yaml | 2 +- src/mir/method/MethodWeighted.cc | 27 +++++++++++++++------------ src/mir/method/MethodWeighted.h | 2 ++ src/mir/method/fe/FiniteElement.cc | 9 +++++++++ 4 files changed, 27 insertions(+), 13 deletions(-) diff --git a/etc/mir/grib-input.yaml b/etc/mir/grib-input.yaml index cc163f32b..1d0302bb7 100644 --- a/etc/mir/grib-input.yaml +++ b/etc/mir/grib-input.yaml @@ -27,4 +27,4 @@ gridType=space_view: # gridType=healpix,orderingConvention=nested isn't fully supported, this is a patch gridType=healpix, orderingConvention=nested: - - matrix-reorder-cols: healpix-ring-to-nested + - finite-element-matrix-reorder-cols: healpix-ring-to-nested diff --git a/src/mir/method/MethodWeighted.cc b/src/mir/method/MethodWeighted.cc index 078dc1209..654c5eb43 100644 --- a/src/mir/method/MethodWeighted.cc +++ b/src/mir/method/MethodWeighted.cc @@ -74,14 +74,6 @@ MethodWeighted::MethodWeighted(const param::MIRParametrisation& parametrisation) addNonLinearTreatment(nonlinear::NonLinearFactory::build(n, parametrisation_)); ASSERT(nonLinear_.back()); } - - if (std::string name; parametrisation_.get("matrix-reorder-rows", name)) { - reorderRows_.reset(reorder::ReorderFactory::build(name)); - } - - if (std::string name; parametrisation_.get("matrix-reorder-cols", name)) { - reorderCols_.reset(reorder::ReorderFactory::build(name)); - } } @@ -231,20 +223,19 @@ const WeightMatrix& MethodWeighted::getMatrix(context::Context& ctx, const repre if (reorderRows_ || reorderCols_) { std::unique_ptr identity(reorder::ReorderFactory::build("identity")); - auto rows = reorderRows_ ? reorderRows_->reorder(out.numberOfPoints()) : identity->reorder(out.numberOfPoints()); + auto rows = + reorderRows_ ? reorderRows_->reorder(out.numberOfPoints()) : identity->reorder(out.numberOfPoints()); ASSERT(rows.size() == W.rows()); auto cols = reorderCols_ ? reorderCols_->reorder(in.numberOfPoints()) : identity->reorder(out.numberOfPoints()); ASSERT(cols.size() == W.cols()); - std::cout << rows.size(); - // expand triplets, renumbering directly std::vector trips; trips.reserve(W.nonZeros()); for (auto i = W.begin(), end = W.end(); i != end; ++i) { - trips.emplace_back(cols.at(i.col()), rows.at(i.row()), *i); + trips.emplace_back(rows.at(i.row()), cols.at(i.col()), *i); } // compress triplets, replace matrix @@ -303,6 +294,18 @@ void MethodWeighted::setSolver(const solver::Solver* s) { } +void MethodWeighted::setReorderRows(reorder::Reorder* r) { + ASSERT(r != nullptr); + reorderRows_.reset(r); +} + + +void MethodWeighted::setReorderCols(reorder::Reorder* r) { + ASSERT(r != nullptr); + reorderCols_.reset(r); +} + + void MethodWeighted::setOperandMatricesFromVectors(WeightMatrix::Matrix& A, WeightMatrix::Matrix& B, const MIRValuesVector& Avector, const MIRValuesVector& Bvector, const double& missingValue, const data::Space& space) const { diff --git a/src/mir/method/MethodWeighted.h b/src/mir/method/MethodWeighted.h index 95feefb66..5624a0ce9 100644 --- a/src/mir/method/MethodWeighted.h +++ b/src/mir/method/MethodWeighted.h @@ -102,6 +102,8 @@ class MethodWeighted : public Method { const solver::Solver& solver() const; void addNonLinearTreatment(const nonlinear::NonLinear*); void setSolver(const solver::Solver*); + void setReorderRows(reorder::Reorder*); + void setReorderCols(reorder::Reorder*); double poleDisplacement() const { return poleDisplacement_; } // -- Overridden methods diff --git a/src/mir/method/fe/FiniteElement.cc b/src/mir/method/fe/FiniteElement.cc index bab926242..8215d8c23 100644 --- a/src/mir/method/fe/FiniteElement.cc +++ b/src/mir/method/fe/FiniteElement.cc @@ -27,6 +27,7 @@ #include "mir/caching/InMemoryMeshCache.h" #include "mir/param/MIRParametrisation.h" +#include "mir/reorder/Reorder.h" #include "mir/repres/Iterator.h" #include "mir/repres/Representation.h" #include "mir/util/Domain.h" @@ -166,6 +167,14 @@ FiniteElement::FiniteElement(const param::MIRParametrisation& param, const std:: : projectionFail == "increase-epsilon" ? ProjectionFail::increaseEpsilon : projectionFail == "missing-value" ? ProjectionFail::missingValue : NOTIMP; + + if (std::string name; parametrisation_.get("finite-element-matrix-reorder-rows", name)) { + setReorderRows(reorder::ReorderFactory::build(name)); + } + + if (std::string name; parametrisation_.get("finite-element-matrix-reorder-cols", name)) { + setReorderCols(reorder::ReorderFactory::build(name)); + } } From bfbcffdeec6ac31c30ecf3a2c6dde008c17f11c6 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Fri, 1 Mar 2024 22:49:08 +0000 Subject: [PATCH 41/69] MIR-647 earthkit-regrid support for linear interpolation from HEALPix orderingConvention=nested --- tests/assertions/MIR-632.002.test | 2 +- tests/assertions/MIR-632.003.test | 2 +- tests/assertions/MIR-632.004.test | 8 ++--- tests/assertions/MIR-632.005.test | 2 +- tests/assertions/MIR-632.009.test | 2 +- tests/assertions/MIR-632.010.test | 2 +- tests/assertions/MIR-632.014.test | 2 +- tests/assertions/MIR-632.015.test | 2 +- tests/assertions/MIR-647.001.test | 29 ++++++++++++++++++ tests/assertions/gridType=healpix,N=36.grib2 | 1 - ...ix,Nside=2,orderingConvention=nested.grib2 | 1 + ...pix,Nside=32,orderingConvention=ring.grib2 | 1 + tests/data/gridType=healpix,N=36.grib2 | Bin 166 -> 0 bytes ...ix,Nside=2,orderingConvention=nested.grib2 | Bin 0 -> 207 bytes ...x,Nside=32,orderingConvention=nested.grib2 | Bin 23910 -> 5792 bytes ...pix,Nside=32,orderingConvention=ring.grib2 | Bin 0 -> 170 bytes tests/plans/MIR-632.002.test | 2 +- tests/plans/MIR-632.003.test | 4 +-- tests/plans/MIR-632.004.test | 4 +-- tests/plans/MIR-632.005.test | 4 +-- tests/plans/MIR-632.009.test | 2 +- tests/plans/MIR-632.010.test | 2 +- tests/plans/MIR-632.014.test | 2 +- tests/plans/MIR-632.015.test | 2 +- tests/plans/MIR-647.001.test | 6 ++++ tests/plans/gridType=healpix,N=36.grib2 | 1 - ...ix,Nside=2,orderingConvention=nested.grib2 | 1 + ...pix,Nside=32,orderingConvention=ring.grib2 | 1 + tests/unit/grib_input.cc | 2 +- 29 files changed, 62 insertions(+), 25 deletions(-) create mode 100644 tests/assertions/MIR-647.001.test delete mode 120000 tests/assertions/gridType=healpix,N=36.grib2 create mode 120000 tests/assertions/gridType=healpix,Nside=2,orderingConvention=nested.grib2 create mode 120000 tests/assertions/gridType=healpix,Nside=32,orderingConvention=ring.grib2 delete mode 100644 tests/data/gridType=healpix,N=36.grib2 create mode 100644 tests/data/gridType=healpix,Nside=2,orderingConvention=nested.grib2 create mode 100644 tests/data/gridType=healpix,Nside=32,orderingConvention=ring.grib2 create mode 100644 tests/plans/MIR-647.001.test delete mode 120000 tests/plans/gridType=healpix,N=36.grib2 create mode 120000 tests/plans/gridType=healpix,Nside=2,orderingConvention=nested.grib2 create mode 120000 tests/plans/gridType=healpix,Nside=32,orderingConvention=ring.grib2 diff --git a/tests/assertions/MIR-632.002.test b/tests/assertions/MIR-632.002.test index 3bf8ae51d..0806063e3 100644 --- a/tests/assertions/MIR-632.002.test +++ b/tests/assertions/MIR-632.002.test @@ -1,5 +1,5 @@ # mars -gridType=healpix,N=36.grib2 +gridType=healpix,Nside=32,orderingConvention=ring.grib2 # mir --grid=2/2 # grib_get assertions diff --git a/tests/assertions/MIR-632.003.test b/tests/assertions/MIR-632.003.test index ea3d2b872..8b2909fee 100644 --- a/tests/assertions/MIR-632.003.test +++ b/tests/assertions/MIR-632.003.test @@ -1,5 +1,5 @@ # mars -gridType=healpix,N=36.grib2 +gridType=healpix,Nside=32,orderingConvention=ring.grib2 # mir --grid=H36 # grib_get assertions diff --git a/tests/assertions/MIR-632.004.test b/tests/assertions/MIR-632.004.test index d471827a2..57add10dc 100644 --- a/tests/assertions/MIR-632.004.test +++ b/tests/assertions/MIR-632.004.test @@ -1,11 +1,11 @@ # mars -gridType=healpix,N=36.grib2 +gridType=healpix,Nside=32,orderingConvention=ring.grib2 # mir --packing=ccsds # grib_get assertions gridType=healpix -gridName=H36 -Nside=36 -numberOfDataPoints=15552 +gridName=H32 +Nside=32 +numberOfDataPoints=12288 packingType=grid_ccsds longitudeOfFirstGridPointInDegrees=45 diff --git a/tests/assertions/MIR-632.005.test b/tests/assertions/MIR-632.005.test index 2de300142..e0d03d2b8 100644 --- a/tests/assertions/MIR-632.005.test +++ b/tests/assertions/MIR-632.005.test @@ -1,5 +1,5 @@ # mars -gridType=healpix,N=36.grib2 +gridType=healpix,Nside=32,orderingConvention=ring.grib2 # mir --interpolation=grid-box-average --grid=H36 # grib_get assertions diff --git a/tests/assertions/MIR-632.009.test b/tests/assertions/MIR-632.009.test index 421b73e36..e6a2f63bc 100644 --- a/tests/assertions/MIR-632.009.test +++ b/tests/assertions/MIR-632.009.test @@ -1,5 +1,5 @@ # mars -gridType=healpix,N=36.grib2 +gridType=healpix,Nside=32,orderingConvention=ring.grib2 # mir --grid=O8 # grib_get assertions diff --git a/tests/assertions/MIR-632.010.test b/tests/assertions/MIR-632.010.test index 5ffcdf9c0..6e452d950 100644 --- a/tests/assertions/MIR-632.010.test +++ b/tests/assertions/MIR-632.010.test @@ -1,5 +1,5 @@ # mars -gridType=healpix,N=36.grib2 +gridType=healpix,Nside=32,orderingConvention=ring.grib2 # mir --grid=F8 # grib_get assertions diff --git a/tests/assertions/MIR-632.014.test b/tests/assertions/MIR-632.014.test index 76efbc849..fb6fb33cf 100644 --- a/tests/assertions/MIR-632.014.test +++ b/tests/assertions/MIR-632.014.test @@ -1,5 +1,5 @@ # mars -gridType=healpix,N=36.grib2 +gridType=healpix,Nside=32,orderingConvention=ring.grib2 # mir --interpolation=grid-box-average --grid=O8 # grib_get assertions diff --git a/tests/assertions/MIR-632.015.test b/tests/assertions/MIR-632.015.test index bb9820307..567c1eb44 100644 --- a/tests/assertions/MIR-632.015.test +++ b/tests/assertions/MIR-632.015.test @@ -1,5 +1,5 @@ # mars -gridType=healpix,N=36.grib2 +gridType=healpix,Nside=32,orderingConvention=ring.grib2 # mir --interpolation=grid-box-average --grid=F8 # grib_get assertions diff --git a/tests/assertions/MIR-647.001.test b/tests/assertions/MIR-647.001.test new file mode 100644 index 000000000..0117fbd4d --- /dev/null +++ b/tests/assertions/MIR-647.001.test @@ -0,0 +1,29 @@ +# mars +gridType=healpix,Nside=2,orderingConvention=nested.grib2 +# mir +--grid=H2 --interpolation=linear +# grib_get assertions +gridType=healpix +gridName=H2 +orderingConvention=ring +Nside=2 +numberOfDataPoints=48 +longitudeOfFirstGridPointInDegrees=45 +values[0]=3 +values[1]=7 +values[2]=11 +values[3]=15 + +values[20]=17 +values[21]=22 +values[22]=21 +values[23]=26 +values[24]=25 +values[25]=30 +values[26]=29 +values[27]=18 + +values[44]=32 +values[45]=36 +values[46]=40 +values[47]=44 diff --git a/tests/assertions/gridType=healpix,N=36.grib2 b/tests/assertions/gridType=healpix,N=36.grib2 deleted file mode 120000 index a4f398ffd..000000000 --- a/tests/assertions/gridType=healpix,N=36.grib2 +++ /dev/null @@ -1 +0,0 @@ -../data/gridType=healpix,N=36.grib2 \ No newline at end of file diff --git a/tests/assertions/gridType=healpix,Nside=2,orderingConvention=nested.grib2 b/tests/assertions/gridType=healpix,Nside=2,orderingConvention=nested.grib2 new file mode 120000 index 000000000..4a5f4db4f --- /dev/null +++ b/tests/assertions/gridType=healpix,Nside=2,orderingConvention=nested.grib2 @@ -0,0 +1 @@ +../data/gridType=healpix,Nside=2,orderingConvention=nested.grib2 \ No newline at end of file diff --git a/tests/assertions/gridType=healpix,Nside=32,orderingConvention=ring.grib2 b/tests/assertions/gridType=healpix,Nside=32,orderingConvention=ring.grib2 new file mode 120000 index 000000000..b44b672f8 --- /dev/null +++ b/tests/assertions/gridType=healpix,Nside=32,orderingConvention=ring.grib2 @@ -0,0 +1 @@ +../data/gridType=healpix,Nside=32,orderingConvention=ring.grib2 \ No newline at end of file diff --git a/tests/data/gridType=healpix,N=36.grib2 b/tests/data/gridType=healpix,N=36.grib2 deleted file mode 100644 index d2b4ae55648b0b03e2efd0953028d4289cf7a477..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 166 zcmZ<{@^t$DpMi-10+sFa(NeF#`#k z13+RL+kaF56k||fTDR1J1;k=d0#iWc{~Lhnc!45}j39AFh%O*Yloe_eklg@t3LD#h KAeWWh90&knFDD-W diff --git a/tests/data/gridType=healpix,Nside=2,orderingConvention=nested.grib2 b/tests/data/gridType=healpix,Nside=2,orderingConvention=nested.grib2 new file mode 100644 index 0000000000000000000000000000000000000000..3d290cd4ab8c7ceb1ba002f828c948f1317ec0f1 GIT binary patch literal 207 zcmZ<{@^t$DpNWY90?q>|QAUO&1_lKNM)ns>vOGY6|3ECr#J~uIOe~BB1_p*e0WD@A z!C(Ny(-{7v0+1jR)4HV&EQ}yEN-Q7}2>#Ckssjsw2_}dxpoAnVkT77-0x4<$I)#IQ kPl2HU$YEmx*{#K%z^O9H6NZ2yAixaa{|Bi619Kn%0G#44(f|Me literal 0 HcmV?d00001 diff --git a/tests/data/gridType=healpix,Nside=32,orderingConvention=nested.grib2 b/tests/data/gridType=healpix,Nside=32,orderingConvention=nested.grib2 index 6642c56d54287ac38cc5a4a462517a0eecfff59f..9b3131592918f0a5a795e76a1c29b56c81acfb47 100644 GIT binary patch literal 5792 zcmY*73tSXc_h%lvJ3Mz5AwiHG9wMTjuHrjnX90n%1e8qkg=A%Fim&ubbO%IP{4m!? z`Am=qNlnr3(_R*Xl9FbUnwDuUhz63ilIV)d-v60}{J#I$-`=@%&bjB_d+vG7O_}gq z0wFXFZg{2?9|06(0|-EAn(1I~L=gPzXrS;%vy{PL7>tM*1{(wZ;e8jLv8IN!=g%Iz**gxRE#NJ2(nMIP8Sb$t##;nh0^;JeE|Uv~(85tZ zSsCjw7Xl}e$A;}?F#*+0I7UGNGcEp5|BUhWyqKG$@!|@uZY-Ncg`5OYu)x$5SJY096$f@0q#LJX)Hpy_}okqD4Qd;fx(16(^iCqELi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P6hy;*?r^oIIKLvV(~yt^u|Y${Ci>xd^R8z zsFp-(^;=SY)+i!ulM|4Xz#KSb4$+qs3t2RRaNU0(^-GB4^c5bN;e|IJ%Tg=i&U*bvL&>F-7Plr zm3z*^|BnmZ{Z5HsRnehXyKmmK78mUnJQ_JiP|9RX&Q+}4=UAM=!YrcX7`4$rstb2& zS4JrLw_6|Zu;}mzP^jM!T6AT<(6OGLfx35!GWa#rc|DkEEX?b7tKXdbAlbzkh}0kC zuh{i_1b|XWVsOb~U|w?FYxtAHJkBnqdxAI6?Jd#wWKJUYma}ovobo+deXm@0wKsI9li=>K@;BRwUIK&-ml>#3+`Pn+o#<&G{ucv5{4JD6ojgyxw zkrZ7Tw(%pAvm6ut)Aj8bUhrarCAVLfBxbo|dAW=Ch;#v&;6?2Xw1961J~;{}Rm$9^ zZJB5&y=s`BgJ*&uz1qoJ3?g(}bO er|ctBE9(mX(c|3ECr#J~uIOe~BB1_p*e0WD@A zVF1Jo(-{7v0+6Tz)4HV&EFftHB?tvHXBJQ$BS?r5Ndu58$qF_~3nbMb4kGy!7#e^S N8ym=OR(5kB000@;ERFyG literal 0 HcmV?d00001 diff --git a/tests/plans/MIR-632.002.test b/tests/plans/MIR-632.002.test index f8f01d61e..520a6ff0c 100644 --- a/tests/plans/MIR-632.002.test +++ b/tests/plans/MIR-632.002.test @@ -1,5 +1,5 @@ # mars -gridType=healpix,N=36.grib2 +gridType=healpix,Nside=32,orderingConvention=ring.grib2 # mir --grid=2/2 # plan diff --git a/tests/plans/MIR-632.003.test b/tests/plans/MIR-632.003.test index 05b05ef55..7c1c4d2a0 100644 --- a/tests/plans/MIR-632.003.test +++ b/tests/plans/MIR-632.003.test @@ -1,6 +1,6 @@ # mars -gridType=healpix,N=36.grib2 +gridType=healpix,Nside=32,orderingConvention=ring.grib2 # mir ---grid=H36 +--grid=H32 # plan Copy[] diff --git a/tests/plans/MIR-632.004.test b/tests/plans/MIR-632.004.test index 207d637fa..96d67ef67 100644 --- a/tests/plans/MIR-632.004.test +++ b/tests/plans/MIR-632.004.test @@ -1,6 +1,6 @@ # mars -gridType=healpix,N=36.grib2 +gridType=healpix,Nside=32,orderingConvention=ring.grib2 # mir --packing=ccsds # plan -Set[packing=ccsds,output=...] +Copy[] diff --git a/tests/plans/MIR-632.005.test b/tests/plans/MIR-632.005.test index cf52ef6b9..40c12291d 100644 --- a/tests/plans/MIR-632.005.test +++ b/tests/plans/MIR-632.005.test @@ -1,6 +1,6 @@ # mars -gridType=healpix,N=36.grib2 +gridType=healpix,Nside=32,orderingConvention=ring.grib2 # mir ---interpolation=grid-box-average --grid=H36 +--interpolation=grid-box-average --grid=H32 # plan Copy[] diff --git a/tests/plans/MIR-632.009.test b/tests/plans/MIR-632.009.test index 6a4d34e86..e89d7527a 100644 --- a/tests/plans/MIR-632.009.test +++ b/tests/plans/MIR-632.009.test @@ -1,5 +1,5 @@ # mars -gridType=healpix,N=36.grib2 +gridType=healpix,Nside=32,orderingConvention=ring.grib2 # mir --grid=O8 # plan diff --git a/tests/plans/MIR-632.010.test b/tests/plans/MIR-632.010.test index ca5a03d17..ae3741a88 100644 --- a/tests/plans/MIR-632.010.test +++ b/tests/plans/MIR-632.010.test @@ -1,5 +1,5 @@ # mars -gridType=healpix,N=36.grib2 +gridType=healpix,Nside=32,orderingConvention=ring.grib2 # mir --grid=F8 # plan diff --git a/tests/plans/MIR-632.014.test b/tests/plans/MIR-632.014.test index 5343a249d..c3c2d17ee 100644 --- a/tests/plans/MIR-632.014.test +++ b/tests/plans/MIR-632.014.test @@ -1,5 +1,5 @@ # mars -gridType=healpix,N=36.grib2 +gridType=healpix,Nside=32,orderingConvention=ring.grib2 # mir --interpolation=grid-box-average --grid=O8 # plan diff --git a/tests/plans/MIR-632.015.test b/tests/plans/MIR-632.015.test index 21fa22a74..bc370f363 100644 --- a/tests/plans/MIR-632.015.test +++ b/tests/plans/MIR-632.015.test @@ -1,5 +1,5 @@ # mars -gridType=healpix,N=36.grib2 +gridType=healpix,Nside=32,orderingConvention=ring.grib2 # mir --interpolation=grid-box-average --grid=F8 # plan diff --git a/tests/plans/MIR-647.001.test b/tests/plans/MIR-647.001.test new file mode 100644 index 000000000..562e3a36e --- /dev/null +++ b/tests/plans/MIR-647.001.test @@ -0,0 +1,6 @@ +# mars +gridType=healpix,Nside=2,orderingConvention=nested.grib2 +# mir +--grid=H2 --interpolation=linear +# plan +Gridded2NamedGrid[grid=H2,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] diff --git a/tests/plans/gridType=healpix,N=36.grib2 b/tests/plans/gridType=healpix,N=36.grib2 deleted file mode 120000 index a4f398ffd..000000000 --- a/tests/plans/gridType=healpix,N=36.grib2 +++ /dev/null @@ -1 +0,0 @@ -../data/gridType=healpix,N=36.grib2 \ No newline at end of file diff --git a/tests/plans/gridType=healpix,Nside=2,orderingConvention=nested.grib2 b/tests/plans/gridType=healpix,Nside=2,orderingConvention=nested.grib2 new file mode 120000 index 000000000..4a5f4db4f --- /dev/null +++ b/tests/plans/gridType=healpix,Nside=2,orderingConvention=nested.grib2 @@ -0,0 +1 @@ +../data/gridType=healpix,Nside=2,orderingConvention=nested.grib2 \ No newline at end of file diff --git a/tests/plans/gridType=healpix,Nside=32,orderingConvention=ring.grib2 b/tests/plans/gridType=healpix,Nside=32,orderingConvention=ring.grib2 new file mode 120000 index 000000000..b44b672f8 --- /dev/null +++ b/tests/plans/gridType=healpix,Nside=32,orderingConvention=ring.grib2 @@ -0,0 +1 @@ +../data/gridType=healpix,Nside=32,orderingConvention=ring.grib2 \ No newline at end of file diff --git a/tests/unit/grib_input.cc b/tests/unit/grib_input.cc index 79559ac9b..02903ccc0 100644 --- a/tests/unit/grib_input.cc +++ b/tests/unit/grib_input.cc @@ -31,7 +31,7 @@ CASE("GribFileInput") { "../data/O400.version=1.grib1", "../data/O400.version=2.grib1", "../data/ORCA.grib2", - "../data/gridType=healpix,N=36.grib2", + "../data/gridType=healpix,Nside=32,orderingConvention=ring.grib2", "../data/gridType=reduced_gg,gridName=N320,shortName=msl.grib1", "../data/gridType=reduced_gg,gridName=O1280,shortName=msl.grib1", "../data/gridType=reduced_gg,gridName=O32,shortName=msl.grib1", From 8918d656002b9c65dd95eddb9b81aad26713d4c7 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Fri, 1 Mar 2024 23:04:41 +0000 Subject: [PATCH 42/69] MIR-647 earthkit-regrid support for linear interpolation from HEALPix orderingConvention=nested --- src/mir/method/MethodWeighted.cc | 15 +++++++++++++-- src/mir/reorder/HEALPix.cc | 11 +++++++++++ src/mir/reorder/HEALPix.h | 4 ++++ src/mir/reorder/Identity.cc | 6 ++++++ src/mir/reorder/Identity.h | 3 ++- src/mir/reorder/Reorder.h | 11 ++++++++++- tests/plans/0000.test | 2 +- tests/plans/0001.test | 2 +- tests/plans/0002.test | 2 +- tests/plans/MIR-219-scalar-grid=veryfine-1.test | 2 +- tests/plans/MIR-219-scalar-grid=veryfine-2.test | 2 +- ...alar-truncation=255-intgrid=O320-grid=1-1.test | 2 +- ...alar-truncation=255-intgrid=auto-grid=1-1.test | 2 +- ...alar-truncation=399-intgrid=auto-grid=1-1.test | 2 +- ...lar-truncation=auto-intgrid=O320-grid=2-2.test | 2 +- ...lar-truncation=auto-intgrid=auto-grid=1-1.test | 2 +- ...lar-truncation=auto-intgrid=auto-grid=N80.test | 2 +- ...ar-truncation=none-intgrid=O400-grid=O200.test | 2 +- ...lar-truncation=none-intgrid=auto-grid=1-1.test | 2 +- tests/plans/MIR-219-scalar.test | 2 +- ...d2uv-truncation=255-intgrid=O320-grid=1-1.test | 2 +- ...d2uv-truncation=255-intgrid=auto-grid=1-1.test | 2 +- ...2uv-truncation=auto-intgrid=O320-grid=2-2.test | 2 +- ...2uv-truncation=auto-intgrid=auto-grid=1-1.test | 2 +- ...2uv-truncation=auto-intgrid=auto-grid=N80.test | 2 +- ...uv-truncation=none-intgrid=O400-grid=O200.test | 2 +- ...2uv-truncation=none-intgrid=auto-grid=1-1.test | 2 +- tests/plans/MIR-219-vod2uv-veryfine-1.test | 2 +- tests/plans/MIR-219-vod2uv-veryfine-2.test | 2 +- tests/plans/MIR-219-vod2uv.test | 2 +- tests/plans/MIR-239-gridname=O64.test | 2 +- tests/plans/MIR-239-gridname=O640.test | 2 +- tests/plans/MIR-294.uv2uv=false.test | 4 ++-- tests/plans/MIR-294.uv2uv=true.test | 2 +- tests/plans/MIR-294.vod2uv=false.test | 4 ++-- tests/plans/MIR-294.vod2uv=true.test | 2 +- tests/plans/MIR-309.001.test | 2 +- tests/plans/MIR-309.002.test | 2 +- tests/plans/MIR-323.002.test | 2 +- tests/plans/MIR-361.001.test | 2 +- tests/plans/MIR-361.003.test | 2 +- tests/plans/MIR-361.007.test | 2 +- tests/plans/MIR-361.010.test | 2 +- tests/plans/MIR-361.011.test | 2 +- tests/plans/MIR-361.012.test | 2 +- tests/plans/MIR-361.013.test | 2 +- tests/plans/MIR-361.015.test | 2 +- tests/plans/MIR-380.O16-to-laea.test | 2 +- tests/plans/MIR-380.regular_ll-to-laea.test | 2 +- tests/plans/MIR-380.sh-to-laea.test | 2 +- tests/plans/MIR-403.test | 2 +- tests/plans/MIR-454.001.test.atlas-orca | 4 ++-- tests/plans/MIR-454.003.test.atlas-orca | 6 +++--- .../MIR-459.nabla=scalar-gradient.param=z.sh.test | 2 +- ...MIR-459.nabla=scalar-laplacian.param=z.sh.test | 2 +- .../MIR-459.nabla=uv-divergence.param=vo_d.test | 2 +- .../MIR-459.nabla=uv-gradient.param=vo_d.test | 2 +- .../MIR-459.nabla=uv-vorticity.param=vo_d.test | 2 +- tests/plans/MIR-474.O16-to-lambert.test | 2 +- tests/plans/MIR-474.regular_ll-to-lambert.test | 2 +- tests/plans/MIR-474.sh-to-lambert.test | 2 +- tests/plans/MIR-487.004.test | 2 +- tests/plans/MIR-487.006.test | 2 +- tests/plans/MIR-497.001.test | 2 +- tests/plans/MIR-497.002.test | 2 +- tests/plans/MIR-497.003.test | 2 +- tests/plans/MIR-510.001.test | 2 +- tests/plans/MIR-510.002.test | 2 +- tests/plans/MIR-544.test | 2 +- tests/plans/MIR-592.001.test | 4 ++-- tests/plans/MIR-592.002.test | 2 +- tests/plans/MIR-592.003.test | 4 ++-- tests/plans/MIR-592.004.test | 2 +- tests/plans/MIR-592.005.test | 4 ++-- tests/plans/MIR-632.001.test | 2 +- tests/plans/MIR-632.002.test | 2 +- tests/plans/MIR-632.006.test.disabled | 6 +++--- tests/plans/MIR-632.007.test | 2 +- tests/plans/MIR-632.008.test | 2 +- tests/plans/MIR-632.009.test | 2 +- tests/plans/MIR-632.010.test | 2 +- tests/plans/MIR-632.011.test | 2 +- tests/plans/MIR-632.012.test | 2 +- tests/plans/MIR-632.013.test | 2 +- tests/plans/MIR-632.014.test | 2 +- tests/plans/MIR-632.015.test | 2 +- tests/plans/MIR-632.016.test | 2 +- tests/plans/MIR-632.018.test | 2 +- tests/plans/MIR-632.019.test | 2 +- tests/plans/MIR-632.020.test | 2 +- tests/plans/MIR-632.023.test | 2 +- tests/plans/MIR-632.024.test | 2 +- tests/plans/MIR-634.002.test | 2 +- tests/plans/MIR-643.001.test | 2 +- tests/plans/MIR-643.002.test | 2 +- tests/plans/MIR-643.003.test | 2 +- tests/plans/MIR-643.004.test | 2 +- tests/plans/MIR-643.005.test | 2 +- tests/plans/MIR-647.001.test | 2 +- .../different-interpolation-methods.0000.test | 8 ++++---- .../different-interpolation-methods.0001.test | 8 ++++---- .../different-interpolation-methods.0002.test | 2 +- .../different-interpolation-methods.0003.test | 2 +- .../different-interpolation-methods.0004.test | 2 +- .../different-interpolation-methods.0005.test | 2 +- .../different-interpolation-methods.0006.test | 2 +- .../different-interpolation-methods.0007.test | 2 +- .../different-interpolation-methods.0008.test | 2 +- .../different-interpolation-methods.0009.test | 2 +- 109 files changed, 165 insertions(+), 123 deletions(-) diff --git a/src/mir/method/MethodWeighted.cc b/src/mir/method/MethodWeighted.cc index 654c5eb43..cb511f724 100644 --- a/src/mir/method/MethodWeighted.cc +++ b/src/mir/method/MethodWeighted.cc @@ -89,8 +89,19 @@ void MethodWeighted::print(std::ostream& out) const { } out << "]"; - out << ",Solver=" << *solver_ << ",cropping=" << cropping_ << ",lsmWeightAdjustment=" << lsmWeightAdjustment_ - << ",pruneEpsilon=" << pruneEpsilon_ << ",poleDisplacement=" << poleDisplacement_; + if (reorderRows_) { + out << ",reorderRows=" << *reorderRows_; + } + + if (reorderCols_) { + out << ",reorderCols=" << *reorderCols_; + } + + out << ",solver=" << *solver_; + out << ",cropping=" << cropping_; + out << ",lsmWeightAdjustment=" << lsmWeightAdjustment_; + out << ",pruneEpsilon=" << pruneEpsilon_; + out << ",poleDisplacement=" << poleDisplacement_; } diff --git a/src/mir/reorder/HEALPix.cc b/src/mir/reorder/HEALPix.cc index 2671ced55..3c7c6e467 100644 --- a/src/mir/reorder/HEALPix.cc +++ b/src/mir/reorder/HEALPix.cc @@ -16,6 +16,7 @@ #include #include #include +#include #include "mir/util/Exceptions.h" @@ -236,6 +237,11 @@ Renumber HEALPixRingToNested::reorder(size_t N) const { } +void HEALPixRingToNested::print(std::ostream&s) const { + s<<"HEALPixRingToNested[]"; +} + + Renumber HEALPixNestedToRing::reorder(size_t N) const { HEALPixReorder reorder(N); Renumber map(N); @@ -246,6 +252,11 @@ Renumber HEALPixNestedToRing::reorder(size_t N) const { } +void HEALPixNestedToRing::print(std::ostream&s) const { + s<<"HEALPixNestedToRing[]"; +} + + static const ReorderBuilder __reorder1("healpix-ring-to-nested"); static const ReorderBuilder __reorder2("healpix-nested-to-ring"); diff --git a/src/mir/reorder/HEALPix.h b/src/mir/reorder/HEALPix.h index 2aa185143..db0f1921c 100644 --- a/src/mir/reorder/HEALPix.h +++ b/src/mir/reorder/HEALPix.h @@ -20,11 +20,15 @@ namespace mir::reorder { struct HEALPixRingToNested final : Reorder { Renumber reorder(size_t N) const override; +private: + void print(std::ostream&) const override; }; struct HEALPixNestedToRing final : Reorder { Renumber reorder(size_t N) const override; +private: + void print(std::ostream&) const override; }; diff --git a/src/mir/reorder/Identity.cc b/src/mir/reorder/Identity.cc index c73bd822a..ffdbabd7f 100644 --- a/src/mir/reorder/Identity.cc +++ b/src/mir/reorder/Identity.cc @@ -13,6 +13,7 @@ #include "mir/reorder/Identity.h" #include +#include namespace mir::reorder { @@ -25,6 +26,11 @@ Renumber Identity::reorder(size_t N) const { } +void Identity::print(std::ostream &s) const { + s << "Identity[]"; +} + + static const ReorderBuilder __reorder("identity"); diff --git a/src/mir/reorder/Identity.h b/src/mir/reorder/Identity.h index c65f551d9..be5233786 100644 --- a/src/mir/reorder/Identity.h +++ b/src/mir/reorder/Identity.h @@ -19,8 +19,9 @@ namespace mir::reorder { struct Identity final : Reorder { -private: Renumber reorder(size_t N) const override; +private: + void print(std::ostream&) const override; }; diff --git a/src/mir/reorder/Reorder.h b/src/mir/reorder/Reorder.h index 07c887b45..63d55c85e 100644 --- a/src/mir/reorder/Reorder.h +++ b/src/mir/reorder/Reorder.h @@ -21,7 +21,8 @@ namespace mir::reorder { using Renumber = std::vector; -struct Reorder { +class Reorder { +public: Reorder() = default; virtual ~Reorder() = default; @@ -32,6 +33,14 @@ struct Reorder { Reorder(Reorder&&) = delete; Reorder& operator=(const Reorder&) = delete; Reorder& operator=(Reorder&&) = delete; + +private: + virtual void print(std::ostream&) const = 0; + + friend std::ostream& operator<<(std::ostream& s, const Reorder& p) { + p.print(s); + return s; + } }; diff --git a/tests/plans/0000.test b/tests/plans/0000.test index 24faa0e76..38d9470a7 100644 --- a/tests/plans/0000.test +++ b/tests/plans/0000.test @@ -3,4 +3,4 @@ param=2t,levtype=sfc # mir --dont-compress-plan --area=80/-10/10/100 --grid=1/1 # plan -Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|AreaCropper[bbox=BoundingBox[north=80,west=-10,south=10,east=100]]|Save[output=...] +Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|AreaCropper[bbox=BoundingBox[north=80,west=-10,south=10,east=100]]|Save[output=...] diff --git a/tests/plans/0001.test b/tests/plans/0001.test index 2c1329097..5113d80c9 100644 --- a/tests/plans/0001.test +++ b/tests/plans/0001.test @@ -3,4 +3,4 @@ param=t,level=1000 # mir --dont-compress-plan --grid=1/1 # plan -ShTruncate[truncation=179]|ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F90]|Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] +ShTruncate[truncation=179]|ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F90]|Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] diff --git a/tests/plans/0002.test b/tests/plans/0002.test index 2696b1d39..515c8a72e 100644 --- a/tests/plans/0002.test +++ b/tests/plans/0002.test @@ -3,4 +3,4 @@ param=2t,levtype=sfc # mir --dont-compress-plan --area=80/-10/10/100 --grid=1/1 --accuracy=8 --packing=so # plan -Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|AreaCropper[bbox=BoundingBox[north=80,west=-10,south=10,east=100]]|Save[packing=second-order,accuracy=8,output=...] +Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|AreaCropper[bbox=BoundingBox[north=80,west=-10,south=10,east=100]]|Save[packing=second-order,accuracy=8,output=...] diff --git a/tests/plans/MIR-219-scalar-grid=veryfine-1.test b/tests/plans/MIR-219-scalar-grid=veryfine-1.test index fcdc88165..778af2712 100644 --- a/tests/plans/MIR-219-scalar-grid=veryfine-1.test +++ b/tests/plans/MIR-219-scalar-grid=veryfine-1.test @@ -4,4 +4,4 @@ param=t,level=1000 # mir --grid=0.1/0.1 --dont-compress-plan # plan -ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F900]|Gridded2RegularLL[increments=Increments[west_east=0.1,south_north=0.1],bbox=BoundingBox[north=90,west=0,south=-90,east=359.9],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] +ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F900]|Gridded2RegularLL[increments=Increments[west_east=0.1,south_north=0.1],bbox=BoundingBox[north=90,west=0,south=-90,east=359.9],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] diff --git a/tests/plans/MIR-219-scalar-grid=veryfine-2.test b/tests/plans/MIR-219-scalar-grid=veryfine-2.test index ec577f5e3..42350502d 100644 --- a/tests/plans/MIR-219-scalar-grid=veryfine-2.test +++ b/tests/plans/MIR-219-scalar-grid=veryfine-2.test @@ -4,4 +4,4 @@ param=t,level=1000 # mir --grid=0.01/0.01 --dont-compress-plan # plan -ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F1280]|Gridded2RegularLL[increments=Increments[west_east=0.01,south_north=0.01],bbox=BoundingBox[north=90,west=0,south=-90,east=359.99],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] +ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F1280]|Gridded2RegularLL[increments=Increments[west_east=0.01,south_north=0.01],bbox=BoundingBox[north=90,west=0,south=-90,east=359.99],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] diff --git a/tests/plans/MIR-219-scalar-truncation=255-intgrid=O320-grid=1-1.test b/tests/plans/MIR-219-scalar-truncation=255-intgrid=O320-grid=1-1.test index 5024d2711..f1b6089d5 100644 --- a/tests/plans/MIR-219-scalar-truncation=255-intgrid=O320-grid=1-1.test +++ b/tests/plans/MIR-219-scalar-truncation=255-intgrid=O320-grid=1-1.test @@ -3,4 +3,4 @@ param=t,level=1000 # mir --truncation=255 --intgrid=O320 --grid=1/1 --dont-compress-plan # plan -ShTruncate[truncation=255]|ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=O320]|Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] +ShTruncate[truncation=255]|ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=O320]|Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] diff --git a/tests/plans/MIR-219-scalar-truncation=255-intgrid=auto-grid=1-1.test b/tests/plans/MIR-219-scalar-truncation=255-intgrid=auto-grid=1-1.test index dd9bc679b..358b6f4d5 100644 --- a/tests/plans/MIR-219-scalar-truncation=255-intgrid=auto-grid=1-1.test +++ b/tests/plans/MIR-219-scalar-truncation=255-intgrid=auto-grid=1-1.test @@ -3,4 +3,4 @@ param=t,level=1000 # mir --truncation=255 --intgrid=auto --grid=1/1 --dont-compress-plan # plan -ShTruncate[truncation=255]|ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F90]|Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] +ShTruncate[truncation=255]|ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F90]|Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] diff --git a/tests/plans/MIR-219-scalar-truncation=399-intgrid=auto-grid=1-1.test b/tests/plans/MIR-219-scalar-truncation=399-intgrid=auto-grid=1-1.test index 3091f7dbb..9f9921e9e 100644 --- a/tests/plans/MIR-219-scalar-truncation=399-intgrid=auto-grid=1-1.test +++ b/tests/plans/MIR-219-scalar-truncation=399-intgrid=auto-grid=1-1.test @@ -4,4 +4,4 @@ param=t,level=1000 # mir --truncation=399 --intgrid=auto --grid=1/1 --dont-compress-plan # plan -ShTruncate[truncation=399]|ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F90]|Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] +ShTruncate[truncation=399]|ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F90]|Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] diff --git a/tests/plans/MIR-219-scalar-truncation=auto-intgrid=O320-grid=2-2.test b/tests/plans/MIR-219-scalar-truncation=auto-intgrid=O320-grid=2-2.test index 511df1d9f..0ad18bfe9 100644 --- a/tests/plans/MIR-219-scalar-truncation=auto-intgrid=O320-grid=2-2.test +++ b/tests/plans/MIR-219-scalar-truncation=auto-intgrid=O320-grid=2-2.test @@ -3,4 +3,4 @@ param=t,level=1000 # mir --truncation=auto --intgrid=O320 --grid=2/2 --dont-compress-plan # plan -ShTruncate[truncation=639]|ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=O320]|Gridded2RegularLL[increments=Increments[west_east=2,south_north=2],bbox=BoundingBox[north=90,west=0,south=-90,east=358],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] +ShTruncate[truncation=639]|ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=O320]|Gridded2RegularLL[increments=Increments[west_east=2,south_north=2],bbox=BoundingBox[north=90,west=0,south=-90,east=358],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] diff --git a/tests/plans/MIR-219-scalar-truncation=auto-intgrid=auto-grid=1-1.test b/tests/plans/MIR-219-scalar-truncation=auto-intgrid=auto-grid=1-1.test index 293c95ea5..4a7e9b8d2 100644 --- a/tests/plans/MIR-219-scalar-truncation=auto-intgrid=auto-grid=1-1.test +++ b/tests/plans/MIR-219-scalar-truncation=auto-intgrid=auto-grid=1-1.test @@ -3,4 +3,4 @@ param=t,level=1000 # mir --truncation=auto --intgrid=auto --grid=1/1 --dont-compress-plan # plan -ShTruncate[truncation=179]|ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F90]|Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] +ShTruncate[truncation=179]|ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F90]|Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] diff --git a/tests/plans/MIR-219-scalar-truncation=auto-intgrid=auto-grid=N80.test b/tests/plans/MIR-219-scalar-truncation=auto-intgrid=auto-grid=N80.test index a902c0a4f..6ea97b48b 100644 --- a/tests/plans/MIR-219-scalar-truncation=auto-intgrid=auto-grid=N80.test +++ b/tests/plans/MIR-219-scalar-truncation=auto-intgrid=auto-grid=N80.test @@ -3,4 +3,4 @@ param=t,level=1000 # mir --truncation=auto --intgrid=auto --grid=N80 --dont-compress-plan # plan -ShTruncate[truncation=159]|ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F80]|Gridded2NamedGrid[grid=N80,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] +ShTruncate[truncation=159]|ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F80]|Gridded2NamedGrid[grid=N80,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] diff --git a/tests/plans/MIR-219-scalar-truncation=none-intgrid=O400-grid=O200.test b/tests/plans/MIR-219-scalar-truncation=none-intgrid=O400-grid=O200.test index 6d1acf2f9..5e2ff5907 100644 --- a/tests/plans/MIR-219-scalar-truncation=none-intgrid=O400-grid=O200.test +++ b/tests/plans/MIR-219-scalar-truncation=none-intgrid=O400-grid=O200.test @@ -3,4 +3,4 @@ param=t,level=1000 # mir --truncation=none --intgrid=O400 --grid=O200 --dont-compress-plan # plan -ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=O400]|Gridded2NamedGrid[grid=O200,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] +ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=O400]|Gridded2NamedGrid[grid=O200,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] diff --git a/tests/plans/MIR-219-scalar-truncation=none-intgrid=auto-grid=1-1.test b/tests/plans/MIR-219-scalar-truncation=none-intgrid=auto-grid=1-1.test index d4d35974a..c7550b71e 100644 --- a/tests/plans/MIR-219-scalar-truncation=none-intgrid=auto-grid=1-1.test +++ b/tests/plans/MIR-219-scalar-truncation=none-intgrid=auto-grid=1-1.test @@ -3,4 +3,4 @@ param=t,level=1000 # mir --truncation=none --intgrid=auto --grid=1/1 --dont-compress-plan # plan -ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F90]|Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] +ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F90]|Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] diff --git a/tests/plans/MIR-219-scalar.test b/tests/plans/MIR-219-scalar.test index b3bf45314..d05274be9 100644 --- a/tests/plans/MIR-219-scalar.test +++ b/tests/plans/MIR-219-scalar.test @@ -3,4 +3,4 @@ param=t,level=1000 # mir --grid=1/1 --dont-compress-plan # plan -ShTruncate[truncation=179]|ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F90]|Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] +ShTruncate[truncation=179]|ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F90]|Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] diff --git a/tests/plans/MIR-219-vod2uv-truncation=255-intgrid=O320-grid=1-1.test b/tests/plans/MIR-219-vod2uv-truncation=255-intgrid=O320-grid=1-1.test index 194f59871..149e26311 100644 --- a/tests/plans/MIR-219-vod2uv-truncation=255-intgrid=O320-grid=1-1.test +++ b/tests/plans/MIR-219-vod2uv-truncation=255-intgrid=O320-grid=1-1.test @@ -3,4 +3,4 @@ param=vo_d,level=1000 # mir --vod2uv --truncation=255 --intgrid=O320 --grid=1/1 --dont-compress-plan # plan -ShTruncate[truncation=255]|ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=O320]|Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] +ShTruncate[truncation=255]|ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=O320]|Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] diff --git a/tests/plans/MIR-219-vod2uv-truncation=255-intgrid=auto-grid=1-1.test b/tests/plans/MIR-219-vod2uv-truncation=255-intgrid=auto-grid=1-1.test index f764136b0..99b38c15e 100644 --- a/tests/plans/MIR-219-vod2uv-truncation=255-intgrid=auto-grid=1-1.test +++ b/tests/plans/MIR-219-vod2uv-truncation=255-intgrid=auto-grid=1-1.test @@ -3,4 +3,4 @@ param=vo_d,level=1000 # mir --vod2uv --truncation=255 --intgrid=auto --grid=1/1 --dont-compress-plan # plan -ShTruncate[truncation=255]|ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F90]|Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] +ShTruncate[truncation=255]|ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F90]|Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] diff --git a/tests/plans/MIR-219-vod2uv-truncation=auto-intgrid=O320-grid=2-2.test b/tests/plans/MIR-219-vod2uv-truncation=auto-intgrid=O320-grid=2-2.test index 674030ef5..c2f2d5fb9 100644 --- a/tests/plans/MIR-219-vod2uv-truncation=auto-intgrid=O320-grid=2-2.test +++ b/tests/plans/MIR-219-vod2uv-truncation=auto-intgrid=O320-grid=2-2.test @@ -3,4 +3,4 @@ param=vo_d,level=1000 # mir --vod2uv --truncation=auto --intgrid=O320 --grid=2/2 --dont-compress-plan # plan -ShTruncate[truncation=639]|ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=O320]|Gridded2RegularLL[increments=Increments[west_east=2,south_north=2],bbox=BoundingBox[north=90,west=0,south=-90,east=358],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] +ShTruncate[truncation=639]|ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=O320]|Gridded2RegularLL[increments=Increments[west_east=2,south_north=2],bbox=BoundingBox[north=90,west=0,south=-90,east=358],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] diff --git a/tests/plans/MIR-219-vod2uv-truncation=auto-intgrid=auto-grid=1-1.test b/tests/plans/MIR-219-vod2uv-truncation=auto-intgrid=auto-grid=1-1.test index 9e6f526bc..3dec84dfb 100644 --- a/tests/plans/MIR-219-vod2uv-truncation=auto-intgrid=auto-grid=1-1.test +++ b/tests/plans/MIR-219-vod2uv-truncation=auto-intgrid=auto-grid=1-1.test @@ -3,4 +3,4 @@ param=vo_d,level=1000 # mir --vod2uv --truncation=auto --intgrid=auto --grid=1/1 --dont-compress-plan # plan -ShTruncate[truncation=179]|ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F90]|Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] +ShTruncate[truncation=179]|ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F90]|Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] diff --git a/tests/plans/MIR-219-vod2uv-truncation=auto-intgrid=auto-grid=N80.test b/tests/plans/MIR-219-vod2uv-truncation=auto-intgrid=auto-grid=N80.test index b4f937ae0..ad3ea2183 100644 --- a/tests/plans/MIR-219-vod2uv-truncation=auto-intgrid=auto-grid=N80.test +++ b/tests/plans/MIR-219-vod2uv-truncation=auto-intgrid=auto-grid=N80.test @@ -3,4 +3,4 @@ param=vo_d,level=1000 # mir --vod2uv --truncation=auto --intgrid=auto --grid=N80 --dont-compress-plan # plan -ShTruncate[truncation=159]|ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F80]|Gridded2NamedGrid[grid=N80,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] +ShTruncate[truncation=159]|ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F80]|Gridded2NamedGrid[grid=N80,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] diff --git a/tests/plans/MIR-219-vod2uv-truncation=none-intgrid=O400-grid=O200.test b/tests/plans/MIR-219-vod2uv-truncation=none-intgrid=O400-grid=O200.test index 3a42e7fe8..ad10caeb7 100644 --- a/tests/plans/MIR-219-vod2uv-truncation=none-intgrid=O400-grid=O200.test +++ b/tests/plans/MIR-219-vod2uv-truncation=none-intgrid=O400-grid=O200.test @@ -3,4 +3,4 @@ param=vo_d,level=1000 # mir --vod2uv --truncation=none --intgrid=O400 --grid=O200 --dont-compress-plan # plan -ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=O400]|Gridded2NamedGrid[grid=O200,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] +ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=O400]|Gridded2NamedGrid[grid=O200,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] diff --git a/tests/plans/MIR-219-vod2uv-truncation=none-intgrid=auto-grid=1-1.test b/tests/plans/MIR-219-vod2uv-truncation=none-intgrid=auto-grid=1-1.test index 8fd6224fb..fa49ad48e 100644 --- a/tests/plans/MIR-219-vod2uv-truncation=none-intgrid=auto-grid=1-1.test +++ b/tests/plans/MIR-219-vod2uv-truncation=none-intgrid=auto-grid=1-1.test @@ -3,4 +3,4 @@ param=vo_d,level=1000 # mir --vod2uv --truncation=none --intgrid=auto --grid=1/1 --dont-compress-plan # plan -ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F90]|Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] +ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F90]|Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] diff --git a/tests/plans/MIR-219-vod2uv-veryfine-1.test b/tests/plans/MIR-219-vod2uv-veryfine-1.test index a7f6023c3..c4f9796bd 100644 --- a/tests/plans/MIR-219-vod2uv-veryfine-1.test +++ b/tests/plans/MIR-219-vod2uv-veryfine-1.test @@ -4,4 +4,4 @@ param=vo_d,level=1000 # mir --vod2uv --grid=0.1/0.1 --dont-compress-plan # plan -ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F900]|Gridded2RegularLL[increments=Increments[west_east=0.1,south_north=0.1],bbox=BoundingBox[north=90,west=0,south=-90,east=359.9],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] +ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F900]|Gridded2RegularLL[increments=Increments[west_east=0.1,south_north=0.1],bbox=BoundingBox[north=90,west=0,south=-90,east=359.9],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] diff --git a/tests/plans/MIR-219-vod2uv-veryfine-2.test b/tests/plans/MIR-219-vod2uv-veryfine-2.test index 247e5be79..2765fabff 100644 --- a/tests/plans/MIR-219-vod2uv-veryfine-2.test +++ b/tests/plans/MIR-219-vod2uv-veryfine-2.test @@ -4,4 +4,4 @@ param=vo_d,level=1000 # mir --vod2uv --grid=0.01/0.01 --dont-compress-plan # plan -ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F1280]|Gridded2RegularLL[increments=Increments[west_east=0.01,south_north=0.01],bbox=BoundingBox[north=90,west=0,south=-90,east=359.99],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] +ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F1280]|Gridded2RegularLL[increments=Increments[west_east=0.01,south_north=0.01],bbox=BoundingBox[north=90,west=0,south=-90,east=359.99],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] diff --git a/tests/plans/MIR-219-vod2uv.test b/tests/plans/MIR-219-vod2uv.test index 5810da6e7..1156e265c 100644 --- a/tests/plans/MIR-219-vod2uv.test +++ b/tests/plans/MIR-219-vod2uv.test @@ -3,4 +3,4 @@ param=vo_d,level=1000 # mir --vod2uv --grid=1/1 --dont-compress-plan # plan -ShTruncate[truncation=179]|ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F90]|Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] +ShTruncate[truncation=179]|ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F90]|Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] diff --git a/tests/plans/MIR-239-gridname=O64.test b/tests/plans/MIR-239-gridname=O64.test index 3d2437fba..10d36c8dd 100644 --- a/tests/plans/MIR-239-gridname=O64.test +++ b/tests/plans/MIR-239-gridname=O64.test @@ -4,4 +4,4 @@ param=t,level=1000 # mir --intgrid=auto --grid=O64 --dont-compress-plan # plan -ShTruncate[truncation=127]|ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F64]|Gridded2NamedGrid[grid=O64,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] +ShTruncate[truncation=127]|ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F64]|Gridded2NamedGrid[grid=O64,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] diff --git a/tests/plans/MIR-239-gridname=O640.test b/tests/plans/MIR-239-gridname=O640.test index 2baffc45d..0bc2555ba 100644 --- a/tests/plans/MIR-239-gridname=O640.test +++ b/tests/plans/MIR-239-gridname=O640.test @@ -4,4 +4,4 @@ param=t,level=1000 # mir --intgrid=auto --grid=O640 --dont-compress-plan # plan -ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F640]|Gridded2NamedGrid[grid=O640,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] +ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F640]|Gridded2NamedGrid[grid=O640,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] diff --git a/tests/plans/MIR-294.uv2uv=false.test b/tests/plans/MIR-294.uv2uv=false.test index 023edd576..fd6d46997 100644 --- a/tests/plans/MIR-294.uv2uv=false.test +++ b/tests/plans/MIR-294.uv2uv=false.test @@ -3,5 +3,5 @@ param=u_v,level=1000,resol=20 # mir --grid=1/1 --rotation=-89/1 --uv2uv=false # plan -ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F21]|Gridded2RotatedLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],rotation=Rotation[south_pole_latitude=-89,south_pole_longitude=1,south_pole_rotation_angle=0],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|AdjustWindsScaleCosLatitude[]|AdjustWindsDirections[rotation=Rotation[south_pole_latitude=-89,south_pole_longitude=1,south_pole_rotation_angle=0]]|Save[packing=simple,output=...] -ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F21]|Gridded2RotatedLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],rotation=Rotation[south_pole_latitude=-89,south_pole_longitude=1,south_pole_rotation_angle=0],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|AdjustWindsScaleCosLatitude[]|AdjustWindsDirections[rotation=Rotation[south_pole_latitude=-89,south_pole_longitude=1,south_pole_rotation_angle=0]]|Save[packing=simple,output=...] +ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F21]|Gridded2RotatedLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],rotation=Rotation[south_pole_latitude=-89,south_pole_longitude=1,south_pole_rotation_angle=0],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|AdjustWindsScaleCosLatitude[]|AdjustWindsDirections[rotation=Rotation[south_pole_latitude=-89,south_pole_longitude=1,south_pole_rotation_angle=0]]|Save[packing=simple,output=...] +ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F21]|Gridded2RotatedLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],rotation=Rotation[south_pole_latitude=-89,south_pole_longitude=1,south_pole_rotation_angle=0],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|AdjustWindsScaleCosLatitude[]|AdjustWindsDirections[rotation=Rotation[south_pole_latitude=-89,south_pole_longitude=1,south_pole_rotation_angle=0]]|Save[packing=simple,output=...] diff --git a/tests/plans/MIR-294.uv2uv=true.test b/tests/plans/MIR-294.uv2uv=true.test index 9206bbe85..c0366305a 100644 --- a/tests/plans/MIR-294.uv2uv=true.test +++ b/tests/plans/MIR-294.uv2uv=true.test @@ -3,4 +3,4 @@ param=u_v,level=1000,resol=20 # mir --grid=1/1 --rotation=-89/1 --uv2uv=true # plan -ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F21]|Gridded2RotatedLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],rotation=Rotation[south_pole_latitude=-89,south_pole_longitude=1,south_pole_rotation_angle=0],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|AdjustWindsScaleCosLatitude[]|AdjustWindsDirections[rotation=Rotation[south_pole_latitude=-89,south_pole_longitude=1,south_pole_rotation_angle=0]]|Save[packing=simple,output=...] +ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F21]|Gridded2RotatedLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],rotation=Rotation[south_pole_latitude=-89,south_pole_longitude=1,south_pole_rotation_angle=0],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|AdjustWindsScaleCosLatitude[]|AdjustWindsDirections[rotation=Rotation[south_pole_latitude=-89,south_pole_longitude=1,south_pole_rotation_angle=0]]|Save[packing=simple,output=...] diff --git a/tests/plans/MIR-294.vod2uv=false.test b/tests/plans/MIR-294.vod2uv=false.test index 15ee4f957..b31f01c46 100644 --- a/tests/plans/MIR-294.vod2uv=false.test +++ b/tests/plans/MIR-294.vod2uv=false.test @@ -3,5 +3,5 @@ param=vo_d,level=1000,resol=20 # mir --grid=1/1 --rotation=-89/1 --vod2uv=false # plan -ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F21]|Gridded2RotatedLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],rotation=Rotation[south_pole_latitude=-89,south_pole_longitude=1,south_pole_rotation_angle=0],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] -ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F21]|Gridded2RotatedLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],rotation=Rotation[south_pole_latitude=-89,south_pole_longitude=1,south_pole_rotation_angle=0],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] +ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F21]|Gridded2RotatedLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],rotation=Rotation[south_pole_latitude=-89,south_pole_longitude=1,south_pole_rotation_angle=0],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] +ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F21]|Gridded2RotatedLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],rotation=Rotation[south_pole_latitude=-89,south_pole_longitude=1,south_pole_rotation_angle=0],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] diff --git a/tests/plans/MIR-294.vod2uv=true.test b/tests/plans/MIR-294.vod2uv=true.test index 6dff41f5a..b9b446ab4 100644 --- a/tests/plans/MIR-294.vod2uv=true.test +++ b/tests/plans/MIR-294.vod2uv=true.test @@ -3,4 +3,4 @@ param=vo_d,level=1000,resol=20 # mir --grid=1/1 --rotation=-89/1 --vod2uv=true # plan -ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F21]|Gridded2RotatedLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],rotation=Rotation[south_pole_latitude=-89,south_pole_longitude=1,south_pole_rotation_angle=0],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|AdjustWindsDirections[rotation=Rotation[south_pole_latitude=-89,south_pole_longitude=1,south_pole_rotation_angle=0]]|Save[packing=simple,output=...] +ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F21]|Gridded2RotatedLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],rotation=Rotation[south_pole_latitude=-89,south_pole_longitude=1,south_pole_rotation_angle=0],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|AdjustWindsDirections[rotation=Rotation[south_pole_latitude=-89,south_pole_longitude=1,south_pole_rotation_angle=0]]|Save[packing=simple,output=...] diff --git a/tests/plans/MIR-309.001.test b/tests/plans/MIR-309.001.test index bc668294b..6e135aa0a 100644 --- a/tests/plans/MIR-309.001.test +++ b/tests/plans/MIR-309.001.test @@ -3,4 +3,4 @@ stream=wave,param=swh,domain=m # mir --area=28/-77/3/-43 --globalise --grid=1/1 # plan -Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=BoundingBox[north=28,west=-77,south=3,east=-43],lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] +Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=BoundingBox[north=28,west=-77,south=3,east=-43],lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] diff --git a/tests/plans/MIR-309.002.test b/tests/plans/MIR-309.002.test index 87eeccd96..ad358d9f4 100644 --- a/tests/plans/MIR-309.002.test +++ b/tests/plans/MIR-309.002.test @@ -3,4 +3,4 @@ stream=wave,param=swh,domain=m # mir --area=28/-77/3/-43 --globalise --grid=1/1 --dont-compress-plan # plan -Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|GlobaliseFilter[]|AreaCropper[bbox=BoundingBox[north=28,west=-77,south=3,east=-43]]|Save[output=...] +Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|GlobaliseFilter[]|AreaCropper[bbox=BoundingBox[north=28,west=-77,south=3,east=-43]]|Save[output=...] diff --git a/tests/plans/MIR-323.002.test b/tests/plans/MIR-323.002.test index 867a3cbcf..923da4548 100644 --- a/tests/plans/MIR-323.002.test +++ b/tests/plans/MIR-323.002.test @@ -3,4 +3,4 @@ stream=espd,param=ci,class=e2,date=19600201,expver=0003,levtype=sfc,number=0 # mir --grid=1/0.25 # plan -Gridded2RegularLL[increments=Increments[west_east=1,south_north=0.25],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] +Gridded2RegularLL[increments=Increments[west_east=1,south_north=0.25],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] diff --git a/tests/plans/MIR-361.001.test b/tests/plans/MIR-361.001.test index 8321b6d27..d44ffa4c2 100644 --- a/tests/plans/MIR-361.001.test +++ b/tests/plans/MIR-361.001.test @@ -3,4 +3,4 @@ MIR-340.grib # mir --area=50/-21/25/6 # plan -Gridded2RegularLL[increments=Increments[west_east=0.35,south_north=0.35],bbox=BoundingBox[north=89.75,west=-21,south=-89.8,east=338.8],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=BoundingBox[north=50,west=-21,south=25,east=6],lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] +Gridded2RegularLL[increments=Increments[west_east=0.35,south_north=0.35],bbox=BoundingBox[north=89.75,west=-21,south=-89.8,east=338.8],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=BoundingBox[north=50,west=-21,south=25,east=6],lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] diff --git a/tests/plans/MIR-361.003.test b/tests/plans/MIR-361.003.test index a805ef140..521881cd8 100644 --- a/tests/plans/MIR-361.003.test +++ b/tests/plans/MIR-361.003.test @@ -3,4 +3,4 @@ MIR-360.grib # mir --area=85/-80/25/40 # plan -Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=BoundingBox[north=85,west=-80,south=25,east=40],lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] +Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=BoundingBox[north=85,west=-80,south=25,east=40],lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] diff --git a/tests/plans/MIR-361.007.test b/tests/plans/MIR-361.007.test index 3e1c65d47..b30f90bf2 100644 --- a/tests/plans/MIR-361.007.test +++ b/tests/plans/MIR-361.007.test @@ -3,4 +3,4 @@ regular_ll.2-2.grib1 # mir --rotation=30/30 # plan -Gridded2RotatedLL[increments=Increments[west_east=2,south_north=2],bbox=BoundingBox[north=90,west=0,south=-90,east=358],rotation=Rotation[south_pole_latitude=30,south_pole_longitude=30,south_pole_rotation_angle=0],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] +Gridded2RotatedLL[increments=Increments[west_east=2,south_north=2],bbox=BoundingBox[north=90,west=0,south=-90,east=358],rotation=Rotation[south_pole_latitude=30,south_pole_longitude=30,south_pole_rotation_angle=0],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] diff --git a/tests/plans/MIR-361.010.test b/tests/plans/MIR-361.010.test index fbf621fba..28c5156f5 100644 --- a/tests/plans/MIR-361.010.test +++ b/tests/plans/MIR-361.010.test @@ -3,4 +3,4 @@ rotated_ll.3-3.grib1 # mir --rotation=10/10 # plan -Gridded2RotatedLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],rotation=Rotation[south_pole_latitude=10,south_pole_longitude=10,south_pole_rotation_angle=0],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] +Gridded2RotatedLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],rotation=Rotation[south_pole_latitude=10,south_pole_longitude=10,south_pole_rotation_angle=0],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] diff --git a/tests/plans/MIR-361.011.test b/tests/plans/MIR-361.011.test index 82547850e..2e0527d75 100644 --- a/tests/plans/MIR-361.011.test +++ b/tests/plans/MIR-361.011.test @@ -3,4 +3,4 @@ MIR-361.grib # mir --area=89.5/-179.5/-89.5/179.5 # plan -Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=89.5,west=0.5,south=-89.5,east=359.5],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=BoundingBox[north=89.5,west=-179.5,south=-89.5,east=179.5],lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] +Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=89.5,west=0.5,south=-89.5,east=359.5],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=BoundingBox[north=89.5,west=-179.5,south=-89.5,east=179.5],lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] diff --git a/tests/plans/MIR-361.012.test b/tests/plans/MIR-361.012.test index 5e07eb023..ae819cc12 100644 --- a/tests/plans/MIR-361.012.test +++ b/tests/plans/MIR-361.012.test @@ -3,4 +3,4 @@ MIR-361.grib # mir --grid=1/1 --area=89.5/-179.5/-89.5/179.5 # plan -Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=89.5,west=0.5,south=-89.5,east=359.5],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=BoundingBox[north=89.5,west=-179.5,south=-89.5,east=179.5],lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] +Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=89.5,west=0.5,south=-89.5,east=359.5],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=BoundingBox[north=89.5,west=-179.5,south=-89.5,east=179.5],lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] diff --git a/tests/plans/MIR-361.013.test b/tests/plans/MIR-361.013.test index e2fecc2f5..e095ca75e 100644 --- a/tests/plans/MIR-361.013.test +++ b/tests/plans/MIR-361.013.test @@ -3,4 +3,4 @@ regular_ll.2-4.grib1 # mir --grid=2/2 # plan -Gridded2RegularLL[increments=Increments[west_east=2,south_north=2],bbox=BoundingBox[north=90,west=0,south=-90,east=358],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] +Gridded2RegularLL[increments=Increments[west_east=2,south_north=2],bbox=BoundingBox[north=90,west=0,south=-90,east=358],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] diff --git a/tests/plans/MIR-361.015.test b/tests/plans/MIR-361.015.test index f989e1239..433b35c3b 100644 --- a/tests/plans/MIR-361.015.test +++ b/tests/plans/MIR-361.015.test @@ -3,4 +3,4 @@ regular_ll.2-4.grib1 # mir --grid=4/4 # plan -Gridded2RegularLL[increments=Increments[west_east=4,south_north=4],bbox=BoundingBox[north=88,west=0,south=-88,east=356],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] +Gridded2RegularLL[increments=Increments[west_east=4,south_north=4],bbox=BoundingBox[north=88,west=0,south=-88,east=356],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] diff --git a/tests/plans/MIR-380.O16-to-laea.test b/tests/plans/MIR-380.O16-to-laea.test index 2fd96fc24..be64e0ca7 100644 --- a/tests/plans/MIR-380.O16-to-laea.test +++ b/tests/plans/MIR-380.O16-to-laea.test @@ -3,4 +3,4 @@ param=2t,levtype=sfc,grid=O16 # mir --grid=gridType=lambert_azimuthal_equal_area\;grid=5000./5000.\;standardParallelInDegrees=52.\;centralLongitudeInDegrees=10.\;latitudeOfFirstGridPointInDegrees=66.982143\;longitudeOfFirstGridPointInDegrees=-35.034024\;Ni=1000\;Nj=950\;gaussianNumber=1280 # plan -Gridded2TypedGrid[grid={"Ni":"1000","Nj":"950","centralLongitudeInDegrees":"10.","gaussianNumber":"1280","grid":"5000./5000.","gridType":"lambert_azimuthal_equal_area","latitudeOfFirstGridPointInDegrees":"66.982143","longitudeOfFirstGridPointInDegrees":"-35.034024","standardParallelInDegrees":"52."},interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] +Gridded2TypedGrid[grid={"Ni":"1000","Nj":"950","centralLongitudeInDegrees":"10.","gaussianNumber":"1280","grid":"5000./5000.","gridType":"lambert_azimuthal_equal_area","latitudeOfFirstGridPointInDegrees":"66.982143","longitudeOfFirstGridPointInDegrees":"-35.034024","standardParallelInDegrees":"52."},interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] diff --git a/tests/plans/MIR-380.regular_ll-to-laea.test b/tests/plans/MIR-380.regular_ll-to-laea.test index ccd977616..3ab0e2299 100644 --- a/tests/plans/MIR-380.regular_ll-to-laea.test +++ b/tests/plans/MIR-380.regular_ll-to-laea.test @@ -3,4 +3,4 @@ regular_ll.2-2.grib2 # mir --grid=gridType=lambert_azimuthal_equal_area\;grid=5000./5000.\;standardParallelInDegrees=52.\;centralLongitudeInDegrees=10.\;latitudeOfFirstGridPointInDegrees=66.982143\;longitudeOfFirstGridPointInDegrees=-35.034024\;Ni=1000\;Nj=950\;gaussianNumber=1280 # plan -Gridded2TypedGrid[grid={"Ni":"1000","Nj":"950","centralLongitudeInDegrees":"10.","gaussianNumber":"1280","grid":"5000./5000.","gridType":"lambert_azimuthal_equal_area","latitudeOfFirstGridPointInDegrees":"66.982143","longitudeOfFirstGridPointInDegrees":"-35.034024","standardParallelInDegrees":"52."},interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] +Gridded2TypedGrid[grid={"Ni":"1000","Nj":"950","centralLongitudeInDegrees":"10.","gaussianNumber":"1280","grid":"5000./5000.","gridType":"lambert_azimuthal_equal_area","latitudeOfFirstGridPointInDegrees":"66.982143","longitudeOfFirstGridPointInDegrees":"-35.034024","standardParallelInDegrees":"52."},interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] diff --git a/tests/plans/MIR-380.sh-to-laea.test b/tests/plans/MIR-380.sh-to-laea.test index 5acecaf6b..68af9ae57 100644 --- a/tests/plans/MIR-380.sh-to-laea.test +++ b/tests/plans/MIR-380.sh-to-laea.test @@ -3,4 +3,4 @@ param=t,level=1000,resol=20 # mir --grid=gridType=lambert_azimuthal_equal_area\;grid=5000./5000.\;standardParallelInDegrees=52.\;centralLongitudeInDegrees=10.\;latitudeOfFirstGridPointInDegrees=66.982143\;longitudeOfFirstGridPointInDegrees=-35.034024\;Ni=1000\;Nj=950\;gaussianNumber=1280 # plan -ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F21]|Gridded2TypedGrid[grid={"Ni":"1000","Nj":"950","centralLongitudeInDegrees":"10.","gaussianNumber":"1280","grid":"5000./5000.","gridType":"lambert_azimuthal_equal_area","latitudeOfFirstGridPointInDegrees":"66.982143","longitudeOfFirstGridPointInDegrees":"-35.034024","standardParallelInDegrees":"52."},interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] +ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F21]|Gridded2TypedGrid[grid={"Ni":"1000","Nj":"950","centralLongitudeInDegrees":"10.","gaussianNumber":"1280","grid":"5000./5000.","gridType":"lambert_azimuthal_equal_area","latitudeOfFirstGridPointInDegrees":"66.982143","longitudeOfFirstGridPointInDegrees":"-35.034024","standardParallelInDegrees":"52."},interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] diff --git a/tests/plans/MIR-403.test b/tests/plans/MIR-403.test index 38252648b..2cbfeb590 100644 --- a/tests/plans/MIR-403.test +++ b/tests/plans/MIR-403.test @@ -3,4 +3,4 @@ param=t,level=1000 # mir --truncation=none --grid=0.25/0.25 --rotation=-40/22 --area=73.5/-27/33/45 # plan -ShToNamedGrid[type=local,cropping=BoundingBox[north=90,west=0,south=50.34,east=360],options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F360]|Gridded2RotatedLL[increments=Increments[west_east=0.25,south_north=0.25],bbox=BoundingBox[north=90,west=0,south=-90,east=359.75],rotation=Rotation[south_pole_latitude=-40,south_pole_longitude=22,south_pole_rotation_angle=0],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=BoundingBox[north=73.5,west=-27,south=33,east=45],lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] +ShToNamedGrid[type=local,cropping=BoundingBox[north=90,west=0,south=50.34,east=360],options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F360]|Gridded2RotatedLL[increments=Increments[west_east=0.25,south_north=0.25],bbox=BoundingBox[north=90,west=0,south=-90,east=359.75],rotation=Rotation[south_pole_latitude=-40,south_pole_longitude=22,south_pole_rotation_angle=0],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=BoundingBox[north=73.5,west=-27,south=33,east=45],lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] diff --git a/tests/plans/MIR-454.001.test.atlas-orca b/tests/plans/MIR-454.001.test.atlas-orca index 8338e9ed2..faf063a6f 100644 --- a/tests/plans/MIR-454.001.test.atlas-orca +++ b/tests/plans/MIR-454.001.test.atlas-orca @@ -3,6 +3,6 @@ ORCA.grib2 # mir --grid=eorca1_u # plan -Gridded2NamedGrid[grid=eORCA1_U,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] +Gridded2NamedGrid[grid=eORCA1_U,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] Copy[] -Gridded2NamedGrid[grid=eORCA1_U,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] +Gridded2NamedGrid[grid=eORCA1_U,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] diff --git a/tests/plans/MIR-454.003.test.atlas-orca b/tests/plans/MIR-454.003.test.atlas-orca index 8b2fbfa0c..f9980e07e 100644 --- a/tests/plans/MIR-454.003.test.atlas-orca +++ b/tests/plans/MIR-454.003.test.atlas-orca @@ -3,6 +3,6 @@ ORCA.grib2 # mir --grid=eorca2 # plan -Gridded2NamedGrid[grid=eORCA2_T,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] -Gridded2NamedGrid[grid=eORCA2_U,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] -Gridded2NamedGrid[grid=eORCA2_V,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] +Gridded2NamedGrid[grid=eORCA2_T,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] +Gridded2NamedGrid[grid=eORCA2_U,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] +Gridded2NamedGrid[grid=eORCA2_V,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] diff --git a/tests/plans/MIR-459.nabla=scalar-gradient.param=z.sh.test b/tests/plans/MIR-459.nabla=scalar-gradient.param=z.sh.test index 640961a35..74506dcdc 100644 --- a/tests/plans/MIR-459.nabla=scalar-gradient.param=z.sh.test +++ b/tests/plans/MIR-459.nabla=scalar-gradient.param=z.sh.test @@ -3,5 +3,5 @@ date=20200308,level=1000,truncation=20,param=z # mir --grid=1/1 --nabla=scalar-gradient # plan -ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F21]|Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|ScalarGradient[meshGeneratorParameters=...]|Save[packing=simple,output=...] +ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F21]|Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|ScalarGradient[meshGeneratorParameters=...]|Save[packing=simple,output=...] diff --git a/tests/plans/MIR-459.nabla=scalar-laplacian.param=z.sh.test b/tests/plans/MIR-459.nabla=scalar-laplacian.param=z.sh.test index 204479525..ba52b4dbc 100644 --- a/tests/plans/MIR-459.nabla=scalar-laplacian.param=z.sh.test +++ b/tests/plans/MIR-459.nabla=scalar-laplacian.param=z.sh.test @@ -3,5 +3,5 @@ date=20200308,level=1000,truncation=20,param=z # mir --grid=1/1 --nabla=scalar-laplacian # plan -ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F21]|Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|ScalarLaplacian[meshGeneratorParameters=...]|Save[packing=simple,output=...] +ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F21]|Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|ScalarLaplacian[meshGeneratorParameters=...]|Save[packing=simple,output=...] diff --git a/tests/plans/MIR-459.nabla=uv-divergence.param=vo_d.test b/tests/plans/MIR-459.nabla=uv-divergence.param=vo_d.test index fc608f878..aad5d94e2 100644 --- a/tests/plans/MIR-459.nabla=uv-divergence.param=vo_d.test +++ b/tests/plans/MIR-459.nabla=uv-divergence.param=vo_d.test @@ -3,5 +3,5 @@ date=20200308,level=1000,truncation=20,param=vo_d # mir --vod2uv --grid=1/1 --nabla=uv-divergence # plan -ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F21]|Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|UVDivergence[meshGeneratorParameters=...]|Save[packing=simple,output=...] +ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F21]|Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|UVDivergence[meshGeneratorParameters=...]|Save[packing=simple,output=...] diff --git a/tests/plans/MIR-459.nabla=uv-gradient.param=vo_d.test b/tests/plans/MIR-459.nabla=uv-gradient.param=vo_d.test index 9826fd690..a257efb8a 100644 --- a/tests/plans/MIR-459.nabla=uv-gradient.param=vo_d.test +++ b/tests/plans/MIR-459.nabla=uv-gradient.param=vo_d.test @@ -3,5 +3,5 @@ date=20200308,level=1000,truncation=20,param=vo_d # mir --vod2uv --grid=1/1 --nabla=uv-gradient # plan -ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F21]|Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|UVGradient[meshGeneratorParameters=...]|Save[packing=simple,output=...] +ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F21]|Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|UVGradient[meshGeneratorParameters=...]|Save[packing=simple,output=...] diff --git a/tests/plans/MIR-459.nabla=uv-vorticity.param=vo_d.test b/tests/plans/MIR-459.nabla=uv-vorticity.param=vo_d.test index dc75f357e..5b134d80f 100644 --- a/tests/plans/MIR-459.nabla=uv-vorticity.param=vo_d.test +++ b/tests/plans/MIR-459.nabla=uv-vorticity.param=vo_d.test @@ -3,5 +3,5 @@ date=20200308,level=1000,truncation=20,param=vo_d # mir --vod2uv --grid=1/1 --nabla=uv-vorticity # plan -ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F21]|Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|UVVorticity[meshGeneratorParameters=...]|Save[packing=simple,output=...] +ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F21]|Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|UVVorticity[meshGeneratorParameters=...]|Save[packing=simple,output=...] diff --git a/tests/plans/MIR-474.O16-to-lambert.test b/tests/plans/MIR-474.O16-to-lambert.test index 63fadf5e1..349cd5239 100644 --- a/tests/plans/MIR-474.O16-to-lambert.test +++ b/tests/plans/MIR-474.O16-to-lambert.test @@ -3,4 +3,4 @@ param=2t,levtype=sfc,grid=O16 # mir --grid=gridType=lambert\;grid=2500./2500.\;writeLaDInDegrees=0\;LaDInDegrees=45.8\;LoVInDegrees=2.\;latitudeOfFirstGridPointInDegrees=37.333\;longitudeOfFirstGridPointInDegrees=-8.354\;Ni=1000\;Nj=950\;gaussianNumber=1280 # plan -Gridded2TypedGrid[grid={"LaDInDegrees":"45.8","LoVInDegrees":"2.","Ni":"1000","Nj":"950","gaussianNumber":"1280","grid":"2500./2500.","gridType":"lambert","latitudeOfFirstGridPointInDegrees":"37.333","longitudeOfFirstGridPointInDegrees":"-8.354","writeLaDInDegrees":"0"},interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] +Gridded2TypedGrid[grid={"LaDInDegrees":"45.8","LoVInDegrees":"2.","Ni":"1000","Nj":"950","gaussianNumber":"1280","grid":"2500./2500.","gridType":"lambert","latitudeOfFirstGridPointInDegrees":"37.333","longitudeOfFirstGridPointInDegrees":"-8.354","writeLaDInDegrees":"0"},interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] diff --git a/tests/plans/MIR-474.regular_ll-to-lambert.test b/tests/plans/MIR-474.regular_ll-to-lambert.test index 1e03d9e40..0789ec487 100644 --- a/tests/plans/MIR-474.regular_ll-to-lambert.test +++ b/tests/plans/MIR-474.regular_ll-to-lambert.test @@ -3,4 +3,4 @@ regular_ll.2-2.grib2 # mir --grid=gridType=lambert\;grid=2500./2500.\;writeLaDInDegrees=1\;LaDInDegrees=45.8\;LoVInDegrees=2.\;latitudeOfFirstGridPointInDegrees=37.333\;longitudeOfFirstGridPointInDegrees=-8.354\;Ni=1000\;Nj=950\;gaussianNumber=1280 # plan -Gridded2TypedGrid[grid={"LaDInDegrees":"45.8","LoVInDegrees":"2.","Ni":"1000","Nj":"950","gaussianNumber":"1280","grid":"2500./2500.","gridType":"lambert","latitudeOfFirstGridPointInDegrees":"37.333","longitudeOfFirstGridPointInDegrees":"-8.354","writeLaDInDegrees":"1"},interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] +Gridded2TypedGrid[grid={"LaDInDegrees":"45.8","LoVInDegrees":"2.","Ni":"1000","Nj":"950","gaussianNumber":"1280","grid":"2500./2500.","gridType":"lambert","latitudeOfFirstGridPointInDegrees":"37.333","longitudeOfFirstGridPointInDegrees":"-8.354","writeLaDInDegrees":"1"},interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] diff --git a/tests/plans/MIR-474.sh-to-lambert.test b/tests/plans/MIR-474.sh-to-lambert.test index fda3385d0..1ae3024df 100644 --- a/tests/plans/MIR-474.sh-to-lambert.test +++ b/tests/plans/MIR-474.sh-to-lambert.test @@ -3,4 +3,4 @@ param=t,level=1000,resol=20 # mir --grid=gridType=lambert\;grid=2500./2500.\;writeLaDInDegrees=0\;LaDInDegrees=45.8\;LoVInDegrees=2.\;latitudeOfFirstGridPointInDegrees=37.333\;longitudeOfFirstGridPointInDegrees=-8.354\;Ni=1000\;Nj=950\;gaussianNumber=1280 # plan -ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F21]|Gridded2TypedGrid[grid={"LaDInDegrees":"45.8","LoVInDegrees":"2.","Ni":"1000","Nj":"950","gaussianNumber":"1280","grid":"2500./2500.","gridType":"lambert","latitudeOfFirstGridPointInDegrees":"37.333","longitudeOfFirstGridPointInDegrees":"-8.354","writeLaDInDegrees":"0"},interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] +ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F21]|Gridded2TypedGrid[grid={"LaDInDegrees":"45.8","LoVInDegrees":"2.","Ni":"1000","Nj":"950","gaussianNumber":"1280","grid":"2500./2500.","gridType":"lambert","latitudeOfFirstGridPointInDegrees":"37.333","longitudeOfFirstGridPointInDegrees":"-8.354","writeLaDInDegrees":"0"},interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] diff --git a/tests/plans/MIR-487.004.test b/tests/plans/MIR-487.004.test index 19746574d..1115394fa 100644 --- a/tests/plans/MIR-487.004.test +++ b/tests/plans/MIR-487.004.test @@ -3,4 +3,4 @@ stream=wave,param=2dfd,direction=1,frequency=1 # mir --accuracy=10 --grid=1/1 # plan -Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=nearest-neighbour,method=KNearestNeighbours[nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,nearestMethod=NearestNeighbourWithLowestIndex[nclosest=4],distanceWeighting=InverseDistanceWeightingSquared[]]]|Save[accuracy=10,output=...] +Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=nearest-neighbour,method=KNearestNeighbours[nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,nearestMethod=NearestNeighbourWithLowestIndex[nclosest=4],distanceWeighting=InverseDistanceWeightingSquared[]]]|Save[accuracy=10,output=...] diff --git a/tests/plans/MIR-487.006.test b/tests/plans/MIR-487.006.test index 9b3c13649..4f60b92ff 100644 --- a/tests/plans/MIR-487.006.test +++ b/tests/plans/MIR-487.006.test @@ -3,4 +3,4 @@ stream=wave,param=2dfd,direction=1,frequency=1 # mir --packing=ieee --grid=1/1 # plan -Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=nearest-neighbour,method=KNearestNeighbours[nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,nearestMethod=NearestNeighbourWithLowestIndex[nclosest=4],distanceWeighting=InverseDistanceWeightingSquared[]]]|Save[packing=ieee,precision=1,output=...] +Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=nearest-neighbour,method=KNearestNeighbours[nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,nearestMethod=NearestNeighbourWithLowestIndex[nclosest=4],distanceWeighting=InverseDistanceWeightingSquared[]]]|Save[packing=ieee,precision=1,output=...] diff --git a/tests/plans/MIR-497.001.test b/tests/plans/MIR-497.001.test index ff4f12954..391b1bd22 100644 --- a/tests/plans/MIR-497.001.test +++ b/tests/plans/MIR-497.001.test @@ -3,4 +3,4 @@ param=t,level=1000 # mir --intgrid=source --grid=O80 # plan -ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=O1280]|Gridded2NamedGrid[grid=O80,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] +ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=O1280]|Gridded2NamedGrid[grid=O80,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] diff --git a/tests/plans/MIR-497.002.test b/tests/plans/MIR-497.002.test index 0095ce670..7eb022c92 100644 --- a/tests/plans/MIR-497.002.test +++ b/tests/plans/MIR-497.002.test @@ -3,4 +3,4 @@ param=t,level=1000 # mir --intgrid=source --truncation=159 --grid=O80 # plan -ShTruncate[truncation=159]|ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=O160]|Gridded2NamedGrid[grid=O80,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] +ShTruncate[truncation=159]|ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=O160]|Gridded2NamedGrid[grid=O80,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] diff --git a/tests/plans/MIR-497.003.test b/tests/plans/MIR-497.003.test index 5c80d8edd..8aefb9a7f 100644 --- a/tests/plans/MIR-497.003.test +++ b/tests/plans/MIR-497.003.test @@ -3,4 +3,4 @@ param=t,level=1000 # mir --intgrid=source --truncation=auto --grid=O80 # plan -ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=O1280]|Gridded2NamedGrid[grid=O80,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] +ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=O1280]|Gridded2NamedGrid[grid=O80,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] diff --git a/tests/plans/MIR-510.001.test b/tests/plans/MIR-510.001.test index fbcc529cb..57147b37a 100644 --- a/tests/plans/MIR-510.001.test +++ b/tests/plans/MIR-510.001.test @@ -3,4 +3,4 @@ gridType=reduced_gg,gridName=O32,shortName=msl.grib1 # mir --grid=O64 # plan -Gridded2NamedGrid[grid=O64,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] +Gridded2NamedGrid[grid=O64,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] diff --git a/tests/plans/MIR-510.002.test b/tests/plans/MIR-510.002.test index d3c852215..b3436d19c 100644 --- a/tests/plans/MIR-510.002.test +++ b/tests/plans/MIR-510.002.test @@ -3,4 +3,4 @@ gridType=reduced_gg,gridName=O32,shortName=msl.grib1 # mir --grid=o64 # plan -Gridded2NamedGrid[grid=O64,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] +Gridded2NamedGrid[grid=O64,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] diff --git a/tests/plans/MIR-544.test b/tests/plans/MIR-544.test index 089913451..4f407910b 100644 --- a/tests/plans/MIR-544.test +++ b/tests/plans/MIR-544.test @@ -3,4 +3,4 @@ param=2t,levtype=sfc,grid=O16 # Mir tool options --grid=2/2 --interpolation=k-nearest-neighbours --distance-weighting=pseudo-laplace --nearest-method=nclosest-or-nearest # plan -Gridded2RegularLL[increments=Increments[west_east=2,south_north=2],bbox=BoundingBox[north=90,west=0,south=-90,east=358],interpolation=k-nearest-neighbours,method=KNearestNeighbours[nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,nearestMethod=NClosestOrNearest[nclosest=4,distanceTolerance=1],distanceWeighting=PseudoLaplace[]]]|Save[output=...] +Gridded2RegularLL[increments=Increments[west_east=2,south_north=2],bbox=BoundingBox[north=90,west=0,south=-90,east=358],interpolation=k-nearest-neighbours,method=KNearestNeighbours[nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,nearestMethod=NClosestOrNearest[nclosest=4,distanceTolerance=1],distanceWeighting=PseudoLaplace[]]]|Save[output=...] diff --git a/tests/plans/MIR-592.001.test b/tests/plans/MIR-592.001.test index f10c04790..cfb9f46b8 100644 --- a/tests/plans/MIR-592.001.test +++ b/tests/plans/MIR-592.001.test @@ -3,5 +3,5 @@ param=vo_d,level=1000,resol=20 # mir --grid=3/3 --interpolation=linear --vod2uv=false # plan -ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F21]|Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] -ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F21]|Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] +ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F21]|Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] +ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F21]|Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] diff --git a/tests/plans/MIR-592.002.test b/tests/plans/MIR-592.002.test index 0fc53ba64..d0878a158 100644 --- a/tests/plans/MIR-592.002.test +++ b/tests/plans/MIR-592.002.test @@ -3,4 +3,4 @@ param=vo_d,level=1000,resol=20 # mir --grid=3/3 --interpolation=linear --vod2uv # plan -ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F21]|Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] +ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F21]|Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] diff --git a/tests/plans/MIR-592.003.test b/tests/plans/MIR-592.003.test index e18af792c..85cb40b32 100644 --- a/tests/plans/MIR-592.003.test +++ b/tests/plans/MIR-592.003.test @@ -3,5 +3,5 @@ param=u_v,level=1000,resol=20 # mir --grid=3/3 --interpolation=linear # plan -ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F21]|Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|AdjustWindsScaleCosLatitude[]|Save[packing=simple,output=...] -ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F21]|Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|AdjustWindsScaleCosLatitude[]|Save[packing=simple,output=...] +ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F21]|Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|AdjustWindsScaleCosLatitude[]|Save[packing=simple,output=...] +ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F21]|Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|AdjustWindsScaleCosLatitude[]|Save[packing=simple,output=...] diff --git a/tests/plans/MIR-592.004.test b/tests/plans/MIR-592.004.test index 75438072f..5aff6941b 100644 --- a/tests/plans/MIR-592.004.test +++ b/tests/plans/MIR-592.004.test @@ -3,4 +3,4 @@ param=t,level=1000,resol=20 # mir --grid=3/3 --interpolation=linear # plan -ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F21]|Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] +ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F21]|Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] diff --git a/tests/plans/MIR-592.005.test b/tests/plans/MIR-592.005.test index c461b35cb..3d385a349 100644 --- a/tests/plans/MIR-592.005.test +++ b/tests/plans/MIR-592.005.test @@ -3,5 +3,5 @@ date=20200308,level=1000,grid=O80,param=u_v # mir --grid=3/3 --interpolation=linear # plan -Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|Save[output=...] -Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|Save[output=...] +Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|Save[output=...] +Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|Save[output=...] diff --git a/tests/plans/MIR-632.001.test b/tests/plans/MIR-632.001.test index c89f51a39..38f034ed0 100644 --- a/tests/plans/MIR-632.001.test +++ b/tests/plans/MIR-632.001.test @@ -3,4 +3,4 @@ regular_ll.2-2.grib2 # mir --grid=H2 # plan -Gridded2NamedGrid[grid=H2,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] +Gridded2NamedGrid[grid=H2,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] diff --git a/tests/plans/MIR-632.002.test b/tests/plans/MIR-632.002.test index 520a6ff0c..cd1b5d603 100644 --- a/tests/plans/MIR-632.002.test +++ b/tests/plans/MIR-632.002.test @@ -3,4 +3,4 @@ gridType=healpix,Nside=32,orderingConvention=ring.grib2 # mir --grid=2/2 # plan -Gridded2RegularLL[increments=Increments[west_east=2,south_north=2],bbox=BoundingBox[north=90,west=0,south=-90,east=358],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] +Gridded2RegularLL[increments=Increments[west_east=2,south_north=2],bbox=BoundingBox[north=90,west=0,south=-90,east=358],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] diff --git a/tests/plans/MIR-632.006.test.disabled b/tests/plans/MIR-632.006.test.disabled index bf711c743..215ee3e65 100644 --- a/tests/plans/MIR-632.006.test.disabled +++ b/tests/plans/MIR-632.006.test.disabled @@ -3,6 +3,6 @@ ORCA.grib2 # mir --grid=H2 # plan -Gridded2NamedGrid[grid=H2,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,validateMesh=0,projectionFail=missing-value]]|Save[output=...] -Gridded2NamedGrid[grid=H2,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,validateMesh=0,projectionFail=missing-value]]|Save[output=...] -Gridded2NamedGrid[grid=H2,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,validateMesh=0,projectionFail=missing-value]]|Save[output=...] +Gridded2NamedGrid[grid=H2,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,validateMesh=0,projectionFail=missing-value]]|Save[output=...] +Gridded2NamedGrid[grid=H2,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,validateMesh=0,projectionFail=missing-value]]|Save[output=...] +Gridded2NamedGrid[grid=H2,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,validateMesh=0,projectionFail=missing-value]]|Save[output=...] diff --git a/tests/plans/MIR-632.007.test b/tests/plans/MIR-632.007.test index 388c9db31..c831a2ec9 100644 --- a/tests/plans/MIR-632.007.test +++ b/tests/plans/MIR-632.007.test @@ -3,4 +3,4 @@ gridType=reduced_gg,gridName=O8,shortName=q.grib2 # mir --grid=H2 # plan -Gridded2NamedGrid[grid=H2,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] +Gridded2NamedGrid[grid=H2,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] diff --git a/tests/plans/MIR-632.008.test b/tests/plans/MIR-632.008.test index eaaf05273..55edc5076 100644 --- a/tests/plans/MIR-632.008.test +++ b/tests/plans/MIR-632.008.test @@ -3,4 +3,4 @@ gridType=regular_gg,gridName=F8,shortName=q.grib2 # mir --grid=H2 # plan -Gridded2NamedGrid[grid=H2,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] +Gridded2NamedGrid[grid=H2,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] diff --git a/tests/plans/MIR-632.009.test b/tests/plans/MIR-632.009.test index e89d7527a..f1dff3a6a 100644 --- a/tests/plans/MIR-632.009.test +++ b/tests/plans/MIR-632.009.test @@ -3,4 +3,4 @@ gridType=healpix,Nside=32,orderingConvention=ring.grib2 # mir --grid=O8 # plan -Gridded2NamedGrid[grid=O8,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] +Gridded2NamedGrid[grid=O8,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] diff --git a/tests/plans/MIR-632.010.test b/tests/plans/MIR-632.010.test index ae3741a88..038b1a4cb 100644 --- a/tests/plans/MIR-632.010.test +++ b/tests/plans/MIR-632.010.test @@ -3,4 +3,4 @@ gridType=healpix,Nside=32,orderingConvention=ring.grib2 # mir --grid=F8 # plan -Gridded2NamedGrid[grid=F8,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] +Gridded2NamedGrid[grid=F8,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] diff --git a/tests/plans/MIR-632.011.test b/tests/plans/MIR-632.011.test index cff448a0f..03110ea40 100644 --- a/tests/plans/MIR-632.011.test +++ b/tests/plans/MIR-632.011.test @@ -3,4 +3,4 @@ regular_ll.2-2.grib2 # mir --interpolation=grid-box-average --grid=H2 # plan -Gridded2NamedGrid[grid=H2,interpolation=grid-box-average,method=GridBoxMethod[name=grid-box,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0]]|Save[output=...] +Gridded2NamedGrid[grid=H2,interpolation=grid-box-average,method=GridBoxMethod[name=grid-box,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0]]|Save[output=...] diff --git a/tests/plans/MIR-632.012.test b/tests/plans/MIR-632.012.test index 6d4c518e8..9b9e0c2fa 100644 --- a/tests/plans/MIR-632.012.test +++ b/tests/plans/MIR-632.012.test @@ -3,4 +3,4 @@ gridType=reduced_gg,gridName=O8,shortName=q.grib2 # mir --interpolation=grid-box-average --grid=H2 # plan -Gridded2NamedGrid[grid=H2,interpolation=grid-box-average,method=GridBoxMethod[name=grid-box,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0]]|Save[output=...] +Gridded2NamedGrid[grid=H2,interpolation=grid-box-average,method=GridBoxMethod[name=grid-box,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0]]|Save[output=...] diff --git a/tests/plans/MIR-632.013.test b/tests/plans/MIR-632.013.test index 1bac2314f..19db890dc 100644 --- a/tests/plans/MIR-632.013.test +++ b/tests/plans/MIR-632.013.test @@ -3,4 +3,4 @@ gridType=regular_gg,gridName=F8,shortName=q.grib2 # mir --interpolation=grid-box-average --grid=H2 # plan -Gridded2NamedGrid[grid=H2,interpolation=grid-box-average,method=GridBoxMethod[name=grid-box,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0]]|Save[output=...] +Gridded2NamedGrid[grid=H2,interpolation=grid-box-average,method=GridBoxMethod[name=grid-box,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0]]|Save[output=...] diff --git a/tests/plans/MIR-632.014.test b/tests/plans/MIR-632.014.test index c3c2d17ee..62984342b 100644 --- a/tests/plans/MIR-632.014.test +++ b/tests/plans/MIR-632.014.test @@ -3,4 +3,4 @@ gridType=healpix,Nside=32,orderingConvention=ring.grib2 # mir --interpolation=grid-box-average --grid=O8 # plan -Gridded2NamedGrid[grid=O8,interpolation=grid-box-average,method=GridBoxMethod[name=grid-box,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0]]|Save[output=...] +Gridded2NamedGrid[grid=O8,interpolation=grid-box-average,method=GridBoxMethod[name=grid-box,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0]]|Save[output=...] diff --git a/tests/plans/MIR-632.015.test b/tests/plans/MIR-632.015.test index bc370f363..c3b6b6110 100644 --- a/tests/plans/MIR-632.015.test +++ b/tests/plans/MIR-632.015.test @@ -3,4 +3,4 @@ gridType=healpix,Nside=32,orderingConvention=ring.grib2 # mir --interpolation=grid-box-average --grid=F8 # plan -Gridded2NamedGrid[grid=F8,interpolation=grid-box-average,method=GridBoxMethod[name=grid-box,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0]]|Save[output=...] +Gridded2NamedGrid[grid=F8,interpolation=grid-box-average,method=GridBoxMethod[name=grid-box,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0]]|Save[output=...] diff --git a/tests/plans/MIR-632.016.test b/tests/plans/MIR-632.016.test index df3fc957c..58847143f 100644 --- a/tests/plans/MIR-632.016.test +++ b/tests/plans/MIR-632.016.test @@ -3,4 +3,4 @@ gridType=reduced_gg,gridName=O8,shortName=q.grib2 # mir --interpolation=grid-box-average --grid=H36 --accuracy=8 # plan -Gridded2NamedGrid[grid=H36,interpolation=grid-box-average,method=GridBoxMethod[name=grid-box,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0]]|Save[accuracy=8,output=...] +Gridded2NamedGrid[grid=H36,interpolation=grid-box-average,method=GridBoxMethod[name=grid-box,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0]]|Save[accuracy=8,output=...] diff --git a/tests/plans/MIR-632.018.test b/tests/plans/MIR-632.018.test index 1355d2aac..818fd02d5 100644 --- a/tests/plans/MIR-632.018.test +++ b/tests/plans/MIR-632.018.test @@ -3,4 +3,4 @@ gridType=reduced_gg,gridName=O8,shortName=q.grib2 # mir --grid=H36 --interpolation=grid-box-average --packing=ccsds # plan -Gridded2NamedGrid[grid=H36,interpolation=grid-box-average,method=GridBoxMethod[name=grid-box,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0]]|Save[output=...] +Gridded2NamedGrid[grid=H36,interpolation=grid-box-average,method=GridBoxMethod[name=grid-box,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0]]|Save[output=...] diff --git a/tests/plans/MIR-632.019.test b/tests/plans/MIR-632.019.test index 466bfda66..b7b3c2707 100644 --- a/tests/plans/MIR-632.019.test +++ b/tests/plans/MIR-632.019.test @@ -3,4 +3,4 @@ param=vo_d,level=1000,resol=20 # mir --grid=H36 --vod2uv # plan -ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F21]|Gridded2NamedGrid[grid=H36,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] +ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F21]|Gridded2NamedGrid[grid=H36,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] diff --git a/tests/plans/MIR-632.020.test b/tests/plans/MIR-632.020.test index b32b43994..2ff9534d8 100644 --- a/tests/plans/MIR-632.020.test +++ b/tests/plans/MIR-632.020.test @@ -3,4 +3,4 @@ param=t,level=1000,resol=20 # mir --grid=H36 # plan -ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F21]|Gridded2NamedGrid[grid=H36,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] +ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F21]|Gridded2NamedGrid[grid=H36,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] diff --git a/tests/plans/MIR-632.023.test b/tests/plans/MIR-632.023.test index 89eb31741..106b96c06 100644 --- a/tests/plans/MIR-632.023.test +++ b/tests/plans/MIR-632.023.test @@ -3,4 +3,4 @@ param=vo_d,level=1,levtype=ml,resol=20.grib2 # mir --grid=H36 --vod2uv # plan -ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F21]|Gridded2NamedGrid[grid=H36,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] +ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F21]|Gridded2NamedGrid[grid=H36,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=1e-06,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] diff --git a/tests/plans/MIR-632.024.test b/tests/plans/MIR-632.024.test index cbaab5f27..d5ff0ce0d 100644 --- a/tests/plans/MIR-632.024.test +++ b/tests/plans/MIR-632.024.test @@ -3,4 +3,4 @@ param=t,level=1,levtype=ml,resol=20.grib2 # mir --grid=H36 # plan -ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F21]|Gridded2NamedGrid[grid=H36,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] +ShToNamedGrid[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,grid=F21]|Gridded2NamedGrid[grid=H36,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[packing=simple,output=...] diff --git a/tests/plans/MIR-634.002.test b/tests/plans/MIR-634.002.test index 2891a485e..f482db71a 100644 --- a/tests/plans/MIR-634.002.test +++ b/tests/plans/MIR-634.002.test @@ -3,4 +3,4 @@ regular_ll.2-2.grib2 # mir --truncation=none --intgrid=none --latitudes=1/2/3 --longitudes=4/5/6 # plan -Gridded2Points[points=3,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] +Gridded2Points[points=3,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] diff --git a/tests/plans/MIR-643.001.test b/tests/plans/MIR-643.001.test index b6c0b59fe..63c29d036 100644 --- a/tests/plans/MIR-643.001.test +++ b/tests/plans/MIR-643.001.test @@ -3,4 +3,4 @@ gridType=healpix,Nside=32,orderingConvention=nested.grib2 # mir --grid=1/1 --interpolation=nn # plan -Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=nn,method=KNearestNeighbours[nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,nearestMethod=NearestNeighbourWithLowestIndex[nclosest=4],distanceWeighting=InverseDistanceWeightingSquared[]]]|Save[output=...] +Gridded2RegularLL[increments=Increments[west_east=1,south_north=1],bbox=BoundingBox[north=90,west=0,south=-90,east=359],interpolation=nn,method=KNearestNeighbours[nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,nearestMethod=NearestNeighbourWithLowestIndex[nclosest=4],distanceWeighting=InverseDistanceWeightingSquared[]]]|Save[output=...] diff --git a/tests/plans/MIR-643.002.test b/tests/plans/MIR-643.002.test index 00308bff3..2d9e0ed78 100644 --- a/tests/plans/MIR-643.002.test +++ b/tests/plans/MIR-643.002.test @@ -3,4 +3,4 @@ gridType=healpix,Nside=32,orderingConvention=nested.grib2 # mir --grid=h32 --interpolation=nn # plan -Gridded2NamedGrid[grid=H32,interpolation=nn,method=KNearestNeighbours[nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,nearestMethod=NearestNeighbourWithLowestIndex[nclosest=4],distanceWeighting=InverseDistanceWeightingSquared[]]]|Save[output=...] +Gridded2NamedGrid[grid=H32,interpolation=nn,method=KNearestNeighbours[nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,nearestMethod=NearestNeighbourWithLowestIndex[nclosest=4],distanceWeighting=InverseDistanceWeightingSquared[]]]|Save[output=...] diff --git a/tests/plans/MIR-643.003.test b/tests/plans/MIR-643.003.test index fac2f4a71..93c7fd855 100644 --- a/tests/plans/MIR-643.003.test +++ b/tests/plans/MIR-643.003.test @@ -3,4 +3,4 @@ gridType=healpix,Nside=32,orderingConvention=nested.grib2 # mir --grid=h16_nested --interpolation=grid-box-average # plan -Gridded2NamedGrid[grid=H16_nested,interpolation=grid-box-average,method=GridBoxMethod[name=grid-box,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0]]|Save[output=...] +Gridded2NamedGrid[grid=H16_nested,interpolation=grid-box-average,method=GridBoxMethod[name=grid-box,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0]]|Save[output=...] diff --git a/tests/plans/MIR-643.004.test b/tests/plans/MIR-643.004.test index 162d3d929..55dceb40a 100644 --- a/tests/plans/MIR-643.004.test +++ b/tests/plans/MIR-643.004.test @@ -3,4 +3,4 @@ regular_ll.2-2.grib2 # mir --grid=h16 --interpolation=nn # plan -Gridded2NamedGrid[grid=H16,interpolation=nn,method=KNearestNeighbours[nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,nearestMethod=NearestNeighbourWithLowestIndex[nclosest=4],distanceWeighting=InverseDistanceWeightingSquared[]]]|Save[output=...] +Gridded2NamedGrid[grid=H16,interpolation=nn,method=KNearestNeighbours[nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,nearestMethod=NearestNeighbourWithLowestIndex[nclosest=4],distanceWeighting=InverseDistanceWeightingSquared[]]]|Save[output=...] diff --git a/tests/plans/MIR-643.005.test b/tests/plans/MIR-643.005.test index fb84773d8..c7c77c5fe 100644 --- a/tests/plans/MIR-643.005.test +++ b/tests/plans/MIR-643.005.test @@ -3,4 +3,4 @@ regular_ll.2-2.grib2 # mir --grid=h16_nested --interpolation=nn # plan -Gridded2NamedGrid[grid=H16_nested,interpolation=nn,method=KNearestNeighbours[nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,nearestMethod=NearestNeighbourWithLowestIndex[nclosest=4],distanceWeighting=InverseDistanceWeightingSquared[]]]|Save[output=...] +Gridded2NamedGrid[grid=H16_nested,interpolation=nn,method=KNearestNeighbours[nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,nearestMethod=NearestNeighbourWithLowestIndex[nclosest=4],distanceWeighting=InverseDistanceWeightingSquared[]]]|Save[output=...] diff --git a/tests/plans/MIR-647.001.test b/tests/plans/MIR-647.001.test index 562e3a36e..41ab6ddcb 100644 --- a/tests/plans/MIR-647.001.test +++ b/tests/plans/MIR-647.001.test @@ -3,4 +3,4 @@ gridType=healpix,Nside=2,orderingConvention=nested.grib2 # mir --grid=H2 --interpolation=linear # plan -Gridded2NamedGrid[grid=H2,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] +Gridded2NamedGrid[grid=H2,interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],reorderCols=HEALPixRingToNested[],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] diff --git a/tests/plans/different-interpolation-methods.0000.test b/tests/plans/different-interpolation-methods.0000.test index 804274ce0..4c9bd5e77 100644 --- a/tests/plans/different-interpolation-methods.0000.test +++ b/tests/plans/different-interpolation-methods.0000.test @@ -3,7 +3,7 @@ different-interpolation-methods.grib1 # mir --grid=3/3 --area=3/0/0/3 # plan -Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=nearest-neighbour,method=KNearestNeighbours[nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=BoundingBox[north=3,west=0,south=0,east=3],lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,nearestMethod=NearestNeighbourWithLowestIndex[nclosest=4],distanceWeighting=InverseDistanceWeightingSquared[]]]|Save[output=...] -Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=BoundingBox[north=3,west=0,south=0,east=3],lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] -Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=nearest-neighbour,method=KNearestNeighbours[nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=BoundingBox[north=3,west=0,south=0,east=3],lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,nearestMethod=NearestNeighbourWithLowestIndex[nclosest=4],distanceWeighting=InverseDistanceWeightingSquared[]]]|Save[output=...] -Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=BoundingBox[north=3,west=0,south=0,east=3],lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] +Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=nearest-neighbour,method=KNearestNeighbours[nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=BoundingBox[north=3,west=0,south=0,east=3],lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,nearestMethod=NearestNeighbourWithLowestIndex[nclosest=4],distanceWeighting=InverseDistanceWeightingSquared[]]]|Save[output=...] +Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=BoundingBox[north=3,west=0,south=0,east=3],lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] +Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=nearest-neighbour,method=KNearestNeighbours[nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=BoundingBox[north=3,west=0,south=0,east=3],lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,nearestMethod=NearestNeighbourWithLowestIndex[nclosest=4],distanceWeighting=InverseDistanceWeightingSquared[]]]|Save[output=...] +Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=BoundingBox[north=3,west=0,south=0,east=3],lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|Save[output=...] diff --git a/tests/plans/different-interpolation-methods.0001.test b/tests/plans/different-interpolation-methods.0001.test index 77f06527a..923756580 100644 --- a/tests/plans/different-interpolation-methods.0001.test +++ b/tests/plans/different-interpolation-methods.0001.test @@ -3,7 +3,7 @@ different-interpolation-methods.grib1 # mir --grid=3/3 --area=3/0/0/3 --dont-compress-plan # plan -Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=nearest-neighbour,method=KNearestNeighbours[nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,nearestMethod=NearestNeighbourWithLowestIndex[nclosest=4],distanceWeighting=InverseDistanceWeightingSquared[]]]|AreaCropper[bbox=BoundingBox[north=3,west=0,south=0,east=3]]|Save[output=...] -Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|AreaCropper[bbox=BoundingBox[north=3,west=0,south=0,east=3]]|Save[output=...] -Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=nearest-neighbour,method=KNearestNeighbours[nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,nearestMethod=NearestNeighbourWithLowestIndex[nclosest=4],distanceWeighting=InverseDistanceWeightingSquared[]]]|AreaCropper[bbox=BoundingBox[north=3,west=0,south=0,east=3]]|Save[output=...] -Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|AreaCropper[bbox=BoundingBox[north=3,west=0,south=0,east=3]]|Save[output=...] +Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=nearest-neighbour,method=KNearestNeighbours[nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,nearestMethod=NearestNeighbourWithLowestIndex[nclosest=4],distanceWeighting=InverseDistanceWeightingSquared[]]]|AreaCropper[bbox=BoundingBox[north=3,west=0,south=0,east=3]]|Save[output=...] +Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|AreaCropper[bbox=BoundingBox[north=3,west=0,south=0,east=3]]|Save[output=...] +Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=nearest-neighbour,method=KNearestNeighbours[nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,nearestMethod=NearestNeighbourWithLowestIndex[nclosest=4],distanceWeighting=InverseDistanceWeightingSquared[]]]|AreaCropper[bbox=BoundingBox[north=3,west=0,south=0,east=3]]|Save[output=...] +Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=linear,method=FiniteElement[name=linear,nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,validateMesh=0,projectionFail=missing-value]]|AreaCropper[bbox=BoundingBox[north=3,west=0,south=0,east=3]]|Save[output=...] diff --git a/tests/plans/different-interpolation-methods.0002.test b/tests/plans/different-interpolation-methods.0002.test index 973d6ab3d..d1d92a9c0 100644 --- a/tests/plans/different-interpolation-methods.0002.test +++ b/tests/plans/different-interpolation-methods.0002.test @@ -3,4 +3,4 @@ regular_ll.2-2.grib1 # mir --grid=3/3 --dont-compress-plan --interpolation=nearest-lsm # plan -Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=nearest-lsm,method=KNearestNeighbours[nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,nearestMethod=NClosest[4],distanceWeighting=DistanceWeightingWithLSM[method=nearest-lsm-with-lowest-index]]]|Save[output=...] +Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=nearest-lsm,method=KNearestNeighbours[nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,nearestMethod=NClosest[4],distanceWeighting=DistanceWeightingWithLSM[method=nearest-lsm-with-lowest-index]]]|Save[output=...] diff --git a/tests/plans/different-interpolation-methods.0003.test b/tests/plans/different-interpolation-methods.0003.test index f03d467fa..2d2790192 100644 --- a/tests/plans/different-interpolation-methods.0003.test +++ b/tests/plans/different-interpolation-methods.0003.test @@ -3,4 +3,4 @@ regular_ll.2-2.grib1 # mir --grid=3/3 --dont-compress-plan --interpolation=nearest-lsm --distance-weighting-with-lsm=nearest-lsm-with-lowest-index # plan -Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=nearest-lsm,method=KNearestNeighbours[nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,nearestMethod=NClosest[4],distanceWeighting=DistanceWeightingWithLSM[method=nearest-lsm-with-lowest-index]]]|Save[output=...] +Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=nearest-lsm,method=KNearestNeighbours[nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,nearestMethod=NClosest[4],distanceWeighting=DistanceWeightingWithLSM[method=nearest-lsm-with-lowest-index]]]|Save[output=...] diff --git a/tests/plans/different-interpolation-methods.0004.test b/tests/plans/different-interpolation-methods.0004.test index 24f44a81a..76a760a27 100644 --- a/tests/plans/different-interpolation-methods.0004.test +++ b/tests/plans/different-interpolation-methods.0004.test @@ -3,4 +3,4 @@ regular_ll.2-2.grib1 # mir --grid=3/3 --dont-compress-plan --interpolation=nearest-lsm --distance-weighting-with-lsm=nearest-lsm # plan -Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=nearest-lsm,method=KNearestNeighbours[nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,nearestMethod=NClosest[4],distanceWeighting=DistanceWeightingWithLSM[method=nearest-lsm]]]|Save[output=...] +Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=nearest-lsm,method=KNearestNeighbours[nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,nearestMethod=NClosest[4],distanceWeighting=DistanceWeightingWithLSM[method=nearest-lsm]]]|Save[output=...] diff --git a/tests/plans/different-interpolation-methods.0005.test b/tests/plans/different-interpolation-methods.0005.test index 54741dcdd..fc92e393e 100644 --- a/tests/plans/different-interpolation-methods.0005.test +++ b/tests/plans/different-interpolation-methods.0005.test @@ -3,4 +3,4 @@ regular_ll.2-2.grib1 # mir --grid=3/3 --dont-compress-plan --interpolation=k-nearest # plan -Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=k-nearest,method=KNearestNeighbours[nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,nearestMethod=NearestNeighbourWithLowestIndex[nclosest=4],distanceWeighting=InverseDistanceWeightingSquared[]]]|Save[output=...] +Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=k-nearest,method=KNearestNeighbours[nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,nearestMethod=NearestNeighbourWithLowestIndex[nclosest=4],distanceWeighting=InverseDistanceWeightingSquared[]]]|Save[output=...] diff --git a/tests/plans/different-interpolation-methods.0006.test b/tests/plans/different-interpolation-methods.0006.test index 3a6bad032..196b9e507 100644 --- a/tests/plans/different-interpolation-methods.0006.test +++ b/tests/plans/different-interpolation-methods.0006.test @@ -3,4 +3,4 @@ regular_ll.2-2.grib1 # mir --grid=3/3 --dont-compress-plan --interpolation=k-nearest --distance-weighting=gaussian # plan -Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=k-nearest,method=KNearestNeighbours[nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,nearestMethod=NearestNeighbourWithLowestIndex[nclosest=4],distanceWeighting=GaussianDistanceWeighting[stddev=6.37123e+06]]]|Save[output=...] +Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=k-nearest,method=KNearestNeighbours[nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,nearestMethod=NearestNeighbourWithLowestIndex[nclosest=4],distanceWeighting=GaussianDistanceWeighting[stddev=6.37123e+06]]]|Save[output=...] diff --git a/tests/plans/different-interpolation-methods.0007.test b/tests/plans/different-interpolation-methods.0007.test index b8f28f08b..f4245dd3c 100644 --- a/tests/plans/different-interpolation-methods.0007.test +++ b/tests/plans/different-interpolation-methods.0007.test @@ -3,4 +3,4 @@ regular_ll.2-2.grib1 # mir --grid=3/3 --dont-compress-plan --interpolation=k-nearest --distance-weighting=gaussian --distance-weighting-gaussian-stddev=2 # plan -Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=k-nearest,method=KNearestNeighbours[nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,nearestMethod=NearestNeighbourWithLowestIndex[nclosest=4],distanceWeighting=GaussianDistanceWeighting[stddev=2]]]|Save[output=...] +Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=k-nearest,method=KNearestNeighbours[nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,nearestMethod=NearestNeighbourWithLowestIndex[nclosest=4],distanceWeighting=GaussianDistanceWeighting[stddev=2]]]|Save[output=...] diff --git a/tests/plans/different-interpolation-methods.0008.test b/tests/plans/different-interpolation-methods.0008.test index 9baf3ccdc..af84595fe 100644 --- a/tests/plans/different-interpolation-methods.0008.test +++ b/tests/plans/different-interpolation-methods.0008.test @@ -3,4 +3,4 @@ regular_ll.2-2.grib1 # mir --grid=3/3 --dont-compress-plan --interpolation=k-nearest --distance-weighting=shepard # plan -Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=k-nearest,method=KNearestNeighbours[nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,nearestMethod=NearestNeighbourWithLowestIndex[nclosest=4],distanceWeighting=InverseDistanceWeighting[power=2]]]|Save[output=...] +Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=k-nearest,method=KNearestNeighbours[nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,nearestMethod=NearestNeighbourWithLowestIndex[nclosest=4],distanceWeighting=InverseDistanceWeighting[power=2]]]|Save[output=...] diff --git a/tests/plans/different-interpolation-methods.0009.test b/tests/plans/different-interpolation-methods.0009.test index 55d070228..f56ede320 100644 --- a/tests/plans/different-interpolation-methods.0009.test +++ b/tests/plans/different-interpolation-methods.0009.test @@ -3,4 +3,4 @@ regular_ll.2-2.grib1 # mir --grid=3/3 --dont-compress-plan --interpolation=k-nearest --distance-weighting=shepard --distance-weighting-shepard-power=3 # plan -Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=k-nearest,method=KNearestNeighbours[nonLinear[MissingIfHeaviestMissing[]],Solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,nearestMethod=NearestNeighbourWithLowestIndex[nclosest=4],distanceWeighting=InverseDistanceWeighting[power=3]]]|Save[output=...] +Gridded2RegularLL[increments=Increments[west_east=3,south_north=3],bbox=BoundingBox[north=90,west=0,south=-90,east=357],interpolation=k-nearest,method=KNearestNeighbours[nonLinear[MissingIfHeaviestMissing[]],solver=Multiply[],cropping=none,lsmWeightAdjustment=0.2,pruneEpsilon=1e-10,poleDisplacement=0,nearestMethod=NearestNeighbourWithLowestIndex[nclosest=4],distanceWeighting=InverseDistanceWeighting[power=3]]]|Save[output=...] From 98781e9347dec18c87c2854a1145d9661e99943f Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Sat, 2 Mar 2024 00:25:15 +0000 Subject: [PATCH 43/69] MIR-647 earthkit-regrid support for linear interpolation from HEALPix orderingConvention=nested --- src/mir/method/MethodWeighted.cc | 5 ++--- src/mir/reorder/HEALPix.cc | 10 +++++----- src/mir/reorder/HEALPix.h | 2 ++ src/mir/reorder/Identity.cc | 2 +- src/mir/reorder/Identity.h | 1 + src/mir/reorder/Reorder.h | 2 ++ 6 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/mir/method/MethodWeighted.cc b/src/mir/method/MethodWeighted.cc index cb511f724..2a763cb47 100644 --- a/src/mir/method/MethodWeighted.cc +++ b/src/mir/method/MethodWeighted.cc @@ -234,11 +234,10 @@ const WeightMatrix& MethodWeighted::getMatrix(context::Context& ctx, const repre if (reorderRows_ || reorderCols_) { std::unique_ptr identity(reorder::ReorderFactory::build("identity")); - auto rows = - reorderRows_ ? reorderRows_->reorder(out.numberOfPoints()) : identity->reorder(out.numberOfPoints()); + auto rows = (reorderRows_ ? reorderRows_ : identity)->reorder(out.numberOfPoints()); ASSERT(rows.size() == W.rows()); - auto cols = reorderCols_ ? reorderCols_->reorder(in.numberOfPoints()) : identity->reorder(out.numberOfPoints()); + auto cols = (reorderCols_ ? reorderCols_ : identity)->reorder(in.numberOfPoints()); ASSERT(cols.size() == W.cols()); // expand triplets, renumbering directly diff --git a/src/mir/reorder/HEALPix.cc b/src/mir/reorder/HEALPix.cc index 3c7c6e467..83ad7235c 100644 --- a/src/mir/reorder/HEALPix.cc +++ b/src/mir/reorder/HEALPix.cc @@ -14,9 +14,9 @@ #include #include +#include #include #include -#include #include "mir/util/Exceptions.h" @@ -237,8 +237,8 @@ Renumber HEALPixRingToNested::reorder(size_t N) const { } -void HEALPixRingToNested::print(std::ostream&s) const { - s<<"HEALPixRingToNested[]"; +void HEALPixRingToNested::print(std::ostream& s) const { + s << "HEALPixRingToNested[]"; } @@ -252,8 +252,8 @@ Renumber HEALPixNestedToRing::reorder(size_t N) const { } -void HEALPixNestedToRing::print(std::ostream&s) const { - s<<"HEALPixNestedToRing[]"; +void HEALPixNestedToRing::print(std::ostream& s) const { + s << "HEALPixNestedToRing[]"; } diff --git a/src/mir/reorder/HEALPix.h b/src/mir/reorder/HEALPix.h index db0f1921c..07c9bd0ed 100644 --- a/src/mir/reorder/HEALPix.h +++ b/src/mir/reorder/HEALPix.h @@ -20,6 +20,7 @@ namespace mir::reorder { struct HEALPixRingToNested final : Reorder { Renumber reorder(size_t N) const override; + private: void print(std::ostream&) const override; }; @@ -27,6 +28,7 @@ struct HEALPixRingToNested final : Reorder { struct HEALPixNestedToRing final : Reorder { Renumber reorder(size_t N) const override; + private: void print(std::ostream&) const override; }; diff --git a/src/mir/reorder/Identity.cc b/src/mir/reorder/Identity.cc index ffdbabd7f..65ac377e1 100644 --- a/src/mir/reorder/Identity.cc +++ b/src/mir/reorder/Identity.cc @@ -26,7 +26,7 @@ Renumber Identity::reorder(size_t N) const { } -void Identity::print(std::ostream &s) const { +void Identity::print(std::ostream& s) const { s << "Identity[]"; } diff --git a/src/mir/reorder/Identity.h b/src/mir/reorder/Identity.h index be5233786..22d0da7f7 100644 --- a/src/mir/reorder/Identity.h +++ b/src/mir/reorder/Identity.h @@ -20,6 +20,7 @@ namespace mir::reorder { struct Identity final : Reorder { Renumber reorder(size_t N) const override; + private: void print(std::ostream&) const override; }; diff --git a/src/mir/reorder/Reorder.h b/src/mir/reorder/Reorder.h index 63d55c85e..f5fd0ca39 100644 --- a/src/mir/reorder/Reorder.h +++ b/src/mir/reorder/Reorder.h @@ -27,6 +27,8 @@ class Reorder { virtual ~Reorder() = default; + // N is the size of the array to reorder + // TODO: change to Representation (numberOfPoints()) virtual Renumber reorder(size_t N) const = 0; Reorder(const Reorder&) = delete; From 9ffaddfb4775ede62ec69ed364fcc95bbde609eb Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Mon, 4 Mar 2024 14:51:26 +0000 Subject: [PATCH 44/69] mir-matrix-reorder transpose fix --- src/tools/mir-matrix-reorder.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/mir-matrix-reorder.cc b/src/tools/mir-matrix-reorder.cc index e6e5b2742..afbfce991 100644 --- a/src/tools/mir-matrix-reorder.cc +++ b/src/tools/mir-matrix-reorder.cc @@ -93,7 +93,7 @@ void MIRMatrixReorder::execute(const eckit::option::CmdArgs& args) { // compress triplets, create output matrix std::sort(trips.begin(), trips.end()); - eckit::linalg::SparseMatrix W(M.rows(), M.cols(), trips); + eckit::linalg::SparseMatrix W(transpose ? M.cols() : M.rows(), transpose ? M.rows() : M.cols(), trips); // create output matrix From 3e624615d2eb2aea66116bfc073524caf00220dd Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Wed, 6 Mar 2024 15:50:26 +0000 Subject: [PATCH 45/69] Cleanup --- src/mir/method/MethodWeighted.cc | 5 +++++ src/mir/repres/unsupported/HEALPixNested.cc | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mir/method/MethodWeighted.cc b/src/mir/method/MethodWeighted.cc index 42649a566..640d2e3ab 100644 --- a/src/mir/method/MethodWeighted.cc +++ b/src/mir/method/MethodWeighted.cc @@ -301,6 +301,11 @@ const WeightMatrix& MethodWeighted::getMatrix(context::Context& ctx, const repre j << "cache_file" << cacheFile; j.endObject(); + // NOTE: to be removed + j << "rows" << w.rows(); + j << "columns" << w.cols(); + j << "cache_file" << cacheFile; + j.endObject(); } diff --git a/src/mir/repres/unsupported/HEALPixNested.cc b/src/mir/repres/unsupported/HEALPixNested.cc index 6685868be..63eb259af 100644 --- a/src/mir/repres/unsupported/HEALPixNested.cc +++ b/src/mir/repres/unsupported/HEALPixNested.cc @@ -75,7 +75,7 @@ std::vector HEALPixNested::gridBoxes() const { ::atlas::Grid HEALPixNested::atlasGrid() const { - Log::warning() << "HEALPixNested::atlasGrid() unsupported" << std::endl; + Log::warning() << "HEALPixNested::atlasGrid() unsupported, returning {type=healpix, ordering=ring}" << std::endl; return ring_.atlasGrid(); } From 0ac64c4d77fc971a0de0af059211cea01bf0fc61 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Wed, 6 Mar 2024 17:16:08 +0000 Subject: [PATCH 46/69] Cleanup --- src/mir/method/MethodWeighted.cc | 3 ++- src/tools/mir-compare.cc | 3 ++- src/tools/mir-list.cc | 3 ++- src/tools/mir-load-legendre.cc | 3 ++- src/tools/mir-load-matrix.cc | 3 ++- src/tools/mir-make-lsm.cc | 3 ++- src/tools/mir-plot-lsm.cc | 3 ++- 7 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/mir/method/MethodWeighted.cc b/src/mir/method/MethodWeighted.cc index 640d2e3ab..9759aca88 100644 --- a/src/mir/method/MethodWeighted.cc +++ b/src/mir/method/MethodWeighted.cc @@ -504,7 +504,8 @@ void MethodWeighted::execute(context::Context& ctx, const repres::Representation if (check_stats) { // compute some statistics on the result auto ostats = field.statistics(i); - log << "Input field statistics: " << istats << "\n" << "Output field statistics: " << ostats << std::endl; + log << "Input field statistics: " << istats << "\n" + << "Output field statistics: " << ostats << std::endl; } } } diff --git a/src/tools/mir-compare.cc b/src/tools/mir-compare.cc index 53724cdbf..a518a67d3 100644 --- a/src/tools/mir-compare.cc +++ b/src/tools/mir-compare.cc @@ -26,7 +26,8 @@ struct MIRCompare : MIRTool { int numberOfPositionalArguments() const override { return 2; } void usage(const std::string& tool) const override { - Log::info() << "\n" << "Usage: " << tool << " [options] file1 file2" << std::endl; + Log::info() << "\n" + << "Usage: " << tool << " [options] file1 file2" << std::endl; } void execute(const eckit::option::CmdArgs& args) override; diff --git a/src/tools/mir-list.cc b/src/tools/mir-list.cc index 6722bb771..33067573a 100644 --- a/src/tools/mir-list.cc +++ b/src/tools/mir-list.cc @@ -31,7 +31,8 @@ struct MIRList : MIRTool { int minimumPositionalArguments() const override { return 1; } void usage(const std::string& tool) const override { - Log::info() << "\n" << "Usage: " << tool << " ..." << std::endl; + Log::info() << "\n" + << "Usage: " << tool << " ..." << std::endl; } void execute(const eckit::option::CmdArgs& args) override; diff --git a/src/tools/mir-load-legendre.cc b/src/tools/mir-load-legendre.cc index 8f8b6b962..f131120db 100644 --- a/src/tools/mir-load-legendre.cc +++ b/src/tools/mir-load-legendre.cc @@ -48,7 +48,8 @@ struct MIRLoadLegendre : MIRTool { int minimumPositionalArguments() const override { return 1; } void usage(const std::string& tool) const override { - Log::info() << "\n" << "Usage: " << tool << " [--load] [--unload] " << std::endl; + Log::info() << "\n" + << "Usage: " << tool << " [--load] [--unload] " << std::endl; } void execute(const eckit::option::CmdArgs& /*args*/) override; diff --git a/src/tools/mir-load-matrix.cc b/src/tools/mir-load-matrix.cc index 2a57fe567..0cb4b5500 100644 --- a/src/tools/mir-load-matrix.cc +++ b/src/tools/mir-load-matrix.cc @@ -60,7 +60,8 @@ struct MIRLoadMatrix : MIRTool { int minimumPositionalArguments() const override { return 1; } void usage(const std::string& tool) const override { - Log::info() << "\n" << "Usage: " << tool << " [--load] [--unload] [--dump=path] " << std::endl; + Log::info() << "\n" + << "Usage: " << tool << " [--load] [--unload] [--dump=path] " << std::endl; } void execute(const eckit::option::CmdArgs& args) override; diff --git a/src/tools/mir-make-lsm.cc b/src/tools/mir-make-lsm.cc index 32723ce63..a91d7cbb8 100644 --- a/src/tools/mir-make-lsm.cc +++ b/src/tools/mir-make-lsm.cc @@ -28,7 +28,8 @@ struct MIRMakeLSM : MIRTool { int minimumPositionalArguments() const override { return 2; } void usage(const std::string& tool) const override { - Log::info() << "\n" << "Usage: " << tool << " file.grib file.lsm" << std::endl; + Log::info() << "\n" + << "Usage: " << tool << " file.grib file.lsm" << std::endl; } void execute(const eckit::option::CmdArgs& /*unused*/) override; diff --git a/src/tools/mir-plot-lsm.cc b/src/tools/mir-plot-lsm.cc index 2229af381..824d3f859 100644 --- a/src/tools/mir-plot-lsm.cc +++ b/src/tools/mir-plot-lsm.cc @@ -51,7 +51,8 @@ struct MIRPlotLSM : MIRTool { int numberOfPositionalArguments() const override { return 1; } void usage(const std::string& tool) const override { - Log::info() << "\n" << "Usage: " << tool << " --grid=1/1 output.pbm" << std::endl; + Log::info() << "\n" + << "Usage: " << tool << " --grid=1/1 output.pbm" << std::endl; } void execute(const eckit::option::CmdArgs& args) override; From eb26cbc661c3beba2dcf3bb063133a2ae7d43b74 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Wed, 6 Mar 2024 17:16:15 +0000 Subject: [PATCH 47/69] Fix --- src/mir/caching/InMemoryCacheUsage.h | 1 + src/mir/netcdf/ReshapeVariableStep.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/mir/caching/InMemoryCacheUsage.h b/src/mir/caching/InMemoryCacheUsage.h index 9ea619a53..bcea38c94 100644 --- a/src/mir/caching/InMemoryCacheUsage.h +++ b/src/mir/caching/InMemoryCacheUsage.h @@ -12,6 +12,7 @@ #pragma once +#include #include diff --git a/src/mir/netcdf/ReshapeVariableStep.h b/src/mir/netcdf/ReshapeVariableStep.h index 3c2469905..76ed6609b 100644 --- a/src/mir/netcdf/ReshapeVariableStep.h +++ b/src/mir/netcdf/ReshapeVariableStep.h @@ -12,6 +12,8 @@ #pragma once +#include + #include "mir/netcdf/Step.h" From b8444ec190d5e606c6b6266d214847a0cd371edc Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Wed, 6 Mar 2024 17:40:11 +0000 Subject: [PATCH 48/69] Fix --- src/mir/method/fe/FiniteElement.h | 2 +- src/mir/reorder/HEALPix.cc | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mir/method/fe/FiniteElement.h b/src/mir/method/fe/FiniteElement.h index 637443245..3eb0da542 100644 --- a/src/mir/method/fe/FiniteElement.h +++ b/src/mir/method/fe/FiniteElement.h @@ -116,7 +116,7 @@ class FiniteElement : public MethodWeighted { // -- Friends - friend class L2Projection; + friend struct L2Projection; }; diff --git a/src/mir/reorder/HEALPix.cc b/src/mir/reorder/HEALPix.cc index 83ad7235c..5898d3897 100644 --- a/src/mir/reorder/HEALPix.cc +++ b/src/mir/reorder/HEALPix.cc @@ -14,6 +14,7 @@ #include #include +#include #include #include #include From 7cd49937f3192bf08cab4f7beaec6a5e4ba23dcf Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Fri, 8 Mar 2024 15:41:26 +0000 Subject: [PATCH 49/69] Fix warning --- src/mir/repres/gauss/regular/Regular.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mir/repres/gauss/regular/Regular.cc b/src/mir/repres/gauss/regular/Regular.cc index 367d9396a..50019e5fd 100644 --- a/src/mir/repres/gauss/regular/Regular.cc +++ b/src/mir/repres/gauss/regular/Regular.cc @@ -12,7 +12,7 @@ #include "mir/repres/gauss/regular/Regular.h" -#include "eckit/parser/JSON.h" +#include "eckit/log/JSON.h" #include "eckit/types/FloatCompare.h" #include "mir/api/MIRJob.h" From c7f5c249a20363e984aee49b123d62ebaa63b3f0 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Mon, 11 Mar 2024 09:55:33 +0000 Subject: [PATCH 50/69] MIR-649 GRIB land-sea mask interpolation behaviour --- src/mir/lsm/GribFileMask.cc | 44 +++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/src/mir/lsm/GribFileMask.cc b/src/mir/lsm/GribFileMask.cc index 2b703ce1f..2fe4b855e 100644 --- a/src/mir/lsm/GribFileMask.cc +++ b/src/mir/lsm/GribFileMask.cc @@ -14,7 +14,7 @@ #include #include -#include +#include #include "eckit/utils/MD5.h" @@ -35,6 +35,12 @@ namespace mir::lsm { GribFileMask::GribFileMask(const eckit::PathName& path, const param::MIRParametrisation& parametrisation, const repres::Representation& representation, const std::string& which) : path_(path) { + auto values_to_mask = [](const MIRValuesVector& values, double threshold, std::vector& mask) { + mask.resize(values.size()); + + // Compare values inequality, "is greater or equal to" + std::transform(values.begin(), values.end(), mask.begin(), [&](double value) { return value >= threshold; }); + }; // WARNING: don't store the grid, it won't be there later if this // object is cached @@ -42,14 +48,21 @@ GribFileMask::GribFileMask(const eckit::PathName& path, const param::MIRParametr Log::debug() << "GribFileMask loading " << path_ << std::endl; - input::GribFileInput file(path_); - const input::MIRInput& input = file; + std::unique_ptr input(new input::GribFileInput(path_)); - ASSERT(file.next()); - data::MIRField field = input.field(); + ASSERT(input->next()); + auto field = input->field(); - param::RuntimeParametrisation runtime(parametrisation); - runtime.set("lsm", false); + double threshold = 0.5; + if (!parametrisation.get("lsm-value-threshold-" + which, threshold)) { + ASSERT(parametrisation.get("lsm-value-threshold", threshold)); + } + + const repres::RepresentationHandle in(field.representation()); + if (in->sameAs(representation)) { + values_to_mask(field.values(0), threshold, mask_); + return; + } std::string interpolation; if (!parametrisation.get("lsm-interpolation-" + which, interpolation)) { @@ -58,6 +71,9 @@ GribFileMask::GribFileMask(const eckit::PathName& path, const param::MIRParametr } } + param::RuntimeParametrisation runtime(parametrisation); + runtime.set("lsm", false); + std::unique_ptr method(method::MethodFactory::build(interpolation, runtime)); Log::debug() << "LSM interpolation method is " << *method << std::endl; @@ -69,22 +85,12 @@ GribFileMask::GribFileMask(const eckit::PathName& path, const param::MIRParametr util::MIRStatistics dummy; // TODO: use the global one context::Context ctx(field, dummy); - method->execute(ctx, *field.representation(), representation); - - double threshold; - if (!parametrisation.get("lsm-value-threshold-" + which, threshold)) { - ASSERT(parametrisation.get("lsm-value-threshold", threshold)); - } - + method->execute(ctx, *in, representation); ASSERT(!ctx.field().hasMissing()); ASSERT(ctx.field().dimensions() == 1); - const MIRValuesVector& values = ctx.field().values(0); - mask_.resize(values.size()); - - /// Compare values inequality, "is greater or equal to" - std::transform(values.begin(), values.end(), mask_.begin(), [&](double value) { return value >= threshold; }); + values_to_mask(ctx.field().values(0), threshold, mask_); } From 04178bd86eab3b23b5cb5962cc5be7dfa59fff17 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Mon, 11 Mar 2024 16:57:44 +0000 Subject: [PATCH 51/69] MIR-650 Exception terminates mir-get-data: HEALPix nested ordering with N=1 --- src/mir/reorder/HEALPix.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mir/reorder/HEALPix.cc b/src/mir/reorder/HEALPix.cc index 5898d3897..b6215c1d9 100644 --- a/src/mir/reorder/HEALPix.cc +++ b/src/mir/reorder/HEALPix.cc @@ -185,8 +185,8 @@ int HEALPixReorder::ring_to_nest(int r) const { p -= 8 * Nside_; } - int i = (r + p) >> 1; - int j = (r - p) >> 1; + int i = std::max(0, (r + p)) >> 1; + int j = std::max(0, (r - p)) >> 1; ASSERT(f < 12 && i < Nside_ && j < Nside_); return CodecFijNest::fij_to_nest(f, i, j, k_); From 4bc512b3b8bdaffff51d47529f5e201d6aadeb02 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Tue, 12 Mar 2024 14:42:05 +0000 Subject: [PATCH 52/69] MIR-646 earthkit-regrid support with interpolationspec, "type" instead of "name" --- src/mir/method/MethodWeighted.cc | 2 ++ src/mir/method/fe/FiniteElement.cc | 1 - src/mir/method/fe/L2Projection.cc | 2 +- src/mir/method/gridbox/GridBoxMethod.cc | 1 - src/mir/method/knn/KNearestNeighbours.cc | 1 - src/mir/method/structured/StructuredBilinearLatLon.cc | 8 -------- src/mir/method/structured/StructuredBilinearLatLon.h | 1 - src/mir/method/structured/StructuredLinear3D.cc | 8 -------- src/mir/method/structured/StructuredLinear3D.h | 1 - src/mir/method/structured/StructuredMethod.cc | 7 +++++++ src/mir/method/structured/StructuredMethod.h | 4 +++- src/mir/method/voronoi/VoronoiMethod.cc | 1 - 12 files changed, 13 insertions(+), 24 deletions(-) diff --git a/src/mir/method/MethodWeighted.cc b/src/mir/method/MethodWeighted.cc index 9759aca88..02ebbb761 100644 --- a/src/mir/method/MethodWeighted.cc +++ b/src/mir/method/MethodWeighted.cc @@ -81,6 +81,8 @@ MethodWeighted::~MethodWeighted() = default; void MethodWeighted::json(eckit::JSON& j) const { + j << "type" << name(); + j << "nonLinear"; j.startList(); for (const auto& n : nonLinear_) { diff --git a/src/mir/method/fe/FiniteElement.cc b/src/mir/method/fe/FiniteElement.cc index 638aeacc5..0f5b127e3 100644 --- a/src/mir/method/fe/FiniteElement.cc +++ b/src/mir/method/fe/FiniteElement.cc @@ -256,7 +256,6 @@ bool FiniteElement::sameAs(const Method& other) const { void FiniteElement::json(eckit::JSON& j) const { j.startObject(); - j << "name" << name(); MethodWeighted::json(j); j << "validateMesh" << validateMesh_; j << "projectionFail" diff --git a/src/mir/method/fe/L2Projection.cc b/src/mir/method/fe/L2Projection.cc index d7088eefc..ac5828121 100644 --- a/src/mir/method/fe/L2Projection.cc +++ b/src/mir/method/fe/L2Projection.cc @@ -55,7 +55,7 @@ bool L2Projection::sameAs(const Method& other) const { void L2Projection::json(eckit::JSON& j) const { j.startObject(); - j << "type" << "l2-projection"; + MethodWeighted::json(j); j << "input", *inputMethod_; j << "output", *outputMethod_; j.endObject(); diff --git a/src/mir/method/gridbox/GridBoxMethod.cc b/src/mir/method/gridbox/GridBoxMethod.cc index 106cbf99f..28c55058b 100644 --- a/src/mir/method/gridbox/GridBoxMethod.cc +++ b/src/mir/method/gridbox/GridBoxMethod.cc @@ -193,7 +193,6 @@ void GridBoxMethod::hash(eckit::MD5& md5) const { void GridBoxMethod::json(eckit::JSON& j) const { j.startObject(); - j << "type" << "grid-box-method"; MethodWeighted::json(j); j.endObject(); } diff --git a/src/mir/method/knn/KNearestNeighbours.cc b/src/mir/method/knn/KNearestNeighbours.cc index 15994d3b1..422a66f50 100644 --- a/src/mir/method/knn/KNearestNeighbours.cc +++ b/src/mir/method/knn/KNearestNeighbours.cc @@ -146,7 +146,6 @@ void KNearestNeighbours::assemble(util::MIRStatistics& /*unused*/, WeightMatrix& void KNearestNeighbours::json(eckit::JSON& j) const { j.startObject(); - j << "type" << name(); MethodWeighted::json(j); j << "nearestMethod" << pick(); j << "distanceWeighting" << distanceWeighting(); diff --git a/src/mir/method/structured/StructuredBilinearLatLon.cc b/src/mir/method/structured/StructuredBilinearLatLon.cc index cad899f09..47b052192 100644 --- a/src/mir/method/structured/StructuredBilinearLatLon.cc +++ b/src/mir/method/structured/StructuredBilinearLatLon.cc @@ -282,14 +282,6 @@ void StructuredBilinearLatLon::hash(eckit::MD5& md5) const { } -void StructuredBilinearLatLon::json(eckit::JSON& j) const { - j.startObject(); - j << "type" << "structured-bilinear-latlon"; - MethodWeighted::json(j); - j.endObject(); -} - - void StructuredBilinearLatLon::print(std::ostream& out) const { out << "StructuredBilinearLatLon["; MethodWeighted::print(out); diff --git a/src/mir/method/structured/StructuredBilinearLatLon.h b/src/mir/method/structured/StructuredBilinearLatLon.h index cd84ec96f..2bd9b53d0 100644 --- a/src/mir/method/structured/StructuredBilinearLatLon.h +++ b/src/mir/method/structured/StructuredBilinearLatLon.h @@ -27,7 +27,6 @@ struct StructuredBilinearLatLon final : StructuredMethod { const char* name() const override; void hash(eckit::MD5&) const override; - void json(eckit::JSON&) const override; void print(std::ostream&) const override; bool sameAs(const Method&) const override; }; diff --git a/src/mir/method/structured/StructuredLinear3D.cc b/src/mir/method/structured/StructuredLinear3D.cc index c237ad8c7..0f8b555e9 100644 --- a/src/mir/method/structured/StructuredLinear3D.cc +++ b/src/mir/method/structured/StructuredLinear3D.cc @@ -216,14 +216,6 @@ void StructuredLinear3D::hash(eckit::MD5& md5) const { } -void StructuredLinear3D::json(eckit::JSON& j) const { - j.startObject(); - j << "type" << "structured-linear-3d"; - MethodWeighted::json(j); - j.endObject(); -} - - void StructuredLinear3D::print(std::ostream& out) const { out << "StructuredLinear3D["; StructuredMethod::print(out); diff --git a/src/mir/method/structured/StructuredLinear3D.h b/src/mir/method/structured/StructuredLinear3D.h index 69f4c8e9e..86a65e64b 100644 --- a/src/mir/method/structured/StructuredLinear3D.h +++ b/src/mir/method/structured/StructuredLinear3D.h @@ -27,7 +27,6 @@ struct StructuredLinear3D final : StructuredMethod { const char* name() const override; void hash(eckit::MD5&) const override; - void json(eckit::JSON&) const override; void print(std::ostream&) const override; bool sameAs(const Method&) const override; }; diff --git a/src/mir/method/structured/StructuredMethod.cc b/src/mir/method/structured/StructuredMethod.cc index ac1f1bf78..f0800a216 100644 --- a/src/mir/method/structured/StructuredMethod.cc +++ b/src/mir/method/structured/StructuredMethod.cc @@ -177,4 +177,11 @@ void StructuredMethod::assemble(util::MIRStatistics& /*unused*/, WeightMatrix& W } +void StructuredMethod::json(eckit::JSON& j) const { + j.startObject(); + MethodWeighted::json(j); + j.endObject(); +} + + } // namespace mir::method::structured diff --git a/src/mir/method/structured/StructuredMethod.h b/src/mir/method/structured/StructuredMethod.h index 973655e31..b866b9e85 100644 --- a/src/mir/method/structured/StructuredMethod.h +++ b/src/mir/method/structured/StructuredMethod.h @@ -32,7 +32,7 @@ namespace mir::method::structured { class StructuredMethod : public MethodWeighted { public: - StructuredMethod(const param::MIRParametrisation&); + explicit StructuredMethod(const param::MIRParametrisation&); ~StructuredMethod() override; protected: @@ -68,6 +68,8 @@ class StructuredMethod : public MethodWeighted { virtual void assembleStructuredInput(WeightMatrix&, const repres::Representation& in, const repres::Representation& out) const = 0; + + void json(eckit::JSON&) const override; }; diff --git a/src/mir/method/voronoi/VoronoiMethod.cc b/src/mir/method/voronoi/VoronoiMethod.cc index 36a5877d9..4672cf89f 100644 --- a/src/mir/method/voronoi/VoronoiMethod.cc +++ b/src/mir/method/voronoi/VoronoiMethod.cc @@ -156,7 +156,6 @@ void VoronoiMethod::hash(eckit::MD5& md5) const { void VoronoiMethod::json(eckit::JSON& j) const { j.startObject(); - j << "type" << "voronoi-method"; MethodWeighted::json(j); j.endObject(); } From 48661d03ee33b3549ad3375c6c4db95fb73699df Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Tue, 12 Mar 2024 14:42:43 +0000 Subject: [PATCH 53/69] MIR-646 earthkit-regrid support with interpolationspec, additional identifiers --- src/mir/caching/WeightCache.h | 2 ++ src/mir/method/MethodWeighted.cc | 21 ++++++++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/mir/caching/WeightCache.h b/src/mir/caching/WeightCache.h index 80084c292..3b9484ec9 100644 --- a/src/mir/caching/WeightCache.h +++ b/src/mir/caching/WeightCache.h @@ -46,6 +46,8 @@ class WeightCache : public eckit::CacheManager { public: // methods explicit WeightCache(const param::MIRParametrisation&); + static int version() { return WeightCacheTraits::version(); } + private: // members friend WeightCacheTraits; }; diff --git a/src/mir/method/MethodWeighted.cc b/src/mir/method/MethodWeighted.cc index 02ebbb761..1eb597b99 100644 --- a/src/mir/method/MethodWeighted.cc +++ b/src/mir/method/MethodWeighted.cc @@ -81,6 +81,8 @@ MethodWeighted::~MethodWeighted() = default; void MethodWeighted::json(eckit::JSON& j) const { + j << "engine" << "mir"; + j << "version" << caching::WeightCache::version(); j << "type" << name(); j << "nonLinear"; @@ -172,8 +174,8 @@ const WeightMatrix& MethodWeighted::getMatrix(context::Context& ctx, const repre log << "MethodWeighted::getMatrix " << *this << std::endl; trace::Timer timer("MethodWeighted::getMatrix"); - double here = timer.elapsed(); - const lsm::LandSeaMasks masks = getMasks(in, out); + double here = timer.elapsed(); + const auto masks = getMasks(in, out); log << "MethodWeighted::getMatrix land-sea masks: " << timer.elapsedSeconds(here) << ", " << (masks.active() ? "active" : "not active") << std::endl; @@ -190,13 +192,12 @@ const WeightMatrix& MethodWeighted::getMatrix(context::Context& ctx, const repre std::string version_str; - auto v = version(); - if (bool(v)) { + if (auto v = version(); v != 0) { version_str = std::to_string(v) + "/"; } std::string disk_key = - std::string(name()) + "/" + version_str + shortName_in + "/" + shortName_out + "-" + std::string(hash); + std::string{name()} + "/" + version_str + shortName_in + "/" + shortName_out + "-" + hash.digest(); std::string memory_key = disk_key; // Add masks if any @@ -297,8 +298,11 @@ const WeightMatrix& MethodWeighted::getMatrix(context::Context& ctx, const repre j << "matrix"; j.startObject(); - j << "rows" << w.rows(); - j << "columns" << w.cols(); + j << "shape"; + j.startList(); + j << w.rows(); + j << w.cols(); + j.endList(); j << "nnz" << w.nonZeros(); j << "cache_file" << cacheFile; j.endObject(); @@ -602,8 +606,7 @@ void MethodWeighted::hash(eckit::MD5& md5) const { n->hash(md5); } - auto v = version(); - if (v != 0) { + if (auto v = version(); v != 0) { md5.add(v); } } From 916e25fccc37088755d84eeabc92a5c56ffdea72 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Tue, 12 Mar 2024 14:55:15 +0000 Subject: [PATCH 54/69] MethodWeighted::hash cleanup --- src/mir/method/structured/StructuredBilinearLatLon.cc | 5 ----- src/mir/method/structured/StructuredBilinearLatLon.h | 1 - src/mir/method/structured/StructuredLinear3D.cc | 5 ----- src/mir/method/structured/StructuredLinear3D.h | 1 - 4 files changed, 12 deletions(-) diff --git a/src/mir/method/structured/StructuredBilinearLatLon.cc b/src/mir/method/structured/StructuredBilinearLatLon.cc index 47b052192..c0211c37a 100644 --- a/src/mir/method/structured/StructuredBilinearLatLon.cc +++ b/src/mir/method/structured/StructuredBilinearLatLon.cc @@ -277,11 +277,6 @@ const char* StructuredBilinearLatLon::name() const { } -void StructuredBilinearLatLon::hash(eckit::MD5& md5) const { - StructuredMethod::hash(md5); -} - - void StructuredBilinearLatLon::print(std::ostream& out) const { out << "StructuredBilinearLatLon["; MethodWeighted::print(out); diff --git a/src/mir/method/structured/StructuredBilinearLatLon.h b/src/mir/method/structured/StructuredBilinearLatLon.h index 2bd9b53d0..42818ea56 100644 --- a/src/mir/method/structured/StructuredBilinearLatLon.h +++ b/src/mir/method/structured/StructuredBilinearLatLon.h @@ -26,7 +26,6 @@ struct StructuredBilinearLatLon final : StructuredMethod { const repres::Representation& out) const override; const char* name() const override; - void hash(eckit::MD5&) const override; void print(std::ostream&) const override; bool sameAs(const Method&) const override; }; diff --git a/src/mir/method/structured/StructuredLinear3D.cc b/src/mir/method/structured/StructuredLinear3D.cc index 0f8b555e9..db49e27e5 100644 --- a/src/mir/method/structured/StructuredLinear3D.cc +++ b/src/mir/method/structured/StructuredLinear3D.cc @@ -211,11 +211,6 @@ const char* StructuredLinear3D::name() const { } -void StructuredLinear3D::hash(eckit::MD5& md5) const { - StructuredMethod::hash(md5); -} - - void StructuredLinear3D::print(std::ostream& out) const { out << "StructuredLinear3D["; StructuredMethod::print(out); diff --git a/src/mir/method/structured/StructuredLinear3D.h b/src/mir/method/structured/StructuredLinear3D.h index 86a65e64b..ccec4a561 100644 --- a/src/mir/method/structured/StructuredLinear3D.h +++ b/src/mir/method/structured/StructuredLinear3D.h @@ -26,7 +26,6 @@ struct StructuredLinear3D final : StructuredMethod { const repres::Representation& out) const override; const char* name() const override; - void hash(eckit::MD5&) const override; void print(std::ostream&) const override; bool sameAs(const Method&) const override; }; From 65492a97ba8e8df1d79721198fa512a4a4b63f6f Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Tue, 12 Mar 2024 14:55:23 +0000 Subject: [PATCH 55/69] MethodWeighted::hash fix --- src/mir/method/knn/KNearestNeighbours.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mir/method/knn/KNearestNeighbours.cc b/src/mir/method/knn/KNearestNeighbours.cc index 422a66f50..f5effa807 100644 --- a/src/mir/method/knn/KNearestNeighbours.cc +++ b/src/mir/method/knn/KNearestNeighbours.cc @@ -46,6 +46,7 @@ bool KNearestNeighbours::sameAs(const Method& other) const { void KNearestNeighbours::hash(eckit::MD5& md5) const { + MethodWeighted::hash(md5); md5 << pick(); md5 << distanceWeighting(); } From 5b6552a15eca871a9d2bca7f9e9437a1f90adc09 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Tue, 12 Mar 2024 15:01:19 +0000 Subject: [PATCH 56/69] MIR-646 earthkit-regrid support with interpolationspec, additional identifiers --- src/mir/method/MethodWeighted.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mir/method/MethodWeighted.cc b/src/mir/method/MethodWeighted.cc index 1eb597b99..292ed771d 100644 --- a/src/mir/method/MethodWeighted.cc +++ b/src/mir/method/MethodWeighted.cc @@ -84,6 +84,11 @@ void MethodWeighted::json(eckit::JSON& j) const { j << "engine" << "mir"; j << "version" << caching::WeightCache::version(); j << "type" << name(); + j << "checksum" << [this]() { + eckit::MD5 h; + hash(h); + return h.digest(); + }(); j << "nonLinear"; j.startList(); From 9684235c60c05512bba33b455c895593d3f9f8fc Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Wed, 13 Mar 2024 16:07:10 +0000 Subject: [PATCH 57/69] MIR-651 packing=ieee (spectral) for ML applications, tests --- ...R-651.packingType=spectral_ieee.001.core.test | 8 ++++++++ ...R-651.packingType=spectral_ieee.002.core.test | 8 ++++++++ ...R-651.packingType=spectral_ieee.003.core.test | 8 ++++++++ ...R-651.packingType=spectral_ieee.004.core.test | 9 +++++++++ ...R-651.packingType=spectral_ieee.005.core.test | 9 +++++++++ ...R-651.packingType=spectral_ieee.006.core.test | 8 ++++++++ ...R-651.packingType=spectral_ieee.007.core.test | 8 ++++++++ ...R-651.packingType=spectral_ieee.008.core.test | 8 ++++++++ tests/assertions/packingType=spectral_ieee.grib2 | 1 + tests/data/packingType=spectral_ieee.grib2 | Bin 0 -> 3135 bytes .../MIR-651.packingType=spectral_ieee.001.test | 6 ++++++ .../MIR-651.packingType=spectral_ieee.002.test | 6 ++++++ .../MIR-651.packingType=spectral_ieee.003.test | 6 ++++++ .../MIR-651.packingType=spectral_ieee.004.test | 6 ++++++ .../MIR-651.packingType=spectral_ieee.005.test | 6 ++++++ .../MIR-651.packingType=spectral_ieee.006.test | 6 ++++++ .../MIR-651.packingType=spectral_ieee.007.test | 6 ++++++ tests/plans/packingType=spectral_ieee.grib2 | 1 + 18 files changed, 110 insertions(+) create mode 100644 tests/assertions/MIR-651.packingType=spectral_ieee.001.core.test create mode 100644 tests/assertions/MIR-651.packingType=spectral_ieee.002.core.test create mode 100644 tests/assertions/MIR-651.packingType=spectral_ieee.003.core.test create mode 100644 tests/assertions/MIR-651.packingType=spectral_ieee.004.core.test create mode 100644 tests/assertions/MIR-651.packingType=spectral_ieee.005.core.test create mode 100644 tests/assertions/MIR-651.packingType=spectral_ieee.006.core.test create mode 100644 tests/assertions/MIR-651.packingType=spectral_ieee.007.core.test create mode 100644 tests/assertions/MIR-651.packingType=spectral_ieee.008.core.test create mode 120000 tests/assertions/packingType=spectral_ieee.grib2 create mode 100644 tests/data/packingType=spectral_ieee.grib2 create mode 100644 tests/plans/MIR-651.packingType=spectral_ieee.001.test create mode 100644 tests/plans/MIR-651.packingType=spectral_ieee.002.test create mode 100644 tests/plans/MIR-651.packingType=spectral_ieee.003.test create mode 100644 tests/plans/MIR-651.packingType=spectral_ieee.004.test create mode 100644 tests/plans/MIR-651.packingType=spectral_ieee.005.test create mode 100644 tests/plans/MIR-651.packingType=spectral_ieee.006.test create mode 100644 tests/plans/MIR-651.packingType=spectral_ieee.007.test create mode 120000 tests/plans/packingType=spectral_ieee.grib2 diff --git a/tests/assertions/MIR-651.packingType=spectral_ieee.001.core.test b/tests/assertions/MIR-651.packingType=spectral_ieee.001.core.test new file mode 100644 index 000000000..9c8c53d2e --- /dev/null +++ b/tests/assertions/MIR-651.packingType=spectral_ieee.001.core.test @@ -0,0 +1,8 @@ +# mars +packingType=spectral_ieee.grib2 +# mir +--grid=1/1 --intgrid=none --packing=simple +# grib_get +packingType=grid_simple +edition=2 +bitsPerValue=32 diff --git a/tests/assertions/MIR-651.packingType=spectral_ieee.002.core.test b/tests/assertions/MIR-651.packingType=spectral_ieee.002.core.test new file mode 100644 index 000000000..8072d8b7c --- /dev/null +++ b/tests/assertions/MIR-651.packingType=spectral_ieee.002.core.test @@ -0,0 +1,8 @@ +# mars +packingType=spectral_ieee.grib2 +# mir +--grid=1/1 --intgrid=none --packing=so +# grib_get +packingType=grid_second_order +edition=2 +bitsPerValue=32 diff --git a/tests/assertions/MIR-651.packingType=spectral_ieee.003.core.test b/tests/assertions/MIR-651.packingType=spectral_ieee.003.core.test new file mode 100644 index 000000000..3d3602af6 --- /dev/null +++ b/tests/assertions/MIR-651.packingType=spectral_ieee.003.core.test @@ -0,0 +1,8 @@ +# mars +packingType=spectral_ieee.grib2 +# mir +--grid=1/1 --intgrid=none --packing=ccsds --grib-edition-conversion=true +# grib_get +packingType=grid_ccsds +edition=2 +bitsPerValue=32 diff --git a/tests/assertions/MIR-651.packingType=spectral_ieee.004.core.test b/tests/assertions/MIR-651.packingType=spectral_ieee.004.core.test new file mode 100644 index 000000000..83ad6b453 --- /dev/null +++ b/tests/assertions/MIR-651.packingType=spectral_ieee.004.core.test @@ -0,0 +1,9 @@ +# mars +packingType=spectral_ieee.grib2 +# mir +--grid=1/1 --intgrid=none --packing=ieee +# grib_get +packingType=grid_ieee +edition=2 +accuracy=32 +precision=1 diff --git a/tests/assertions/MIR-651.packingType=spectral_ieee.005.core.test b/tests/assertions/MIR-651.packingType=spectral_ieee.005.core.test new file mode 100644 index 000000000..ad89fdb87 --- /dev/null +++ b/tests/assertions/MIR-651.packingType=spectral_ieee.005.core.test @@ -0,0 +1,9 @@ +# mars +packingType=spectral_ieee.grib2 +# mir +--grid=1/1 --intgrid=none --packing=ieee --accuracy=32 +# grib_get +packingType=grid_ieee +edition=2 +accuracy=32 +precision=1 diff --git a/tests/assertions/MIR-651.packingType=spectral_ieee.006.core.test b/tests/assertions/MIR-651.packingType=spectral_ieee.006.core.test new file mode 100644 index 000000000..9b7b82ab1 --- /dev/null +++ b/tests/assertions/MIR-651.packingType=spectral_ieee.006.core.test @@ -0,0 +1,8 @@ +# mars +packingType=spectral_ieee.grib2 +# mir +--grid=1/1 --intgrid=none +# grib_get +packingType=grid_simple +edition=2 +bitsPerValue=32 diff --git a/tests/assertions/MIR-651.packingType=spectral_ieee.007.core.test b/tests/assertions/MIR-651.packingType=spectral_ieee.007.core.test new file mode 100644 index 000000000..62c5cdd86 --- /dev/null +++ b/tests/assertions/MIR-651.packingType=spectral_ieee.007.core.test @@ -0,0 +1,8 @@ +# mars +packingType=spectral_ieee.grib2 +# mir +--grid=1/1 --intgrid=none --packing=av +# grib_get +packingType=grid_ieee +edition=2 +bitsPerValue=32 diff --git a/tests/assertions/MIR-651.packingType=spectral_ieee.008.core.test b/tests/assertions/MIR-651.packingType=spectral_ieee.008.core.test new file mode 100644 index 000000000..674d857fb --- /dev/null +++ b/tests/assertions/MIR-651.packingType=spectral_ieee.008.core.test @@ -0,0 +1,8 @@ +# mars +packingType=spectral_ieee.grib2 +# mir +--grid=0.5/0.5 +# grib_get +packingType=grid_simple +edition=2 +bitsPerValue=32 diff --git a/tests/assertions/packingType=spectral_ieee.grib2 b/tests/assertions/packingType=spectral_ieee.grib2 new file mode 120000 index 000000000..d02deb751 --- /dev/null +++ b/tests/assertions/packingType=spectral_ieee.grib2 @@ -0,0 +1 @@ +../data/packingType=spectral_ieee.grib2 \ No newline at end of file diff --git a/tests/data/packingType=spectral_ieee.grib2 b/tests/data/packingType=spectral_ieee.grib2 new file mode 100644 index 0000000000000000000000000000000000000000..0371e6168710ab2e68075d9ab977494815fa2594 GIT binary patch literal 3135 zcmds%`(I3Z7svN>R}!ZZA>kCccEQYEyO~|h>~HQxN#dx4lui<*9;uNYm2x88%M7JX zE)|Jpe|J$K6x}4(L&%*7Iq3E@J(oY?S+Cbx@7HI&KI^CN`Yy*63mpaq2o+)|hSP&E z=-`OR~>AcsSqZEE^Rd(KkqPq72aIYXM*7Ud+L96ywb^Q7%bL2GDrFFcN@Yi=_t>EX6T4LBB)bQZb@t=F9JXIw z(rlmd#K`{IvnmJGu5}JGV%#0pv}|-p(2jQ~sypk@*7``S8qg`8=ol-e-A;>rzUzwj zT^%Ks&3hA zqhKb{Z9kLx!lgR%+|-ES)~PNz9oZ14OYl;S0r+_E<)}vT#&ak3HkMhqTuD4=pUOy(H@h0 z6!SC%#q9)?@KA)3v>u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^e>wq%#2%h-)CdvWp2 qT5?ZPKKY~e8e5T$*kY&0>@P4)QJJ`fJXtr1Rq%VT`YKcYVEhY1HT?Gg literal 0 HcmV?d00001 diff --git a/tests/plans/MIR-651.packingType=spectral_ieee.001.test b/tests/plans/MIR-651.packingType=spectral_ieee.001.test new file mode 100644 index 000000000..dff5a30a8 --- /dev/null +++ b/tests/plans/MIR-651.packingType=spectral_ieee.001.test @@ -0,0 +1,6 @@ +# mars +packingType=spectral_ieee.grib2 +# mir +--grid=1/1 --intgrid=none --packing=simple +# plan +ShToRegularLL[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,bbox=BoundingBox[north=90,west=0,south=-90,east=360],increments=Increments[west_east=1,south_north=1]]|Save[packing=simple,accuracy=32,output=...] diff --git a/tests/plans/MIR-651.packingType=spectral_ieee.002.test b/tests/plans/MIR-651.packingType=spectral_ieee.002.test new file mode 100644 index 000000000..e42375239 --- /dev/null +++ b/tests/plans/MIR-651.packingType=spectral_ieee.002.test @@ -0,0 +1,6 @@ +# mars +packingType=spectral_ieee.grib2 +# mir +--grid=1/1 --intgrid=none --packing=so +# plan +ShToRegularLL[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,bbox=BoundingBox[north=90,west=0,south=-90,east=360],increments=Increments[west_east=1,south_north=1]]|Save[packing=second-order,accuracy=32,output=...] diff --git a/tests/plans/MIR-651.packingType=spectral_ieee.003.test b/tests/plans/MIR-651.packingType=spectral_ieee.003.test new file mode 100644 index 000000000..2b80e6728 --- /dev/null +++ b/tests/plans/MIR-651.packingType=spectral_ieee.003.test @@ -0,0 +1,6 @@ +# mars +packingType=spectral_ieee.grib2 +# mir +--grid=1/1 --intgrid=none --packing=ccsds --grib-edition-conversion=true +# plan +ShToRegularLL[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,bbox=BoundingBox[north=90,west=0,south=-90,east=360],increments=Increments[west_east=1,south_north=1]]|Save[packing=ccsds,accuracy=32,output=...] diff --git a/tests/plans/MIR-651.packingType=spectral_ieee.004.test b/tests/plans/MIR-651.packingType=spectral_ieee.004.test new file mode 100644 index 000000000..6b1b1b94f --- /dev/null +++ b/tests/plans/MIR-651.packingType=spectral_ieee.004.test @@ -0,0 +1,6 @@ +# mars +packingType=spectral_ieee.grib2 +# mir +--grid=1/1 --intgrid=none --packing=ieee +# plan +ShToRegularLL[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,bbox=BoundingBox[north=90,west=0,south=-90,east=360],increments=Increments[west_east=1,south_north=1]]|Save[packing=ieee,accuracy=32,precision=1,output=...] diff --git a/tests/plans/MIR-651.packingType=spectral_ieee.005.test b/tests/plans/MIR-651.packingType=spectral_ieee.005.test new file mode 100644 index 000000000..176a3de3b --- /dev/null +++ b/tests/plans/MIR-651.packingType=spectral_ieee.005.test @@ -0,0 +1,6 @@ +# mars +packingType=spectral_ieee.grib2 +# mir +--grid=1/1 --intgrid=none --packing=ieee --accuracy=32 +# plan +ShToRegularLL[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,bbox=BoundingBox[north=90,west=0,south=-90,east=360],increments=Increments[west_east=1,south_north=1]]|Save[packing=ieee,accuracy=32,precision=1,output=...] diff --git a/tests/plans/MIR-651.packingType=spectral_ieee.006.test b/tests/plans/MIR-651.packingType=spectral_ieee.006.test new file mode 100644 index 000000000..4995324a8 --- /dev/null +++ b/tests/plans/MIR-651.packingType=spectral_ieee.006.test @@ -0,0 +1,6 @@ +# mars +packingType=spectral_ieee.grib2 +# mir +--grid=1/1 --intgrid=none +# plan +ShToRegularLL[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,bbox=BoundingBox[north=90,west=0,south=-90,east=360],increments=Increments[west_east=1,south_north=1]]|Save[packing=simple,accuracy=32,output=...] diff --git a/tests/plans/MIR-651.packingType=spectral_ieee.007.test b/tests/plans/MIR-651.packingType=spectral_ieee.007.test new file mode 100644 index 000000000..136844612 --- /dev/null +++ b/tests/plans/MIR-651.packingType=spectral_ieee.007.test @@ -0,0 +1,6 @@ +# mars +packingType=spectral_ieee.grib2 +# mir +--grid=1/1 --intgrid=none --packing=av +# plan +ShToRegularLL[type=local,cropping=none,options=[4886829aa871a5c38f41fff09ed0970e],invtrans=,bbox=BoundingBox[north=90,west=0,south=-90,east=360],increments=Increments[west_east=1,south_north=1]]|Save[packing=ieee,accuracy=32,precision=1,output=...] diff --git a/tests/plans/packingType=spectral_ieee.grib2 b/tests/plans/packingType=spectral_ieee.grib2 new file mode 120000 index 000000000..d02deb751 --- /dev/null +++ b/tests/plans/packingType=spectral_ieee.grib2 @@ -0,0 +1 @@ +../data/packingType=spectral_ieee.grib2 \ No newline at end of file From e0d7be31ec10b8190f30523bf3fbed1af573fcaf Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Wed, 13 Mar 2024 16:08:25 +0000 Subject: [PATCH 58/69] MIR-651 packing=ieee (spectral) for ML applications, tests fix --- src/mir/compare/GribField.cc | 14 +++++--------- src/mir/input/GribInput.cc | 13 ------------- 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/src/mir/compare/GribField.cc b/src/mir/compare/GribField.cc index d2e33281b..f1a6e97e1 100644 --- a/src/mir/compare/GribField.cc +++ b/src/mir/compare/GribField.cc @@ -1201,25 +1201,21 @@ Field GribField::field(const char* buffer, size_t size, const std::string& path, // field->insert("decimalScaleFactor", decimalScaleFactor); // } - long edition; - if (codes_get_long(h, "edition", &edition) == 0) { + if (long edition = 0; codes_get_long(h, "edition", &edition) == 0) { field->format("grib" + l2s(edition)); } - long missingValuesPresent; - if (codes_get_long(h, "missingValuesPresent", &missingValuesPresent) == 0) { + if (long missingValuesPresent = 0; codes_get_long(h, "missingValuesPresent", &missingValuesPresent) == 0) { if (missingValuesPresent != 0) { field->missingValuesPresent(true); } } - long bitsPerValue; - if (codes_get_long(h, "bitsPerValue", &bitsPerValue) == 0) { - field->accuracy(bitsPerValue); + if (long accuracy = 0; codes_get_long(h, "accuracy", &accuracy) == 0) { + field->accuracy(accuracy); } - long decimalScaleFactor; - if (codes_get_long(h, "decimalScaleFactor", &decimalScaleFactor) == 0) { + if (long decimalScaleFactor = 0; codes_get_long(h, "decimalScaleFactor", &decimalScaleFactor) == 0) { field->decimalScaleFactor(decimalScaleFactor); } diff --git a/src/mir/input/GribInput.cc b/src/mir/input/GribInput.cc index 16bd55321..4c78649ec 100644 --- a/src/mir/input/GribInput.cc +++ b/src/mir/input/GribInput.cc @@ -293,7 +293,6 @@ static const char* get_key(const std::string& name, grib_handle* h) { {"south", "latitudeOfLastGridPointInDegrees"}, {"truncation", "pentagonalResolutionParameterJ"}, // Assumes triangular truncation - {"accuracy", "bitsPerValue"}, {"south_pole_latitude", "latitudeOfSouthernPoleInDegrees"}, {"south_pole_longitude", "longitudeOfSouthernPoleInDegrees"}, @@ -871,18 +870,6 @@ bool GribInput::get(const std::string& name, long& value) const { return false; } - std::string packing; - if (key == "bitsPerValue" && get("packing", packing) && packing == "ieee") { - // GRIB2 Section 5 Code Table 7 - // NOTE: - // - has to be done here as GRIBs packingType=grid_ieee ignores bitsPerValue (usually 0?) - // - packingType=grid_ieee has "precision", but "spectral_ieee" doesn't - long precision = 0; - codes_get_long(grib_, "precision", &precision); - value = precision == 1 ? 32 : precision == 2 ? 64 : precision == 3 ? 128 : 0; - return value != 0; - } - // FIXME: make sure that 'value' is not set if CODES_MISSING_LONG int err = codes_get_long(grib_, key.c_str(), &value); if (err == CODES_NOT_FOUND || codes_is_missing(grib_, key.c_str(), &err) != 0) { From 41a81105f563540d909acc3e8427c5f0a87f32f0 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Wed, 13 Mar 2024 16:23:26 +0000 Subject: [PATCH 59/69] MIR-651 packing=ieee (spectral) for ML applications, tests fix --- .../assertions/MIR-651.packingType=spectral_ieee.007.core.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/assertions/MIR-651.packingType=spectral_ieee.007.core.test b/tests/assertions/MIR-651.packingType=spectral_ieee.007.core.test index 62c5cdd86..58a0a8117 100644 --- a/tests/assertions/MIR-651.packingType=spectral_ieee.007.core.test +++ b/tests/assertions/MIR-651.packingType=spectral_ieee.007.core.test @@ -5,4 +5,4 @@ packingType=spectral_ieee.grib2 # grib_get packingType=grid_ieee edition=2 -bitsPerValue=32 +accuracy=32 From 3b9e2491b543ac9741e56f6c13c87c7c77e16fa2 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Wed, 13 Mar 2024 16:59:35 +0000 Subject: [PATCH 60/69] MIR-646 earthkit-regrid support with interpolationspec, additional identifiers --- src/mir/method/MethodWeighted.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mir/method/MethodWeighted.cc b/src/mir/method/MethodWeighted.cc index 292ed771d..cb7fb642c 100644 --- a/src/mir/method/MethodWeighted.cc +++ b/src/mir/method/MethodWeighted.cc @@ -84,7 +84,7 @@ void MethodWeighted::json(eckit::JSON& j) const { j << "engine" << "mir"; j << "version" << caching::WeightCache::version(); j << "type" << name(); - j << "checksum" << [this]() { + j << "uid" << [this]() -> std::string { eckit::MD5 h; hash(h); return h.digest(); From 71f1f5cb39825c4065724a83ae7f14d2434b1393 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Wed, 13 Mar 2024 16:49:43 +0000 Subject: [PATCH 61/69] Version 1.20.0 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 66e2ae6c2..398935591 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.19.1 +1.20.0 From 3d31eb24d07169306af3800a8ccfc7a1f1beec2e Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Mon, 18 Mar 2024 03:50:55 +0000 Subject: [PATCH 62/69] MIR-646 earthkit-regrid support with interpolationspec, simplify the common cases --- src/mir/method/MethodWeighted.cc | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/mir/method/MethodWeighted.cc b/src/mir/method/MethodWeighted.cc index cb7fb642c..283fc04ac 100644 --- a/src/mir/method/MethodWeighted.cc +++ b/src/mir/method/MethodWeighted.cc @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -84,11 +85,6 @@ void MethodWeighted::json(eckit::JSON& j) const { j << "engine" << "mir"; j << "version" << caching::WeightCache::version(); j << "type" << name(); - j << "uid" << [this]() -> std::string { - eckit::MD5 h; - hash(h); - return h.digest(); - }(); j << "nonLinear"; j.startList(); @@ -299,7 +295,25 @@ const WeightMatrix& MethodWeighted::getMatrix(context::Context& ctx, const repre j.startObject(); j << "input" << in; j << "output" << out; - j << "interpolation" << *this; + + const static std::map KNOWN_INTERPOLATION{ + {"400c01c61126d89c19737f623db4b874", "grid-box-average"}, + {"5c8dd32797dfd4f4aa36edf188282308", "linear"}, + {"bdcc6407de8ea3adb73843c6cf794458", "nearest-neighbour"}, + }; + + if (auto it = KNOWN_INTERPOLATION.find([](const MethodWeighted& method) { + std::ostringstream ss; + eckit::JSON k(ss); + k << method; + return (eckit::MD5() << ss.str()).digest(); + }(*this)); + it != KNOWN_INTERPOLATION.end()) { + j << "interpolation" << it->second; + } + else { + j << "interpolation" << *this; + } j << "matrix"; j.startObject(); From 81edcc9fd9f81147ef42e530a7ab480ac6978062 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Mon, 18 Mar 2024 06:15:34 +0000 Subject: [PATCH 63/69] MIR-646 earthkit-regrid support with interpolationspec, simplify the common cases --- src/mir/method/MethodWeighted.cc | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/mir/method/MethodWeighted.cc b/src/mir/method/MethodWeighted.cc index 283fc04ac..8743c78d3 100644 --- a/src/mir/method/MethodWeighted.cc +++ b/src/mir/method/MethodWeighted.cc @@ -82,8 +82,6 @@ MethodWeighted::~MethodWeighted() = default; void MethodWeighted::json(eckit::JSON& j) const { - j << "engine" << "mir"; - j << "version" << caching::WeightCache::version(); j << "type" << name(); j << "nonLinear"; @@ -297,9 +295,9 @@ const WeightMatrix& MethodWeighted::getMatrix(context::Context& ctx, const repre j << "output" << out; const static std::map KNOWN_INTERPOLATION{ - {"400c01c61126d89c19737f623db4b874", "grid-box-average"}, - {"5c8dd32797dfd4f4aa36edf188282308", "linear"}, - {"bdcc6407de8ea3adb73843c6cf794458", "nearest-neighbour"}, + {"73e1dd539879ffbbbb22d6bc789c2262", "linear"}, + {"7738675c7e2c64d463718049ebef6563", "nearest-neighbour"}, + {"a81efab621096650c20a978062cdd169", "grid-box-average"}, }; if (auto it = KNOWN_INTERPOLATION.find([](const MethodWeighted& method) { @@ -315,6 +313,9 @@ const WeightMatrix& MethodWeighted::getMatrix(context::Context& ctx, const repre j << "interpolation" << *this; } + j << "engine" << "mir"; + j << "version" << caching::WeightCache::version(); + j << "matrix"; j.startObject(); j << "shape"; @@ -326,11 +327,6 @@ const WeightMatrix& MethodWeighted::getMatrix(context::Context& ctx, const repre j << "cache_file" << cacheFile; j.endObject(); - // NOTE: to be removed - j << "rows" << w.rows(); - j << "columns" << w.cols(); - j << "cache_file" << cacheFile; - j.endObject(); } From e7009726e996db2592f813de1cc29b69f1da7a61 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Mon, 18 Mar 2024 06:28:24 +0000 Subject: [PATCH 64/69] MIR-646 earthkit-regrid support with interpolationspec, simplify the common cases --- src/mir/method/MethodWeighted.cc | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/mir/method/MethodWeighted.cc b/src/mir/method/MethodWeighted.cc index 8743c78d3..5d093b33a 100644 --- a/src/mir/method/MethodWeighted.cc +++ b/src/mir/method/MethodWeighted.cc @@ -294,27 +294,30 @@ const WeightMatrix& MethodWeighted::getMatrix(context::Context& ctx, const repre j << "input" << in; j << "output" << out; - const static std::map KNOWN_INTERPOLATION{ + j << "interpolation"; + j.startObject(); + j << "engine" << "mir"; + j << "version" << caching::WeightCache::version(); + const static std::map KNOWN_METHOD{ {"73e1dd539879ffbbbb22d6bc789c2262", "linear"}, {"7738675c7e2c64d463718049ebef6563", "nearest-neighbour"}, {"a81efab621096650c20a978062cdd169", "grid-box-average"}, }; - if (auto it = KNOWN_INTERPOLATION.find([](const MethodWeighted& method) { + if (auto it = KNOWN_METHOD.find([](const MethodWeighted& method) { std::ostringstream ss; eckit::JSON k(ss); k << method; - return (eckit::MD5() << ss.str()).digest(); + auto x = (eckit::MD5() << ss.str()).digest(); + return x; }(*this)); - it != KNOWN_INTERPOLATION.end()) { - j << "interpolation" << it->second; + it != KNOWN_METHOD.end()) { + j << "method" << it->second; } else { - j << "interpolation" << *this; + j << "method" << *this; } - - j << "engine" << "mir"; - j << "version" << caching::WeightCache::version(); + j.endObject(); j << "matrix"; j.startObject(); From 2bee569fbd179dcb0a5e085b1cf825d1cfd96539 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Mon, 18 Mar 2024 06:29:28 +0000 Subject: [PATCH 65/69] MIR-646 earthkit-regrid support with interpolationspec, simplify the common cases --- src/mir/method/MethodWeighted.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/mir/method/MethodWeighted.cc b/src/mir/method/MethodWeighted.cc index 5d093b33a..b602cc22b 100644 --- a/src/mir/method/MethodWeighted.cc +++ b/src/mir/method/MethodWeighted.cc @@ -308,8 +308,7 @@ const WeightMatrix& MethodWeighted::getMatrix(context::Context& ctx, const repre std::ostringstream ss; eckit::JSON k(ss); k << method; - auto x = (eckit::MD5() << ss.str()).digest(); - return x; + return (eckit::MD5() << ss.str()).digest(); }(*this)); it != KNOWN_METHOD.end()) { j << "method" << it->second; From bc8158334ae4cd0aaa11d95cf67db26c0a4eb6f7 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Wed, 20 Mar 2024 08:36:14 +0000 Subject: [PATCH 66/69] Reorganise tests --- tests/assertions/MIR-583.001.test | 6 +++ tests/{unit => assertions}/MIR-583.grib1 | Bin tests/unit/interpolations.cc | 53 ++++------------------- 3 files changed, 15 insertions(+), 44 deletions(-) create mode 100644 tests/assertions/MIR-583.001.test rename tests/{unit => assertions}/MIR-583.grib1 (100%) diff --git a/tests/assertions/MIR-583.001.test b/tests/assertions/MIR-583.001.test new file mode 100644 index 000000000..8f858c4ba --- /dev/null +++ b/tests/assertions/MIR-583.001.test @@ -0,0 +1,6 @@ +# MIR-583 interpolation=linear failure on low parametricEpsilon +MIR-583.grib1 +# mir +--grid=0.04/0.04 --interpolation=linear --finite-element-projection-fail=missing-value +# grib_get +# (none) diff --git a/tests/unit/MIR-583.grib1 b/tests/assertions/MIR-583.grib1 similarity index 100% rename from tests/unit/MIR-583.grib1 rename to tests/assertions/MIR-583.grib1 diff --git a/tests/unit/interpolations.cc b/tests/unit/interpolations.cc index ee34c644f..c51956277 100644 --- a/tests/unit/interpolations.cc +++ b/tests/unit/interpolations.cc @@ -27,29 +27,19 @@ namespace mir::tests::unit { CASE("interpolations") { - api::MIRJob jobs[7]; // jobs[0]: no post-processing + api::MIRJob jobs[3]; // jobs[0]: no post-processing - jobs[1].set("caching", false); - jobs[1].set("grid", "2/2"); - - jobs[2].set("caching", false); - jobs[2].set("grid", "3/3"); + jobs[0].set("caching", false); + jobs[0].set("grid", "3/3"); - jobs[3].set("caching", false); - jobs[3].set("grid", "1/1"); - jobs[3].set("area", "40/20/20/40"); - - jobs[4].set("caching", false); - jobs[4].set("grid", "1/1"); - jobs[4].set("area", "40/20/20/40"); - jobs[4].set("frame", 2); + jobs[1].set("caching", false); + jobs[1].set("grid", "1/1"); + jobs[1].set("area", "40/20/20/40"); + jobs[1].set("frame", 2); #if mir_HAVE_ATLAS - jobs[5].set("caching", false); - jobs[5].set("rotation", "-90/0"); - - jobs[6].set("caching", false); - jobs[6].set("rotation", "-89/10"); + jobs[2].set("caching", false); + jobs[2].set("rotation", "-89/10"); #endif @@ -57,10 +47,7 @@ CASE("interpolations") { param::SimpleParametrisation args; for (const std::string& in : { - "../data/param=2t,levtype=sfc,grid=F640", - "../data/param=2t,levtype=sfc,grid=N640", "../data/param=2t,levtype=sfc,grid=O640", - "../data/regular_ll.2-2.grib2", "../data/regular_ll.2-4.grib1", }) { for (const auto& job : jobs) { @@ -130,28 +117,6 @@ CASE("interpolations") { } -#if mir_HAVE_ATLAS -CASE("MIR-583") { - // interpolation=linear failure on low parametricEpsilon - - api::MIRJob job; - job.set("caching", false); - job.set("grid", "0.04/0.04"); - job.set("interpolation", "linear"); - job.set("finite-element-missing-value-on-projection-fail", false); - - param::SimpleParametrisation args; - std::unique_ptr input(input::MIRInputFactory::build("MIR-583.grib1", args)); - - output::EmptyOutput output; - - while (input->next()) { - job.execute(*input, output); - } -} -#endif - - } // namespace mir::tests::unit From 21e421c0c880164c74b24106940d777021c69ace Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Wed, 20 Mar 2024 09:19:31 +0000 Subject: [PATCH 67/69] Reorganise tests --- tests/assertions/0010.core.test | 18 +++++++++--------- tests/data/multi-format.grib | Bin 23310 -> 10536 bytes 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/assertions/0010.core.test b/tests/assertions/0010.core.test index 2ef578176..e69743294 100644 --- a/tests/assertions/0010.core.test +++ b/tests/assertions/0010.core.test @@ -1,13 +1,13 @@ -# Mars request (found in Portugese requirements) +# mars param=2t,levtype=sfc -# Mir tool options ---dont-compress-plan --grid=0.1/0.1 --area=60/180/-56/-180 -# grib_get assertions -Ni = 3600 -Nj = 1161 -iDirectionIncrementInDegrees = 0.1 -jDirectionIncrementInDegrees = 0.1 +# mir +--dont-compress-plan --grid=1/1 --area=60/180/-56/-180 +# grib_get +Ni = 360 +Nj = 117 +iDirectionIncrementInDegrees = 1 +jDirectionIncrementInDegrees = 1 latitudeOfFirstGridPointInDegrees = 60 longitudeOfFirstGridPointInDegrees = 180 latitudeOfLastGridPointInDegrees = -56 -longitudeOfLastGridPointInDegrees = 539.9 +longitudeOfLastGridPointInDegrees = 539 diff --git a/tests/data/multi-format.grib b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u=5^QZps&^G^$rfh%ZD&GH(O)vR({_NNODss*Ll)T>m)Of4E my0gk}mA3mM_9orJ&N&z!MH2taW}6+y&EPKU+P^LR)c*l=98+5W From c84d5340769db50eb0cdfe9d2038294f23d39dba Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Mon, 25 Mar 2024 16:27:10 +0000 Subject: [PATCH 68/69] MIR-647 test cache orderingConvention=nested != cache orderingConvention=ring --- tests/assertions/MIR-647.001.test | 2 ++ tests/assertions/MIR-647.002.test | 31 ++++++++++++++++++ ...lpix,Nside=2,orderingConvention=ring.grib2 | 1 + ...lpix,Nside=2,orderingConvention=ring.grib2 | Bin 0 -> 207 bytes tests/plans/MIR-647.002.test | 6 ++++ ...lpix,Nside=2,orderingConvention=ring.grib2 | 1 + 6 files changed, 41 insertions(+) create mode 100644 tests/assertions/MIR-647.002.test create mode 120000 tests/assertions/gridType=healpix,Nside=2,orderingConvention=ring.grib2 create mode 100644 tests/data/gridType=healpix,Nside=2,orderingConvention=ring.grib2 create mode 100644 tests/plans/MIR-647.002.test create mode 120000 tests/plans/gridType=healpix,Nside=2,orderingConvention=ring.grib2 diff --git a/tests/assertions/MIR-647.001.test b/tests/assertions/MIR-647.001.test index 0117fbd4d..4633efec8 100644 --- a/tests/assertions/MIR-647.001.test +++ b/tests/assertions/MIR-647.001.test @@ -1,6 +1,8 @@ # mars gridType=healpix,Nside=2,orderingConvention=nested.grib2 # mir +$MIR_CACHING=1 +$MIR_CACHE_PATH=cache.MIR-647 --grid=H2 --interpolation=linear # grib_get assertions gridType=healpix diff --git a/tests/assertions/MIR-647.002.test b/tests/assertions/MIR-647.002.test new file mode 100644 index 000000000..57cea6221 --- /dev/null +++ b/tests/assertions/MIR-647.002.test @@ -0,0 +1,31 @@ +# mars +gridType=healpix,Nside=2,orderingConvention=ring.grib2 +# mir +$MIR_CACHING=1 +$MIR_CACHE_PATH=cache.MIR-647 +--grid=H2 --interpolation=linear +# grib_get assertions +gridType=healpix +gridName=H2 +orderingConvention=ring +Nside=2 +numberOfDataPoints=48 +longitudeOfFirstGridPointInDegrees=45 +values[0]=0 +values[1]=1 +values[2]=2 +values[3]=3 + +values[20]=20 +values[21]=21 +values[22]=22 +values[23]=23 +values[24]=24 +values[25]=25 +values[26]=26 +values[27]=27 + +values[44]=44 +values[45]=45 +values[46]=46 +values[47]=47 diff --git a/tests/assertions/gridType=healpix,Nside=2,orderingConvention=ring.grib2 b/tests/assertions/gridType=healpix,Nside=2,orderingConvention=ring.grib2 new file mode 120000 index 000000000..a10c93a90 --- /dev/null +++ b/tests/assertions/gridType=healpix,Nside=2,orderingConvention=ring.grib2 @@ -0,0 +1 @@ +../data/gridType=healpix,Nside=2,orderingConvention=ring.grib2 \ No newline at end of file diff --git a/tests/data/gridType=healpix,Nside=2,orderingConvention=ring.grib2 b/tests/data/gridType=healpix,Nside=2,orderingConvention=ring.grib2 new file mode 100644 index 0000000000000000000000000000000000000000..0ecdcf894e102980dda24f06abb00a774bee3613 GIT binary patch literal 207 zcmZ<{@^t$DpNWY90?q>|QAUO&1_lKNM)ns>vOGY6|3ECr#J~uIOe~BB1_p*e0WD@A z!C(Ny(-{7v0+1jR)4HV&EFdKeN)QTY&McrhMvxGgV1noZawS=TgaLyVNU8zo6b=SH j1%?J7hm8$nw-$Q>r^+Nx7y^ob05gRDAEW{d%z*#^oN+JF literal 0 HcmV?d00001 diff --git a/tests/plans/MIR-647.002.test b/tests/plans/MIR-647.002.test new file mode 100644 index 000000000..02696c7b2 --- /dev/null +++ b/tests/plans/MIR-647.002.test @@ -0,0 +1,6 @@ +# mars +gridType=healpix,Nside=2,orderingConvention=ring.grib2 +# mir +--grid=H2 --interpolation=linear +# plan +Copy[] diff --git a/tests/plans/gridType=healpix,Nside=2,orderingConvention=ring.grib2 b/tests/plans/gridType=healpix,Nside=2,orderingConvention=ring.grib2 new file mode 120000 index 000000000..a10c93a90 --- /dev/null +++ b/tests/plans/gridType=healpix,Nside=2,orderingConvention=ring.grib2 @@ -0,0 +1 @@ +../data/gridType=healpix,Nside=2,orderingConvention=ring.grib2 \ No newline at end of file From 40557f8296b8ed59e6cf6677b6abae0d298d7556 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Mon, 25 Mar 2024 16:27:16 +0000 Subject: [PATCH 69/69] MIR-647 test cache orderingConvention=nested != cache orderingConvention=ring, fix --- src/mir/method/MethodWeighted.cc | 49 ++++++++++++++++---------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/src/mir/method/MethodWeighted.cc b/src/mir/method/MethodWeighted.cc index b602cc22b..988d74c73 100644 --- a/src/mir/method/MethodWeighted.cc +++ b/src/mir/method/MethodWeighted.cc @@ -249,30 +249,6 @@ const WeightMatrix& MethodWeighted::getMatrix(context::Context& ctx, const repre } } - if (reorderRows_ || reorderCols_) { - std::unique_ptr identity(reorder::ReorderFactory::build("identity")); - - auto rows = (reorderRows_ ? reorderRows_ : identity)->reorder(out.numberOfPoints()); - ASSERT(rows.size() == W.rows()); - - auto cols = (reorderCols_ ? reorderCols_ : identity)->reorder(in.numberOfPoints()); - ASSERT(cols.size() == W.cols()); - - // expand triplets, renumbering directly - std::vector trips; - trips.reserve(W.nonZeros()); - - for (auto i = W.begin(), end = W.end(); i != end; ++i) { - trips.emplace_back(rows.at(i.row()), cols.at(i.col()), *i); - } - - // compress triplets, replace matrix - std::sort(trips.begin(), trips.end()); - - eckit::linalg::SparseMatrix w(W.rows(), W.cols(), trips); - W.swap(w); - } - log << "MethodWeighted::getMatrix create weights matrix: " << timer.elapsedSeconds(here) << std::endl; log << "MethodWeighted::getMatrix matrix W " << W << std::endl; @@ -546,6 +522,31 @@ void MethodWeighted::computeMatrixWeights(context::Context& ctx, const repres::R trace::Timer timer("Assemble matrix"); assemble(ctx.statistics(), W, in, out); W.cleanup(pruneEpsilon_); + + if (reorderRows_ || reorderCols_) { + std::unique_ptr identity( + reorderRows_ && reorderCols_ ? nullptr : reorder::ReorderFactory::build("identity")); + + auto rows = (reorderRows_ ? reorderRows_ : identity)->reorder(out.numberOfPoints()); + ASSERT(rows.size() == W.rows()); + + auto cols = (reorderCols_ ? reorderCols_ : identity)->reorder(in.numberOfPoints()); + ASSERT(cols.size() == W.cols()); + + // expand triplets, renumbering directly + std::vector trips; + trips.reserve(W.nonZeros()); + + for (auto i = W.begin(), end = W.end(); i != end; ++i) { + trips.emplace_back(rows.at(i.row()), cols.at(i.col()), *i); + } + + // compress triplets, replace matrix + std::sort(trips.begin(), trips.end()); + + eckit::linalg::SparseMatrix w(W.rows(), W.cols(), trips); + W.swap(w); + } } // matrix validation always happens after creation, because the matrix can/will be cached