Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please correct the code below ( after line 6 . ) so that it really does the following: 1 . Read Soil Humidity, Soil Temperature,

Please correct the code below (after line 6.) so that it really does the following:
1. Read Soil Humidity, Soil Temperature, Atomosphere Humidity and Atomosphere Temp values from the Plant_Data.csv file.
2. Calculate the minimum, maximum and average values for Soil and Atomosphere Temp as degrees Farenheit and the Soil and Atomosphere Humidity as a percentage.
3. Plot how Soil Temperature (x-axis) is affected by Atomosphere Humidity (y-axis)
4. Repeat step 3 for how Soil Temperature is affected by Atomosphere Temp
5. Plot both in a single subplot with an appropriate title, x-axis and y-axis labels and a legend.
6. Save it as Soil_Air_Plot.pdf
import csv
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
#Read Soil Humidity, Soil Temperature, Atomosphere Humidity, and Atmosphere Temp values from the Plant_Data.csv file.
plant_file = pd.read_csv('/content/drive/MyDrive/Plant_Data.csv')
#Extracting column values for plotting
atm_temp = plant_file['Atomosphere Temp (\deg C)'].values
atm_hum = plant_file['Atomosphere Humidity (%)'].values
soil_temp = plant_file['Soil Temperature (\deg C)'].values
soil_hum = plant_file['Soil Humidity (%)'].values
#Calculate the minimum, maximum, and average values for Soil and Atmosphere Temp as degrees Fahrenheit and the Soil and Atmosphere Humidity as a percentage.
def celsius_to_fahrenheit(celsius):
return (celsius *9/5)+32
atm_temp_f = celsius_to_fahrenheit(atm_temp)
soil_temp_f = celsius_to_fahrenheit(soil_temp)
atm_temp_min = min(atm_temp_f)
atm_temp_max = max(atm_temp_f)
atm_temp_avg = np.mean(atm_temp_f)
soil_temp_min = min(soil_temp_f)
soil_temp_max = max(soil_temp_f)
soil_temp_avg = np.mean(soil_temp_f)
atm_hum_avg = np.mean(atm_hum)
soil_hum_avg = np.mean(soil_hum)
print(f'Average ATM Temperature: {atm_temp_avg:.2f}\deg F')
print(f'Average Soil Temperature: {soil_temp_avg:.2f}\deg F')
print(f'Average ATM Humidity: {atm_hum_avg:.2f}%')
print(f'Average Soil Humidity: {soil_hum_avg:.2f}%')
#Plot how Soil Temperature (x-axis) is affected by Atmosphere Humidity (y-axis)
plt.figure(figsize=(12,6))
plt.subplot(1,2,1)
plt.scatter(atm_hum, soil_temp_f)
plt.title('Soil Temperature vs. Atmosphere Humidity')
plt.xlabel('Atmosphere Humidity (%)')
plt.ylabel('Soil Temperature (\deg F)')
#Plot how Soil Temperature is affected by Atmosphere Temp
plt.subplot(1,2,2)
plt.scatter(atm_temp_f, soil_temp_f)
plt.title('Soil Temperature vs. Atmosphere Temperature')
plt.xlabel('Atmosphere Temperature (\deg F)')
plt.ylabel('Soil Temperature (\deg F)')
#Plot both in a single subplot with an appropriate title, x-axis, and y-axis labels and a legend.
plt.tight_layout()
plt.legend(['Soil Temperature'])
#Save it as Soil_Air_Plot.pdf
plt.savefig('Soil_Air_Plot.pdf')
plt.show()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems An Application Oriented Approach Complete Version

Authors: Michael Kifer, Arthur Bernstein, Richard Lewis

2nd Edition

0321268458, 978-0321268457

More Books

Students also viewed these Databases questions

Question

How many Tables Will Base HCMSs typically have? Why?

Answered: 1 week ago

Question

What is the process of normalization?

Answered: 1 week ago