NEAREST_MATERIAL
This function performs fuzzy matching on material names and returns the closest valid material ID from the available insulation, building-material, and refractory tables.
If complete is set to true, the search is restricted to materials that have all key properties available (density, heat capacity, and thermal conductivity). This is useful when subsequent calculations require a complete property set.
The output is a material key string that can be passed directly to related property functions.
Excel Usage
=NEAREST_MATERIAL(name, complete)
name(str, required): Search keywords for material matching (dimensionless).complete(bool, optional, default: false): Whether to return only materials with complete data.
Returns (str): Material ID that best matches the search term.
Example 1: Stainless steel fuzzy match
Inputs:
| name |
|---|
| stainless steel |
Excel formula:
=NEAREST_MATERIAL("stainless steel")
Expected output:
"Metals, stainless steel"
Example 2: Mineral fiber fuzzy match
Inputs:
| name |
|---|
| mineral fiber |
Excel formula:
=NEAREST_MATERIAL("mineral fiber")
Expected output:
"Mineral fiber"
Example 3: Glass fiber board fuzzy match
Inputs:
| name |
|---|
| glass fiber board |
Excel formula:
=NEAREST_MATERIAL("glass fiber board")
Expected output:
"Glass fiber board"
Example 4: Complete data match
Inputs:
| name | complete |
|---|---|
| stainless steel | true |
Excel formula:
=NEAREST_MATERIAL("stainless steel", TRUE)
Expected output:
"Metals, stainless steel"
Python Code
Show Code
from ht.insulation import nearest_material as ht_nearest_material
def nearest_material(name, complete=False):
"""
Return the nearest material match from insulation tables.
See: https://ht.readthedocs.io/en/latest/ht.insulation.html
This example function is provided as-is without any representation of accuracy.
Args:
name (str): Search keywords for material matching (dimensionless).
complete (bool, optional): Whether to return only materials with complete data. Default is False.
Returns:
str: Material ID that best matches the search term.
"""
try:
result = ht_nearest_material(name, complete=complete)
return str(result)
except Exception as e:
return f"Error: {str(e)}"