Skip to content

Commit

Permalink
Merge commit 'd93f1e3bd407e5d17441565bb7e7cfbc8f90d6e8'
Browse files Browse the repository at this point in the history
  • Loading branch information
wcarthur committed Apr 16, 2021
2 parents 1916233 + d93f1e3 commit 0382db5
Show file tree
Hide file tree
Showing 9 changed files with 126 additions and 127 deletions.
37 changes: 18 additions & 19 deletions .travis.yml
@@ -1,30 +1,29 @@
language: python
python:
- '3.6'
- '3.7'
- '3.8'
language: shell

env:
- PYTHON_VERSION=3.6
- PYTHON_VERSION=3.7
- PYTHON_VERSION=3.8

os:
- linux
- windows

before_install:
- source ./preinstall.sh

install:
- sudo apt-get update
- wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
# install in batch mode i.e. no input
- bash Miniconda3-latest-Linux-x86_64.sh -b -p $HOME/conda
- export PATH="$HOME/conda/bin:$PATH"
# clear bash cache table
- hash -r
- conda config --set always_yes yes
- conda config --set changeps1 no
- conda update -q conda
- conda config --add channels conda-forge
- conda config --set channel_priority strict
- conda env create -q -f tcrmenv.yml python=$TRAVIS_PYTHON_VERSION
- source activate tcrm
- source ./postinstall.sh

branches:
except:
- config
- notebooks

script:
- python installer/setup.py build_ext -i
- nosetests -v --with-coverage --cover-package=.

