Differences between revisions 4 and 7 (spanning 3 versions)
Revision 4 as of 2009-10-19 10:39:23
Size: 3881
Editor: anonymous
Comment:
Revision 7 as of 2010-10-16 20:32:29
Size: 4260
Editor: anonymous
Comment:
Deletions are marked like this. Additions are marked like this.
Line 9: Line 9:
= Software for geo-scientific data processing and analysis = = (Free) Software for Geo-scientific Data Processing and Analysis =
Line 104: Line 104:
octave:1> x=linspace(0,2*pi,100)
octave:2> y=sin(x)
octave:3> plot(x,y)
>> x=linspace(0,2*pi,100)
>> y=sin(x)
>> plot(x,y)
Line 125: Line 125:
 * Read [[http://www.euroscipy.org/file/3776?vid=download|EuroSciPy 2010 lecture notes]]

= Links =

 * http://python.org/
 * http://scipy.org/
 * http://matplotlib.sourceforge.net/
 * http://www.pyngl.ucar.edu/
 * http://gmt.soest.hawaii.edu/

 * http://techreport.com/discussions.x/16713
 * http://python.org/about/success/usa/
 * http://python.org/about/success/forecastwatch/

This lesson motivates the use of Python. The Python programming language is compared with other systems for geo-scientific data processing and analysis.

(Free) Software for Geo-scientific Data Processing and Analysis

Comparison of Programming Languages

Ideal programming language for geo-scientific data processing and analysis

  • Fast array operations
  • Image processing and numeric/scientific routines
  • Visualization
  • Various data formats
  • Processing of files and metadata
  • Short development cycles
  • Very high level of abstraction
  • Interactive

Ideal programming language for geo-scientific data processing and analysis?

  • Assembler
  • Fortran, C/C++, Java
  • Perl, Python
  • Matlab, IDL
  • Visual and menu driven environments, ENVI, GIS

Programming versus visual environments

  • Visual environments are very useful for specific tasks
  • Closed commerical software
  • Programming offers more flexibility
  • GIS scripting with python

Scripting verus Traditional Programming

  • Traditional programming refers to building usually large, monolithic systems
  • Fortran, C/C++, Java
  • Scripting means programming at a high and flexible abstraction level
  • Perl, Python, Ruby, Scheme, Tcl
  • Scientific computing environments
  • IDL, Matlab/Octave, Maple, Mathematica, R

Why Python?

Scalability

  • The ability to scale from easy to difficult problems and the ability for beginners and experts to be comfortable.
  • Python is easy enough to be a first language and powerful enough to write complex applications
  • Scientific computing is more than number crunching
    • Converting data formats
    • Extracting metadata from text
    • Working with a large number of files and directories
  • Object oriented programming possible, but not required
  • Simple interfacing of C,C++ and Fortran code
  • Heterogeneous data structures are easy to use
  • Readable and compact code
  • Freely available, open source, and runs on Unix, Mac and Windows

Scientific Python Environment

  • Basic Python has limited instruction set
  • Extensions (modules)
  • Scientific modules (scipy/numpy)
  • Interactive environment (ipython)
  • Plots and visualization (pylab)

Getting started with IPython and Pylab

Invoking the IPython shell

ipython -pylab

loads matplotlib module and enables interactive plotting

Quit with CTRL-D

Getting help

help()
help modules

list available modules

Features of IPython:

  • Command history (up, down)
  • Word completion by typing TAB
  • System commands through magic functions cd, ls, env, pwd
  • Access to Unix shell by prefix !, e.g. !ls -s | sort -g

  • Debugging and profiling
  • Program control: run

  • Print interactive variables who, whos

Are you a Matlab user?

The exercise is to plot a sine wave:

Matlab/Octave:

>> x=linspace(0,2*pi,100)
>> y=sin(x)
>> plot(x,y)

Pylab:

In [1]: x=linspace(0,2*pi,100)
In [2]: y=sin(x)
In [3]: plot(x,y)

So, it works pretty much the same way!

Of course there are some differences but many similarities.

Exercise

Links

LehreWiki: OpenSource2010/Lesson1 (last edited 2010-10-18 11:49:45 by anonymous)