MassimoCimmino / pygfunction

An open-source toolbox for the evaluation of thermal response factors (g-functions) of geothermal borehole fields.
BSD 3-Clause "New" or "Revised" License
48 stars 21 forks source link

API change on patch release #261

Closed j-c-cook closed 1 year ago

j-c-cook commented 1 year ago

@mitchute changed the name of the first argument in gt.media.fluid.Fluid here: https://github.com/MassimoCimmino/pygfunction/pull/232/commits/ac88d2b39373809bc5a52694431a9c4f897a3586.

The following code is valid for pygfunction version 2.2.0, but not for version 2.2.2.

    # Fluid properties
    mixer = 'MEG'  # Ethylene glycol mixed with water
    percent = 20.  # Percentage of ethylene glycol added in
    fluid = gt.media.Fluid(mixer=mixer, percent=percent)
MassimoCimmino commented 1 year ago

I missed this change since mixer / fluid_str is not a keyword argument.

@mitchute Do you have specific requirements for the new variable name?

I would say that fluid_str is more appropriate than mixer since mixer == 'Water' is somewhat odd.

j-c-cook commented 1 year ago

Alright I'll update ghedt then. Please note the following functionality is functional in Python and therefore every argument can be treated as a keyword.

>>> import pygfunction as gt
>>> mixer = 'MEG'
>>> percent = 20
>>> d = {'mixer': mixer, 'percent': percent}
>>> fluid = gt.media.Fluid(**d)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: __init__() got an unexpected keyword argument 'mixer'
>>> d = {'fluid_str': mixer, 'percent': percent}
>>> fluid = gt.media.Fluid(**d)
mitchute commented 1 year ago

No specific requirements on my end. It just seemed like a better name, as you noted.