| 1 |
/* |
| 2 |
* (C) Copyright 2013 ECMWF. |
| 3 |
* |
| 4 |
* This software is licensed under the terms of the Apache Licence Version 2.0 |
| 5 |
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. |
| 6 |
* In applying this licence, ECMWF does not waive the privileges and immunities |
| 7 |
* granted to it by virtue of its status as an intergovernmental organisation |
| 8 |
* nor does it submit to any jurisdiction. |
| 9 |
*/ |
| 10 |
|
| 11 |
#pragma once |
| 12 |
|
| 13 |
#include <array> |
| 14 |
#include <iosfwd> |
| 15 |
|
| 16 |
#include "atlas/domain/detail/RectangularDomain.h" |
| 17 |
|
| 18 |
namespace atlas { |
| 19 |
class RectangularDomain; |
| 20 |
class ZonalBandDomain; |
| 21 |
} // namespace atlas |
| 22 |
|
| 23 |
namespace atlas { |
| 24 |
namespace domain { |
| 25 |
|
| 26 |
class ZonalBandDomain : public atlas::domain::RectangularLonLatDomain { |
| 27 |
protected: |
| 28 |
static constexpr char units_[] = "degrees"; |
| 29 |
|
| 30 |
public: |
| 31 |
static bool is_global(const Interval& y); |
| 32 |
|
| 33 |
public: |
| 34 |
// constructor |
| 35 |
ZonalBandDomain(const eckit::Parametrisation&); |
| 36 |
ZonalBandDomain(const Interval&); |
| 37 |
ZonalBandDomain(const Interval&, const double west); |
| 38 |
|
| 39 |
static std::string static_type() { return "zonal_band"; } |
| 40 |
virtual std::string type() const override { return static_type(); } |
| 41 |
|
| 42 |
/// Checks if the point is contained in the domain |
| 43 |
virtual bool contains(double x, double y) const override; |
| 44 |
|
| 45 |
virtual bool global() const override { return global_; } |
| 46 |
virtual bool empty() const override { return (ymin() == ymax()); } |
| 47 |
|
| 48 |
virtual Spec spec() const override; |
| 49 |
|
| 50 |
virtual void print(std::ostream&) const override; |
| 51 |
|
| 52 |
virtual void hash(eckit::Hash&) const override; |
| 53 |
|
| 54 |
virtual std::string units() const override { return units_; } |
| 55 |
|
| 56 |
/// Check if grid includes the North pole |
| 57 |
virtual bool containsNorthPole() const override; |
| 58 |
|
| 59 |
/// Check if grid includes the South pole |
| 60 |
virtual bool containsSouthPole() const override; |
| 61 |
|
| 62 |
protected: |
| 63 |
friend class ::atlas::RectangularDomain; |
| 64 |
|
| 65 |
private: |
| 66 |
bool global_; |
| 67 |
double ymin_tol_; |
| 68 |
double ymax_tol_; |
| 69 |
}; |
| 70 |
|
| 71 |
} // namespace domain |
| 72 |
} // namespace atlas |