after_success: coveralls
notifications:
slack:
Expand Down
10 changes: 5 additions & 5 deletions DataProcess/DataProcess.py
Expand Up @@ -465,8 +465,8 @@ def _speed(self, dist, dt, indicator, initIndex):
"""
Extract speeds for all obs, initial obs and TC origins
Input: dist - array of distances between consecutive TC
observations
dt - array of times between consecutive TC observations
observations (km)
dt - array of times between consecutive TC observations (hours)
indicator - array of ones/zeros representing initial TC
observations (including TCs with a single
observation)
Expand Down Expand Up @@ -499,17 +499,17 @@ def _speed(self, dist, dt, indicator, initIndex):
speed_no_init = pjoin(self.processPath, 'speed_no_init')
# Extract all speeds
self.logger.debug('Outputting data into {0}'.format(all_speed))
header = 'all cyclone speed in m/s'
header = 'all cyclone speed in km/h'
flSaveFile(all_speed, speed, header, fmt='%6.2f')

# Extract initial speeds
self.logger.debug('Outputting data into {0}'.format(init_speed))
header = 'initial cyclone speed in m/s'
header = 'initial cyclone speed in km/h'
flSaveFile(init_speed, initSpeed, header, fmt='%f')

# Extract speeds, excluding initial speeds
self.logger.debug('Outputting data into {0}'.format(speed_no_init))
header = 'cyclone speed without initial ones in m/s'
header = 'cyclone speed without initial ones in km/h'
flSaveFile(speed_no_init, speedNoInit, header, fmt='%6.2f')

def _pressure(self, pressure, indicator):
Expand Down
2 changes: 1 addition & 1 deletion Evaluate/interpolateTracks.py
Expand Up @@ -114,7 +114,7 @@ def interpolate(track, delta, interpolation_type=None):
nLon = interp1d(timestep, track.Longitude, kind='linear')(newtime)
nLat = interp1d(timestep, track.Latitude, kind='linear')(newtime)

if len(validIdx) == 2:
if len(validIdx) >= 2:
npCentre = interp1d(timestep,
track.CentralPressure,
kind='linear')(newtime)
Expand Down
12 changes: 6 additions & 6 deletions TrackGenerator/TrackGenerator.py
Expand Up @@ -1293,7 +1293,7 @@ def dumpAllCellCoefficients(self):
'dtype': 'f',
'atts': {
'long_name': 'Mean forward speed',
'units': 'm/s'
'units': 'km/h'
}
},
1: {
Expand All @@ -1314,7 +1314,7 @@ def dumpAllCellCoefficients(self):
'dtype': 'f',
'atts': {
'long_name': 'Standard deviation forward speed',
'units': 'm/s'
'units': 'km/h'
}
},
3: {
Expand All @@ -1324,7 +1324,7 @@ def dumpAllCellCoefficients(self):
'dtype': 'f',
'atts': {
'long_name': 'Minimum forward speed',
'units': 'm/s'
'units': 'km/h'
}
},
4: {
Expand All @@ -1334,7 +1334,7 @@ def dumpAllCellCoefficients(self):
'dtype': 'f',
'atts': {
'long_name': 'Mean forward speed (over land)',
'units': 'm/s'
'units': 'km/h'
}
},
5: {
Expand All @@ -1356,7 +1356,7 @@ def dumpAllCellCoefficients(self):
'atts': {
'long_name': 'Standard deviation of forward' +
' speed (over land)',
'units': 'm/s'
'units': 'km/h'
}
},
7: {
Expand All @@ -1366,7 +1366,7 @@ def dumpAllCellCoefficients(self):
'dtype': 'f',
'atts': {
'long_name': 'Minimum forward speed (over land)',
'units': 'm/s'
'units': 'km/h'
}
},
8: {
Expand Down
2 changes: 1 addition & 1 deletion Utilities/track.py
Expand Up @@ -324,7 +324,7 @@ def ncSaveTracks(trackfile, tracks,
tvar.lon_units = 'degrees east'
tvar.lat_units = 'degrees north'
tvar.pressure_units = 'hPa'
tvar.speed_units = 'm/s'
tvar.speed_units = 'km/h'
tvar.length_units = 'km'
tvar.trackId = repr(t.trackId)

Expand Down
113 changes: 21 additions & 92 deletions docs/install.rst
Expand Up @@ -19,18 +19,21 @@ For users wanting to only run the code, a zip file or gzipped tar file
of the latest releases can be downloaded from the `Releases page
<https://github.com/GeoscienceAustralia/tcrm/releases>`_.

To have access to the latest updates, users should clone the repository, and
then regularly pull from the repository as updates are made.

Those wanting to contribute to development can `fork
<https://github.com/GeoscienceAustralia/tcrm/fork>`_ the
repository. Submit a pull request to have your changes integrated into
TCRM.
TCRM. Read more about contribting_ to the TCRM code.

.. _dependencies:

Dependencies
------------

TCRM relies on a number of additional libraries that are not part of
the standard library. There are several ways to obtain the required
the standard Pyhton library. There are several ways to obtain the required
libraries -- using Python's recommended tool `pip
<https://pip.readthedocs.org/en/latest/>`_, installing a distribution
such as `Python(x,y) package <http://code.google.com/p/pythonxy/>`_
Expand Down Expand Up @@ -59,23 +62,6 @@ please see the documentation for each individual library.
* Parallel execution in multi-processor environments (with MPI
installed) requires `mpi4py <https://mpi4py.readthedocs.io/>`_

Using pip
~~~~~~~~~

If you have `pip <https://pip.readthedocs.org/en/latest/>`_ installed,
the required modules can be installed using the following command,
executed in the main TCRM directory

.. code-block:: bash
pip -v install -r requirements.txt
This will automatically build the required libraries (listed in the
``requirements.txt`` file) and any dependencies. ``pip`` must be on
the ``$PATH`` for this to work.

.. _compilation:


Using Anaconda
~~~~~~~~~~~~~~
Expand All @@ -98,6 +84,22 @@ The bash promt will look like
(tcrm) user@server:~/tcrm$
Using pip
~~~~~~~~~

If you have `pip <https://pip.readthedocs.org/en/latest/>`_ installed,
the required modules can be installed using the following command,
executed in the main TCRM directory

.. code-block:: bash
pip -v install -r requirements.txt
This will automatically build the required libraries (listed in the
``requirements.txt`` file) and any dependencies. ``pip`` must be on
the ``$PATH`` for this to work.



.. _environment:

Expand Down Expand Up @@ -140,79 +142,6 @@ CSH/TCSH shell
setenv PYTHONPATH $PYTHONPATH:/path/to/tcrm:/path/to/tcrm/Utilities
.. _dependencies:

Dependencies
------------

TCRM relies on a number of additional libraries that are not part of
the standard library. There are several ways to obtain the required
libraries -- using Python's recommended tool `pip
<https://pip.readthedocs.org/en/latest/>`_, installing a distribution
such as `Python(x,y) package <http://code.google.com/p/pythonxy/>`_
(for Windows environments) or `Anaconda
<https://www.anaconda.com/distribution/#download-section>`_ (cross-platform), or
installing the libraries from source or binary installers
(pre-compiled binary Windows installer versions for all the libraries
(both 32-bit and 64-bit) can be obtained `here
<http://www.lfd.uci.edu/~gohlke/pythonlibs/>`_).

For detailed instructions on installation of these dependencies,
please see the documentation for each individual library.

* `Python <https://www.python.org/>`_ - v3.5 or later
* `Numpy <http://www.numpy.org/>`_ - v1.6 or later
* `Scipy <http://www.scipy.org/>`_ - v0.12 or later
* `Matplotlib <http://matplotlib.org/>`_ v1.2 or later.
* `Basemap <http://matplotlib.org/basemap/index.html>`_
* `netcdf4-python <https://code.google.com/p/netcdf4-python/>`_ -
version 1.0.8 or later
* `Shapely <http://toblerity.org/shapely/index.html>`_ - v1.2.15 or later
* `statsmodels <http://statsmodels.sourceforge.net>`_
* `seaborn <http://seaborn.pydata.org>`_
* `pandas <http://pandas.pydata.org>`_
* `gitpython <http://gitpython.readthedocs.org>`_
* Parallel execution in multi-processor environments (with MPI
installed) requires `mpi4py <https://mpi4py.readthedocs.io/>`_

Using pip
~~~~~~~~~

If you have `pip <https://pip.readthedocs.org/en/latest/>`_ installed,
the required modules can be installed using the following command,
executed in the main TCRM directory

.. code-block:: bash
pip -v install -r requirements.txt
This will automatically build the required libraries (listed in the
``requirements.txt`` file) and any dependencies. ``pip`` must be on
the ``$PATH`` for this to work.


Using Anaconda
~~~~~~~~~~~~~~

To install ``tcrm``, make a new environment:

.. code-block:: bash
conda env create -f tcrmenv.yml
After creating the environment the user needs to move to that environment using the command

.. code-block:: bash
conda activate tcrm
The bash promt will look like

.. code-block::
(tcrm) user@server:~/tcrm$
.. _compilation:

Windows
Expand Down
46 changes: 46 additions & 0 deletions postinstall.sh
@@ -0,0 +1,46 @@
# begin installing miniconda
if [[ "$TRAVIS_OS_NAME" != "windows" ]]; then
echo "installing miniconda for posix";
bash $HOME/download/miniconda.sh -b -u -p $MINICONDA_PATH;
elif [[ "$TRAVIS_OS_NAME" == "windows" ]]; then
echo "folder $MINICONDA_SUB_PATH does not exist"
echo "installing miniconda for windows";
choco install miniconda3 --params="'/JustMe /AddToPath:1 /D:$MINICONDA_PATH_WIN'";
fi;
# end installing miniconda

export PATH="$MINICONDA_PATH:$MINICONDA_SUB_PATH:$MINICONDA_LIB_BIN_PATH:$PATH";

# begin checking miniconda existance
echo "checking if folder $MINICONDA_SUB_PATH exists"
if [[ -d $MINICONDA_SUB_PATH ]]; then
echo "folder $MINICONDA_SUB_PATH exists"
else
echo "folder $MINICONDA_SUB_PATH does not exist"
fi;
# end checking miniconda existance

source $MINICONDA_PATH/etc/profile.d/conda.sh;
hash -r;
echo $TRAVIS_OS_NAME
echo $PYTHON_VERSION
python --version

if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then
echo "Removing mpi4py from environment for windows build"
echo "Package not available in conda channels"
sed -i '/mpi4py/d' ./tcrmenv.yml
fi

conda config --set always_yes yes --set changeps1 no;
conda update -q conda;
conda config --add channels conda-forge;
conda config --set channel_priority strict;
# Useful for debugging any issues with conda
conda info -a

echo "Create TCRM environment"
conda env create -q -f tcrmenv.yml python=$PYTHON_VERSION;
conda activate tcrm
python --version
conda list
24 changes: 24 additions & 0 deletions preinstall.sh
@@ -0,0 +1,24 @@
if [[ "$TRAVIS_OS_NAME" != "windows" ]]; then
export MINICONDA_PATH=$HOME/miniconda;
export MINICONDA_SUB_PATH=$MINICONDA_PATH/bin;
elif [[ "$TRAVIS_OS_NAME" == "windows" ]]; then
export MINICONDA_PATH=$HOME/miniconda;
export MINICONDA_PATH_WIN=`cygpath --windows $MINICONDA_PATH`;
export MINICONDA_SUB_PATH=$MINICONDA_PATH/Scripts;
fi;
export MINICONDA_LIB_BIN_PATH=$MINICONDA_PATH/Library/bin;
# Obtain miniconda installer
if [[ "$TRAVIS_OS_NAME" != "windows" ]]; then
mkdir -p $HOME/download;
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
echo "downloading miniconda.sh for linux";
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O $HOME/download/miniconda.sh;
elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
echo "downloading miniconda.sh for osx";
wget https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O $HOME/download/miniconda.sh;
fi;
fi;
# Install openssl for Windows
if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then
choco install openssl.light;
fi;

0 comments on commit 0382db5

Please sign in to comment.