Question

Write a program in Python to read the .txt file . Then to plot CO2_flux against time for every half hour .A H P DATAH DATAU DATA DATA DATA DATA 0 0 DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DAT

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Kindly find the code for reading a file and plotting the graph of CO2_flux against Time. Dont forget to chnage the filename before running the code.

 import matplotlib import matplotlib.pyplot as plt import csv with open('example.txt','r') as f_input: csv_input = csv.reader(f_input, delimiter=' ', skipinitialspace=True) x = [] y = [] for cols in csv_input: x.append(matplotlib.dates.datestr2num(cols[0])) y.append(float(cols[1])) # naming the x axis plt.xlabel('Time') # naming the y axis plt.ylabel('CO2_flux') # giving a title to my graph plt.title('CO2_flux vs Time') # plotting the points plt.plot_date(x, y) # beautify the x-labels plt.gcf().autofmt_xdate() # function to show the plot plt.show()

  

Add a comment
Know the answer?
Add Answer to:
Write a program in Python to read the .txt file . Then to plot CO2_flux against...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Need help writing a program that meets pseudocode and criteria . Txt File below input.txt file...

    Need help writing a program that meets pseudocode and criteria . Txt File below input.txt file data 05 11/30/16 03 12/07/16 05 12/07/16 05 12/08/16 01 12/10/16 07 12/11/16 07 12/14/16 06 12/15/16 02 12/21/16 05 12/21/16 06 12/22/16 07 12/22/16 08 12/23/16 07 12/23/16 07 12/23/16 07 12/23/16 08 12/24/16 08 12/24/16 07 12/24/16 03 12/26/16 05 12/26/16 07 12/28/16 04 12/29/16 07 01/01/17 06 01/03/17 07 01/03/17 08 01/05/17 05 01/10/17 04 01/17/17 08 01/17/17 07 01/18/17 07...

  • Therefore, for this program you will read the data in the file named weatherdata_2.txt into arrays...

    Therefore, for this program you will read the data in the file named weatherdata_2.txt into arrays for the wind speed and for the temperature. You will then use the stored data to calculate and output the average wind speed and the average temperature. Create a constant with a value of 30 and use that to declare and loop through your arrays and as a divisor to produce your averages. Here is the data file (below). 1. 14 25 2. 12...

  • PYTHON The program needs to process the arrival and departure of each patient documented in the...

    PYTHON The program needs to process the arrival and departure of each patient documented in the patient data file. While processing each patient, send the following output to an output file: a.Use your two new functions to initially print out a "0". b. As each patient arrives, print out the name of the patient & the time that they arrive at. c. Update the billboard counter to indicate that the wait time has increased. d. Print out the new billboard...

  • Python code file PLEASE!! b.) Write a program that uses FSOLVEO to solve the Rolling Wheel...

    Python code file PLEASE!! b.) Write a program that uses FSOLVEO to solve the Rolling Wheel Dynamics – impending slip problem shown on Canvas. You MUST use the "args” feature of Fsolve to communicate the wheel parameters. Use all of the wheel parameters posted, except for the static coefficient of friction and the ramp-angle . Generate a plot of ramp- angle vs coefficient of friction for impending slip, for friction values of 0.1, 0.15,0.2, 0.25, up to 0.85. 17-94. The...

  • Topics: list, file input/output (Python) You will write a program that allows the user to read...

    Topics: list, file input/output (Python) You will write a program that allows the user to read grade data from a text file, view computed statistical values based on the data, and to save the computed statistics to a text file. You will use a list to store the data read in, and for computing the statistics. You must use functions. The data: The user has the option to load a data file. The data consists of integer values representing student...

  • Need help with C++ assignment Assignment 1 and .txt files are provided at the bottom. PART...

    Need help with C++ assignment Assignment 1 and .txt files are provided at the bottom. PART A PART B Assignment 1 #include <iostream> #include <string> #include <fstream> #include <iomanip> #include <stdio.h> #include <ctype.h> #include <string.h> #include <algorithm> using namespace std; /** This structure is to store the date and it has three integer fields **/ struct Date{    int day;    int month;    int year; }; /** This structure is to store the size of the box and it...

  • 27) (6 pts) We saw in class (and in the plot below, from class) that when...

    27) (6 pts) We saw in class (and in the plot below, from class) that when concentration of the chemical compound MSA (methane sulfonic acid) is high in ice cores, the temperature of the Earth is low (and vice versa). MSA is an oxidation product of dimethylsulfide (DMS). Age ky ago 566 13 33 107 11 141 Work A) What is the source of the DMS that leads to MSA? (circle one) a) Marine algae b) Volcanic activity c) Power...

  • w File Edit View Go Tools Window Help HW1-2.pdf (page 2 of 2) Q Search 2....

    w File Edit View Go Tools Window Help HW1-2.pdf (page 2 of 2) Q Search 2. You collected a set of data concerning the down time for a machine (in minutes). The data is plotted in the following relative frequency histogram: 0.2 0.15 0.1 0.05 10 15 20 25 30 a) What's the mode of the data? b) The q-q plot is shown in the following chart. ls the data normally distributed? Why or why not? 2.5 1.5 05 th...

  • Write a program (python) to calculate and plot the position and the velocity of a linear...

    Write a program (python) to calculate and plot the position and the velocity of a linear piston connected to a crank through a connecting rod as a function of crank angle. The crank shaft is rotating at a constant angular velocity. The equation for the piston position and velocity is respectively given by ? = ? ???? + √? 2 − ? 2???2? ? = −? ? ???? − ? 2 ? ???? ???? √? 2 − ? 2???2? where...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT