Hi Ivan,
Okay so you've got 35 years of data which totals about 400Gb ... that's one big dataset!
Iris doesn't support deferred data saving i.e. so even if you load the full dataset under the guise of deferred loading, when attempting to save the dataset Iris will have to realise the full dataset in memory before saving ... and that's just not going to happen (not yet). We will get around to deferred saving at some point, but I don't know where that fits into the development pipeline.
So my personal approach would be to do the following. It may not be ideal, but it may suffice ... others from the community or other core developers may take a different angle of attack!
I'd take the hit on the chin and load the full dataset (that's the slow part) then pickle the resultant cubes, which we'll be able to reap the benefit from with a speedy load later ...
So something along the lines of the following will load your full dataset (not the data, just the meta-data) then pickle the result ...
import cPickle
import os
import iris
# Go make a cuppa coffee or five, read the paper (cover to cover), and perhaps surf the entire internet ...
cubes = iris.load(path)
# Set the target pickle filename ...
pickle_file = os.path.join(os.path.dirname(path), 'pickle.pkl')
# Save the cubes as a pickle to file ...
with open(pickle_file, 'wb') as fh:
cPickle.dump(cubes, fh, cPickle.HIGHEST_PROTOCOL)
Given that you've pickled your dataset, load it, then perform a constrained extract to get the data sub-set that your interested in for your analysis ...
# Load the pickle in a heart-beat ...
with open('pickle.pkl', 'rb') as fh:
cubes = cPickle.load(fh)
# Now perform the extract ...
cube = cubes.extract('surface_net_downward_shortwave_flux' & iris.Constraint(time=constraint))
If your dataset is static and doesn't change (and I'm assuming here that's the case since it's so massive) then it's safe to pickle. The benefit is that loading the pickle is fast, in the knowledge that you've had a one hit time penalty for the initial load, reading of meta-data and merging into cubes.
Now you can extract to constrain your dataset as required and perform your analysis.
The downside of this approach is that your kinda tied to a specific release version of Iris. Your pickle file may not be valid for future versions of Iris as the code base will change, possibility invalidating your pickle file of your cube dataset.
HTH
-Bill