Question

This is a python matplotlib question. So it would be great if you could show me in python method.

Histogram of wind gust speeds As before the file akaroawindgusts.txt contains hourly maximum wind gusts speeds at the Akaroa

grsgrw.py regrgreg.py* plot_wind gust histogram A first simple matplotlib demo *** import numpy as np import matplotlib.pyp

I have this loadtxt that asked to plot histogram of wind gusts(column 3) that lie in direction angle(column 2) from min angle to max angle inclusively. I don't know how to include min_angle and max_angle into my codes.

Lazotave en ITMON IDND SMD RANTE en INUTMAT should be Wind gusts from akaroawindgusts.txt in directions 180 through 270 Count

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

import numpy as np
import matplotlib.pyplot as plt
from math import sin,pi
import math

def plot_wind_gust_histogram(filename,min_angle,max_angle):
   data1=np.loadtxt(filename,delimiter=";",skiprows=1,usecols=2) #speed
   data2=np.loadtxt(filename,delimiter=";",skiprows=1,usecols=1) #direction   add this
  
   data1=data1[np.where(np.logical_and( data2[:]>=min_angle , data2[:]<=max_angle ))].astype(np.int)   #add this

   axes=plt.axes()
   axes.hist(data1, bins=range(0,141,10) , facecolor='blue')
   axes.grid(True)
   axes.set_title("Wind gusts from file akaroawindgusts.txt in direction 180 and 270")
   axes.set_xlabel("Wind gust speed (km/h)")
   axes.set_ylabel("Count")
   axes.set_xticks(np.arange(0,141,10))
   axes.set_yticks(np.arange(0,70,10))
   plt.show()

plot_wind_gust_histogram("akaroawindgusts.txt",180,270)

1.py import numpy as np import matplotlib.pyplot as plt from math import sin,pi import math 4 def plot_wind gust_histogram(fi

Add a comment
Know the answer?
Add Answer to:
This is a python matplotlib question. So it would be great if you could show me...
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
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