SciTools/iris — pull request #866 by rhattersley (2013-11-29 16:41:07+00:00)
Title: Default LBUSER(2) to -99 when saving to PP

The F3 documentation for LBUSER(2) states:
>LBUSER(2) NADDR
> - Start address in DATA. Not to be confused with disk address - Word 29.
> - Relative to start of DATA, i.e. First field NADDR=1
> - For fieldsfiles relative to start of Fixed Length Header
> - Set to -99 if LBEGIN not known

which cross references:
> LBEGIN Disk address/Start Record
> - Files with well-formed records : Disk address (Word Number) relative to start of file. From vn 4.3
> - Boundary datasets with well-formed records : (Pre vn 5.0) Only the start of the data for each validity time is aligned with the start of a sector. All the data for the same validity time is contiguous. For example, in a file with 5 variables for each validity time, only the disk addresses for fields 1, 6, 11, 16 etc. are aligned with a sector boundary. (vn5.2-) All data fields are aligned with a sector boundary.
> - Fieldsfile direct access data sets : Start record
> - For all other files including those not set up with well-formed records : set to zero

For a PP file the concept of LBUSER(2) as an offset into the contiguous data array held internally by the UM (and dumped straight into a FieldsFile) no longer applies. There is no contiguous data area.

All of which suggests we should be setting LBUSER(2) to -99 ... as done in this PR. :smile:

NB. LBUSER(2) is actually `field.lbuser[1]` in the code thanks to Fortran vs. C indexing.