Question

In: Computer Science

PYTHON COMPUTER CODE PROGRAMMING - DISPLAYING A PLOT OF TEMPERATURE VERSUS DEPTH WHEN GIVEN A LATITUDE....

PYTHON COMPUTER CODE PROGRAMMING - DISPLAYING A PLOT OF TEMPERATURE VERSUS DEPTH WHEN GIVEN A LATITUDE. PYTHON ASSIGNMENT. NOT SURE HOW TO PLOT THIS DATA WITH THE GIVEN INFO BELOW:

Just as the atmosphere may be divided into layers characterized by how the temperature changes as altitude increases, the oceans may be divided into zones characterized by how the temperature changes as depth increases. We shall divide the oceans into three zones: the surface zone comprises the water at depths between 0 m and 200 m; the thermocline comprises the water at depths between 200 m and 1000 m; and the deep zone comprises water at depths exceeding 1000 m.

We shall assume that temperature is unaffected by longitude.

We shall assume that at all latitudes, temperature is a continuous function of depth. Informally, this means that you can sketch the graph of temperature versus depth (at a particular latitude and longitude) without lifting your pencil from the page.

We shall assume that the wind and waves serve to mix water in the surface zone so effectively that the temperature remains constant with depth. It does change with latitude, though, as the temperature in the surface zone is greatly affected by solar radiation [4]. We shall assume that in late March (around the time of the equinox) the temperature in the surface zone is a linear function of the absolute value of the latitude. Further, we shall assume that in late March the temperature in the surface zone is 2 ◦ C at the poles, and 24 ◦ C at the equator.

We shall also assume that, because solar energy never makes it to the deepest water, the temperature remains constant with depth in the deep zone. In fact, we shall assume that, no matter the latitude, the temperature of water in the deep zone in late March is 2 ◦ C.

Since water in the surface zone can be warm, water in the deep zone is always cold, and the temperature at a given latitude is a continuous function of depth, the temperature must change with depth throughout the thermocline. We shall assume that, at each latitude and longitude, temperature is a linear function of depth in this zone.

My current python code includes:

def sal_of_seawater(latitude):
seawater = -(1/45)*latitude+36
return(seawater)

#temp_of_seawater, calculate temperature gived water depth and latitude
def temp_of_seawater(depth, latitude):
#model_temp_surface
if 0 <= depth <200:
model_temp = (22/90)*latitude+24
elif 200 <= depth < 1000:
#thermocline
model_temp = (2-((-22/90)*latitude+24)/800)*depth+((-22/90)*latitude+24)-200*(2-(-22/90)*latitude)
#deep
else:
model_temp = (2)
return(model_temp)

latitude = float(input("Please enter latitude (South = -90, north = 90 and 0 = equator :")

plot()

Solutions

Expert Solution

Use underline words to create the answers for you

So , you have defined the the function below properly .

def sal_of_seawater(latitude):
seawater = -(1/45)*latitude+36
return(seawater)

#temp_of_seawater, calculate temperature gived water depth and latitude
def temp_of_seawater(depth, latitude):
#model_temp_surface
if 0 <= depth <200:
model_temp = (22/90)*latitude+24
elif 200 <= depth < 1000:
#thermocline
model_temp = (2-((-22/90)*latitude+24)/800)*depth+((-22/90)*latitude+24)-200*(2-(-22/90)*latitude)
#deep
else:
model_temp = (2)
return(model_temp)

Instead of taking input from user , You define a continues function which takes values from 1 to 10  

For latitudes 1 to 10 what will be tempratures .

So you get two dimension array. For each latitude what is the temprature value .

Use plot function to create the graph

latitude = float(input("Please enter latitude (South = -90, north = 90 and 0 = equator :"

plot()


Related Solutions

Write a Python code that when the temperature of the CPU in the raspberry pi exceeds...
Write a Python code that when the temperature of the CPU in the raspberry pi exceeds 40 degrees Celsius you receive an email.
can anyone give me a code for nodemcu wifi chip for displaying temperature and humidity to...
can anyone give me a code for nodemcu wifi chip for displaying temperature and humidity to app where temp and humidity data is sent to cloud and then cloud sends the data to mobile app
Make a plot of bonding energy versus melting temperature for Al, Ag, and Au.
Make a plot of bonding energy versus melting temperature for Al, Ag, and Au.
Does anyone know the code to use in R programming to create a scatter plot?
Does anyone know the code to use in R programming to create a scatter plot?
Does anyone know the code to use in R programming to create a box plot?
Does anyone know the code to use in R programming to create a box plot?
"Using Python, code to find the smallest and largest planet mass (if known), and plot these...
"Using Python, code to find the smallest and largest planet mass (if known), and plot these as two curves against the year of discovery" Basically looking to use data from an excel sheet where 'disc_year' and 'pl_mass' are columns of data; and code Python to find the maximum value of mass and the minimum value of mass for each year, then plot this as two curves. There are multiple planets for any given year hence multiple values for mass. Below...
Explain event-driven programming in Python. Give 2 examples of code where event-driven programming is used.
Explain event-driven programming in Python. Give 2 examples of code where event-driven programming is used.
PYTHON PROGRAMMING Using tktinker, create a gui that surrounds the code below that has buttons and...
PYTHON PROGRAMMING Using tktinker, create a gui that surrounds the code below that has buttons and labels and an overall theme. # Meet the chatbot Eve print('Hi there! Welcome to the ChatBot station. I am going to ask you a series of questions and all you have to do is answer!') print(' ') print('Lets get started') #begin questions firstName = input('What is your first name?: ') lastName = input('What is your last name? ') print("Hi there, ", firstName + lastName,...
WANT CODE IN PYTHON PROGRAM: THE QUESTION IS BASED ON Mcdonald.csv Plot graphically which food categories...
WANT CODE IN PYTHON PROGRAM: THE QUESTION IS BASED ON Mcdonald.csv Plot graphically which food categories have the highest and lowest varieties. Which all variables have an outlier? Which variables have the Highest correlation. Plot them and find out the value ? Which category contributes to the maximum % of Cholesterol in a diet (% daily value)? Which item contributes maximum to the Sodium intake? Which 4 food items contains the most amount of Saturated Fat?
Python programming: can someone please fix my code to get it to work correctly? The program...
Python programming: can someone please fix my code to get it to work correctly? The program should print "car already started" if you try to start the car twice. And, should print "Car is already stopped" if you try to stop the car twice. Please add comments to explain why my code isn't working. Thanks! # Program goals: # To simulate a car game. Focus is to build the engine for this game. # When we run the program, it...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT