{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Welcome to GeogG122: Scientific Computing (Univeristy College London)\n", "\n", "## Course information\n", "\n", "### Course Convenor\n", "\n", "[Dr Gómez-Dans](http://www.geog.ucl.ac.uk/people/research-staff/jose-gomez-dans)\n", "\n", "### Course Staff\n", "[Dr. Gómez-Dans](http://www.geog.ucl.ac.uk/people/research-staff/jose-gomez-dans) \n", "[Prof P. Lewis](http://www.geog.ucl.ac.uk/~plewis) \n", "\n", " \n", "\n", "### Useful links\n", "\n", "[Course Moodle page](http://moodle.ucl.ac.uk/course/view.php?id=13891) \n", "\n", "[A useful reading list for basic and advanced Unix.](http://www.ee.surrey.ac.uk/Teaching/Unix/books-uk.html) \n", "\n", "- **0.0 Introduction ** \n", " [Introductory notes](http://nbviewer.ipython.org/urls/raw.github.com/profLewis/geogg122/master/Chapter0_Introduction/f1_index.ipynb) \n", " \n", " \n", "- **1.0 Unix** \n", " [Unix notes](http://nbviewer.ipython.org/urls/raw.github.com/profLewis/geogg122/master/Chapter1_Unix/f3_1_unix_intro.ipynb) \n", " [Unix exercises](http://nbviewer.ipython.org/urls/raw.github.com/profLewis/geogg122/master/Chapter1_Unix/f3_1a_unix_intro_answers.ipynb) \n", " \n", " \n", "- **2.0 Python 101** \n", " The aim of this Chapter is to introduce you to some of the fundamental concepts in Python. Mainly, this is based around fundamental data types in Python (`int`, `float`, `str`, `bool` etc.) and ways to group them (`tuple`, `list` and `dict`). We then learn about how to loop over groups of things, which gives us control to iterate some process. We need to spend a little time on strings, as you will likely to quite a bit of string processing in Scientific Computing (e.g. reading/writing data to/from ASCII text files). Although some of the examples we use are very simple to explain a concept, the more developed ones should be directly applicable to the sort of programming you are likely to need to do. A set of exercises is developed throughout the chapter, with worked answers available to you once you have had a go yourself. In addition, a more advanced section of the chapter is available, that goes into some more detail and complkications. This too has a set of exercises with worked examples. \n", "\n", " [Course Notes](http://nbviewer.ipython.org/urls/raw.github.com/profLewis/geogg122/master/Chapter2_Python_intro/python101.ipynb) \n", " [Answers](http://nbviewer.ipython.org/urls/raw.github.com/profLewis/geogg122/master/Chapter2_Python_intro/main_answers.ipynb) \n", " [Advanced](http://nbviewer.ipython.org/urls/raw.github.com/profLewis/geogg122/master/Chapter2_Python_intro/advanced.ipynb) \n", " [Advanced Answers](http://nbviewer.ipython.org/urls/raw.github.com/profLewis/geogg122/master/Chapter2_Python_intro/advanced_answers.ipynb) \n", " \n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "\n", "\n", "## Purpose of this course\n", "\n", "This course, GeogG122 Scientific Computing, is a term 1 MSc module worth 15 credits (25% of the term 1 credits) that aims to:\n", "\n", "* impart an understanding of scientific computing\n", "* give students a grounding in the basic principles of algorithm development and program construction\n", "* to introduce principles of computer-based image analysis and model development\n", "\n", "It is open to students from a number of [MSc courses](http://www.geog.ucl.ac.uk/admissions-and-teaching/postgraduates) run by the [Department of Geography](http://www.geog.ucl.ac.uk) [UCL](www.ucl.ac.uk), but the material should be of wider value to others wishing to make use of scientific computing.\n", "\n", "The module will cover:\n", "\n", "* Introduction to programming (algorithms, data structures, control structures, I/O, languages and pseudocode)\n", "* Introduction to linux environment (login, shell, file systems) and hardware\n", "* Compilation and debugging\n", "* Computing for image analysis (with reference to software such as ENVI/IDL)\n", "* Computing in Python\n", "* Computing for environmental modelling\n", "* Data visualisation for scientific applications\n", "\n", "## Learning Outcomes\n", "\n", "\n", "At the end of the module, students should:\n", "\n", "* have a working knowledge of linux / unix operating systems and have the knowledge and confidence to obtain, compile and install commonly available scientific software packages\n", "* have an understanding of algorithm development and be able to use widely used scientific computing software to manipulate datasets and accomplish analytical tasks\n", "* have an understanding of the technical issues specific to image-based analysis, model implementation and scientific visualisation\n", "\n", "## Timetable\n", "\n", "The course takes place over 10 weeks in term 1, on Wednesdays usually from 10:00 to 13:00 (09:00-13:00 in the first two sessions) in the Geography Department Unix Computing Lab (PB110) in the [Pearson Building, UCL](http://www.ucl.ac.uk/efd/roombooking/building-location/?id=003). Classes take place from the second week of term to the final week of term, other than Reading week. See [UCL term dates for further information](http://www.ucl.ac.uk/transition/joining/all-students/term-dates).\n", "\n", "## Assessment\n", "\n", "Assessment is through one piece of coursework that is submitted in both paper form and electronically via Moodle. See the [Moodle page](http://moodle.ucl.ac.uk/course/view.php?id=13891) for more details.\n", "\n", "## Structure of the Course\n", "\n", "\n", "* 06\t3 Oct\t09:00-13:00\t4 hrs\tIntroduction to Unix\t110\tJGD\n", "* 07\t10 Oct\t09:00-13:00\t4 hrs\tIntroduction to Python\t110\tJGD\n", "* 08\t17 Oct\t10:00-13:00\t3 hrs\tPython coding\t110\tJGD\n", "* 09\t24 Oct\t10:00-13:00\t3 hrs\tPython coding\t110\tJGD\n", "* 10\t31 Oct\t10:00-13:00\t3 hrs\tRaster and vector data \t110\tJGD\n", "* 11\t\t\t\tREADING WEEK (ENVI)\t\t\n", "* 12\t14 Nov\t10:00-13:00\t3 hrs\tRaster and vector data\t110\tJGD\n", "* 13\t21 Nov\t10:00-13:00\t3 hrs\tBuilding and calibrating a model\t110\tJGD\n", "* 14\t28 Nov\t10:00-13:00\t3 hrs\tBuilding and calibrating a model\t110\tJGD\n", "* 15\t5 Dec\t10:00-13:00\t3 hrs\tGroup practical\t110\tJGD\n", "* 16\t12 Dec\t10:00-13:00\t3 hrs\tGroup practical\t110\tJGD\n", "\n", "Total scheduled hours: 32 hours\n", "\n", "JGD: Dr. Gómez-Dans\n", "\n", "Rooms: PB110 = Pearson Building Unix Lab, Room 110, 1st floor\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Using these notes" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "There are several ways you can access this course material.\n", "\n", "These notes are created in [jupyter notebooks](http://jupyter.org).\n", "\n", "The course is all stored online in [github](https://github.com/profLewis/geogg122), so you can just navigate to that site and download the files as you like.\n", "\n", "All notes will have been downloaded for you to your `DATA` area, so you can directly access them from there.\n", "\n", "If you want to access these same notes from outside UCL, see [connection from outsiude UCL](Connection.ipynb).\n", "\n", "\n", "Provided you have a relatively up to date version of [`ipython`](http://ipython.org/ipython-doc/dev/interactive/nbconvert.html#nbconvert) and a few other tools such as [`pandoc`](http://johnmacfarlane.net/pandoc/installing.html) you can convert your own notebooks to other formats using `ipython`, e.g.:\n", " \n", "`berlin% jupyter nbconvert --to html f2_intro.ipynb`\n", "\n", "You can also convert the notebooks to other [formats](http://ipython.org/ipython-doc/rel-1.0.0/interactive/nbconvert.html) though you might need some other tools as well for this. If you have a working copy of `LaTeX` on your system (e.g. [MacTeX](http://tug.org/mactex/downloading.html) on OS X), you can convert the notebooks to pdf format:\n", "\n", "`berlin% jupyter nbconvert --to latex --post PDF f2_intro.ipynb`" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Obtaining the course material" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "Alternatively, you can obtain the whole course from [github](https://github.com/profLewis/geogg122).\n", "\n", "To download the whole course, you can:\n", " \n", "1. **using git** \n", "\n", " use the command [`git`](http://en.wikipedia.org/wiki/Git_%28software%29), if available: \n", " Create a place on the system that you want to work in (N.B., don't type `berlin%`: that represents the command line prompt), e.g.: \n", " \n", " `berlin% mkdir -p ~/Data/msc` \n", " `berlin% cd ~/Data/msc` \n", " `berlin% git clone https://github.com/profLewis/geogg122.git` \n", " `berlin% cd ~/Data/msc/geogg122`\n", " \n", " This will create a directory `~/Data/msc/geogg122` which has the current versions of the notebooks for the course and associated files.\n", " \n", " If the course notes change at all (e.g. are updated), you can update your copy with:\n", " \n", " `berlin% git pull`\n", " \n", " To find out more about using `git`, type `git --help`, get [help online](http://www.siteground.com/tutorials/git/commands.htm) or download and use a [gui tool](http://git-scm.com/downloads). \n", " \n", " \n", " If you set up an account on [github](https://github.com/edu), you can fork the [course repository](https://github.com/profLewis/geogg122) to make your own version of the course notes, and add in your own comments and examples, if that helps you learn or remember things.\n", "\n", "
\n",
" \n",
"2. **using a zip file** \n",
"\n",
" Download the course as a zip file:\n",
" \n",
" `berlin% mkdir -p ~/Data/msc` \n",
" `berlin% cd ~/Data/msc` \n",
" `berlin% wget -O geogg122.zip https://github.com/profLewis/geogg122/archive/master.zip` \n",
" `berlin% unzip geogg122.zip` \n",
" `berlin% cd ~/Data/msc/geogg122-master`\n",
" \n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Using the course material"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Once you have copied the course material as described above (and have changed directory to where you have put the course (e.g. `~/Data/msc/geogg122-master` or `~/Data/msc/geogg122`) then `cd` to the chapter you want, e.g.:\n",
"\n",
"`berlin% cd ~/Data/msc/geogg122/Chapter0_Introduction`\n",
"\n",
"and you can start the notebooks with:\n",
" \n",
"`berlin% ipython notebook`\n",
"\n",
"This should launch a web browser with the address `http://127.0.0.1:8888/` or similar with links to the notebooks you have available. "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"To load a *specific* notebook, you can type e.g.:\n",
" \n",
"`berlin% ipython notebook f1_index.ipynb`"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Python"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"For most users wanting to install a working python environment, Anaconda appears to be far easier and overall quite nice to use: