Thursday, January 31, 2008

CSE2031 Lecture 8

  • When creating a struct no space is allocated
  • typedef
    • Make a new type name
  • Typedef double grade
    • "grade" is now a new type
    • grade g1 = 3.5
      • Grade can be used whenever double is used
    • Typedef unsigned int size_t;
    • Typedef void (*_sighandler_t)(int)
  • Pointers to structs
    • Structpoint p1;
    • Structpoint* pp;
    • pp = &p1;
    • the name of a struct is not a pointer to the beginning of the variable
    • p1.x = 9
    • *pp.x = 9 //doesn't work
      • Because dot operator has precedence over *
    • (*pp).x = 9
      • // will properly dereference the struct
    • ppàx = 9
      • same as (*pp).x =9 only this is proper
  • self referential structures
  • if you don't use malloc calloc etc it is put on the stack not the heap
  • look in back of the book under IO
    • c library IO(buffered)
    • this is the buffer which input and output is written to
    • int getChar(void)
    • int putchar(int)
    • scanf
    • printf
  • file access
    • FILE
      • The way you create one is
        • FILE * fp
        • fp = fopen("filename", mode);
        • mode is
          • read write and append
          • a 2 character string
          • char*
        • instead of filename you can use
          • "rb"
          • "wb"
          • Ab"
          • "rt"
          • "wt"
          • "at"


 


 


 

//creating a structpoint//

--------------------

structpoint{

    int x;

    int y;


 

    }

---------------------------


 

structpoint p1;

p1.x = 5;

p1.y = 6;

------------

or


 

structpoint p1 = {5,6};

----------------------------------

or

structpoint{

int x;

int y;

}

p1;

p1.x = 5

p1.y = 6;

//you can make a new struct doing it this way

--------------------------------------

struct{

int x;

int y;

}

p1.x = 5;

p1.y = 6;

//cannot make a second struct doing it this way

---------------------------------------

typef unsigned int size_t;

typedef void (*_sighandler_t)(int)

--------------------------------------

typedef structpoint {

int x;

int y;

}

point;

/*now "point" is the name of a type

* it can have pint p1;

*instead of structpoint p1

*/

--------------------------------

/* self referential structures*/

struct listNode{

int value;

struct listNode* next;

}

--------------------------------

struct treeNode{

int value;

struct treeNode* left;

struct treeNode* right;

}

------------------------------------

or

--------------------------------------

typedef structTNode* TreePtr

typedef structTNode{

int value;

TreePtr left;

TreePtr right;

}TreeNode


 

-----------------------------------------

TreePtr root = (TreePtr)malloc(sizeof(TreeNode));         // - do not do this instead - sizeof(int) + 2*sizeof(TreePtr)

root->value = 5;

root -> right = (TreePtr)malloc(sizeof(TreeNode));

root -> right ->value=2;

root -> right->right =null;

root -> right ->left = null;

/*creates a binaryTree with root starting point at 5 pointing to a 2 on its right side that has no strings after it*/

--------------------

struct item{

double price;

char name[50];

}

item x1;

strcpy(x1,name, "Notebook");

---------------------------

struct item{

double price;

char* name;

}

item x1;

x1.name = "notebook";

-----------------------------------

fprintf(fp,...);

fscanf(fp,...);

fclose(fp);

ferror(fp);

intfeof(fp); //if you reached end of file on that file

fflush(fp);

fseek(fp,...);

fsetpos(fp,...);

--------buffered standard output under this line--

stdin

stdont

stderr

---------unbuffered under this line---


 

STDIN_FILENO         0

STDOUT_FILENO        1

STDERR_FILENO        2

--------------------------------------------------

#include <stdio.h>

#include <unistd.h>

int main(void)

