Python for data analysis in Oceanography

Binder License

Twitter Follow

Getting started

You can run this tutorial online without installing anything on your local machine just by clicking launch Binder icon from the top right corner of this page.

If you wish to have a local copy instead, follow the steps below:

  • Download miniconda (Python 3.x 64-bit version recommended) and install it using the instructions provided here. Skip this step if you already have miniconda/Anaconda installed.

  • Copy and paste the following command in your terminal to clone this repository:

git clone https://github.com/LijoDXL/OceanographyWithPython.git
  • Change to the cloned directory and create a new conda environment:

cd OceanographyWithPython
conda env create -f PHYoceanENV.yml
  • You can now activate the new environment by typing:

conda activate PHY_OCEAN
# to deactivate env:
conda deactivate
  • Your terminal prompt will change to indicate the currently active environment. That’s it, now try JupyterLab by typing in your termimal:

jupyter lab

Adding packages in your environment

Suppose you want to install a new package to your PHY_OCEAN environment. Here is what you should do:

  • Check the package’s documentation page for a section on installation. If available, follow the instructions there. It will be usually of the form conda install -c <channel-name> <package-name>.

  • If not, head over to anaconda.org and search with the package name there.

  • From the search results, click the one with most number of downloads (conda-forge channel preferred) to find the installation step.

  • Before you install, do not forget to activate your environment by typing:

conda activate PHY_OCEAN

Note

More details on managing environment with conda can be found here.

Other tools worth learning

  • Tmux: Easily organize your various terminal sessions. Highly useful if you work with remote sessions a lot.

  • Git: Version control your workflow. Never have the hassle of dealing with files like draft.doc,draft_edited.doc,draft_final_correction.doc,final_v1.doc,final_v2.doc,absolutely_final.doc.

_images/phdComic.jpg
Aim