Esempio n. 1
0
        /// <summary>
        /// Checks whether the variable is a coordinate axis or not.
        /// </summary>
        /// <param name="var"></param>
        /// <returns></returns>
        public static bool IsCoordinateAxis(this Variable var)
        {
            if (var == null)
            {
                throw new ArgumentNullException("var");
            }

            if (var.TypeOfData == typeof(DateTime))
            {
                return(true);
            }

            if (GeoConventions.IsLatitude(var) || GeoConventions.IsLongitude(var))
            {
                return(true);
            }

            string units = var.Metadata.GetUnits();

            if (String.IsNullOrEmpty(units))
            {
                return(false);
            }

            units = units.ToLower();
            foreach (var cu in coordinateUnits)
            {
                if (units.Contains(cu))
                {
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 2
0
 public static bool IsSpatialAxis(Variable v)
 {
     if (v.Rank != 1 || v.TypeOfData == typeof(String) || v.TypeOfData == typeof(DateTime))
     {
         return(false);
     }
     return(GeoConventions.IsLatitude(v) || GeoConventions.IsLongitude(v) || v.Name == "x" || v.Name == "y");
 }