{

printf("a");

write(1, "X", 1);

fprintf(stdout, "B");

write (1,"Y", 1);

printf("C");

write(1, "Z\n", 2);

printf("\n");

return 0;

/*output is

XYZ

ABC

this is becuase it's buffered

/*

}

                        

Tuesday, January 29, 2008

CSE2031 Lecture 7

void* ß malloc (int n)

int *p;

p = malloc (50 * sizeof(int));

Or

p = (int*) malloc(50*sizeof(int));

if((p=malloc(..) ) == null)

{

…exit(1)

}

free(p); //deallocate this space;

  • calloc enters 0's in memory for allocated space
  • go to man 3 malloc
    • talks about malloc calloc and realloc
    • realloc
      • allows you to resize memory partition previously allocated
  • arrays in C don't know how long they are

int x //declares an int

int f(int a , double b) // function that returns an int

int *f(int a, double b) //pointer to a unction that returns an int

int (*f)(int a, double b )//declares a function that takes parameters and returns an int


 


 


 


 


 


 


 


 


 

#include <stdlib.h>

#include <stdio.h>

#include <string.h>


 

int strCompare(const void *, const void *);

int intCompare(const void* p1, const void* p2);

int main(void)

{

char* A[] = {"30","3","20","2","0","5","10","1","40","4", "5"};

    for (i = 0;i<11;i++)

{

printf("%s ", A[i[);

}

putchar('\n');

qsort(A, sizeof(A)/sizeof(char *), sizeof(char *), strCompare);

return 0;

}

int strCompare(const void*p1,const void*p2)

{

int n = strcmp(*(char**)p1, *(char**)p2); //

if (n<0) return -1;

if (n>0) return 1;

return 0;

}

int intCompare(const void*p1, const void*p2)

{

int n1 = atoi(*(char**)p1);

int n2 = atoi(*(char**)p2); // atoi casts string to integer

if (n1<n2) return -1;

if (n1>n2) return 1;

}


 

(A, ... , cmp)

//int cmp(const void *p1, const void *p2)

//{int n1 =

int n2 =

if(n1<n2) return -1;

if(n1>n2) return 1;

return 0;


 


 

c struct

  • struct point {int x, int y};
    • point is the structure tag

CSE2011 Lecture 8

Loop invariants

  • What is the loop invariant
    • In general it is an extremely difficult question to answer. It contains the essential difficulty in programming
    • Fundamentally it is the following
      • LI = totalWork = workToDo + workDone
    • Question a: does the loop terminate?
    • Question b: is the postcondition of OP true at loop end

Loop Design

  • Find the loop invariant
  • After consulting an oracle we have determined that the following is an appropriate loop invariant
    • This is the create part of programming
  • Question 1
    • Make the loop invariant true at the start
  • Question 2
    • Is the loop invariant still true after operation 2 is executed?
    • After operation2 show li first part is true
    • See effect of moving data from workToDo to workDone while maintaining the invariant

EATS1011 Lecture 8

Clouds

  • Clouds to fall but then they fall into warmer air and evaporate
  • CCN: 100%
    • Cloud condensation Nuclei (CCN)
  • Newton's first law
    • The droplet of radius r
    • The droplet's going down
    • And friction of particles in the air
    • Eventually balance out
    • Friction force
      • 6πR(eta) V
        • Eta is viscosity (missing symbol)
    • Gravitational force
      • M*g
        • M ass of the droplet
        • G ravity
        • = 4/3πR3
    • These two forces equal each other out
    • Get formulas from website
    • This only applies to 'small' droples (< 100microns)
    • Terminal Velocity




    • VT = 6x103 R(m) m/s (R> 100 mm)
  • Condenstation -> growth
    • 1/R
  • 1) collision and coalescence
    • Warm
  • 2) bergeon process
    • Mixed phase clouds
      • (liquid water + ice)
    • The difference in vapour pressure drives the growth of the droplets
  • Size spectrum
    • 1 micron -> 5 microns -> 10 microns – 15 microns – 50 microns
    • The small ones fall slower than the large ones
    • The large one sweep up the smaller ones under them
      • Until the droplet gets even bigger and falls faster
      • If there are enough small particles you can see how we get very large droplets

Thursday, January 24, 2008

CSE 2031 Lecture 6

Arrays and pointers

  • An array name by itself is
    • An address
    • A pointer value
  • A pointer is
    • A variable taking addresses as values
  • An array name is
    • A particular fixed address
    • Like a constant pointer
  • When an array is declared, the compiler allocates
    • A base address
      • The address of element 0
  • And sufficient memory allocation for the rest of the elements

Array indexing and pointer arithmetic

#define MAXSIZE 1024

int A[MAXSIZE], *p;

/*

*space allocated for A

* but p – has not been given a value , even if it did here wouldn't necessarily be any space allocated *where it pointed

*/

Equivalent Statements

  • P = A;
  • P = A+I;
  • P = &A[0];
  • P=&A[i];
  • P[0]
    • is the same as saying *p
  • p[3]
    • is the same as saying *(p+3)

Summing the Array

  • 4 forms
  • 1

    sum =0;

    int i;

    for (i=0; i<maxSize; i++)

    sum += A[i];


     

  • 2

sum = 0;

for(p=A; p<&A[MAXSIZE];p++)

sum+= *p;

  • 3

sum = 0;

For(i=0;i<MAXSIZE;i++

sum += *(A+i);

  • 4

Sum = 0;

P=A;

For(i=0 i<MAXSIZE;i++)

Sum += p[i]; /*no dereferencing*/

  • Practice adding pointers and casting them
  • When you minus the two you get how many blocks of allocated memory exist between them
  • If you cast them and minus them you get the mem address casted to ints then you get the difference between that

Arrays as function parameters

  • In a function header
    • An array isn't declared w/ a fixed size in a function header
    • Int A[] is equivalent to int *A
      • This ONLY applies to a function parameter
    • Otherwise Int A[] is is NOT equivalent to int *A
      • Int *A; creates a pointer variable
      • Int A[] creates a constant pointer and no storage

Pointers and strings

  • Strings are arrays of char and are ended with \0
    • \0 is a null character
  • "ABC"
    • Type is char*
    • Value is address of the 'A'
  • Char word[] = "xyz"
    • Is the same as char word[] = {'x','y','z','\0'};
  • Char *p = "xyz";
    • Word is an array of length 4.
    • P is a pointer and points (for now) to an array with 4 elements
    • P can change reference
    • *p doesn't allocate new space

Dynamic Memory Allocation

  • Memory allocated while the program is running
  • Stack
    • When there is a function call there are parameters and local variables
    • Space set aside to hold the values for returns when functions are called
      • Stacks grow during recursion
      • Goes from the top down
      • LIFO
    • A stack grows and shrinks automatically
  • Heap
    • Declares space and the space remains allocated

Malloc

  • Void *malloc ( size_T n) /* memory allocation*/
    • Returns pointer to n bytes
    • Parameter is an integer type
      • Signed or unsigned
    • Sets aside an amount of space
    • Set aside contiguously , like an array
    • What is returned is a pointer to the space allocated
    • If space cannot be allocated a null pointer is returned
    • The storage is uninitialized
      • Not necessarily emptied space
    • Returns NULL if it can't be done
  • Void *calloc (size_t n, size_t element_size)
    • Allocate enough space for this many elements that take 'so much space'

Algorithm assessment

  • Is the algorithm running in constant time?
    • Runs the same amount of time no matter when 'n' is
    • O(1)
      • No loops or constant time loops
  • Linear time
    • Does the problem run exactly proportional to the size of 'n'?
    • Dominant single loop dependant linearly on n
  • Logarithmic
    • The algorithm divides the size of the problem by a constant
      • Runs in O(log n)
        • Dominant single lop is a divide by 2 on each iteration

Assertions

  • Boolean expressions or predicates that evaluate to true or false
  • In a program they express constraints on the state that must be true at that point
  • Associate with
    • Individual program statements
    • Functions
    • Classes
  • Specify clearly, precisely and succinctly
    • What is expected and guaranteed by each component
      • Class function and statement
    • The essence of documentation
    • Essential for debugging
    • Aids in fault tolerance
  • Result
    • Result of a query but only in ensure assertions
  • Current
    • @ Current object
  • Void
    • Not attached
  • Name
    • Value of the variable name before a routine starts
  • Name'
    • Value of the name after a routine terminates
    • Alternate name 'old name' instead of Name'
  • **study textual notation**
    • From online notes, cannot type all this

Tuesday, January 22, 2008

CSE 2031 Lecture 5

void makeDouble(int* x)

{

    *x = 2* *x;

}


 

* modifies a pointer

This in English is makeDouble takes an integers pointer

Then the integers pointer is modified.

An '&' sign is a pointer. int I, *p; /* means that there is an integer I and an integer memory reference *p;

An expression has a type and value.

*(r=&j) *= *p

**p dereferences p


 

Pointer to void

  • Why do pointers have types?
    • So we can dereference them

Eats 1011 Lecture 6

ITCZ - intertropical Convergence Zone

ERBE – Earth Radiation Budget Experiment

  • Designed to study the radiative energy
  • Measures radiation coming from the atmosphere

Tropics

  • Solar heating is greater than IR cooling

Polar Regions

  • Solar heating is less than IR cooling

Heat transfers between the two to stop the earth from getting really hot in some areas and really cold in others


 

Water Vapour in the Atmosphere

  • Mixing ratio
    • Troposphere is between 10-2 to 10-5 by volume or mass with most in the lower troposphere
    • Global average ~2.5*10-3
    • Stratosphere 4*10-6 by volume
  • Latent Heat
    • Energy is required/released for a phase change
    • Heat storage when liquid converts to vapour
    • Heat release when vapour turns to water
      • Lv – vaporization – 2.5 * 106 J/Kg
      • Lf – fusion / freezing – 3.3*105
      • Ls – sublimation – Lu + Lf – 2.8*106
        • Energy required / released when 1Kg of material changes state
  • To calculate the amount of energy required for evaporation
    • Need mass of water

      • 2cm = 0.02m rain (over each m2)
      • Density water, pw = 1000kg/m3
      • Mass = 20kg/m2





      • Mean water mixing ratio ~
        • Mass water =
      • Removal rate is estimated from the globally average rainfall ~ 1m / year
      • This is equivalent to about
      • Mass over 1m2 ~ /m2
      • = 1000 kg/m2
      • Turnover time

tresidence = (25kg/m2) / (1000 kg/m2 * year)

Sunday, January 20, 2008

Delete me

Thursday, January 17, 2008

CSE 2031 Lecture 4

Strings

  • strlen(s)
    • returns length
  • strcmp(s,t)
  • returns positive if s>t, negative if s<t, and 0 if they are equal.
  • strcat(s,t)
    • concatenates t onto s
      • changes string s
    • looks or \o and contatenates at that spot

#include <stdio.h>

Int main(void)

{

char s1[] = {'H','e','l','l','o','\o'};

char s2[4];

printf("Address of s1 is %p\n", s1);

printf("address of s2 is %p\n", s2);

printf("Enter a line: ");

fgets(s2, sizeof(s2), stdin);/* bolded represent extras for using fgets*/

printf("%s\n", s2);

printf("%s\n", s1);

return 0;

}


 

  • Fgets is the new one that works better, if you use just gets you will run into problems with memory over runs
  • Where s1 in this example can be overwritten by s2 if the user input is long enough
  • Look up input and output in textbook
  • With fgets it will only take in the amount of characters assigned after the first comma
  • However if less than the specified amount is passed and the enter key is pushed, the new line character will count as 1 char

Pointers

int n = 5;

int *p;

p = &n

printf("%d\n", *p);

printf("%d\n", n);


 


 

  • *p = 7;
    • Changes whatever value P was addressing to 7

If n = 5, and you said this before printing, it would print 7

EATS 1011 Lecture 5


 

  • Co2 has less of an impact on global warming than waper vapour, but CO2 can be controlled, water vapour isn't something humans can control
  • The surface temperature would be exactly the same as the effective temperature if we had no atmosphere but 30% albedo
  • Teffective =
  • Greenhouse effect
    • Dilute solar radiation heats (mostly) surface
    • Surface heats and emits mid-IR radiation which is absorbed(mostly) by atmospheric gases and clouds
      • The gases such as water vapour(clouds), carbon dioxide are what cause the greenhouse effect because they absorb radiation from the sun
    • Atmosphere re-radiates
      • Up to space
      • Back down to earth
    • Surface is heated "twice" (solar + mid-IR)
      • Figure 212 on slide
    • Red skys are caused by Rayleigh scattering

      •  
        • Where lambda is the wavelength
    • Albedo
      • Refers to visible part of the light spectrum
      • Albedo depends on the surface the light is directed to
      • Fresh snow is most reflective, 75-95% light reflected
      • Earth is about 30% 'albedo'
        • Not sure how to use the word 'albedo'
      • 6% reflected from atmosphere
      • 20% reflected by clouds
      • 4% is reflected naturally by the earth's surface
      • 51% of solar energy heats the Earth's surface
      • Total energy budget

      • Most infrared is absorbed by the earth's atmosphere instead of being released into space
      • When the sun goes down at night we don't freeze because infra red energy from the atmosphere continues heating the earth while the sun is down
      • 70 units of solar coming in , 50 heating the surface, after all the processing we have 70 units of energy leaving in the mid infrared

Earth's Energy Budget

  • Top of atmosphere
    • 70 units of solar in balanced by 70 units of Mid-IR emitted
  • Surface
    • Heated twice
    • Solar 51 units and 96 mid-IR units
    • We are heated by mid-IR at night
  • Read slides for more details on the web

Seasons

  • What are the drivers of the seasons
    • In the tropics there are no seasons
    • Seasons are at mid latitudes
  • orbital parameters
    • ellipticity of orbits
      • Perihelion
        • 147 x 106 km, 4th january
      • Ephelion
        • 153 x 106 km, 4th July
      • 7% change in insolation
    • Insolation:
      • The suns energy averaged over 24 hours
    • Obliquity: tilt
      • Rotation axis – pole star
      • 23.5 degrees
      • Solstice
        • N pole sun 21st June, sun overhead at noon at tropic of Cancer(23.5N)
        • S pole sun 21st December, sun overhead at noon at the tropic of Capricorn (23.5S)
        • Regions of perpetual day and night
      • Equinox
        • Axis 90 to sun – earth line
        • Vernal 21st march
        • Autumnal 21st September
        • Effects the length of the day
  • So what causes the seasons
    • Ellipticity
      • 7% so little impact
        • Except over eons
    • Obliquity
      • Large effect at mid- and polar latitudes
    • Latitude
      • In the tropics changes driven by overhead sun
      • Wet and dry seasons
      • Twice a year
  • Length of day light for various latitudes


 

CSE 2011 Lecture 5


 

Testing and Debugging

  • Create a test plan application that will probe the program with input and compare its output to see if the program is outputting the desired output from the test
  • Verification
    • Does the software meet its specifications
  • Validation
    • Does the software meet its requirements
  • Identify test criteria
    • What are the goats for comparing the system against its spec
      • Reliability, completeness, robustness
    • Identify target components for testing
      • In an OO system the classes and class hierarchies
    • Generate test cases
      • Produce test cases that can identify faults in an implementation
    • Execute test cases against target components
    • Evaluation
      • If expected outputs are not produced, a bug report is issued
  • Black box testing
    • Testing based on input and output alone
      • Do not consider underlying implementation
    • Test cases are generated from the spec
      • Pre and post conditions
    • Specific kinds of black box testing
      • Random testing
        • Generate random inputs
        • Easy to generate cases
        • Good at detecting failures
        • Must be able to easily generate expected output
      • Partition testing
        • Cannot try all possibly inputs
          • Partition input into equivalence classes
          • Every value in a class should behave similarly
        • Test cases
          • Just before the boundary
          • Just after the boundary
          • On a boundary
          • One from the middle of an equivalence class
        • Loops
          • Zero times through the body
          • Once through the body many times through the body

Tuesday, January 15, 2008

CSE 2031 Lecture 3

  • Integer types:
    • char
    • short
    • int
    • long
  • Floating point types:
    • float
    • double
    • long double

Char

  • 1 byte long
  • char<= short<=int<=long
  • denote characters in single quotes
  • \0 is a null character
  • char *b = "TEST";
    • is a string writer (assumption)
  • EOF
    • Reads as -1
      • Which is an array of ones
  • getchar() reads a byte of unsigned chars and stores 4 bytes to represent them
    • the promotion to int is done as a signed char
    • This is because of things like EOF
  • A signed char
    • Fills the other bytes with the first bit of the signed char
    • If it is signed and starts with 0
      • It is non negative
    • If it starts with 1
      • It is a negative number
  • An unsigned
    • Does not fill the other 3 bytes with the first bit but with all 0's when promoted to an int

Declarations

  • when you declare a variable in C it is visible throughout the score of the brackets that it is withheld
  • if you want a variable to be visible throughout a program put it above the main
  • to make one variable local to a file use the word 'static'

String

  • an array of char
  • there is no 'String' in C

Arrays

  • to declare an array in C
    • use type name[size]
      • example: int number[10]
  • you can initialize an array w/o a specified size
    • char s[] = {'h','e','l','l','o','\0', 'q'}
    • printf("%s /n", s}
      • returns 'hello'
        • note there is no q, that is because null character was before it

printF

  • %d prints integers
  • %s prints char characters
    • Prints until it finds a null character
    • Null character is \0
  • %p prints the address

Console

  • Od –cb filename
    • Describes a file in bits

CSE 2011 Lecture 4

Inheritance

  • An object is a collection of data and methods to operate on that data
    • Method is a procedure, function, operation
  • For a motor
    • turnOn
    • turnOff
    • setSpeed
  • An Object is an instance of a Class
    • The class provides the template for the object
  • Template gives
    • Data
    • Methods
  • Class contains methods, objects contain the data
    • Typically pictured as an object pointing to the class
    • Because the object uses methods
    • Objects share methods

Container

  • A collection of data is stored in a container
    • The data can be of different sub-types
  • Containers can be organized in different ways
    • Sequence,
    • Tree's
    • Table

Sequence

  • A list of objects in order
    • Contains a head, front, tail and last
    • Sequence = <head. ^ tail = front ^ <last>

EATS 1011 Lecture 4

  • In the northern hemisphere high pressure system goes clockwise, low pressure systems go counter-clockwise
    • This is due to the 'Coriolis effect'
  • GEOS bright colours represent 'cold'



  • EÅ
    is the solar energy at 1 AU ("constant")
  • 1 AU = 1.5.108 km = 1.5.1011 m
  • EÅ
    = Lʘ/( 4.pRp2) = Lʘ/( 4.p1 AU)2)
  • = 1.38.103 W m-2
  • Lʘ
    = EÅ
    4.p(1 AU)2
  • E(Rp) = Lʘ/( 4.pRp2) = EÅ
    /(Rp/1 AU)2
  • = EÅ
    /Rp2
  • Rp measured in AU


  • 37% of energy from the solar spectrum is near infrared


  • Most energy from the sun is less than 1 micron


  • We can see light where the sun outputs the most energy


  • The sun emits mostly in the UC, visible and near infrared regions


  • Humans can only see the visible region


  • The earth emits almost all in the mid infra red region


  • Satellites measuring IR can pick up differences in temperatures (clouds, water, surface, etc)


  • The area under the solar-radiation curve is the total (all wavelengths) solar radiance reaching the earth's orbit


    • =1.38*103 W m-2

