1 Introduction

This tutorial will walk you through installing Python on Mac OSX... a real prerequisite for using and developing OCW.

If you find any issues or errors with this wiki page, please get in touch and let us know.

Important Note

If the Linux OS or Xcode on your Mac is the latest version, then you can skip Section 2 and directly install Anaconda.

Important Note

If you are familiar with Anaconda Python, Homebrew or MacPorts Python, skip both Sections 1 and 2 and check the list of required packages and Python libraries to run OCW.


2 Install Xcode on your Mac OS system

  • Go to App Store.

  • Search Xcode and install it on your Macbook or iMac.

  • Once it is installed, run Xcode

  • Go to Xcode -> Preference.

  • Go to ‘Downloads’ tab and install command line tools.

3 Install Anaconda Python

Free Download

You can download it for free here

Installation HowTo

The instruction to install anaconda python is given here.

If you're running an Linux platform, make sure you have Python Development libraries installed, e.g. (for Ubuntu Linux): sudo apt-get install python-dev

3.1 After Installation

For .csh users: Add this to .cshrc in your home directory.

Set Environment
set path = (/anaconda/bin $path)

alias python /anaconda/bin/python

For .bash users: Add this to .bashrc or .bash_profile in your home directory.

Set Environment
export PATH=/anaconda/bin:$PATH

alias python='/anaconda/bin/python'

3.2 Install Bottle and basemap libraries

Install
conda install pip
 
pip install bottle

conda install basemap

conda install netcdf4

4 Get the code and set up environment to run RCMES

  • Check out the OCW master code from the Apache Git repos.
Check out
git clone git://git.apache.org/climate.git 

  • Create a cache directory; this will store observational data.
Create Cache
mkdir cache

 

  • Create a work directory; this will store output data such as netCDF files and plots.
Create Work Output Directory
mkdir work
  • The resulting directory should now look like this

  • Examine the OCW source code. 

Navigate to the climate folder.

Navigating to the OCW source code
cd climate

Inside this folder, you will find a number of folders and files. These include:

  • the Readme files that provide useful information regarding the licensing of the code, and changes made
  • Source code directories

docs/                             Directory containing documentation about files in the project.

easy-ocw/                     Directory containing resources for building Apache OCW and its dependencies.

esgf/                              Directory containing resources for ESGF-RCMES integration.

examples/                     Directory containing scripts to perform end-to-end evaluations.

obs4MIPS/                    Directory containing resources to convert standard data formats into CMIP5 data format, written by Lawrence Livermore National Laboratory (LLNL).

ocw/                              Directory containing resources to perform climate model evaluations.

ocw-ui/                          Directory containing resources to provide a graphical user interface for OCW.

rcmet/                           Directory containing the Regional Climate Model Evaluation Toolkit (RCMET), the legacy code from the internal Jet Propulsion Laboratory (JPL) project. 

  • Scripts

setup.py                        Script for building and installing packages, and displaying package information.

  • Set some project specific environment variables

   For .csh users: Add this to .cshrc in your home directory.

Environment Vairables
# To Add climate, climate ui, and PYTHONPATH to your .cshrc

setenv OCW_HOME=/path/to/climate

setenv OCW_UI_HOME=$OCW_HOME/ocw-ui

setenv PYTHONPATH=$OCW_HOME:$PYTHONPATH

   

For .bash users: Add this to .bashrc or .bash_profile in your home directory.

# To Add climate, climate ui, and PYTHONPATH to your .bashrc or .bash_profile

export OCW_HOME=/path/to/climate

export OCW_UI_HOME=$OCW_HOME/ocw-ui

export PYTHONPATH=$OCW_HOME:$PYTHONPATH

5 Run some Regional Climate Modeling Evaluations

  • Link the frontend app folder (In the virtual machine version, this step is not necessary.)
OCW Web App
cd $OCW_UI_HOME/backend

ln -s ../frontend/app app

Paths to Directories
WORK_DIR: change the value to the location where you wish to save evaluation results e.g. work

PATH_LEADER: change the value to the location where you wish to save model output files e.g. cache

  • Start up the backend server by running the following.
Start Server
python run_webservices.py

6 Navigate to the Web Application

  • Now open your web browser and go to http://localhost:8082 where you will see the running Web Application.

  • Click ‘the +’ sign to add observational and model data.

  • Select the 'RCMED' tab.
  • Select the RCMED dataset that you would like to use for your evaluation using the drop-down box e.g. TRMM
  • Select the dataset parameter that you would like to use e.g. pcp

  • Click ‘Add Observation’
  • In the 'Local File' tab, type ‘/’ then your model files in /usr/local/rcmes will show up.

  • Choose a model file, parse it and click ‘Add Dataset’

  • After adding model files, your screen should look like below.

  • Click the working tools icon to the direct left of the Evaluate button for settings. You can choose a metric to calculate and plot, temporal regridding option and add sub-region information (path + filename).

  • At this stage OCW will automatically detect overlapping domains and time between observations and models. 

You can conduct model evaluation using spatial and temporal subsets of the original data. The grey shaded area is the actual evaluation domain selected by a user.

 

  • Now click ‘Evaluate’ button. You can see the progress in the terminal windows 1.

  • Click ‘Results’ on the top of page.

7 The End...

That gives you an overview of installing the target OCW environment, running some simple regional climate modeling analysis and visualizing the results.

If you find any issues or errors with this wiki page, please get in touch and let us know.

8 Download this tutorial

This pdf below is a collective work from the RCMES Team. The major contributions come from Kyo for starting the guide, and Jinwon for testing it out and adding to it.

Download the Guide Here:

  File Modified
PDF File How2installPythonOnMacsByKyoLee.pdf how to install python + modules Jun 06, 2013 by Shakeh Elisabeth Khudikyan

  • No labels