95
95
96
96
97
97
def InsertImagesIntoHTML (html_path : str , short_names : set , full_names : set ) -> None :
98
-
99
98
# Write a reference to the image(s) into the HTML file by inserting before the "</body>" tag
100
99
# build the string to be inserted first
101
100
insert_string = ''
@@ -144,7 +143,7 @@ def render_default(p: float, unit: str = '', fmt: str = '') -> str:
144
143
:type fmt: str
145
144
:return: the string representation of the float
146
145
"""
147
- if not np . can_cast ( p , float ):
146
+ if not is_float ( p ):
148
147
raise ValueError (f'Parameter ({ p } ) must be a float or convertible to float.' )
149
148
150
149
unit = UpgradeSymbologyOfUnits (unit )
@@ -176,7 +175,7 @@ def render_scientific(p: float, unit: str = '', fmt: str = '') -> str:
176
175
:rtype: str
177
176
"""
178
177
179
- if not np . can_cast ( p , float ):
178
+ if not is_float ( p ):
180
179
raise ValueError (f'Parameter ({ p } ) must be a float or convertible to float.' )
181
180
182
181
unit = UpgradeSymbologyOfUnits (unit )
@@ -197,7 +196,7 @@ def render_Parameter_default(p: Parameter, fmt: str = '') -> str:
197
196
:type fmt: str
198
197
:return: the string representation of the float
199
198
"""
200
- if not np . can_cast (p .value , float ):
199
+ if not is_float (p .value ):
201
200
raise ValueError (f'Parameter ({ p .value } ) must be a float or convertible to float.' )
202
201
203
202
return render_default (p .value , p .CurrentUnits .value )
@@ -214,7 +213,7 @@ def render_parameter_scientific(p: Parameter, fmt: str = '') -> str:
214
213
:return: the string representation of the float
215
214
"""
216
215
217
- if not np . can_cast (p .value , float ):
216
+ if not is_float (p .value ):
218
217
raise ValueError (f'Parameter ({ p .value } ) must be a float or convertible to float.' )
219
218
220
219
return render_scientific (p .value , p .CurrentUnits .value )
@@ -241,7 +240,7 @@ def density_water_kg_per_m3(Twater_degC: float, pressure: Optional[PlainQuantity
241
240
Raises:
242
241
ValueError: If Twater_degC is not a float or convertible to float.
243
242
"""
244
- if not np . can_cast (Twater_degC , float ):
243
+ if not is_float (Twater_degC ):
245
244
raise ValueError (f'Twater_degC ({ Twater_degC } ) must be a float or convertible to float.' )
246
245
247
246
try :
@@ -276,7 +275,7 @@ def celsius_to_kelvin(celsius: float) -> float:
276
275
277
276
@lru_cache
278
277
def viscosity_water_Pa_sec (
279
- Twater_degC : float ,
278
+ Twater_degC : float ,
280
279
pressure : Optional [PlainQuantity ] = None ) -> float :
281
280
"""
282
281
Calculate the dynamic viscosity of water as a function of temperature and pressure.
@@ -390,7 +389,7 @@ def vapor_pressure_water_kPa(temperature_degC: float) -> float:
390
389
391
390
try :
392
391
return (quantity (CP .PropsSI ('P' , 'T' , celsius_to_kelvin (temperature_degC ), 'Q' , 0 , 'Water' ), 'Pa' )
393
- .to ('kPa' ).magnitude )
392
+ .to ('kPa' ).magnitude )
394
393
395
394
except (NotImplementedError , ValueError ) as e :
396
395
raise ValueError (f'Input temperature ({ temperature_degC } C) is out of range or otherwise not implemented' ) from e
0 commit comments