Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into unstructured_plots
Browse files Browse the repository at this point in the history
Conflicts:
	testing/vcs/CMakeLists.txt
  • Loading branch information
aashish24 committed Apr 23, 2015
2 parents d7bf1c3 + baf7b8f commit f51e761
Show file tree
Hide file tree
Showing 23 changed files with 754 additions and 150 deletions.
11 changes: 8 additions & 3 deletions CMake/cdat_modules_extra/setup_runtime.csh.in
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ endif
# which can lead to errors.
if ( $?UVCDAT_SETUP_PATH ) then
if ( ${UVCDAT_SETUP_PATH} == ${install_prefix} ) then
echo 'UVCDAT setup already sourced for this install location.'
exit 1
echo 'Nothing to do since UVCDAT is already setup at '${UVCDAT_SETUP_PATH}
exit 0
else
echo 'ERROR: UVCDAT setup was previously sourced at '${UVCDAT_SETUP_PATH}
echo 'Open a new shell in order to use a different install location.'
echo 'ERROR: There is no need to run setup_runtime manually anymore.'
echo 'ERROR: Open a new shell in order to use a different install location.'
exit 1
endif
endif
Expand Down Expand Up @@ -91,3 +92,7 @@ setenv UVCDAT_SETUP_PATH ${install_prefix}

unset install_prefix

echo 'Successfully updated your environment to use UVCDAT'
echo '(changes are valid for this session/terminal only)'
echo 'Version: '${UVCDAT_PROMPT_STRING}
echo 'Location: '${UVCDAT_SETUP_PATH}
9 changes: 7 additions & 2 deletions CMake/cdat_modules_extra/setup_runtime.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ function cleanup {
# which can lead to errors.
if [ -n "${UVCDAT_SETUP_PATH}" ] ; then
if [ "${UVCDAT_SETUP_PATH}" = "${install_prefix}" ] ; then
echo "Nothing to do since UVCDAT is already setup at: ${UVCDAT_SETUP_PATH}" 1>&2
cleanup
return 0
else
echo "ERROR: UVCDAT setup was previously sourced at \"${UVCDAT_SETUP_PATH}\"" 1>&2
echo "ERROR: UVCDAT setup was previously sourced at: ${UVCDAT_SETUP_PATH}" 1>&2
echo "ERROR: There is no need to run setup_runtime manually anymore." 1>&2
echo "ERROR: Open a new shell in order to use a different install location." 1>&2
cleanup
Expand All @@ -23,7 +24,7 @@ fi

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

export UVCDAT_SETUP_PATH="${install_prefix}"
cleanup
echo "Successfully updated your environment to use UVCDAT" 1>&2
echo "(changes are valid for this session/terminal only)" 1>&2
echo "Version: ${UVCDAT_PROMPT_STRING}" 1>&2
echo "Location: ${UVCDAT_SETUP_PATH}" 1>&2
return 0
4 changes: 2 additions & 2 deletions Packages/unidata/Lib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
modification, or enhancement.
"""
from udunits import udunits

from udunits import udunits,addBaseUnit,addDimensionlessUnit,addScaledUnit,\
addOffsettedUnit,addMultipliedUnits,addInvertedUnit,addDividedUnits
udunits_init=0
34 changes: 33 additions & 1 deletion Packages/unidata/Lib/udunits.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,38 @@
version=sys.version.split()[0].split('.')
version=string.join(version[:2],'.')
udunits_name=unidata.__path__[0]+'/udunits.dat'
def addBaseUnit(name):
"""let you add to udunits2 system a new base unit with a specific name"""
return udunits_wrap.addBaseUnit(name)

def addDimensionlessUnit(name):
"""let you add to udunits2 system a new dimensionless unit with a specific name"""
return udunits_wrap.addDimensionlessUnit(name)

def addScaledUnit(name,scale,original):
"""let you add to udunits2 system a new scaled unit with a specific name
from an original unit"""
return udunits_wrap.addScaledUnit(name,scale,original)

def addOffsettedUnit(name,offset,original):
"""let you add to udunits2 system a new offsetted unit with a specific name
from an original unit"""
return udunits_wrap.addOffsettedUnit(name,offset,original)

def addMultipliedUnits(name,unit1,unit2):
"""let you add to udunits2 system a new unit with a specific name
which is the multiplication of two other units specified by name"""
return udunits_wrap.addMultipliedUnits(name,unit1,unit2)

def addDividedUnits(name,unit1,unit2):
"""let you add to udunits2 system a new unit with a specific name
which is the division of two other units specified by name"""
return udunits_wrap.addDividedUnits(name,unit1,unit2)

def addInvertedUnit(name,original):
"""let you add to udunits2 system a new inverted unit with a specific name
from an original unit"""
return udunits_wrap.addInvertedUnit(name,original)

class udunits(object):
"""UNIDATA/UDUNITS Python Object
Expand Down Expand Up @@ -78,7 +110,7 @@ def __init__(self,value,units):
udunits_wrap.init()#udunits_name)
unidata.udunits_init=1
self._units=units
self._value=value
self._value=float(value)

def to(self,units):
if isinstance(units,udunits):
Expand Down
Loading

0 comments on commit f51e761

Please sign in to comment.