Geog 820.03 Basic Skills in Scientific Programming Syllabus, Introduction, Fundamentals of IDL Syntax.

Slides:



Advertisements
Similar presentations
Overview of programming in C C is a fast, efficient, flexible programming language Paradigm: C is procedural (like Fortran, Pascal), not object oriented.
Advertisements

Fortran Jordan Martin Steven Devine. Background Developed by IBM in the 1950s Designed for use in scientific and engineering fields Originally written.
Introduction to Perl Bioinformatics. What is Perl? Practical Extraction and Report Language A scripting language Components an interpreter scripts: text.
COSC 120 Computer Programming
 2002 Prentice Hall. All rights reserved. 1 Chapter 2 – Introduction to Python Programming Outline 2.1 Introduction 2.2 First Program in Python: Printing.
Guide To UNIX Using Linux Third Edition
JavaScript, Third Edition
C PROGRAMMING LECTURE C-language Computer Fundamentals.
Basic Elements of C++ Chapter 2.
Computer Science 101 Introduction to Programming.
Chapter 1: An Introduction to Computers and Programming Prelude to Programming Concepts and Design Copyright © 2001 Scott/Jones, Inc.. All rights reserved.
© The McGraw-Hill Companies, 2006 Chapter 1 The first step.
Chapter 17 Programming Tools The Architecture of Computer Hardware and Systems Software: An Information Technology Approach 3rd Edition, Irv Englander.
Introduction to FORTRAN
 2008 Pearson Education, Inc. All rights reserved Introduction to Computers, the Internet and World Wide Web.