Planetary Effective temperatures

  • The sun is far enough away to consider its rays parallel to eachother
  • Some light scatters back into space
  • The difference between infra red and solar energy is solar energy only comes through during the day
    • Emitted light as opposed to scattered
  • Albedo
    • A =
  • Radius of planet, b
  • Atmosphere emits as Planck body, sT4 W/m2
  • Steady state energy balance
    • Heating = cooling
  • Absorption (area*flux) = emission(area*flux)





  • Total amount of energy intercepted = π b2
  • Teff = effective temperature
  • Earth, rp 1AU
  • Albedo = .3 ( i.e. 70% of energy absorbed)
    • Teff = 255 Kelvin, = -18 Celcius
  • But The mean temperature is about 15 Celcius
    • T = 33 celcius
  • What is the implication for this temperature difference?
    • Natural greenhouse effect
      • Main greenhouse gas in the atmosphere is water vapour
  • Earth radiates / cools in the mid – IR (Wien's Law) from about 5km
  • Obliquity
    • the tilt of the planet from the sun

  • Mercury – rotates slowly and has a very large d/n temperature difference because heat deposited locally cannot be rapidly transferred to other locations such as the night side
  • Venus – T of 700k is actually the surface temperature and is evidence of a large greenhouse effect
  • Earth - natural greenhouse effect of about 33C
  • Mars - small greenhouse effect
  • Jupiter - interior heating - gravitational contraction
  • saturn - same
  • uranus - no
  • neptune - same as J and S
  • Pluto - aerosols and methane lead to a greenhouse effect

Heating of the Earth by Radiation

  • Solar radiation incident on atmosphere
    • Dilute 6000 K radiation
    • Scatters off air, clouds (numbers later)
    • Absorbed by aerosols, clouds, gases
    • Overall visible fairly transparent
    • Surface absorbs most radiation
      • Albedo trees(15%, ocean 10%)
    • Mid-IR radiation emitted from Earth / atmosphere system
    • Also called terrestrial radiation / long wavelength
    • Mid-IR is quite absorptive
    • "windows" 8-9, 10-12 чm
    • Main absorbers
      • H2O, CO2, clouds
    • Seconday absorbers
      • CH4, N2O, CFCI3,CF2Cl2, O3
    • Absorption of radiation
      • For graph on absorption
        • 100 = total absorption
        • 0 = no absorption
      • O2 and O3 absorb very energetic radiation from the sun
      • At about 9.6 microns ozone is acting as a greenhouse gas
    • Nitrous oxide
      • No role in visible spectrum
      • At about 4 microns and 6 microns absorbs quite a lot of energy
    • Methane
      • Heats the atmosphere a little bit
      • Plays a major role at about 6 microns
    • Water vapour
      • Water vapour absorbs a long range
        • Short mid and long range
        • From 4 -8 microns it plays a major rold
        • Plays a major role in controlling earths temperature
    • Carbon dioxide
      • Heats the atmosphere because it absorbs infrared radiation
      • Major band at about 15 microns
  • Most visible radiation goes to the surface

Transmission of solar and IR radiation


Thursday, January 10, 2008

CSE 2031 Lecture 2

Course Information

15% on assignments

30 % on midterm

Rest on exam


 

Recap from day 1

  • -Wall
    • Shows any errors the compiler wouldn't typically catch
  • -o
    • Allows you to change the executable files filename
  • -c
    • Stops compilation after the object module is produced
  • -E
    • Stops the compilation after the preprocessor phase
    • Textual manipulation of the source code


 

#include <stdio.h>

int main(void)

{

    int n, m;

    int product = 1; /* will eventually hold n!*/

    scanf("%d, &n);

    m=n;

    while ( m > 0)

        product *= m--;

    printf("%d! = %d\n", n, product);

    return 0;

}


 

#include <stdio.h>


 

int factorial(int) /* must be declared here in case user inputs a non-int*/

int main(void)

{

int n;

scanf("%d", &n)

printf("%d! = %d\n", n, factorial(n));

return 0;

int factorial(int x)

{

    /* base case*/

if (x<2) return 1;

    /*recursive calls*/

return x*factorial(x-1);

}

/*returns 5! = 120*/

}

If you want to compile with two files linking eachother use

  • cc -0 printFactorial factorial.c printfactorial2.c
  • this will link the code used in printFactorial from factorial.c so that printFactorial will work
    • this is more explicit than java because there isn't an 'import' feature
    • instead the feature is found in the compiler
  • when you compile a program that uses multiple files you have to name all the files on the command line
  • utility 'make'
    • merges files together
    • looks for a 'makefile'
      • in a make file there are dependency lines or action lines
        • action lines MUST be tabbed over
      • dependency lines describe the files in use
      • action lines tell console what to do to generate the file described in the dependency file
    • when 'make' is typed in console it runs the commands found in makefile
    • read makefile on course website, when it is available
      • console: make clean
      • runs the clean command found in 'makefile'
      • all warning flags are put in 'makefile' such as –Wall
  • Compiler
    • –l makes the console look in the library for functions used that aren't in stdio.h
    • –lm looks in the m (math) library


 

#include <stdio.h>

#include <math.h>

int main(void)

{

    double x;

    

    printf("Enter value for x: ");

    scanf("%1f", &x);

    

    printf("x = %f sqrt(x) = %1f\n", x, sqrt(x));

    return 0;

}

s

Array as an Abstract Data Type

  • What is an array?
    • An indexed, homogeneous collection of variables
    • Indexed from n-1 where n is the size
    • Multi dimensional
      • 1 index per dimension
    • The upper bound must be greater than or equal to the lower bound
  • An integer
    • is four bytes long, in sequence
  • to put one thing in to memory is called 'mapping'
  • row order is where the rows are separated and the columns are adjacent
    • column order is the opposite
  • if you have an array going from [-5 ..+6, +1 … 10, 3…5] of chess pieces
    • you would have an array of
      • -5, …, +6 of
        • An array of 1 , … , 10 of
          • An array of 3, …, 5 of chess pieces
  • Index – lower bound , to find the memory location of an object in a one dimensional array
    • For multi dimensional the 2nd 3rd… n dimensions start at the end point of the first but find an index the same way as a 1 dimensional array
  • Array Descriptor
    • Dimension count
      • For each dimension it needs to lower bound and upper bound and total size
      • A prototype array descriptor
        •     
  • A0 is the hypothetical location in memory where the first lower bound is found in memory.

CSE 2011 Lecture 3

Array as an Abstract Data Type

  • What is an array?
    • An indexed, homogeneous collection of variables
    • Indexed from n-1 where n is the size
    • Multi dimensional
      • 1 index per dimension
    • The upper bound must be greater than or equal to the lower bound
  • An integer
    • is four bytes long, in sequence
  • to put one thing in to memory is called 'mapping'
  • row order is where the rows are separated and the columns are adjacent
    • column order is the opposite
  • if you have an array going from [-5 ..+6, +1 … 10, 3…5] of chess pieces
    • you would have an array of
      • -5, …, +6 of
        • An array of 1 , … , 10 of
          • An array of 3, …, 5 of chess pieces
  • Index – lower bound , to find the memory location of an object in a one dimensional array
    • For multi dimensional the 2nd 3rd… n dimensions start at the end point of the first but find an index the same way as a 1 dimensional array
  • Array Descriptor
    • Dimension count
      • For each dimension it needs to lower bound and upper bound and total size
      • A prototype array descriptor
        •     
  • A0 is the hypothetical location in memory where the first lower bound is found in memory.

EATS 1011 Lecture 3

Energy

  • Ability or capacity to do work
  • Comes in many forms, kinetic, potential, heat, etc
  • Energy is conserved
    • 1st law of thermodynamics
  • Work is done on matter if it is pushed, pulled or lifted over some distance
    • Example: lifting implies exerting force against gravity
  • By doing work on something we give it energy which can be used to do work on something else
    • Example pulling a spring gives stored potential energy
  • The energy stored in an object (internal energy) determines how much work it can do. This is called gravitational potential energy or potential energy à potential to do work
    • Example potential energy lifting a mass through a height
    • –PE = mgh
  • Where
    • M = mass(kg)
    • G = gravitational acceleration(m/S2)
    • H = distance lifted (m)
  • Unites of energy
    • 1 erg = 1 dyne/cm = 2.388 x 10-8cal
  • 1 joule (j) = 1 newton meter (N.m) = .239cal
    • =107
      erg
  • 1 calorie (cal) = 4.186 J = 4.186 * 107 erg
  • Chemical potential energy
    • A substance has potential energy if it can do work when a chemical change can occur (coal , natural gas, chemicals, food have PE)
  • Kinetic energy (KE) = energy of motion
    • KE = ½ mv2
  • Where:
    • M = mass(kg)
    • V = velocity (m/s)
  • Faster moving à higher KE
    • Example strong wind has more KE
  • Kinetic energy of random motion is often referred o as Heat Energy
  • Energy can't be destroyed or created, it only moves from one form to another

Atmospheric Heating

  • Conduction
    • Molecular motions
    • Near surface
    • Thermosphere
  • Convection
    • Macroscopic motions
      • Example winds, turbulence
    • Horizontal, vertical
    • Hot air rises
      • Example a hot surface transferring hot surface energy into the atmosphere

  • Latent heat
    • Condensation to evaporation
    • Freezing/fusion/melting
    • Sublimation
      • As water goes through the three phases energy about 1 million joules per kilogram of ice to have it turn to water
      • And 2.5 million joules for water to turn to vapour
  • Radiation
    • Energy transfers at the speed of light

    Electromagnetic Radiation

    • EMR/ light has both wave and particle properties(photon)
    • λ -Wavelength(m)
    • v – frequency (s-1)
    • C = λv = 3*108m/s
      • The speed of light
    • E = hv(j)
      • H = 6.636*10-34Js
    • "black body or planck Body: is a hypothetical body that emits radiation in a manner so that the total amount of en4ergy is only a function of temperature and spectral shape is a universal function with a single peak (see later) (P35)
    • The total amount of energy (integrate over v) crossing a square meter per second is given by Stefan-Boltzman Law
      • E(T) = λT4Wm-2
      • Where λ = 5.67 * 10-8 W m-2K-4 is the Stefan-Boltzman constant
    • The location of the peak is given by Wien's Law

    • Question: what is the wavelength of the maximum radiation emitted by the earth and by the sun?
      • for Eatrch the average surface temp is
        • 288Kelvin(15C)
      • For the sun
        • 6000 kelvin
        • Using wien's law we can find the wavelength of the maximum radiation
          • For earth λmax ~ 10um mid-IR radiation
          • For te sun λmax ~ .5um visible radiation

Solar Properties

  • Main sequence star
  • Burns H – fusion
  • Layers
    • Core ~ 107k
    • Radiative zone
    • Convective zone
    • Photosphere ~ 6000k (What we see)
    • Chromospheres ~ 4000k
    • Corona ~ 1 000 000k
    • Sun spots ("cold") prominences, granules, spicules, etc
    • R0 ~ 700 000km
    • Emits L(sun) = 3.9 * 1026W
    • Spectrum ~ planck body = f(v,t) universal function
    • Use S-B equation give Tsun ~ 5700k (effective temperature)
    • Solar cycle ~ 11 years
    • Total output variation <.1% over 20 years
      • EUV > 3
      • X-Ray ~ 100
    • The more sunpots, the more energy from the sun

Which is interesting because the sun gives off most heat when it has the most spots with 'cold spots'

Tuesday, January 8, 2008

CSE 2011 Lecture 2

Abstract data types

  • Definition:
    • Abstract: to take out irrelevant information and obtain what is important
    • Data:
    • Type:
  • Definition: a model of a set of objects together with a set of operations on them
  • Abstract à model of subset of all possible properties
  • Objects are nouns, operations are verbs
    • Only a first approximation but useful at the boundary with the world
  • Any collection of nouns and verbs is an ADT
    • Difficulty is to define good and useful ADT's
  • Objects can be divided into two categories
    • The objects themselves
    • And the meta objects
      • Descriptions of other objects
      • Programmer is interested in them to build good models with finite resources such as memory and disk
        • Sizes
        • Amounts
  • 5 basic operations
    • Enquiry
    • Read
      • Typically return user data
      • Typically should not change the meta data
    • Write
      • Changes the meta data
      • Writing meta data into file
    • Reorganize
      • Changes the physical relation ships among real objects
        • Sort a list by names
    • Test
      • Not strictly a part of ADT
      • Useful for implementers
  • Documentation
    • Operations
      • Give
        • Signature
        • Informal description
        • Pre and post conditions
      • Use natural language, mathematics, diagrams – whatever best gets the meaning across
      • Be simple complete, clear, precise, concise as possible
    • Axioms
      • Describes axioms about operations in a program
        • Example: new account starts balance at 0
  • Invariants
    • Conditions that must be true after the execution of any method in the class
    • The conditions that hold, at all times, among the objects in an instance of the ADT
      • More on this when we discuss design by contract

Eats 1011 Lecture 2

From Last Lecture

  • Photosynthesis
    • N(CO2 + sunlight à(H2CO)n + nO2(day)
    • O2 + H2CO à CO2 + H2O(night)"burning" (energy release)
    • Death/burial oc C à O2 remains in atmosphere
  • Summary
    • Most of the carbon is in sedimentary rocks so that the CO2 – N2 **
    • Carbon budget(arb units)
      • Biosphere:
        • Marine: 1
        • Non-marine: 1
      • Atmosphere: 70
      • Ocean – dissolved : 4000
      • Fossil fuels : 800
      • Shales: 800 000
      • Carbonate Rocks: 2 000 000
    • Pressure and density
      • In talking of the atmosphere in a quantitative fashion we need to be concerned about certain fundamentals
      • Pressure, P, of a gas
      • Force/area = Newtons/m2 = Pascal(Pa)
      • Two ( at least) views
        • Microscopic or macroscopic
        • Microscopic or kinetic
          • Collisions and rate of change of momentum
        • Macroscopic
          • The barometer, 1644
        • Column of mercury balances air pressure
        • Pressure
          • =weight of air / area
          • = mass / m2
          • note that as we ascend there is lenss air so that pressure decreases with altitude
          • surface pressure at MSL (mean sea level)
            • 101.32 kPa
            • =1013.2 mb (millibars)
            • =760 mm Hg = .76 metres Hg
            • =29.2 inches Hg
            • =32 feet of water approx 10 meters of water
            • Mass of air over 1 m2 = P/g ~ 105/10
              • = 104 kg = 10 tonnes / m2
            • *1mb = 100 Pa = 1hPa
            • Back to origins
              • If oceans evaporated, what would the pressure be?
              • The weight of column of water – per square meter
              • Mass of water over 1 m2
                • Density * volume =
                  • 103kg/m3 x 3.2*103 m*1m2
                  • =3.5 * 106 kg/m2
                • Weight = mass *g
                  • ~ 3.5 * 107 Pa = 350 atm
  • Pressure of gas = force per unit area (Pa)
  • Boyles law, P∞ 1/v
    • T constant
    • V volume
  • Charles Law V∞ T
    • P constant
  • Combine as perfect gas law (PGL) or equation of state
    • P pRT
    • R = R*/M(gas constant)
    • R* = 8.314*x103 J/K/kmole (universal gas constant
    • M = kg molecular weight
    • T = temperature in degrees Kelvin = 273.16+ T(°C)
  • Density at MSL p = P/RT
    • M = kg molecular weight = 29 kg/kmole
    • R = R*/M
    • R*/29kg/ kmole = 287 J/K/kg
    • T = 27°C = 300K
    • P = P/RT = 105/(287*300)
    • ~1.2 kg/m3
  • Vertical Structure
    • Vertical variation (Z) of pressure in the atmosphere
    • (get diagram from website)
    • Stationary cylinder
      • Cross sectional area, A
      • Density, p(kg/M3)
    • Weight of cylinder downwards is balanced by net upward pressure force
    • Mass of cylinder = volume * density
      • DZ * Axp
    • Force balance (upwards)
      • (P + dP) * A + P * A – dZ*A*p*g = 0
    • Simplify
      • dP/dZ = -pg – Hydrostatic Law
    • H = RT/g(m) = 8km
    • P(0) = 1.013*102kPa
    • P(0) = 1.2 kg/m3
    • P(Z) = p(0) * exp(-z/h)
    • p(Z) = p(0) * exp(-z/h)
  • the higher you go upwards the less pressure in the atmosphere
  • https://horsehead.ccs.yorku.ca/moodle/login/index.php
  • Mean free path(λ) (the average distance between molecules calculating a distance a molecule can travel before it collides with another
    • Q*N* λ = 1
    • Q – cross section (m2)
    • Number density, N (molec m-3)
    • Surface, λ = .3 чm
    • 300 km, λ = 100km (satellite drag)
  • Vertical variation of pressure – ocean
    • Equation of state p = p0*z (z<0), ie P increases linearly with depth
    • P doubles in z = 10 meteres, ie P(0) = p0*g*z
  • Vertical temperature Structure
    • In the stratosphere/ thermosphere temperature increases with height
    • In the troposphere/mesosphere it decreases
    • In order
      • Troposphere
      • Stratosphere
      • Mesosphere
      • Thermosphere
    • Temperature structure
      • Troposphere: 0-10/16km tropopause
      • Stratosphere: tropopause – 50km
      • Mesosphere: stratopause – 85km
      • Thermosphere: mesopause – 300km
      • Exosphere: above 300km "collisionless"
    • Lapse rate
    • ***
    • Homosphere
      • Most "inert" species are well mixed
    • Heterosphere
      • Species are in diffusive equilibrium i.e for each species there is a hydrostatic law
    • Ionosphere
      • Atmosphere is ionized by EUV

Thursday, January 3, 2008

CSE2031 Lecture 1

Course Information

Prof: Gordon Turpin

Email: gordon@cse.yorku.ca

    -only send mail from prism account

    -use a subject header "2031: …"


 

Hello World


 

#include <stdio.h>

int main(void)

{

printf("Hello World!"\n");

return 0;

}

  • #include <stdio.h>
    • This file is replaced in the header in compile time
    • stdio.h does not contain executable code
      • only definition of constants
      • include statements
      • and function prototypes
      • 'printf'
        • A function call
        • (method is a function, method is a java term)
        • When it encounters a function call like 'printf'
          • It wants the function prototype of printf
  • int main(void)
    • 'void' means it takes no parameters
    • 'main' returns an 'int'
  • return 0;
    • indicates success
    • unspecified types are assumed to be 'int'
  • printf
    • most basic print type
    • '\n' sends a new line after the text
  • This program doesn't return a '0' because printing is not the same as returning


 

Compiling C

  • Simplest way to compile

    cc hello.c

    ls a.out

    cat hello.c

  • 'cat' prints out the code for hello.c in console
  • cat is called from /bin/cat
  • cc is the compile command
    • cc created a.out
      • to create a different file name
        • use cc –o hello hello.c
          • 'hello' is the filename
          • -o is the 'flag' to create a different name
        • cc –o hello –Wall hello.c
          • –Wall will allow the compiler point out errors in code
        • cc –o hello –Wall -pedantic hello.c
          • allows you to see if code will run on older versions of C
        • cc –o hello –Wall -pedantic –c hello.c
          • stops compilation when the object module is produced
          • Produces the file 'hello.o'
          • nm hello.o
            • shows the function 'main' in the T (text)
            • and there is a call for a function 'printf'
        • cc –o hello –Wall –pedantic –c -E hello.c
          • stops the compilation after the preprocessor phase
          • Replaces #define with code supplied for that function


             

  • echo $PATH
    • returns the paths where the shell will look for the commands you are passing
      • separated by ':'
    • the last place bash looks in is the current directory
    • ./a.out will find a.out within your path
    • PATH=$PATH:..
      • Adds ' ..' to the $PATH
  • a.out only needs executable permission to run
  • if you write a shell script you would need execute and read permission


 

chmod

  • 9 permission bits
    • ---------
      • User
    • ---------
      • Group
    • ---------
      • Owner    
    • Read = 4
    • Write = 2
    • Execute = 1
    • Non = 0
  • 'chmod 751 a.out 'gives
    • user
      • r/w/e
    • group
      • r/e
    • owner
      • e

Comments

  • /*comment in here */


     

CSE2001 Lecture 1

Course information

Prof: George Tourlakis

Course website: www.cse.yorku.ca/~gt/courses/

Evaluation Breakdown

  • Homework (30%) , Midterm (30%), Final Exam (40%)
  • Mathematical induction is very important
  • PDA
    • Push down automata
      • Will accept {anbn| n≥0}
  • Assignments are to be typed
    • George uses LaTex for writing equations on a computer.
    • mcTex is for PC
  • Book authors: Hopcroft / Ullman/ Motwani
    • We will cover
      • Finite Automata (FA)
      • Push Down Automata (PDA)
      • A little about TM's(mostly from Tourlakis's notes)
    • Feb 19th is Test 1
  • if a test is missed the percentage is added to the final exam
  • other references
    • webnotes
  • Sets
    • A , x, { , , ,}, { a a b}
      • Used to denote sets
    • Order doesn't matter in a set
    • Neither do repetitions
      • {a,a,b} == {a,b} == {b,a}
    • N - Natural numbers symbol in McTax
      • \mathb
    • {x:P(x)}
    • {X|p(x)}
      • : and | used as 'such that' labels
  • Russel paradox
    • Does every math property P(x) determine a set?
      • No!
    • X ε Y
    • {0} ε{1}
      • False
    • {0} ε{0}
      • True
    • How about R = {x ε x}?
      • x ε R == x ε x

R ε R = R ε R

CSE 2011 Lecture 1

Course Information

Website: http://www.cse.yorku.ca/course/2011/

Workload: 3 reports(6%,7%,7%), 2 class tests(20%,20%) and a final exam(40%).

Course directly for prism: prism:/cse/course/2011

  • Found here:
    • Java files for assignments
    • Answers for assignments
  • To find your grade:
    • Console: courseInfo 2011 [2007-08 W]


 

  • Data structures
    • A systematic way to organize and access data
      • That is easy to retrieve
    • Algorithm
      • Step by step procedure for performing some task in a finite amount of time
      • "Sometimes you want to use the slower algorithms because they are faster"
    • Programs = Data Structures + Algorithms
      • The course forms a framework for developing useful programs
  • Principles of public design
    • Principle of use
      • Programs will be used by people
      • They are public
      • Must be designed for people
    • Principle of misuse
      • Programs will be misused by people
    • Principle of evolution
      • Programs will be changed by people
      • If you want to modify it you'll have to know how it works
    • Principle of migration
      • Programs will be moved to new environments by people
  • Software quality
    • Readable and understandable
      • All design artifacts – program text included – are primarily to be read and used by people
      • Execution is incidental
    • Correct and complete
      • It works – it is useable
      • Works correctly for all possible inputs that one might encounter within a domain of interest
    • First write correct programs then worry about efficiency
      • A fast program that is wrong is worse than useless
      • Speed up where necessary after instrumentation
      • Always design to be as efficient as you wanted to be and no more
    • Efficient as it needs to be
      • Use an appropriate amount of resources for the task
        • Space for storing data and temporary results
        • Execution time
        • Space – time tradeoff
        • Communications bandwidth
    • Modifiable
      • All programs evolve over time
      • Make plausible modifications easy
        • One sign of a good design is it is easy to modify and adapt to changing circumstances
    • On time and on budget
      • Time is money
        • Pay back on investment
      • Imbedded systems
        • Programs are only a part of the system
  • Basic data structures
    • Array
      • Single type of data
      • Fixed size
      • homogeneous
    • Tuple
      • Collection of different types of data
      • Heterogeneous
  • We want to store things in a container of the basic data structures
  • We want to organize data structures
  • A container should be able to:
    • Add
    • Remove
    • Retrieve
    • Find size
      • How big the container is
      • How many things are in the container
      • If it contains something
    • organize
  • A fundamental organization of a collection
    • Iteration
    • Move elements
  • Fundamental property of a sequence
    • The beginning and the end of the sequence
    • There is a front a sequence and a rear to a sequence
  • A list is the organization of a container

Eats 1011 Lecture 1

Course information

Textbook – 'essentials of meteorology – an invitation to the atmosphere'.

Website - http://horsehead.ccs.yorku.ca/moodle/login/index.php


 

Introduction


 

  • Earth's radius – 6370km
  • Tropical cloud tops ~ 14km
  • What is our atmosphere made of?
    • Permanent gases
      • 78.08% nitrogen
      • 20.95% oxygen
        • If there is too much oxygen things would burst into flames
        • If there is too little oxygen then we couldn't breathe properly
      • .93% argon
      • .0018% neon
      • .0005 helium
      • .00006 hydrogen
      • .000009 xenon
    • Mixing ratios by volume =
    • Composition constant to stand up to ~ 90km
    • Permanent gases all have very long lifetimes
    • O2 is consumed by burning fossil fuels but released by photosynthesis, changes by ~ 20 ppmv in 10 years
    • Ppmv =     Parts per million volume
    • Variable gases
      • 0-4% water vapor
        • Water exists in 3 phases on earth
          • vapour
          • liquid
          • solid
        • most is in the bottom 3km
        • latent heat release is important
        • vapour 'invisible', but absorbs light in near IR and throughout the IR – Greenhouse Gas(GHG)
        • condensed cloud and water droplets
        • frozen air ice pellets, crystals and snow
      • .037% carbon dioxide (375 ppm)
        • Greenhouse gas (GHG) – 370 ppmv
        • Increasing at ~.4% / year
        • 16% from 1958 (figure 1.3 ahrens)
        • 32% from beginning of industrial revolution
        • 'lifetime' ~ 250 years
        • Sources of CO2
          • reverse photosynthesis
          • O2 + sugar / food à CO2 + H2O
            • Wintertime CO2 increases
          • decay of vegetation
          • exhalations of animals / people (burning)
          • burning of fossil fuels(coal, oil, natural gas)
          • deforestation (burned or left to rot)
          • volcanic eruptions
        • Sinks
          • removal by photosynthesis
          • CO2 + H2O + Visible light à O2 + sugar
          • ocean sinks
            • CO2 dissolves in oceans (à 50 times the total atmospheric CO2)
            • Phytoplankton(tiny plants) fix CO2 into organic tissues
            • Mixes downward in oceans
            • Summertime CO2
      • .00017 methane (1.7ppm)
        • CH4 = Methane
        • GHG – 1.7 ppmv
        • Increasing by .5% per year
        • Lifetime – 10 years
        • Sources
          • termites (biological activity). Anaerobic (no oxygen) breakdown of plant material by bacteria
            • rice paddies
            • wetlands
          • enteric fermentation
            • cows, elephants flatulence
            • landfills
            • pipeline loss
        • Sinks
          • loss by chemical reactions in the atmosphere
      • .00003 nitrous oxide (.3 ppm)
      • .000004 ozone (.04ppm)
        • O3 - ozone
        • Most of the ozone is in the stratosphere (20-50km)
        • Serves as a UV filter (<300nm)
        • Secondary pollutant
          • mixture of NOx and hydrocarbon gases
          • causes respiratory problems
      • .000001 particles (dust, soot, etc) (.01 - .15ppm)
        • Aerosols
          • Natural sources
            • Volcanoes, forest fires, blown dust, sea salt, trees
          • Anthropogenic sources
            • Roads, biomass burning, emissions, reactions in the atmosphere
          • Health issues, smaller particles are more lethal
            • PM 2.5µm
          • N.B. cloud/rain not normally included as aerosols
      • .00000002 chlorofluorocarbons (CFC's) (.0002ppm)
    • 1.7 ppmv means that for every million air molecules in a volume 1.7 are methane molecules
  • Ice cores from Arctic and Antarctic
    • Greenland is about 3000 m
    • Antarctica 3000 m
    • was our atmosphere always like this?
      • Our universe is about 15 billion years old
      • Solar system formed from rotating debris
        • Planets planetsimals asteroids comets
      • Earth formed about 4.5 billion years ago
        • Pulverized by colliding bodies
        • Atmosphere of H2, He
        • Swept away by early solar wind
      • It is likely that we have a secondary or tertiary atmosphere
      • Likely there was a volcanic outgassing
      • Emissions from current volcanoes
        • 80% water
        • 10% CO2
        • 2% nitrogen
        • Variable% SO2
      • Cooling
        • water formed oceans
          • not much land
      • collisions
        • formation of moon
        • possible cometary source of water
      • sun
        • 1bya
          • Earth was almost completely frozen
          • Atmosphere
            • Water, CO2,
              • completely different from today
      • early atmosphere had no capacity for shielding from UV radiation from the sun
        • absorption limits
        • **
      • So where did our O2 atmosphere come from?
        • Water photolysis generates O2 and ozone (.3µ)
      • Photosynthesis
        • N(CO2 + H2O) + sunlight à (H2CO)n + nO2(day)
        • O2 + H2CO à CO2 + H2O (night) "burning": energy release
        • Death/burial of C à O2 remains in atmosphere
      • Summary

Most of the carbon is in sedimentary rocks so that the CO2 – N2 budget is similar to that of Venus in absolute amounts and to mars in ratio