<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Intorduction to Object Oriented Programming in Python
Definition of the minimal class in two lines
Define class
Step1:  Use class
Step2:  Definition of a class with attributes (properties)
Step3:  Definition of a class with constructor
Step4:  Create a Human instance and give him a name instantly
Step5:  Definition of a class with several methods
Step6:  Create a Human, give him a name, grow by one year (in-place)
Step7:  Add get_ methods to the class
Step8:  Create a class with Inheritance
Step9:  Create an Teacher with name, grow him sufficiently, use him.
Step10:  Import class definition from a module
Store class definition in a separate file. E.g.
Step11:  Practical example
Step12:  How would it look without OOP?
1. A lot of functions to import
Step13:  2. A lot of data to unpack and to pass between functions
Step14:  3. And imagine now we open a satellite image which has
<ASSISTANT_TASK:>
Python Code:
class A():
    pass
Explanation: Intorduction to Object Oriented Programming in Python
Definition of the minimal class in two lines
Define class
End of explanation
a = A()    # create an instance of class A
print (a)
print (type(a))
Explanation: Use class
End of explanation
class Human(object):
    name = ''
    age = 0
human1 = Human()          # create instance of Human
human1.name = 'Anton'     # name him    (add data to this object)
human1.age = 39           # set the age (add data to this object)
print (type(human1))
print (human1.name)
print (human1.age)
Explanation: Definition of a class with attributes (properties)
End of explanation
class Human(object):
    name = ''
    age = 0
    
    def __init__(self, name):
        self.name = name
Explanation: Definition of a class with constructor
End of explanation
h1 = Human('Anton')
print (h1.name)
print (h1.age)
Explanation: Create a Human instance and give him a name instantly
End of explanation
class Human(object):
    ''' Human being '''
    name = ''
    age = 0
    
    def __init__(self, name):
        ''' Create a Human '''
        self.name = name
    
    def grow(self):
        ''' Grow a Human by one year (in-place) '''
        self.age += 1
Explanation: Definition of a class with several methods
End of explanation
human1 = Human('Adam')
human1.grow()
print (human1.name)
print (human1.age)
Explanation: Create a Human, give him a name, grow by one year (in-place)
End of explanation
class Human(object):
    ''' Human being '''
    name = ''
    age = 0
    
    def __init__(self, name):
        ''' Create a Human '''
        self.name = name
    
    def grow(self):
        ''' Grow a Human by one year (in-place) '''
        self.age += 1
    
    def get_name(self):
        ''' Return name of a Human '''
        return self.name
    def get_age(self):
        ''' Return name of a Human '''
        return self.age
h1 = Human('Eva')
print (h1.get_name())
Explanation: Add get_ methods to the class
End of explanation
class Teacher(Human):
    ''' Teacher of Python '''
    def give_lecture(self):
        ''' Print lecture on the screen ''' 
        
        print ('bla bla bla')
Explanation: Create a class with Inheritance
End of explanation
t1 = Teacher('Anton')
while t1.get_age() < 50:
    t1.grow()
print (t1.get_name())
print (t1.get_age())
t1.give_lecture()
Explanation: Create an Teacher with name, grow him sufficiently, use him.
End of explanation
# add directory scripts to PYTHONPATH (searchable path)
import sys
sys.path.append('scripts')
from human_teacher import Teacher
t1 = Teacher('Morten')
t1.give_lecture()
Explanation: Import class definition from a module
Store class definition in a separate file. E.g.:
https://github.com/nansencenter/nansat-lectures/blob/master/human_teacher.py
End of explanation
## add scripts to the list of searchable directories
import sys
sys.path.append('scripts')
# import class definiton our module
from ts_profile import Profile
# load data
p = Profile('data/tsprofile.txt')
# work with the object
print (p.get_ts_at_level(5))
print (p.get_ts_at_depth(200))
print (p.get_mixed_layer_depth(.1))
Explanation: Practical example
End of explanation
from st_profile import load_profile, get_ts_at_level, get_ts_at_depth
from st_profile import get_mixed_layer_depth, plot_ts
Explanation: How would it look without OOP?
1. A lot of functions to import
End of explanation
depth, temp, sal =  load_profile('tsprofile.txt')
print (get_ts_at_level(depth, temp, sal))
Explanation: 2. A lot of data to unpack and to pass between functions
End of explanation
from nansat import Nansat
n = Nansat('satellite_filename.hdf')
Explanation: 3. And imagine now we open a satellite image which has:
many matrices with data
georeference information (e.g. lon, lat of corners)
description of data (metadata)
and so on...
And here comes OOP:
End of explanation
<END_TASK>