Question: Python: I previously created 3 arrays with 25 elements in each: time (tm_hr), wave height (wave_height) and wind speed (knots). Then made 2 plots: wave

Python: I previously created 3 arrays with 25 elements in each: time (tm_hr), wave height (wave_height) and wind speed (knots). Then made 2 plots: wave height vs time and wind speed vs time. The steps of what I need to do next are as follows :

  1. Create bins in the time hour array. The number of bins should be specified in a variable nbins. Check your bin boundaries.
  2. For each time bin identify the wave height and wind speed values for the times in each bin. This can be done with a boolean index array. Make sure that the values associated with the first and last time value are included (depending on which side of each interval is open). In other words, make sure that both boundary time array values are included in the analysis.
  3. Calculate and store the value (wave height and wind speed) average for each bin.
  4. You will need to also create a new time hours array that represents the mid-interval time for each bin.
  5. Plot both the filtered wave height and wind speed as a function of the mid-interval times. Vary the number of bins and check the plots until you find the smallest nbins with only one peak.
  6. Adopt that bin size as your filter and calculate the time lag from the difference of the times at which the filtered wave height and wind speeds have their maximum.

I'm having trouble starting, if I could particularly get help with 1-4. Thanks

If needed the arrays are: tm_hr=[24.0,23.0,22.0,21.0,20.0,19.0,18.0,17.0,16.0,15.0,14.0,13.0,12.0,11.0,10.0,9.0,8.0,7.0,6.0,5.0,4.0,3.0,2.0,1.0,0.0], wave_height=[3.3,3.5,3.8,4.0,4.1,4.2,4.2,4.8,4.7,4.4,4.5,4.1,4.3,4.0,3.7,3.5,3.2,3.1,3.0,2.9,2.9,2.8,2.5,2.4,2.2] and knots=[19.438444924406046,19.438444924406046,17.49460043196544,19.438444924406046,21.38228941684665,21.38228941684665,21.38228941684665,25.269978401727858,27.213822894168466,25.269978401727858,19.438444924406046,27.213822894168466,23.326133909287257,25.269978401727858,27.213822894168466,23.326133909287257,23.326133909287257,21.38228941684665,21.38228941684665,19.438444924406046,19.438444924406046,19.438444924406046,17.49460043196544,17.49460043196544,17.49460043196544]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!