<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Iris introduction course
2. Loading and Saving
Learning Outcome
Step1:  2.1 Iris Load Functions<a id='iris_load_functions'></a>
There are three main load functions in Iris
Step2:  If we give this filepath to load, we see that Iris returns a cubelist.
Step3:  A CubeList is a specialised version of a Python list object 
Step4:  If we compare the first cube in the cubelist returned by calling load and the cube returned by calling load_cube we see that they are equal.
Step5:  <div class="alert alert-block alert-warning">
<b><font color='brown'>Exercise
Step6:  2.2 Saving Cubes<a id='saving'></a>
The iris.save function provides a convenient interface to save Cube and CubeList instances.
Below we load the uk_hires.pp file from Iris' provided sample data which returns a cubelist of the cubes that were produced from that file. We then save this cubelist out to netcdf.
Step7:  We can check the ncdump to see what Iris saved
Step8:  Extra keywords can be passed to specific fileformat savers.
<div class="alert alert-block alert-warning">
<b><font color='brown'>Exercise
Step9:  2. Go to the Iris reference documentation for iris.save. What keywords are accepted to iris.save when saving a PP file?
<ASSISTANT_TASK:>
Python Code:
import iris
Explanation: Iris introduction course
2. Loading and Saving
Learning Outcome: by the end of this section, you will be able to use Iris to load datasets from disk as Iris cubes and save Iris cubes back to disk.
Duration: 30 minutes.
Overview:<br>
2.1 Iris Load Functions<br>
2.2 Saving Cubes<br>
2.3 Exercise<br>
2.4 Summary of the Section
End of explanation
fname = iris.sample_data_path('air_temp.pp')
Explanation: 2.1 Iris Load Functions<a id='iris_load_functions'></a>
There are three main load functions in Iris: load, load_cube and load_cubes.
load is a general purpose loading function. Typically this is where all data analysis will start, before more loading is refined with the more controlled loading from the other two functions.
load_cube returns a single cube from the given source(s) and constraint. There will be exactly one cube, or an exception will be raised.
load_cubes returns a cubelist of cubes from the given sources(s) and constraint(s). There will be exactly one cube per constraint, or an exception will be raised.
Note: load_cube is a special case of load. 
Let's compare the result of calling load and load_cube. We start by selecting the air_temp.pp file from Iris' sample data.
End of explanation
cubes = iris.load(fname)
print(type(cubes))
print(cubes)
Explanation: If we give this filepath to load, we see that Iris returns a cubelist.
End of explanation
cube = iris.load_cube(fname)
print(type(cube))
print(cube)
Explanation: A CubeList is a specialised version of a Python list object : 
If you look at the CubeList reference documentation, you can see that it has the behaviours of an ordinary list, like len(cubes), cubes.remove(x), cubes[index].  However, it prints out in a special way and has additional cube-specific methods, some of which we discuss in later sections (extract, merge and concatenate).
If we pass this filepath instead to iris.load_cube, we see that Iris then returns a cube.
End of explanation
cubes[0] == cube
Explanation: If we compare the first cube in the cubelist returned by calling load and the cube returned by calling load_cube we see that they are equal.
End of explanation
#
# edit space for user code ...
#
Explanation: <div class="alert alert-block alert-warning">
<b><font color='brown'>Exercise: </font></b>
    <p>Try loading in the `uk_hires.pp` from Iris' sample data, first with iris.load then iris.load_cube. Why does iris.load_cube fail if you only supply the filepath?</p>
</div>
End of explanation
fname = iris.sample_data_path('uk_hires.pp')
cubes = iris.load(fname)
iris.save(cubes, 'saved_cubes.nc')
Explanation: 2.2 Saving Cubes<a id='saving'></a>
The iris.save function provides a convenient interface to save Cube and CubeList instances.
Below we load the uk_hires.pp file from Iris' provided sample data which returns a cubelist of the cubes that were produced from that file. We then save this cubelist out to netcdf.
End of explanation
!ncdump -h saved_cubes.nc | head -n 20
!rm saved_cubes.nc
Explanation: We can check the ncdump to see what Iris saved:
End of explanation
# space for user code ...
# SAMPLE SOLUTION
# %load solutions/iris_exercise_2.3a
Explanation: Extra keywords can be passed to specific fileformat savers.
<div class="alert alert-block alert-warning">
<b><font color='brown'>Exercise: </font></b>
    <p>Take a look at the above link to the `iris.save` documentation, to see which fileformats iris can save to.</p>
</div>
2.3 Section Review Exercise<a id='exercise_2'></a>
1. Load the file in iris.sample_data_path('atlantic_profiles.nc'), using iris.load_cube to load in the sea_water_potential_temperature cube only.
End of explanation
# space for user code ...
# SAMPLE SOLUTION
# %load solutions/iris_exercise_2.3b
Explanation: 2. Go to the Iris reference documentation for iris.save. What keywords are accepted to iris.save when saving a PP file?
End of explanation
<END_TASK>