Geog Basic Skills in Scientific Programming Syllabus, Introduction, Fundamentals of IDL Syntax.
High-Level Programming Languages: C++
(1.1) COEN 171 Programming Languages Winter 2000 Ron Danielson.
Introduction to Python
General Computer Science for Engineers CISC 106 Lecture 02 Dr. John Cavazos Computer and Information Sciences 09/03/2010.
Chapter 2: Basic Elements of Java J ava P rogramming: From Problem Analysis to Program Design, From Problem Analysis to Program Design, Second Edition.
PYTHON. Python is a high-level, interpreted, interactive and object- oriented scripting language. Python was designed to be highly readable which uses.
Computer Science 101 Introduction to Programming.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley STARTING OUT WITH Python Python First Edition by Tony Gaddis Chapter 2 Input,
Java Programming, Second Edition Chapter One Creating Your First Java Program.
Computer Science 101 Introduction to Programming.
Chapter 8 High-Level Programming Languages. 8-2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
1 System Administration Introduction to Scripting, Perl Session 3 – Sat 10 Nov 2007 References:  chapter 1, The Unix Programming Environment, Kernighan.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 2 Chapter 2 - Introduction to C Programming.
Perl Practical(?)‏ Extraction and Report Language.
Beginning C++ Through Game Programming, Second Edition
CIS-165 C++ Programming I CIS-165 C++ Programming I Bergen Community College Prof. Faisal Aljamal.
Introduction to C Programming Chapter 2 : Data Input, Processing and Output.
Just a Little PHP Programming PHP on the Server. Common Programming Language Features Comments Data Types Variable Declarations Expressions Flow of Control.
Lecture 2: Introduction to C Programming. OBJECTIVES In this lecture you will learn:  To use simple input and output statements.  The fundamental data.
Perl Language Yize Chen CS354. History Perl was designed by Larry Wall in 1987 as a text processing language Perl has revised several times and becomes.
Programming Languages Meeting 14 December 9/10, 2014.
1 Chapter 3 Syntax, Errors, and Debugging Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
Introduction to Programming
C++ Lecture 1 Friday, 4 July History of C++ l Built on top of C l C was developed in early 70s from B and BCPL l Object oriented programming paradigm.
Chapter 1 Computers, Compilers, & Unix. Overview u Computer hardware u Unix u Computer Languages u Compilers.
Introduction to Perl NICOLE VECERE. Background General Purpose Language ◦ Procedural, Functional, and Object-oriented Developed for text manipulation.
Department of Electrical and Computer Engineering Introduction to Perl By Hector M Lugo-Cordero August 26, 2008.
Introduction to Python Dr. José M. Reyes Álamo. 2 Three Rules of Programming Rule 1: Think before you program Rule 2: A program is a human-readable set.
Arrays. Review of last lecture Overview of computer languages Overview of IDL Strength of IDL: (1) Interactive/compiled modes; (2) Array-oriented; (3)
Python Let’s get started!.
Computer and Programming. Computer Basics: Outline Hardware and Memory Programs Programming Languages and Compilers.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Chapter 2 - Introduction to C Programming Outline.
Introduction to JavaScript CSc 2320 Fall 2014 Disclaimer: All words, pictures are adopted from “Simple JavaScript”by Kevin Yank and Cameron Adams and also.
Spring 2009 Programming Fundamentals I Java Programming XuanTung Hoang Lecture No. 8.
Department of Electronic & Electrical Engineering Introduction to C - The Development cycle. Why C? The development cycle. Using Visual Studio ? A simple.
PERL By C. Shing ITEC Dept Radford University. Objectives Understand the history Understand constants and variables Understand operators Understand control.
Skill Area 311 Part B. Lecture Overview Assembly Code Assembler Format of Assembly Code Advantages Assembly Code Disadvantages Assembly Code High-Level.
Chapter 4: Variables, Constants, and Arithmetic Operators Introduction to Programming with C++ Fourth Edition.
1 Types of Programming Language (1) Three types of programming languages 1.Machine languages Strings of numbers giving machine specific instructions Example:
Programming Language Theory 2014, 1 Chapter 1 :: Introduction Origin : Michael L. Scott School of Computer & Information Engineering,
Unit 1 Review By: Mr. Jacobs.
小型系統 心情 vs. 古典樂 心情 vs. 古典樂 浪漫求籤系統 美食導航系統 季潔亭雅鈺熒岱芸 美食導航系統 楊氏音樂模擬大會考人瑋 若維 芷萱 伽倩 楊氏音樂模擬大會考 麥當勞熱量計算系統 火星文困擾你嗎 ? 火星文困擾你嗎 ? 歌詞知多少 - 挑戰你的腦容量英琪 日馨 青雪 鈺娟.
C++ Programming Chapter 1 Programming & Programs.
C++ Programming: From Problem Analysis to Program Design, Fourth Edition Chapter 3: Input/Output Samples.
Fundamentals of Programming I Overview of Programming
National Scientific Library at Tbilisi State University
Computer Science 210 Computer Organization
Constants and Variables
An Introduction to Programming with C++ Fifth Edition
The Selection Structure
General Computer Science for Engineers CISC 106 Lecture 03
DATA TYPES AND OPERATIONS
INTRODUCTION to PERL PART 1.
PYTHON - VARIABLES AND OPERATORS
Presentation transcript:

Geog Basic Skills in Scientific Programming Syllabus, Introduction, Fundamentals of IDL Syntax

Syllabus

Types of computer programming languag es High-level languages –Algebra formula-type (FORTRAN, ALGOL, BASIC, PASCAL, APL, PL/I) –Business data processing (COBOL, RPG) –String and list processing (LISP, Prolog) –Object-oriented (C++, JAVA, Python, Perl) –Visual (Visual Basic, Visual JAVA, Visual C) System languages Assembly languages Machine languages

History of computer languages FORTRAN 1954 LISP 1958 ALGOL 1958 COBOL 1959 BASIC 1964 PASCAL 1970 C 1971, C

Structure of a computer program 1.Define variables, arrays, constants 2.Read in data 3.Pre-processing: quality control, filling missing data, interpolation, re-gridding 4.Data analysis or other calculation 5.Plot the results 6.Output the results

A good programming style Clear (have a clear structure) Simple (try to use less lines) General (try to use variables) Accumulate subroutines

Overview of the Interactive Data Language (IDL) Developed and marketed by Research Systems, Inc. of Boulder, Colorado (first version released in 1981) It is basically FORTRAN + strong visualization, array operation, and object-oriented functions It is available for Windows, MacOS, UNIX (including Linux). Requires no (or little) change of code when transfer to a new platform Now widely used in research, educational, and commercial settings (e.g. astronomy, space, physics, earth, medical, and engineering)

