diff --git a/doc/tag-index b/doc/tag-index index 242e10f437..43cbc054b5 100644 --- a/doc/tag-index +++ b/doc/tag-index @@ -1,6 +1,8 @@ Notes on tags used in MITgcmUV ============================== +o utils/python: + - make MITgcmutils compatible with numpy 2.0.0 again. o testreport: - improve way of sending results tar file with "scp", now allowing to combine "ssh" then "scp". diff --git a/utils/python/MITgcmutils/MITgcmutils/conversion.py b/utils/python/MITgcmutils/MITgcmutils/conversion.py index 04c9e3eb11..d26b7a7f9f 100644 --- a/utils/python/MITgcmutils/MITgcmutils/conversion.py +++ b/utils/python/MITgcmutils/MITgcmutils/conversion.py @@ -43,14 +43,14 @@ def pfromz(rC, rF0=0.0, lat=None, rhoConst=1.0275e+3, eosRefP0=1.01325e+5, >>> pfromz(-1000,lat=[70,90]) 1009.6304, 1010.2562 """ - z = np.asfarray(rC) + z = np.asarray(rC, dtype=np.float64) assert np.all(z<=0), 'input_error: values cannot be positive' if lat is None: gravity = 9.81 else: - lat = np.asfarray(lat) + lat = np.asarray(lat, dtype=np.float64) if lat.ndim == 1 and z.ndim == 1: lat,z = np.meshgrid(lat,z) diff --git a/utils/python/MITgcmutils/MITgcmutils/density.py b/utils/python/MITgcmutils/MITgcmutils/density.py index 5540d923ee..939831b2fa 100644 --- a/utils/python/MITgcmutils/MITgcmutils/density.py +++ b/utils/python/MITgcmutils/MITgcmutils/density.py @@ -37,9 +37,10 @@ def _check_salinity(s): sneg = s<0 - if not np.any(sneg): - warnings.warn('found negative salinity values, reset them to NaN') - # s[sneg] = np.NaN + if np.any(sneg): + warnings.warn('found negative salinity values') + # warnings.warn('found negative salinity values, reset them to nan') + # s[sneg] = np.nan return s @@ -105,8 +106,8 @@ def linear(salt,theta, """ # make sure arguments are floating point - s = np.asfarray(salt) - t = np.asfarray(theta) + s = np.asarray(salt, dtype=np.float64) + t = np.asarray(theta, dtype=np.float64) _check_dimensions(s,t) @@ -152,8 +153,8 @@ def poly3(poly3,salt,theta): - Converted to python by Gavilan on 2024-07-18 """ # make sure arguments are floating point - s = np.asfarray(salt) - t = np.asfarray(theta) + s = np.asarray(salt, dtype=np.float64) + t = np.asarray(theta, dtype=np.float64) coeffs=poly3[:,3:] @@ -249,9 +250,9 @@ def jmd95(salt,theta,p): """ # make sure arguments are floating point - s = np.asfarray(salt) - t = np.asfarray(theta) - p = np.asfarray(p) + s = np.asarray(salt, dtype=np.float64) + t = np.asarray(theta, dtype=np.float64) + p = np.asarray(p, dtype=np.float64) _check_dimensions(s,t,p) @@ -299,9 +300,9 @@ def bulkmodjmd95(salt,theta,p): """ Compute bulk modulus """ # make sure arguments are floating point - s = np.asfarray(salt) - t = np.asfarray(theta) - p = np.asfarray(p) + s = np.asarray(salt, dtype=np.float64) + t = np.asarray(theta, dtype=np.float64) + p = np.asarray(p, dtype=np.float64) # coefficients in pressure coordinates for # 3. secant bulk modulus K of fresh water at p = 0 @@ -424,9 +425,9 @@ def unesco(salt,theta,p): """ # make sure arguments are floating point - s = np.asfarray(salt) - t = np.asfarray(theta) - p = np.asfarray(p) + s = np.asarray(salt, dtype=np.float64) + t = np.asarray(theta, dtype=np.float64) + p = np.asarray(p, dtype=np.float64) _check_dimensions(s,t,p) @@ -473,9 +474,9 @@ def bulkmodunesco(salt,theta,p): """ Compute bulk modulus """ # make sure arguments are floating point - s = np.asfarray(salt) - t = np.asfarray(theta) - p = np.asfarray(p) + s = np.asarray(salt, dtype=np.float64) + t = np.asarray(theta, dtype=np.float64) + p = np.asarray(p, dtype=np.float64) # 3. secant bulk modulus K of fresh water at p = 0 eosJMDCKFw = [ 1.965221e+04, @@ -600,7 +601,7 @@ def mdjwf(salt,theta,p,epsln=0): """ # make sure arguments are floating point - s = np.asarray(s, dtype=np.float64) + s = np.asarray(salt, dtype=np.float64) t = np.asarray(theta, dtype=np.float64) p = np.asarray(p, dtype=np.float64) @@ -667,7 +668,7 @@ def mdjwf(salt,theta,p,epsln=0): ) denom = 1.0/(epsln+den) - rho = rhoNum*denom + rho = num*denom return rho @@ -704,9 +705,9 @@ def teos10(salt,theta,p,epsln=0): """ # make sure arguments are floating point - sa = np.asfarray(salt) - ct = np.asfarray(theta) - p = np.asfarray(p) + sa = np.asarray(salt, dtype=np.float64) + ct = np.asarray(theta, dtype=np.float64) + p = np.asarray(p, dtype=np.float64) _check_dimensions(sa,ct,p) diff --git a/utils/python/MITgcmutils/setup.py b/utils/python/MITgcmutils/setup.py index 3628985a55..9401f74f48 100644 --- a/utils/python/MITgcmutils/setup.py +++ b/utils/python/MITgcmutils/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="MITgcmutils", - version="0.2", + version="0.2.1", author="MITgcm Developers and Contributors", author_email="mitgcm-support@mitgcm.org", description="Python utilities for MITgcm", @@ -19,8 +19,5 @@ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", ], - install_requires=["numpy"], - extras_require={ - "plot": ["matplotlib"], - } + install_requires=["numpy","matplotlib"], )