So far my code to plot a a graph is like so:
iplt.plot(pressure_no1, color='black')
plt.xlabel('Time / hour of day')
plt.ylabel('Atmospheric pressure / kPa')
iplt.show()
it is a 6 hour cube (although is 2dimensional) data set, with 420 data points. I need just the data points hr=0, hr=1 hr=2, hr=3, hr=4, hr=5 to be plotted and none in between the hour.
could something like the following work?
pressure_no1_hrs = pressure_no1.coord('hour'==int).points
plt.plot(pressure_no1_hrs)
Image of graph with all data points and start of the time coordinates Image of last lot of time coordinates
For an Iris-specific solution, you could use a PartialDateTime:
import iris
import iris.quickplot as qplt
import numpy as np
import matplotlib.pyplot as plt
measures = np.random.normal(size=(360, ))
timepoints = np.arange(start=0, stop=360)
cube = iris.cube.Cube(measures, long_name='atmospheric_pressure', units='kPa')
time_coord = iris.coords.DimCoord(
timepoints, units='minutes since 2020-07-01 00:00', standard_name='time')
cube.add_dim_coord(time_coord, 0)
subcube = cube.extract(iris.Constraint(time=iris.time.PartialDateTime(minute=0)))
qplt.plot(cube, label='All data')
qplt.plot(subcube, label='Hourly data')
plt.legend()
plt.show()