From b845a766394e37477748ae5f3023681a1791ca63 Mon Sep 17 00:00:00 2001 From: David Linke <dr.david.linke@gmail.com> Date: Sat, 24 Aug 2024 23:17:25 +0200 Subject: [PATCH] Update to new UCUM version v2.2 (June-2024) --- README.md | 4 +- src/ucumvert/parser.py | 2 +- src/ucumvert/pint_ucum_defs.txt | 5 +- .../pint_ucum_defs_mapping_report.txt | 30 ++++++----- src/ucumvert/ucum_grammar.lark | 5 +- src/ucumvert/ucum_pint.py | 5 +- src/ucumvert/vendor/README.md | 2 +- src/ucumvert/vendor/ucum-essence.xml | 54 +++++++++++-------- src/ucumvert/vendor/ucum_examples.tsv | 2 +- tests/test_ucum.py | 2 - tests/test_xm_util.py | 2 +- 11 files changed, 65 insertions(+), 48 deletions(-) diff --git a/README.md b/README.md index 9419c01..e8e9101 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Note that UCUM does non provide a canonical representation, e.g. `m/s` and `m.s- - Parser for UCUM unit strings that implements the full grammar. - Converter for creating [pint](https://pypi.org/project/pint/) units from UCUM unit strings. -- A pint unit definition file [pint_ucum_defs.txt](https://github.com/dalito/ucumvert/blob/main/src/ucumvert/pint_ucum_defs.txt) that extends pint´s default units with UCUM units. All UCUM units from Version 2.1 of the specification are included. +- A pint unit definition file [pint_ucum_defs.txt](https://github.com/dalito/ucumvert/blob/main/src/ucumvert/pint_ucum_defs.txt) that extends pint´s default units with UCUM units. All UCUM units from the new version 2.2 of the specification (June 2024) are included. **ucumvert** generates the UCUM grammar by filling a template with unit codes, prefixes etc. from the official [ucum-essence.xml](https://github.com/ucum-org/ucum/blob/main/ucum-essence.xml) file (a copy is included in this repo). So updating the parser for new UCUM releases is straight forward. @@ -126,7 +126,7 @@ To (re)generate this tsv-file from the official xlsx-file in the [UCUM repositor ```bash pip install openpyxl -python src/src/ucumvert/vendor/get_ucum_example_as_tsv.py +python src/ucumvert/vendor/get_ucum_example_as_tsv.py ``` ## Useful links diff --git a/src/ucumvert/parser.py b/src/ucumvert/parser.py index b10222d..5a0e57a 100644 --- a/src/ucumvert/parser.py +++ b/src/ucumvert/parser.py @@ -85,7 +85,7 @@ # instead of deca-r which does not exist. UCUM_GRAMMAR = """ - # Based on UCUM specification (Version 2.1, 2017-11-21) + # Based on UCUM specification (Version 2.2, 2024-06-28) # Includes ucumvert-specific fixes to handle all common UCUM units # and some edge cases not present in the official examples. # This file is auto-created by parser.update_lark_ucum_grammar_file diff --git a/src/ucumvert/pint_ucum_defs.txt b/src/ucumvert/pint_ucum_defs.txt index 710be59..2c6d475 100644 --- a/src/ucumvert/pint_ucum_defs.txt +++ b/src/ucumvert/pint_ucum_defs.txt @@ -41,7 +41,7 @@ homeopathic_potency_of_quintamillesimal_korsakovian_series = 1 = _ = kp_Q high_power_field = 1 = _ = HPF low_power_field = 1 = _ = LPF international_unit = 1 = _ = i.U. = IU = iU -arbitary_unit = 1 = _ = arb_U +arbitrary_unit = 1 = _ = arb_U US_pharmacopeia_unit = 1 = _ = USP_U GPL_unit = 1 = _ = GPL_U MPL_unit = 1 = _ = MPL_U @@ -88,6 +88,9 @@ diopter = 1 / meter = _ = diop slope = tan(1 rad) prism_diopter = 100 * tan(1 rad) = _ = p_diop +nephelometric_turbidity_unit = 1 = _ = NTU +formazin_nephelometric_unit = 1 = _ = FNU + mil_i = inch / 1000 cml_i = π/4 * mil_i**2 hd_i = 4 * inch diff --git a/src/ucumvert/pint_ucum_defs_mapping_report.txt b/src/ucumvert/pint_ucum_defs_mapping_report.txt index c66d264..d085009 100644 --- a/src/ucumvert/pint_ucum_defs_mapping_report.txt +++ b/src/ucumvert/pint_ucum_defs_mapping_report.txt @@ -27,7 +27,7 @@ # Ti --> tebi (default registry) # === metric === -# mol --> mole (default registry) # mol = 6.0221367 * 10*23 # METRIC, mole, amount of substance (si) +# mol --> mole (default registry) # mol = 6.02214076 * 10*23 # METRIC, mole, amount of substance (si) # sr --> steradian (default registry) # sr = 1 * rad2 # METRIC, steradian, solid angle (si) # Hz --> hertz (default registry) # Hz = 1 * s-1 # METRIC, hertz, frequency (si) # N --> newton (default registry) # N = 1 * kg.m/s2 # METRIC, newton, force (si) @@ -53,18 +53,18 @@ # ar --> are (ucumvert registry) # ar = 100 * m2 # METRIC, are, area (iso1000) # t --> metric_ton (default registry) # t = 1e3 * kg # METRIC, tonne, mass (iso1000) # bar --> bar (default registry) # bar = 1e5 * Pa # METRIC, bar, pressure (iso1000) -# u --> unified_atomic_mass_unit (default registry) # u = 1.6605402e-24 * g # METRIC, unified atomic mass unit, mass (iso1000) +# u --> unified_atomic_mass_unit (default registry) # u = 1.66053906660e-24 * g # METRIC, unified atomic mass unit, mass (iso1000) # eV --> electron_volt (default registry) # eV = 1 * [e].V # METRIC, electronvolt, energy (iso1000) # pc --> parsec (default registry) # pc = 3.085678e16 * m # METRIC, parsec, length (iso1000) # [c] --> speed_of_light (default registry) # [c] = 299792458 * m/s # METRIC, velocity of light, velocity (const) -# [h] --> planck_constant (default registry) # [h] = 6.6260755e-34 * J.s # METRIC, Planck constant, action (const) -# [k] --> boltzmann_constant (default registry) # [k] = 1.380658e-23 * J/K # METRIC, Boltzmann constant, (unclassified) (const) +# [h] --> planck_constant (default registry) # [h] = 6.62607015e-34 * J.s # METRIC, Planck constant, action (const) +# [k] --> boltzmann_constant (default registry) # [k] = 1.380649e-23 * J/K # METRIC, Boltzmann constant, (unclassified) (const) # [eps_0] --> vacuum_permittivity (default registry) # [eps_0] = 8.854187817e-12 * F/m # METRIC, permittivity of vacuum, electric permittivity (const) # [mu_0] --> vacuum_permeability (default registry) # [mu_0] = 1 * 4.[pi].10*-7.N/A2 # METRIC, permeability of vacuum, magnetic permeability (const) -# [e] --> elementary_charge (default registry) # [e] = 1.60217733e-19 * C # METRIC, elementary charge, electric charge (const) -# [m_e] --> electron_mass (default registry) # [m_e] = 9.1093897e-28 * g # METRIC, electron mass, mass (const) -# [m_p] --> proton_mass (default registry) # [m_p] = 1.6726231e-24 * g # METRIC, proton mass, mass (const) -# [G] --> newtonian_constant_of_gravitation (default registry) # [G] = 6.67259e-11 * m3.kg-1.s-2 # METRIC, Newtonian constant of gravitation, (unclassified) (const) +# [e] --> elementary_charge (default registry) # [e] = 1.602176634e-19 * C # METRIC, elementary charge, electric charge (const) +# [m_e] --> electron_mass (default registry) # [m_e] = 9.1093837139e-31 * kg # METRIC, electron mass, mass (const) +# [m_p] --> proton_mass (default registry) # [m_p] = 1.67262192595e-27 * kg # METRIC, proton mass, mass (const) +# [G] --> newtonian_constant_of_gravitation (default registry) # [G] = 6.67430e-11 * m3.kg-1.s-2 # METRIC, Newtonian constant of gravitation, (unclassified) (const) # [g] --> standard_gravity (default registry) # [g] = 980665e-5 * m/s2 # METRIC, standard acceleration of free fall, acceleration (const) # [ly] --> light_year (default registry) # [ly] = 1 * [c].a_j # METRIC, light-year, length (const) # gf --> force_gram (default registry) # gf = 1 * g.[g] # METRIC, gram-force, force (const) @@ -290,7 +290,7 @@ # [S] --> svedberg (default registry) # [S] = 1 * 10*-13.s # NON_METRIC, Svedberg unit, sedimentation coefficient (chemical) # [HPF] --> high_power_field (ucumvert registry) # [HPF] = 1 * 1 # NON_METRIC, high power field, view area in microscope (chemical) # [LPF] --> low_power_field (ucumvert registry) # [LPF] = 100 * 1 # NON_METRIC, low power field, view area in microscope (chemical) -# [arb'U] --> arbitary_unit (ucumvert registry) # [arb'U] = 1 * 1 # NON_METRIC, arbitary unit, arbitrary (chemical) +# [arb'U] --> arbitrary_unit (ucumvert registry) # [arb'U] = 1 * 1 # NON_METRIC, arbitrary unit, arbitrary (chemical) # [USP'U] --> US_pharmacopeia_unit (ucumvert registry) # [USP'U] = 1 * 1 # NON_METRIC, United States Pharmacopeia unit, arbitrary (chemical) # [GPL'U] --> GPL_unit (ucumvert registry) # [GPL'U] = 1 * 1 # NON_METRIC, GPL unit, biologic activity of anticardiolipin IgG (chemical) # [MPL'U] --> MPL_unit (ucumvert registry) # [MPL'U] = 1 * 1 # NON_METRIC, MPL unit, biologic activity of anticardiolipin IgM (chemical) @@ -311,10 +311,10 @@ # [PFU] --> plaque_forming_unit (ucumvert registry) # [PFU] = 1 * 1 # NON_METRIC, plaque forming units, amount of an infectious agent (chemical) # [FFU] --> focus_forming_units (ucumvert registry) # [FFU] = 1 * 1 # NON_METRIC, focus forming units, amount of an infectious agent (chemical) # [CFU] --> colony_forming_unit (ucumvert registry) # [CFU] = 1 * 1 # NON_METRIC, colony forming units, amount of a proliferating organism (chemical) -# [IR] --> allergene_index_of_reactivity (ucumvert registry) # [IR] = 1 * 1 # NON_METRIC, index of reactivity, amount of an allergen callibrated through in-vivo testing using the Stallergenes® method. (chemical) -# [BAU] --> bioequivalent_allergen_unit (ucumvert registry) # [BAU] = 1 * 1 # NON_METRIC, bioequivalent allergen unit, amount of an allergen callibrated through in-vivo testing based on the ID50EAL method of (intradermal dilution for 50mm sum of erythema diameters (chemical) +# [IR] --> allergene_index_of_reactivity (ucumvert registry) # [IR] = 1 * 1 # NON_METRIC, index of reactivity, amount of an allergen calibrated through in-vivo testing using the Stallergenes® method (chemical) +# [BAU] --> bioequivalent_allergen_unit (ucumvert registry) # [BAU] = 1 * 1 # NON_METRIC, bioequivalent allergen unit, amount of an allergen calibrated through in-vivo testing based on the ID50EAL method of (intradermal dilution for 50mm sum of erythema diameters (chemical) # [AU] --> allergen_unit (ucumvert registry) # [AU] = 1 * 1 # NON_METRIC, allergen unit, procedure defined amount of an allergen using some reference standard (chemical) -# [Amb'a'1'U] --> allergen_unit_for_Ambrosia_artemisiifolia (ucumvert registry) # [Amb'a'1'U] = 1 * 1 # NON_METRIC, allergen unit for Ambrosia artemisiifolia, procedure defined amount of the major allergen of ragweed. (chemical) +# [Amb'a'1'U] --> allergen_unit_for_Ambrosia_artemisiifolia (ucumvert registry) # [Amb'a'1'U] = 1 * 1 # NON_METRIC, allergen unit for Ambrosia artemisiifolia, procedure defined amount of the major allergen of ragweed (chemical) # [PNU] --> protein_nitrogen_unit (ucumvert registry) # [PNU] = 1 * 1 # NON_METRIC, protein nitrogen unit, procedure defined amount of a protein substance (chemical) # [Lf] --> limit_of_flocculation (ucumvert registry) # [Lf] = 1 * 1 # NON_METRIC, Limit of flocculation, procedure defined amount of an antigen substance (chemical) # [D'ag'U] --> D_antigen_unit (ucumvert registry) # [D'ag'U] = 1 * 1 # NON_METRIC, D-antigen unit, procedure defined amount of a poliomyelitis d-antigen substance (chemical) @@ -324,11 +324,13 @@ # Ao --> angstrom (ucumvert registry) # Ao = 0.1 * nm # NON_METRIC, Ångström, length (misc) # b --> barn (default registry) # b = 100 * fm2 # NON_METRIC, barn, action area (misc) # att --> technical_atmosphere (ucumvert registry) # att = 1 * kgf/cm2 # NON_METRIC, technical atmosphere, pressure (misc) -# [psi] --> pound_force_per_square_inch (default registry) # [psi] = 1 * [lbf_av]/[in_i]2 # NON_METRIC, pound per sqare inch, pressure (misc) +# [psi] --> pound_force_per_square_inch (default registry) # [psi] = 1 * [lbf_av]/[in_i]2 # NON_METRIC, pound per square inch, pressure (misc) # circ --> turn (ucumvert registry) # circ = 2 * [pi].rad # NON_METRIC, circle, plane angle (misc) -# sph --> sphere (ucumvert registry) # sph = 4 * [pi].sr # NON_METRIC, spere, solid angle (misc) +# sph --> sphere (ucumvert registry) # sph = 4 * [pi].sr # NON_METRIC, sphere, solid angle (misc) # [car_m] --> carat (ucumvert registry) # [car_m] = 2e-1 * g # NON_METRIC, metric carat, mass (misc) # [car_Au] --> carat_of_gold_alloys (ucumvert registry) # [car_Au] = 1/24 # NON_METRIC, carat of gold alloys, mass fraction (misc) # [smoot] --> smoot (ucumvert registry) # [smoot] = 67 * [in_i] # NON_METRIC, Smoot, length (misc) # [m/s2/Hz^(1/2)] --> meter_per_square_second_per_square_root_of_hertz (ucumvert registry) # [m/s2/Hz^(1/2)] = 1 * sqrt(1 m2/s4/Hz) # NON_METRIC, meter per square seconds per square root of hertz, amplitude spectral density (misc) +# [NTU] --> nephelometric_turbidity_unit (ucumvert registry) # [NTU] = 1 * 1 # NON_METRIC, Nephelometric Turbidity Unit, turbidity (misc) +# [FNU] --> formazin_nephelometric_unit (ucumvert registry) # [FNU] = 1 * 1 # NON_METRIC, Formazin Nephelometric Unit, turbidity (misc) # bit_s --> bit (ucumvert registry) # bit_s = 1 * ld(1 1) # NON_METRIC, bit, amount of information (infotech) diff --git a/src/ucumvert/ucum_grammar.lark b/src/ucumvert/ucum_grammar.lark index 1c44584..a9ec385 100644 --- a/src/ucumvert/ucum_grammar.lark +++ b/src/ucumvert/ucum_grammar.lark @@ -1,4 +1,4 @@ -# Based on UCUM specification (Version 2.1, 2017-11-21) +# Based on UCUM specification (Version 2.2, 2024-06-28) # Includes ucumvert-specific fixes to handle all common UCUM units # and some edge cases not present in the official examples. # This file is auto-created by parser.update_lark_ucum_grammar_file @@ -74,7 +74,8 @@ UNIT_NON_METRIC: "10*" |"10^" |"[pi]" |"%" |"[ppth]" |"[ppm]" |"[ppb]" |"[CCID_50]" |"[TCID_50]" |"[EID_50]" |"[PFU]" |"[FFU]" |"[CFU]" |"[IR]" |"[BAU]" |"[AU]" |"[Amb'a'1'U]" |"[PNU]" |"[Lf]" |"[D'ag'U]" |"[FEU]" |"[ELU]" |"[EU]" |"Ao" |"b" |"att" |"[psi]" |"circ" |"sph" - |"[car_m]" |"[car_Au]" |"[smoot]" |"[m/s2/Hz^(1/2)]" |"bit_s" + |"[car_m]" |"[car_Au]" |"[smoot]" |"[m/s2/Hz^(1/2)]" |"[NTU]" + |"[FNU]" |"bit_s" EXPONENT : ["+"|"-"] NON_ZERO_DIGITS FACTOR: NON_ZERO_DIGITS diff --git a/src/ucumvert/ucum_pint.py b/src/ucumvert/ucum_pint.py index 860c781..7d1efc2 100644 --- a/src/ucumvert/ucum_pint.py +++ b/src/ucumvert/ucum_pint.py @@ -385,5 +385,6 @@ def run_examples(): # pragma: no cover if __name__ == "__main__": - run_examples() - # find_ucum_codes_that_need_mapping() + # run_examples() + find_matching_pint_definitions() + find_ucum_codes_that_need_mapping() diff --git a/src/ucumvert/vendor/README.md b/src/ucumvert/vendor/README.md index 5c6931d..c6bc90a 100644 --- a/src/ucumvert/vendor/README.md +++ b/src/ucumvert/vendor/README.md @@ -2,7 +2,7 @@ This directory contain copies of files from the [UCUM repository](https://github.com/ucum-org/ucum) to enable running the code without internet access. The copied files fall under the [UCUM Copyright Notice and License](https://github.com/ucum-org/ucum/blob/main/LICENSE.md) (Version 1.0). -* `ucum-essence.xml` - Version 2.1 (revision date: 2017-11-21 19:04:52 -0500). +* `ucum-essence.xml` - Version 2.2 (revision date: 2024-06-17). * Used to build the terminals of the lark parser. * `ucum_examples.tsv` - Extracted from [TableOfExampleUcumCodesForElectronicMessaging.xlsx](https://github.com/ucum-org/ucum/blob/main/common-units/TableOfExampleUcumCodesForElectronicMessaging.xlsx), Version 1.5, released 06/2020 * Used in unit tests. The tsv was created with the script `get_ucum_examples_as_tsv.py`. diff --git a/src/ucumvert/vendor/ucum-essence.xml b/src/ucumvert/vendor/ucum-essence.xml index 81a21c4..ff99474 100644 --- a/src/ucumvert/vendor/ucum-essence.xml +++ b/src/ucumvert/vendor/ucum-essence.xml @@ -1,7 +1,6 @@ <?xml version="1.0" encoding="ascii"?> -<root xmlns="http://unitsofmeasure.org/ucum-essence" version="2.1" - revision="$Revision: 442 $" - revision-date="$Date: 2017-11-21 19:04:52 -0500 (Tue, 21 Nov 2017) $"> +<root xmlns="http://unitsofmeasure.org/ucum-essence" version="2.2" revision="N/A" + revision-date="2024-06-17"> <prefix Code="Y" CODE="YA"> <name>yotta</name> <printSymbol>Y</printSymbol> @@ -210,7 +209,7 @@ <name>mole</name> <printSymbol>mol</printSymbol> <property>amount of substance</property> - <value Unit="10*23" UNIT="10*23" value="6.0221367">6.0221367</value> + <value Unit="10*23" UNIT="10*23" value="6.02214076">6.02214076</value> </unit> <unit Code="sr" CODE="SR" isMetric="yes" class="si"> <name>steradian</name> @@ -337,7 +336,8 @@ <unit Code="gon" CODE="GON" isMetric="no" class="iso1000"> <name>gon</name> <name>grade</name> - <printSymbol>□<sup>g</sup> + <printSymbol> + <sup>g</sup> </printSymbol> <property>plane angle</property> <value Unit="deg" UNIT="DEG" value="0.9">0.9</value> @@ -366,11 +366,11 @@ <property>volume</property> <value Unit="dm3" UNIT="DM3" value="1">1</value> </unit> - <unit Code="L" isMetric="yes" class="iso1000"> + <unit Code="L" CODE="L" isMetric="yes" class="iso1000"> <name>liter</name> <printSymbol>L</printSymbol> <property>volume</property> - <value Unit="l" value="1">1</value> + <value Unit="l" UNIT="L" value="1">1</value> </unit> <unit Code="ar" CODE="AR" isMetric="yes" class="iso1000"> <name>are</name> @@ -474,7 +474,7 @@ <name>unified atomic mass unit</name> <printSymbol>u</printSymbol> <property>mass</property> - <value Unit="g" UNIT="G" value="1.6605402e-24">1.6605402 × 10<sup>-24</sup> + <value Unit="g" UNIT="G" value="1.66053906660e-24">1.66053906660 × 10<sup>-24</sup> </value> </unit> <unit Code="eV" CODE="EV" isMetric="yes" class="iso1000"> @@ -510,7 +510,7 @@ <i>h</i> </printSymbol> <property>action</property> - <value Unit="J.s" UNIT="J.S" value="6.6260755e-34">6.6260755 × 10<sup>-34</sup> + <value Unit="J.s" UNIT="J.S" value="6.62607015e-34">6.62607015 × 10<sup>-34</sup> </value> </unit> <unit Code="[k]" CODE="[K]" isMetric="yes" class="const"> @@ -519,7 +519,7 @@ <i>k</i> </printSymbol> <property>(unclassified)</property> - <value Unit="J/K" UNIT="J/K" value="1.380658e-23">1.380658 × 10<sup>-23</sup> + <value Unit="J/K" UNIT="J/K" value="1.380649e-23">1.380649 × 10<sup>-23</sup> </value> </unit> <unit Code="[eps_0]" CODE="[EPS_0]" isMetric="yes" class="const"> @@ -551,7 +551,7 @@ <i>e</i> </printSymbol> <property>electric charge</property> - <value Unit="C" UNIT="C" value="1.60217733e-19">1.60217733 × 10<sup>-19</sup> + <value Unit="C" UNIT="C" value="1.602176634e-19">1.602176634 × 10<sup>-19</sup> </value> </unit> <unit Code="[m_e]" CODE="[M_E]" isMetric="yes" class="const"> @@ -563,7 +563,7 @@ </i> </printSymbol> <property>mass</property> - <value Unit="g" UNIT="g" value="9.1093897e-28">9.1093897 × 10<sup>-28</sup> + <value Unit="kg" UNIT="kg" value="9.1093837139e-31">9.1093837139 × 10<sup>-31</sup> </value> </unit> <unit Code="[m_p]" CODE="[M_P]" isMetric="yes" class="const"> @@ -575,7 +575,7 @@ </i> </printSymbol> <property>mass</property> - <value Unit="g" UNIT="g" value="1.6726231e-24">1.6726231 × 10<sup>-24</sup> + <value Unit="kg" UNIT="kg" value="1.67262192595e-27">1.67262192595 × 10<sup>-27</sup> </value> </unit> <unit Code="[G]" CODE="[GC]" isMetric="yes" class="const"> @@ -584,7 +584,7 @@ <i>G</i> </printSymbol> <property>(unclassified)</property> - <value Unit="m3.kg-1.s-2" UNIT="M3.KG-1.S-2" value="6.67259e-11">6.67259 × 10<sup>-11</sup> + <value Unit="m3.kg-1.s-2" UNIT="M3.KG-1.S-2" value="6.67430e-11">6.67430 × 10<sup>-11</sup> </value> </unit> <unit Code="[g]" CODE="[G]" isMetric="yes" class="const"> @@ -1166,7 +1166,7 @@ <value Unit="[lb_av]" UNIT="[LB_AV]" value="100">100</value> </unit> <unit Code="[lcwt_av]" CODE="[LCWT_AV]" isMetric="no" class="avoirdupois"> - <name>long hunderdweight</name> + <name>long hundredweight</name> <name>British hundredweight</name> <property>mass</property> <value Unit="[lb_av]" UNIT="[LB_AV]" value="112">112</value> @@ -1660,7 +1660,7 @@ <value Unit="[iU]" UNIT="[IU]" value="1">1</value> </unit> <unit Code="[arb'U]" CODE="[ARB'U]" isMetric="no" isArbitrary="yes" class="chemical"> - <name>arbitary unit</name> + <name>arbitrary unit</name> <printSymbol>arb. U</printSymbol> <property>arbitrary</property> <value Unit="1" UNIT="1" value="1">1</value> @@ -1787,13 +1787,13 @@ <unit Code="[IR]" CODE="[IR]" isMetric="no" isArbitrary="yes" class="chemical"> <name>index of reactivity</name> <printSymbol>IR</printSymbol> - <property>amount of an allergen callibrated through in-vivo testing using the Stallergenes® method.</property> + <property>amount of an allergen calibrated through in-vivo testing using the Stallergenes® method</property> <value Unit="1" UNIT="1" value="1">1</value> </unit> <unit Code="[BAU]" CODE="[BAU]" isMetric="no" isArbitrary="yes" class="chemical"> <name>bioequivalent allergen unit</name> <printSymbol>BAU</printSymbol> - <property>amount of an allergen callibrated through in-vivo testing based on the ID50EAL method of (intradermal dilution for 50mm sum of erythema diameters</property> + <property>amount of an allergen calibrated through in-vivo testing based on the ID50EAL method of (intradermal dilution for 50mm sum of erythema diameters</property> <value Unit="1" UNIT="1" value="1">1</value> </unit> <unit Code="[AU]" CODE="[AU]" isMetric="no" isArbitrary="yes" class="chemical"> @@ -1806,7 +1806,7 @@ class="chemical"> <name>allergen unit for Ambrosia artemisiifolia</name> <printSymbol>Amb a 1 U</printSymbol> - <property>procedure defined amount of the major allergen of ragweed.</property> + <property>procedure defined amount of the major allergen of ragweed</property> <value Unit="1" UNIT="1" value="1">1</value> </unit> <unit Code="[PNU]" CODE="[PNU]" isMetric="no" isArbitrary="yes" class="chemical"> @@ -1949,7 +1949,7 @@ <value Unit="S" UNIT="S" value="1">1</value> </unit> <unit Code="[psi]" CODE="[PSI]" isMetric="no" class="misc"> - <name>pound per sqare inch</name> + <name>pound per square inch</name> <printSymbol>psi</printSymbol> <property>pressure</property> <value Unit="[lbf_av]/[in_i]2" UNIT="[LBF_AV]/[IN_I]2" value="1">1</value> @@ -1961,7 +1961,7 @@ <value Unit="[pi].rad" UNIT="[PI].RAD" value="2">2</value> </unit> <unit Code="sph" CODE="SPH" isMetric="no" class="misc"> - <name>spere</name> + <name>sphere</name> <printSymbol>sph</printSymbol> <property>solid angle</property> <value Unit="[pi].sr" UNIT="[PI].SR" value="4">4</value> @@ -1997,6 +1997,18 @@ <function name="sqrt" value="1" Unit="m2/s4/Hz"/> </value> </unit> + <unit Code="[NTU]" CODE="[NTU]" isMetric="no" class="misc"> + <name>Nephelometric Turbidity Unit</name> + <printSymbol/> + <property>turbidity</property> + <value Unit="1" UNIT="1" value="1">1</value> + </unit> + <unit Code="[FNU]" CODE="[FNU]" isMetric="no" class="misc"> + <name>Formazin Nephelometric Unit</name> + <printSymbol/> + <property>turbidity</property> + <value Unit="1" UNIT="1" value="1">1</value> + </unit> <unit Code="bit_s" CODE="BIT_S" isMetric="no" isSpecial="yes" class="infotech"> <name>bit</name> <printSymbol>bit<sub>s</sub> diff --git a/src/ucumvert/vendor/ucum_examples.tsv b/src/ucumvert/vendor/ucum_examples.tsv index b467fd5..417e8ea 100644 --- a/src/ucumvert/vendor/ucum_examples.tsv +++ b/src/ucumvert/vendor/ucum_examples.tsv @@ -280,7 +280,7 @@ Row # (not a code) UCUM_CODE Description of the Unit (using UCUM descriptions wh 279 L/kg liter per kilogram 280 L/L liter per liter 281 L/min liter per minute -282 L/min/m2 liter per minute per sqaure meter +282 L/min/m2 liter per minute per square meter 283 L/(min.m2) liter per minute per square meter 284 L/s liter per second 285 L/s/s2 liter per second per square second diff --git a/tests/test_ucum.py b/tests/test_ucum.py index c4d42e6..2a89d79 100644 --- a/tests/test_ucum.py +++ b/tests/test_ucum.py @@ -7,8 +7,6 @@ def get_units_2casings(): ucumvert.xml_util.CODE_ATTRIB = "Code" cased = get_metric_units() + get_non_metric_units() - # Unit code "L" has no no-case version so we remove it. - cased.remove("L") ucumvert.xml_util.CODE_ATTRIB = "CODE" nocase = get_metric_units() + get_non_metric_units() ucumvert.xml_util.CODE_ATTRIB = "Code" diff --git a/tests/test_xm_util.py b/tests/test_xm_util.py index 7e53a2c..e18cddc 100644 --- a/tests/test_xm_util.py +++ b/tests/test_xm_util.py @@ -2,5 +2,5 @@ def test_get_units(): - assert len(get_units()) == 303 # noqa: PLR2004 + assert len(get_units()) == 305 # noqa: PLR2004 assert set(get_units()) == set(get_metric_units() + get_non_metric_units())