SciTools/iris — pull request #503 by esc24 (2013-05-14 15:00:55+00:00)
Title: New pp save rule to handle missing forecast period

I've have a cube loaded from a netcdf file. The cube is is a time mean and has a scalar time coordinate with bounds. The cube also has a forecast_reference_time but does not have a forecast period. When saved to PP and then loaded again the time coordinate is corrupted and the forecast_reference_time is lost.

This PR adds a new PP save rule to handle the case of a missing forecast period. It reconstructs the forecast period from the upper time bound and the forecast_reference_time and assigns it to lbft.

I have not added a test yet as I am unsure how these rules are currently tested. Could someone please point me in the right direction? I'd welcome a PR :wink:

PS. I'd also welcome a better way to calculate the forecast period in hours (my current approach is far from ideal, but it seems I cannot subtract two netcdftime datetime objects).