<jupyter_start><jupyter_text>Problem 1 (5 pts):Write a script (or Jupyter Notebook code block) that opens the file, uses a for loop to read through the file line by line and reports the highest water level and the date and time that was observed.<jupyter_code>fhand = open('/blue/bsc4452/share/Class_Files/data/CO-OPS__8729108__wl.csv')
CurrentMax = 0.0
CurrentDate = ""
for line in fhand:
    line = line.strip().split(",")
    try:
        CurrentVal = float(line[1])
    except:
        continue  
    
    if CurrentMax < float(line[1]):
        CurrentMax = float(line[1])
        CurrentDate = line[0]

print(CurrentDate, CurrentMax)<jupyter_output>2018-10-10 18:06 6.647<jupyter_text>Problem 2 (5 pts):Either in a new script or modifying the above script, calculate the lowest, highest and average water level observed during the time period. As above, print the date and time for the lowest and highest readings.<jupyter_code>fhand = open('/blue/bsc4452/share/Class_Files/data/CO-OPS__8729108__wl.csv')
CurrentMax = 0.0
CurrentMin = 100
CurrentDateMax = ""
CurrentDateMin = ""
WaterList = []
for line in fhand:
    line = line.strip().split(",")
    try:
        CurrentVal = float(line[1])
    except:
        continue  
    
    if CurrentMax < float(line[1]):
        CurrentMax = float(line[1])
        CurrentDateMax = line[0]
    
    if CurrentMin > float(line[1]):
        CurrentMin = float(line[1])
        CurrentDateMin = line[0]
        
    WaterList.append(float(line[1]))
    

print('Max:', CurrentDateMax, CurrentMax)
print('Min:', CurrentDateMin, CurrentMin)
print('Average:', sum(WaterList)/len(WaterList))<jupyter_output>Max: 2018-10-10 18:06 6.647
Min: 2018-10-11 15:36 1.621
Average: 2.9823232044198904<jupyter_text>Problem 3 (5 pts):Write a script (or Jupyter Notebook) that calculates the fastest rise in water level per 6-minute period between measurements (for this assignment, assume that each line of the dataset is a 6-minute interval) and reports the date and time that was observed and the change in water level from the previous recording.<jupyter_code>fhand = open('/blue/bsc4452/share/Class_Files/data/CO-OPS__8729108__wl.csv')
MaxRise = 0.0
lineNum = 0

for line in fhand:
    line = line.strip().split(",")
    try:
        CurrentVal = float(line[1])
    except:
        lineNum = lineNum + 1
        continue  
    
    if lineNum == 1:
        StartVal = float(line[1])
    
    EndVal = float(line[1])
    Rise = EndVal - StartVal
        
    if Rise > MaxRise:
        MaxRise = Rise
        EndValDate = line[0]
    StartVal = EndVal
    lineNum = lineNum + 1
        

print('Max Rise:', EndValDate, MaxRise)<jupyter_output>Max Rise: 2018-10-10 17:42 0.6400000000000006<jupyter_text>Problem 4 (5 pts):Imagine that the file is providing live readings of the water level. Write a script (or Jupyter Notebook) to print a line of text with a warning if any of these events occur:* The water level increases more than 0.25 since the previous recording.* The water level is over 5.0.* No reading is received at a time point.<jupyter_code>fhand = open('/blue/bsc4452/share/Class_Files/data/CO-OPS__8729108__wl.csv')
lineNum = 0
MaxRise = 0.25
MaxLevel = 5.0

for line in fhand:
    line = line.strip().split(",")
    try:
        CurrentVal = float(line[1])
    except:
        if line[1] == "":
            print(f"No reading is received at a time point on {line[0]}")
        lineNum = lineNum + 1
        continue  
        
    if lineNum == 1:
        StartVal = float(line[1])
    
    EndVal = float(line[1])
    Rise = EndVal - StartVal
        
    if Rise > MaxRise:
        print(f"The water level increases more than 0.25 since the previous recording on {line[0]}")
    StartVal = EndVal
    lineNum = lineNum + 1
        
    if MaxLevel < float(line[1]):
        print(f"The water level is over 5.0 on {line[0]}")<jupyter_output>The water level increases more than 0.25 since the previous recording on 2018-10-10 17:30
The water level increases more than 0.25 since the previous recording on 2018-10-10 17:36
The water level increases more than 0.25 since the previous recording on 2018-10-10 17:42
The water level is over 5.0 on 2018-10-10 17:42
The water level increases more than 0.25 since the previous recording on 2018-10-10 17:48
The water level is over 5.0 on 2018-10-10 17:48
The water level increases more than 0.25 since the previous recording on 2018-10-10 17:54
The water level is over 5.0 on 2018-10-10 17:54
The water level is over 5.0 on 2018-10-10 18:00
The water level is over 5.0 on 2018-10-10 18:06
The water level is over 5.0 on 2018-10-10 18:12
No reading is received at a time point on 2018-10-10 18:18
The water level is over 5.0 on 2018-10-10 18:24
The water level is over 5.0 on 2018-10-10 18:30
The water level is over 5.0 on 2018-10-10 18:36
The water level is over 5.0 on 2018-10-10 18:42
The water l[...]
{'fraction_non_alphanumeric': 0.09726195341234165, 'fraction_numerical': 0.08806702084184716, 'mean_word_length': 3.1801878736122973, 'pattern_counts': {'":': 1, '<': 16, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '51623', 'license': 'MIT', 'n_tokens_mistral': 1878, 'n_tokens_neox': 1570, 'n_words': 567, 'path': 'Mabry_ProblemSet3.ipynb', 'repo_name': 'mmabry/CompTools_BSC4452', 'size': '4894'}