Class NetCDFUnitFormat

  • All Implemented Interfaces:

    public final class NetCDFUnitFormat
    extends BaseUnitFormatter
    Parser/Encoder for units expressed in the NetCDF CF syntax, with ability to configure the unit syntax transformation and allow setting up custom aliases just for the NetCDF case.
    • Field Detail


        public static final String NETCDF_UNIT_ALIASES
        Unit aliases config file name (normally looked up in the classpath)
        See Also:
        Constant Field Values

        public static final String NETCDF_UNIT_REPLACEMENTS
        Unit replacements config file name (normally looked up in the classpath)
        See Also:
        Constant Field Values
    • Method Detail

      • createWithBuiltInConfig

        public static NetCDFUnitFormat createWithBuiltInConfig()
        Creates a NetCDFUnitFormat with the built-in defaults.
      • builtInReplacements

        public static Map<String,​String> builtInReplacements()
      • loadPropertiesOrdered

        public static LinkedHashMap<String,​String> loadPropertiesOrdered​(InputStream is)
        Loads a properties file preserving its internal order
        is - The input stream to be read
        The contents as a LinkedHashMap preserving the file contents
      • setReplacements

        public void setReplacements​(Map<String,​String> replacements)
        Configures the string replacements to be performed before trying to parse the units.
        replacements - The replacements to be used. It is strongly advised to use a LinkedHashMap as replacements are run from top to bottom, in order, and the order might influence the results
      • setAliases

        public void setAliases​(Map<String,​String> aliases)
        Configures the aliases to be used on the unit parser. An alias is a different name for a unit.
      • parse

        public Unit<?> parse​(String spec)
        Parses a unit applying the configured set of replacements and aliases