From 682a1a12fbb1373efdcd459bb0b034dde821c6f5 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Fri, 11 Aug 2023 12:01:43 +0100 Subject: [PATCH] eckit::geometry --- src/eckit/geometry/CMakeLists.txt | 1 + src/eckit/geometry/Ordering.h | 50 ++++++++++++++++++++++++++ src/eckit/geometry/iterator/Regular.cc | 35 ------------------ 3 files changed, 51 insertions(+), 35 deletions(-) create mode 100644 src/eckit/geometry/Ordering.h diff --git a/src/eckit/geometry/CMakeLists.txt b/src/eckit/geometry/CMakeLists.txt index 88dc23ff5..8c1db1045 100644 --- a/src/eckit/geometry/CMakeLists.txt +++ b/src/eckit/geometry/CMakeLists.txt @@ -19,6 +19,7 @@ list( APPEND eckit_geometry_srcs Iterator.h KPoint.cc KPoint.h + Ordering.h Point.cc Point.h Point2.cc diff --git a/src/eckit/geometry/Ordering.h b/src/eckit/geometry/Ordering.h new file mode 100644 index 000000000..7ee940ae0 --- /dev/null +++ b/src/eckit/geometry/Ordering.h @@ -0,0 +1,50 @@ +/* + * (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 + + +namespace eckit::geometry { + + +enum Ordering +{ + scan_full_i_full_j_i_positively_j_negatively_j_consecutive_i_single_direction, + scan_full_i_full_j_i_negatively_j_negatively_j_consecutive_i_single_direction, + scan_full_i_full_j_i_positively_j_positively_j_consecutive_i_single_direction, + scan_full_i_full_j_i_negatively_j_positively_j_consecutive_i_single_direction, + scan_full_i_full_j_i_positively_j_negatively_i_consecutive_i_single_direction, + scan_full_i_full_j_i_negatively_j_negatively_i_consecutive_i_single_direction, + scan_full_i_full_j_i_positively_j_positively_i_consecutive_i_single_direction, + scan_full_i_full_j_i_negatively_j_positively_i_consecutive_i_single_direction, + scan_full_i_full_j_i_positively_j_negatively_j_consecutive_i_alternating_direction, + scan_full_i_full_j_i_negatively_j_negatively_j_consecutive_i_alternating_direction, + scan_full_i_full_j_i_positively_j_positively_j_consecutive_i_alternating_direction, + scan_full_i_full_j_i_negatively_j_positively_j_consecutive_i_alternating_direction, + scan_full_i_full_j_i_positively_j_negatively_i_consecutive_i_alternating_direction, + scan_full_i_full_j_i_negatively_j_negatively_i_consecutive_i_alternating_direction, + scan_full_i_full_j_i_positively_j_positively_i_consecutive_i_alternating_direction, + scan_full_i_full_j_i_negatively_j_positively_i_consecutive_i_alternating_direction, + // TODO scan_ ... shift + + scan_reduced_i_full_j_i_positively_j_negatively, + scan_reduced_i_full_j_i_negatively_j_negatively, + scan_reduced_i_full_j_i_positively_j_positively, + scan_reduced_i_full_j_i_negatively_j_positively, + // TODO scan_ ... shift + + healpix_ring, + healpix_nested, +}; + + +} // namespace eckit::geometry diff --git a/src/eckit/geometry/iterator/Regular.cc b/src/eckit/geometry/iterator/Regular.cc index f110ec900..511f612d6 100644 --- a/src/eckit/geometry/iterator/Regular.cc +++ b/src/eckit/geometry/iterator/Regular.cc @@ -18,41 +18,6 @@ namespace eckit::geometry::iterator { -#if 0 -Scanning mode (grib2/tables/30/3.4.table, grib2/template.3.scanning_mode.def) - -bool iScansPositively -- 1 0 Points of first row or column scan in the +i (+x) direction -- 1 1 Points of first row or column scan in the -i (-x) direction - -bool jScansPositively -- 2 0 Points of first row or column scan in the -j (-y) direction -- 2 1 Points of first row or column scan in the +j (+y) direction - -bool jPointsAreConsecutive -- 3 0 Adjacent points in i (x) direction are consecutive -- 3 1 Adjacent points in j (y) direction is consecutive - -bool alternativeRowScanning -- 4 0 All rows scan in the same direction -- 4 1 Adjacent rows scan in the opposite direction - -- 5 0 Points within odd rows are not offset in i (x) direction -- 5 1 Points within odd rows are offset by Di/2 in i (x) direction -- 6 0 Points within even rows are not offset in i (x) direction -- 6 1 Points within even rows are offset by Di/2 in i (x) direction -- 7 0 Points are not offset in j (y) direction -- 7 1 Points are offset by Dj/2 in j (y) direction - -- 8 0 n_i columns, n_j rows -- 8 1 Rows have n_i points if points are not offset in i direction - Rows have n_i-1 points if points are offset by Di/2 in i direction - Columns have n_j points if points are not offset in j direction - Columns have n_j-1 points if points are offset by Dj/2 in j direction - -#endif - - Regular::Regular(size_t ni, size_t nj, double north, double west, double we, double ns) : ni_(ni), nj_(nj), north_(north), west_(west), we_(we), ns_(ns), i_(0), j_(0), lat_(north_), lon_(west_), count_(0), first_(true), p_(PointLonLat{0, 0}) { latValue_ = lat_;