import iris

fname = iris.sample_data_path('atlantic_profiles.nc')
cubes = iris.load(fname)

"""
Explanation: Exercise 1:
1. Using the file in iris.sample_data_path('atlantic_profiles.nc') load the data and print the cube list. Store these cubes in a variable called cubes.
End of explanation
"""


print(sorted([cube.name() for cube in cubes]))

"""
Explanation: 2. Print a sorted list of unique names for the cubes.
End of explanation
"""


cube = cubes.extract('sea_water_potential_temperature')[0]
print(cube)
print('minimum value:', cube.data.min())
print('maximum value:', cube.data.max())
print('standard deviation:', cube.data.std())

"""
Explanation: 3. Extract the "sea_water_potential_temperature" cube. Print the minimum, maximum, mean and standard deviation of the cube's data.
End of explanation
"""


print(cube.attributes)

"""
Explanation: 4. Print the attributes of the cube.
End of explanation
"""


for coord in cube.coords():
    print(coord.name())

"""
Explanation: 5. Print the names of all coordinates on the cube. (Hint: Remember the cube.coords method)
End of explanation
"""


latitude = cube.coord('latitude')
print(latitude.has_bounds())
print('minimum latitude:', latitude.points.min())
print('maximum latitude:', latitude.points.max())

"""
Explanation: 6. Get hold of the "latitude" coordinate on the cube. Identify whether the cube has bounds. Print the minimum and maximum latitude points in this cube.
End of explanation
"""


