Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added alpha-beta projection to cubed sphere. #87

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/atlas/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,7 @@ util/Rotation.h
util/Registry.h
util/SphericalPolygon.cc
util/SphericalPolygon.h
util/SquareMatrix.h
util/UnitSphere.h
util/vector.h
util/VectorOfAbstract.h
Expand Down
12 changes: 11 additions & 1 deletion src/atlas/grid/CubedSphereGrid.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,19 @@ class CubedSphereGrid : public Grid {
// Return the size of the cubed sphere grid, where N is the number of grid boxes along the edge of a tile
inline int N() const { return grid_->N(); }

// Return the number of tiles
/// @brief return tiles object.
inline atlas::grid::CubedSphereTiles tiles() const { return grid_->tiles(); }

/// @brief return cubed sphere projection object.
inline const projection::detail::CubedSphereProjectionBase& cubedSphereProjection() const {

const auto projPtr =
dynamic_cast<const projection::detail::CubedSphereProjectionBase*>
(projection().get());

return *projPtr;
};

temporary::IterateTIJ tij() const { return temporary::IterateTIJ(*grid_); }

const std::string& stagger() const { return grid_->stagger(); }
Expand Down
8 changes: 8 additions & 0 deletions src/atlas/grid/Tiles.cc
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,13 @@ std::ostream& operator<<(std::ostream& os, const CubedSphereTiles& t) {
return os;
}

const PointXY& CubedSphereTiles::tileCentre(size_t t) const {
return get()->tileCentre(t);
}

const JacobianXY& CubedSphereTiles::tileJacobian(size_t t) const {
return get()->tileJacobian(t);
}

} // namespace grid
} // namespace atlas
8 changes: 8 additions & 0 deletions src/atlas/grid/Tiles.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class Hash;
//---------------------------------------------------------------------------------------------------------------------

namespace atlas {
class JacobianXY;
class PointXY;
class PointLonLat;

Expand Down Expand Up @@ -85,6 +86,13 @@ class CubedSphereTiles : DOXYGEN_HIDE(public util::ObjectHandle<atlas::grid::det
// a "diagonal" extension over corners of the cube.
atlas::PointXY tileCubePeriodicity(const atlas::PointXY& xyExtended, const atlas::idx_t tile) const;

/// @brief Return the position of the tile centre in xy space.
const PointXY& tileCentre(size_t t) const;

/// @brief Return the Jacobian of xy with respect to the curvilinear
/// coordinates of the tile.
const JacobianXY& tileJacobian(size_t t) const;

private:
/// Output to stream
void print(std::ostream&) const;
Expand Down
9 changes: 9 additions & 0 deletions src/atlas/grid/detail/tiles/FV3Tiles.cc
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,15 @@ void FV3CubedSphereTiles::print(std::ostream& os) const {
}


const PointXY& FV3CubedSphereTiles::tileCentre(size_t t) const {
throw_NotImplemented("tileCentre not implemented for FV3Tiles", Here());
}

const JacobianXY& FV3CubedSphereTiles::tileJacobian(size_t t) const {
throw_NotImplemented("tileJacobian not implemented for FV3Tiles", Here());;
}


namespace {
static CubedSphereTilesBuilder<FV3CubedSphereTiles> register_builder(FV3CubedSphereTiles::static_type());
}
Expand Down
5 changes: 5 additions & 0 deletions src/atlas/grid/detail/tiles/FV3Tiles.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ class FV3CubedSphereTiles : public CubedSphereTiles {

virtual void print(std::ostream&) const override;

virtual const PointXY& tileCentre(size_t t) const override;

virtual const JacobianXY& tileJacobian(size_t t) const override;


private:
};

Expand Down
Loading