You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
VolumetricFlux (m³·s⁻¹·m⁻²), a measure of the volume of fluid flowing through a surface per unit of time (equivalent to mean flow velocity)
FlowResistivity (Pa·s·m⁻²), a measure of the ability of a porous material to resist the flow of air through it.
As one can see, both have three factors (two of them being SI metrics) I ended up generating all of the different possible units through a python script and as expected, there are quite a lot... (for VolumetricFlux to be specific 2.6k) I don't think that's feasible. What should the criteria be for the inclusion of a unit?
The script:
fromitertoolsimportcombinations, productprefix= {
"yotta": "Y",
"zetta": "Z",
"exa": "E",
"peta": "P",
"tera": "T",
"giga": "G",
"mega": "M",
"kilo": "k",
"hecto": "h",
"deca": "da",
"deci": "d",
"centi": "c",
"milli": "m",
"micro": "µ",
"nano": "n",
"pico": "p",
"femto": "f",
"atto": "a",
"zepto": "z",
"yocto": "y",
"second": "s",
"minute": "min",
"hour": "h"
}
first= ["yotta", "zetta", "exa", "peta", "tera", "giga", "mega", "kilo", "hecto", "deca",
None, "deci", "centi", "milli", "micro", "nano", "pico", "femto", "atto",
"zepto", "yocto"]
second= ["second", "minute", "hour"]
third= ["yotta", "zetta", "exa", "peta", "tera", "giga", "mega", "kilo", "hecto", "deca",
None, "deci", "centi", "milli", "micro", "nano", "pico", "femto", "atto",
"zepto", "yocto"]
combinations=list(product(first, second, third))
# we need to do two runs, first for cubic meters, then for liters.forfirst, second, thirdincombinations:
first_str=firstiffirstisnotNoneelse""third_str=thirdifthirdisnotNoneelse""unit_name=f'@cubic_{first_str}meter_per_{second}_per_square_{third_str}meter'first_factor='*'.join((f'prefix!({first})', ) *3) iffirstisnotNoneelse"1.0E0"matchsecond:
case"second":
second_factor="1.0E0"case"minute":
second_factor="60.0E0"case"hour":
second_factor="3600.0E0"case_:
raiseValueError(f"Unknown unit {second}")
third_factor='*'.join((f'prefix!({third})', ) *2) ifthirdisnotNoneelse"1.0E0"conversion_factor=f'({first_factor})/({second_factor})/({third_factor})'first_prefix=prefix[first] iffirstisnotNoneelse""second_prefix=prefix[second]
third_prefix=prefix[third] ifthirdisnotNoneelse""unit=f'{first_prefix}m³·{second_prefix}·{third_prefix}m⁻²'singular=f'cubic {first_str}meter per {second} per square {third_str}meter'# collapse multiple spaces into onesingular=' '.join(singular.split())
plural=f'cubic {first_str}meters per {second} per square {third_str}meter'# collapse multiple spaces into oneplural=' '.join(plural.split())
print(f'{unit_name}: {conversion_factor}; "{unit}", "{singular}", "{plural}";')
forfirst, second, thirdincombinations:
first_str=firstiffirstisnotNoneelse""third_str=thirdifthirdisnotNoneelse""unit_name=f'@{first_str}liter_per_{second}_per_square_{third_str}meter'first_factor='*'.join(('prefix!(milli)',) +(f'prefix!({first})', ) *3) iffirstisnotNoneelse"1.0E0"matchsecond:
case"second":
second_factor="1.0E0"case"minute":
second_factor="60.0E0"case"hour":
second_factor="3600.0E0"case_:
raiseValueError(f"Unknown unit {second}")
third_factor='*'.join((f'prefix!({third})', ) *2) ifthirdisnotNoneelse"1.0E0"conversion_factor=f'({first_factor})/({second_factor})/({third_factor})'first_prefix=prefix[first] iffirstisnotNoneelse""second_prefix=prefix[second]
third_prefix=prefix[third] ifthirdisnotNoneelse""unit=f'{first_prefix}L·{second_prefix}·{third_prefix}m⁻²'singular=f'{first_str}liter per {second} per square {third_str}meter'# collapse multiple spaces into onesingular=' '.join(singular.split())
plural=f'{first_str}liters per {second} per square {third_str}meter'# collapse multiple spaces into oneplural=' '.join(plural.split())
print(f'{unit_name}: {conversion_factor}; "{unit}", "{singular}", "{plural}";')
The text was updated successfully, but these errors were encountered:
For quantities like this with a lot of unit combinations I'll usually do yotta through yocto for the dimension that is most commonly used and then hand pick other commonly used units. For these quantities perhaps start with yotta-yocto+hour/minute/second+no prefix and no prefix+hour/minute/second+yotta-yocto. I believe that will give 120 combinations each which isn't too bad.
I have a PR ready for two new units:
VolumetricFlux
(m³·s⁻¹·m⁻²
), a measure of the volume of fluid flowing through a surface per unit of time (equivalent to mean flow velocity)FlowResistivity
(Pa·s·m⁻²
), a measure of the ability of a porous material to resist the flow of air through it.As one can see, both have three factors (two of them being SI metrics) I ended up generating all of the different possible units through a python script and as expected, there are quite a lot... (for
VolumetricFlux
to be specific 2.6k) I don't think that's feasible. What should the criteria be for the inclusion of a unit?The script:
The text was updated successfully, but these errors were encountered: