From d7ce9dc55dc0b1cdb29eb24ae7afc83d2f918b46 Mon Sep 17 00:00:00 2001 From: Datseris Date: Tue, 4 Jan 2022 12:44:17 +0100 Subject: [PATCH] add `gnv` function --- src/core/coredefs.jl | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/core/coredefs.jl b/src/core/coredefs.jl index fe276309..5e3efe7c 100644 --- a/src/core/coredefs.jl +++ b/src/core/coredefs.jl @@ -17,11 +17,22 @@ Get the index of dimension `d`. dimindex(A, i::Int) = i dimindex(A, dim) = DimensionalData.dimnum(A, dim) +""" + gnv(object) → x +Short for "get numeric value", this function will return the pure numeric value +of the given object. Convenience function for quickly gettin the numeric data of +dimensional arrays or dimensions. +""" +gnv(x) = x +gnv(x::AbDimArray) = DimensionalData.parent(x) +gnv(x::Dimension) = x.val + export At, Between, Near # Selectors from DimensionalArrays.jl export hasdim, dims, dimindex export Time, Lon, Lat, dims, Coord, Hei, Pre, Ti export UnstructuredGrid, LonLatGrid, spacestructure export DimensionalData # for accessing its functions +export gnv @dim Lon IndependentDim "Longitude" @dim Lat IndependentDim "Latitude"