From c908a600ca9acbfab071d8d5727bef37898c71ae Mon Sep 17 00:00:00 2001 From: Jean-Michel Campin Date: Wed, 18 Dec 2024 12:03:09 -0500 Subject: [PATCH 1/2] Adjust testreport alternative results-sending option (#898) * adjust criteria for rarely used option adjust criteria for "alternative way to send testreport results", i.e., when "scp" is used instead of "mpack". * restore permissions * document minor adjustment to testreport --- doc/tag-index | 4 ++++ tools/do_tst_2+2 | 8 ++++---- verification/testreport | 10 ++++------ 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/doc/tag-index b/doc/tag-index index f2fe071f9e..242e10f437 100644 --- a/doc/tag-index +++ b/doc/tag-index @@ -1,6 +1,10 @@ Notes on tags used in MITgcmUV ============================== +o testreport: + - improve way of sending results tar file with "scp", now allowing to combine + "ssh" then "scp". + checkpoint69c (2024/12/06) o pkg/mom_common,fluxform,vecinv: - remove ISOTROPIC_COS_SCALING code from pkg/mom_vecinv/mom_vi_hdissip.F (was diff --git a/tools/do_tst_2+2 b/tools/do_tst_2+2 index 03fd0c812e..f353525e03 100755 --- a/tools/do_tst_2+2 +++ b/tools/do_tst_2+2 @@ -271,12 +271,12 @@ if test "x$ADDRESS" != xNONE -a "x$ADDRESS" != x ; then fi fi if test "x$SENDCMD" != x ; then - SendOpt='' ; headCMD=`echo $SENDCMD | awk '{print $1}'` - if test $headCMD != 'scp' ; then SendOpt='-s MITgcm-test -m 3555000' ; fi - #echo " run: $SENDCMD $SendOpt ${SAVDIR}/${DRESULTS}".tar.gz" $ADDRESSES" + sendOpt='' ; nb=`echo $SENDCMD | grep -c '\'` + if [ $nb -eq 0 ] ; then sendOpt='-s MITgcm-test -m 3555000' ; fi + #echo " run: $SENDCMD $sendOpt ${SAVDIR}/${DRESULTS}".tar.gz" $ADDRESSES" tar -cf ${SAVDIR}/${DRESULTS}".tar" $DRESULTS > /dev/null 2>&1 \ && gzip ${SAVDIR}/${DRESULTS}".tar" \ - && $SENDCMD $SendOpt ${SAVDIR}/${DRESULTS}".tar.gz" $ADDRESS + && $SENDCMD $sendOpt ${SAVDIR}/${DRESULTS}".tar.gz" $ADDRESS out=$? if test "x$out" != x0 ; then echo diff --git a/verification/testreport b/verification/testreport index f0d9c62503..f358f2b795 100755 --- a/verification/testreport +++ b/verification/testreport @@ -1051,7 +1051,6 @@ scandirs() fi } - check_eedata() { # check_eedata eedata size.h @@ -1094,7 +1093,6 @@ check_eedata() ############################################################################### - # Default properties debug=0 verbose=1 @@ -1907,14 +1905,14 @@ if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then echo "No results email was sent." else if test "x$SENDCMD" != x ; then - SendOpt='' ; headCMD=`echo $SENDCMD | awk '{print $1}'` - if test $headCMD != 'scp' ; then SendOpt='-s MITgcm-test -m 3555000' ; fi + sendOpt='' ; nb=`echo $SENDCMD | grep -c '\'` + if [ $nb -eq 0 ] ; then sendOpt='-s MITgcm-test -m 3555000' ; fi if [ $verbose -gt 1 ]; then - echo " run: $SENDCMD $SendOpt ${SAVDIR}/${DRESULTS}".tar.gz" $ADDRESSES" + echo " run: $SENDCMD $sendOpt ${SAVDIR}/${DRESULTS}".tar.gz" $ADDRESSES" fi tar -cf ${SAVDIR}/${DRESULTS}".tar" $DRESULTS > /dev/null 2>&1 \ && gzip ${SAVDIR}/${DRESULTS}".tar" \ - && $SENDCMD $SendOpt ${SAVDIR}/${DRESULTS}".tar.gz" $ADDRESSES + && $SENDCMD $sendOpt ${SAVDIR}/${DRESULTS}".tar.gz" $ADDRESSES RETVAL=$? if test "x$RETVAL" != x0 ; then echo From 83a53713c2ed13d25627079695c9d261bed25f64 Mon Sep 17 00:00:00 2001 From: Oliver Jahn Date: Wed, 18 Dec 2024 15:15:23 -0500 Subject: [PATCH 2/2] Update MITgcmutils for numpy 2.0.0 and bug fix (#897) * Update MITgcmutils for numpy 2.0.0 * Fix two bugs * MITgcmutils now always requires matplotlib * adjust warning statement * Bump MITgcmutils version number * MITgcmutils: fix bug in negative salinity check * document fix in utils/python --------- Co-authored-by: Martin Losch <30285667+mjlosch@users.noreply.github.com> Co-authored-by: Jean-Michel Campin --- doc/tag-index | 2 + .../MITgcmutils/MITgcmutils/conversion.py | 4 +- .../python/MITgcmutils/MITgcmutils/density.py | 49 ++++++++++--------- utils/python/MITgcmutils/setup.py | 7 +-- 4 files changed, 31 insertions(+), 31 deletions(-) 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"], )