NOAA-ORR-ERD / PyNUCOS

Python NOAA Unit Converter for OIl Spills
Other
2 stars 8 forks source link

Be smarter about parsing Unit names #19

Open ChrisBarker-NOAA opened 4 years ago

ChrisBarker-NOAA commented 4 years ago

The code currently "normalizes" names by removing spaces and capitalization. ANd recently "dot", to support, e.g. m.s-1

But we should probably be smarter. There may be places where spaces and/or capitalization matter.

UDunits, for instance, has an sytax for units where / and . mean something, and Capitalization is significant (so that, e.g. M means Mega, and m means milli -- maybe:-) )

-CHB

ChrisBarker-NOAA commented 9 months ago

UDUNITS also accepts a LOT of variations:

meter second-1 meters second-1 meter seconds-1 meters seconds-1 meter s-1 meters s-1

So maybe a way to do this is to use UDUNITS to pre-parse the units.

Hmm -- one problem there -- jsNUCOS is used in WEbClients, and and currently uses the same unit list as PyNUCOS -- but I don't think adding UDUNITS there is an option.