Skip to content

Commit 8d0ec90

Browse files
committed
Merge branch 'newdiagtest' of http://github.com/UV-CDAT/uvcdat into newdiagtest
Conflicts: testing/metrics/CMakeLists.txt
2 parents edd8008 + e269eb0 commit 8d0ec90

25 files changed

Lines changed: 757 additions & 153 deletions

CMake/cdat_modules_extra/setup_runtime.csh.in

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@ endif
2222
# which can lead to errors.
2323
if ( $?UVCDAT_SETUP_PATH ) then
2424
if ( ${UVCDAT_SETUP_PATH} == ${install_prefix} ) then
25-
echo 'UVCDAT setup already sourced for this install location.'
26-
exit 1
25+
echo 'Nothing to do since UVCDAT is already setup at '${UVCDAT_SETUP_PATH}
26+
exit 0
2727
else
2828
echo 'ERROR: UVCDAT setup was previously sourced at '${UVCDAT_SETUP_PATH}
29-
echo 'Open a new shell in order to use a different install location.'
29+
echo 'ERROR: There is no need to run setup_runtime manually anymore.'
30+
echo 'ERROR: Open a new shell in order to use a different install location.'
3031
exit 1
3132
endif
3233
endif
@@ -91,3 +92,7 @@ setenv UVCDAT_SETUP_PATH ${install_prefix}
9192

9293
unset install_prefix
9394

95+
echo 'Successfully updated your environment to use UVCDAT'
96+
echo '(changes are valid for this session/terminal only)'
97+
echo 'Version: '${UVCDAT_PROMPT_STRING}
98+
echo 'Location: '${UVCDAT_SETUP_PATH}

CMake/cdat_modules_extra/setup_runtime.sh.in

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ function cleanup {
1010
# which can lead to errors.
1111
if [ -n "${UVCDAT_SETUP_PATH}" ] ; then
1212
if [ "${UVCDAT_SETUP_PATH}" = "${install_prefix}" ] ; then
13+
echo "Nothing to do since UVCDAT is already setup at: ${UVCDAT_SETUP_PATH}" 1>&2
1314
cleanup
1415
return 0
1516
else
16-
echo "ERROR: UVCDAT setup was previously sourced at \"${UVCDAT_SETUP_PATH}\"" 1>&2
17+
echo "ERROR: UVCDAT setup was previously sourced at: ${UVCDAT_SETUP_PATH}" 1>&2
1718
echo "ERROR: There is no need to run setup_runtime manually anymore." 1>&2
1819
echo "ERROR: Open a new shell in order to use a different install location." 1>&2
1920
cleanup
@@ -23,7 +24,7 @@ fi
2324

2425
# Check that the install prefix exists, otherwise stop.
2526
if [ ! -d "${install_prefix}" ] ; then
26-
echo "ERROR: \"${install_prefix}\" is not a directory." 1>&2
27+
echo "ERROR: ${install_prefix} is not a directory." 1>&2
2728
cleanup
2829
return 1
2930
fi
@@ -85,4 +86,8 @@ export PYTHONPATH
8586

8687
export UVCDAT_SETUP_PATH="${install_prefix}"
8788
cleanup
89+
echo "Successfully updated your environment to use UVCDAT" 1>&2
90+
echo "(changes are valid for this session/terminal only)" 1>&2
91+
echo "Version: ${UVCDAT_PROMPT_STRING}" 1>&2
92+
echo "Location: ${UVCDAT_SETUP_PATH}" 1>&2
8893
return 0

Packages/unidata/Lib/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@
1616
modification, or enhancement.
1717
1818
"""
19-
from udunits import udunits
20-
19+
from udunits import udunits,addBaseUnit,addDimensionlessUnit,addScaledUnit,\
20+
addOffsettedUnit,addMultipliedUnits,addInvertedUnit,addDividedUnits
2121
udunits_init=0

Packages/unidata/Lib/udunits.py

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,38 @@
22
version=sys.version.split()[0].split('.')
33
version=string.join(version[:2],'.')
44
udunits_name=unidata.__path__[0]+'/udunits.dat'
5+
def addBaseUnit(name):
6+
"""let you add to udunits2 system a new base unit with a specific name"""
7+
return udunits_wrap.addBaseUnit(name)
8+
9+
def addDimensionlessUnit(name):
10+
"""let you add to udunits2 system a new dimensionless unit with a specific name"""
11+
return udunits_wrap.addDimensionlessUnit(name)
12+
13+
def addScaledUnit(name,scale,original):
14+
"""let you add to udunits2 system a new scaled unit with a specific name
15+
from an original unit"""
16+
return udunits_wrap.addScaledUnit(name,scale,original)
17+
18+
def addOffsettedUnit(name,offset,original):
19+
"""let you add to udunits2 system a new offsetted unit with a specific name
20+
from an original unit"""
21+
return udunits_wrap.addOffsettedUnit(name,offset,original)
22+
23+
def addMultipliedUnits(name,unit1,unit2):
24+
"""let you add to udunits2 system a new unit with a specific name
25+
which is the multiplication of two other units specified by name"""
26+
return udunits_wrap.addMultipliedUnits(name,unit1,unit2)
27+
28+
def addDividedUnits(name,unit1,unit2):
29+
"""let you add to udunits2 system a new unit with a specific name
30+
which is the division of two other units specified by name"""
31+
return udunits_wrap.addDividedUnits(name,unit1,unit2)
32+
33+
def addInvertedUnit(name,original):
34+
"""let you add to udunits2 system a new inverted unit with a specific name
35+
from an original unit"""
36+
return udunits_wrap.addInvertedUnit(name,original)
537

638
class udunits(object):
739
"""UNIDATA/UDUNITS Python Object
@@ -78,7 +110,7 @@ def __init__(self,value,units):
78110
udunits_wrap.init()#udunits_name)
79111
unidata.udunits_init=1
80112
self._units=units
81-
self._value=value
113+
self._value=float(value)
82114

83115
def to(self,units):
84116
if isinstance(units,udunits):

0 commit comments

Comments
 (0)