Strength of IDL comparing with other languages (e.g. C and Fortran) IDL offers both interactive and compiled programming modes (C and Fortran offer only compiled mode) IDL is optimized to perform array operations (C and Fortran is is optimized to perform scalar operations) IDL variables may be created or redefined with a new type, size, or value at any time (in C and Fortran the variable type is fixed at run-time) IDL includes many built-in and user-developed routines for visualization and numerical analysis (C and Fortran require external libraries)

Open and run IDL Open IDL Interactive mode: print, “Hello world!” Edit a program file Compile and run a program file In unix version:.r filename.pro Online help: >?

The simplest IDL program print, ‘This is my first IDL program’ end Note: Every IDL program should end with an “ end ” statement

Structure of a computer program 1.Define variables, arrays, constants 2.Read in data 3.Pre-processing: quality control, filling missing data, interpolation, re-gridding 4.Data analysis or other calculation 5.Plot the results 6.Output the results

Variables and Data types Three basic data types: –Integer: i=1, j=12, k=123 –Floating-point: x=1.5, y=3.8 –String: a=‘This is a string’, b=‘123’ To check about data type: help, variable_name Other data types (not often used)

Data type conversions IDL allows conversion of one data type to another –From float to integer i=fix(2.8) –From integer to float x=float(3) –From integer to string a=string(45) Note: Conversion from float to integer will loose all the decimals fix(5.001)=5 fix(5.999)=5

Define variable names You can use any names other than the reserved words Traditionally (e.g. in FORTRAN), people use: i, j, k, l, m, n for integers other letters (a-h, o-z) for floating-point

Simple calculation Arithmetical operators: +, -, *, /, ^ (x+y*2-z^3)/4.0 Note: Integer divided by integer returns an integer 5/4 = 1, 3/4 = 0 Relational operators: eq, ne, lt, gt, le, ge return “1” if true or “0” if false 3 le 5 returns 1 8 eq 11 returns 0

Operators and operator precedence ( ) has the highest level of precedence! Arithmetical operators have higher level of precedence than relational operators

Example: Currency exchange ; Define variables and constants dollar=0.0 euro=0.0 rate= 0.92 ; 1 dollar equals to 0.92 euros ; Input data dollar=200.0 ; Do calculation euro=dollar*rate ; Output result print, euro end

Simple data input/output (I/O) Data input from keyboard: read, x read, x, y, z Data output to screen: print, x print, x, y, z We’ll discuss about file I/O in the future

Example: Currency exchange ; Define variables and constants dollar=0.0 euro=0.0 rate= 0.92 ; 1 dollar equals to 0.92 euros ; Input data print, “Input dollar amount” read, dollar ; Do calculation euro=dollar*rate ; Output result print, “The amount of Euro is”, euro end

Summary Overview of computer languages Overview of IDL Strength of IDL: (1) Interactive/compiled modes; (2) Array-oriented; (3) Variables easily redefined; (4) Many built-in subroutines Open, edit, and run IDL Variables and data types Operators Simple data I/O

A good programming style Clear (have a clear structure) Simple (try to use less lines) General (try to use variables) Accumulate subroutines

Structure of a computer program 1.Define variables, arrays, constants 2.Read in data 3.Pre-processing: quality control, filling missing data, interpolation, re-gridding 4.Data analysis or other calculation 5.Plot the results 6.Output the results

In-class assignment I Design a picture using characters on the keyboard. Write an IDL program to print it out using multiple lines of ‘print’ statement Assume x=3, y=4, z=8, write an IDL program to calculate w=3z 2 -5x y 2.8 and print out the result Please write a program for a supermarket cashier. Assume the price is $0.99/lb for apples, $1.29/lb for watermelons, $2.99/lb for strawberries, and $3.49/lb for blueberries. Assume the sales tax is 7%. Please write a program to read in the weight of each product, and then calculate and print out the receipt. Try to make the receipt look similar to what you get from a supermarket.