@@ -60,7 +60,7 @@ def repl(m):
60
60
except ImportError :
61
61
pass
62
62
63
-
63
+ # ------
64
64
# Reused with modification from MetPy under the terms of the BSD 3-Clause License.
65
65
# Copyright (c) 2015,2017,2019 MetPy Developers.
66
66
# Create registry, with preprocessors for UDUNITS-style powers (m2 s-2) and percent signs
@@ -83,13 +83,29 @@ def repl(m):
83
83
)
84
84
85
85
# Define commonly encountered units (both CF and non-CF) not defined by pint
86
+ units .define ("@alias meter = gpm" )
87
+ # ----- end block copied from metpy
88
+
89
+ # -----
90
+ # The following redefinitions were copied from xclim under the terms of their Apache-2 license
91
+ # In pint, the default symbol for year is "a" which is not CF-compliant (stands for "are")
92
+ units .define ("year = 365.25 * day = yr" )
93
+
94
+ # Define commonly encountered units not defined by pint
95
+ units .define ("@alias degC = C = deg_C" )
96
+ units .define ("@alias degK = deg_K" )
97
+ units .define ("@alias day = d" )
98
+ units .define ("@alias hour = h" ) # Not the Planck constant...
86
99
units .define (
87
- "degrees_north = degree = degrees_N = degreesN = degree_north = degree_N = degreeN"
100
+ "degrees_north = degree = degrees_north = degrees_N = degreesN = degree_north = degree_N = degreeN"
88
101
)
89
102
units .define (
90
- "degrees_east = degree = degrees_E = degreesE = degree_east = degree_E = degreeE"
103
+ "degrees_east = degree = degrees_east = degrees_E = degreesE = degree_east = degree_E = degreeE"
91
104
)
92
- units .define ("@alias meter = gpm" )
105
+ units .define ("[speed] = [length] / [time]" )
106
+ # ----- end block copied from xclim
107
+
108
+ # Add other specific aliases (by cf_xarray developers)
93
109
units .define ("practical_salinity_unit = [] = psu = PSU" )
94
110
95
111
# Enable pint's built-in matplotlib support
0 commit comments