The BADVAL START and END fields will specify which Level 1 and Level 2 dimensions a given BADVAL record will apply to. Again, there can be no overlap of the ranges specified by multiple BADVAL records; i.e., there can only be one bad-data flag per data value.
In the previous example, we changed the number of station identifiers in each record, depending on which stations had data available. Another option would be to make a single Level 1 definition for the array of station identifiers, giving it a fixed length of three. In this case, we would mark the data from Station 1003 on Day 2 with bad-data flag values. That is, we would set the missing station's temperature to some flag value and set the BADVAL.VALUE field to that same flag value. The START and END fields have two elements each (one for the Level 1 dimension and one for the Level 2 dimension); to make this BADVAL record apply over the entire dataset, both START elements would be 0, and both END elements would be -1. This is the most straightforward and common use of the BADVAL record type. The relevant record fields will be as follows (indices start at 0):
As another example, consider the case of the vector winds described above in Example 2 in Section 3.2.2. In this case, a different bad-data flag may be needed for each data component. The elements of the START and END array will correspond to the longitude, latitude, pressure, and day-of-year dimensions. The relevant record fields will be the same as in that example, with the addition of the BADVAL record type as follows (indices start at 0):
The IDL code for writing such a record might look something like this:
; set up the BADVAL record RECTYPE = long(40) ; This is the first BADVAL record RECSORT = long(1) ; This BADVAL record is valid over the entire range of ; Levels 1-3 dimensions START = long( [ 0, 0, 0, 0 ] ) ENDIT = long( [ -1, -1, -1, -1 ]) ; Remember, VALUE must have as many components as the data VALUE = float( [ -9999.0, -9999.0, -999.0 ] )
writeu,log_file_unit, RECTYPE,RECSORT, reserved $ , reserved, START, ENDIT, VALUE
Now consider the possibility that after, say, nine days the bad-data flag is changed, so that each pressure altitude has its own bad-data flag value. This situation would need seven BADVAL records: the first would contain the single bad data value that applies to all of the pressure altitudes for the first nine days. Then a second BADVAL record would contain the flag that applies to the first pressure altitude for the rest of the days. The third through seventh records would give the flags that apply to the other pressure levels after the ninth day.
The relevant record fields would now be as follows (indices start at 0):