From 50c6076e424fed3552bfb4859604090e6a310656 Mon Sep 17 00:00:00 2001 From: Massimo Cimmino Date: Wed, 10 Nov 2021 13:55:35 -0500 Subject: [PATCH 1/2] Implement deprecation warnings for old gfunction API --- pygfunction/gfunction.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/pygfunction/gfunction.py b/pygfunction/gfunction.py index c142ffbb..475d22d7 100644 --- a/pygfunction/gfunction.py +++ b/pygfunction/gfunction.py @@ -881,6 +881,13 @@ def uniform_heat_extraction(boreholes, time, alpha, use_similarities=True, Journal of Heat and Mass Transfer, 70, 641-650. """ + # This function is deprecated as of v2.1. It will be removed in v3.0. + warnings.warn("`pygfunction.gfunction.uniform_heat_extraction` is " + "deprecated as of v2.1. It will be removed in v3.0. " + "New features are not fully supported by the function. " + "Use the `pygfunction.gfunction.gFunction` class instead.", + DeprecationWarning) + boundary_condition = 'UHTR' # Build options dict options = {'nSegments':1, @@ -981,6 +988,13 @@ def uniform_temperature(boreholes, time, alpha, nSegments=8, Journal of Heat and Mass Transfer, 70, 641-650. """ + # This function is deprecated as of v2.1. It will be removed in v3.0. + warnings.warn("`pygfunction.gfunction.uniform_temperature` is " + "deprecated as of v2.1. It will be removed in v3.0. " + "New features are not fully supported by the function. " + "Use the `pygfunction.gfunction.gFunction` class instead.", + DeprecationWarning) + boundary_condition = 'UBWT' # Build options dict options = {'nSegments':nSegments, @@ -1080,6 +1094,13 @@ def equal_inlet_temperature( fields. International Journal of Heat and Mass Transfer, 91, 1119-1127. """ + # This function is deprecated as of v2.1. It will be removed in v3.0. + warnings.warn("`pygfunction.gfunction.equal_inlet_temperature` is " + "deprecated as of v2.1. It will be removed in v3.0. " + "New features are not fully supported by the function. " + "Use the `pygfunction.gfunction.gFunction` class instead.", + DeprecationWarning) + network = Network( boreholes, UTubes, m_flow_network=m_flow_borehole*len(boreholes), cp_f=cp_f, nSegments=nSegments) @@ -1202,6 +1223,13 @@ def mixed_inlet_temperature( Environment, 25 (8), 1007-1022 """ + # This function is deprecated as of v2.1. It will be removed in v3.0. + warnings.warn("`pygfunction.gfunction.mixed_inlet_temperature` is " + "deprecated as of v2.1. It will be removed in v3.0. " + "New features are not fully supported by the function. " + "Use the `pygfunction.gfunction.gFunction` class instead.", + DeprecationWarning) + boundary_condition = 'MIFT' # Build options dict options = {'nSegments':nSegments, From f98b16d7e9c83ada6226e88e1512aa6e815d60ea Mon Sep 17 00:00:00 2001 From: Massimo Cimmino Date: Wed, 10 Nov 2021 13:57:28 -0500 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f6294788..bd09adbf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ * [Issue 125](https://github.com/MassimoCimmino/pygfunction/issues/125) - Refactored class methods and docstrings in `Pipe` and `Network` objects to better represent the expected shapes of array inputs and outputs. * [Issue 154](https://github.com/MassimoCimmino/pygfunction/issues/154) - Replaced `numpy.int` and `numpy.bool` dtypes in array initializations with built-in types `int` and `bool`. `numpy.int` and `numpy.bool` are deprecated as of `numpy` version `1.20`. * [Issue 158](https://github.com/MassimoCimmino/pygfunction/issues/158) - Changed default parameter values for *g*-function calculations. The `gFunction` class now uses the `'equivalent'` solver by default and a non-uniform discretization of `nSegments=8` given by `utilities.segment_ratios()`. +* [Issue 160](https://github.com/MassimoCimmino/pygfunction/issues/160) - Deprecated functions `gfunction.uniform_heat_extraction`, `gfunction.uniform_temperature`, `gfunction.equal_inlet_temperature` and `gfunction.mixed_inlet_temperature`. They will be removed in `v3.0.0`. ### Bug fixes