Next: , Previous: Full file processing, Up: Setting the timeLoop


5.2.2 Dates Processing

The dates processing mode of timeLoop creates a loop over repeated dates and times. This mode is particularly useful in developing climatologies. For example, if you need to compute the 6-hourly average of a field for June, July and August (JJA) from 1960 to 1990, then the dates processing mode will do the job for you. The implementation of the date processing mode can be somewhat daunting, but is simplified once you realize that each of the date/time components (year, month, day, hour, and fcst) can be described using either start/end values or a list of acceptable values. For example, JJA can be requested either as startMonth=6,endMonth=8 or as listMonth=(/6,7,8/). Clearly the style that you choose will depend on the length and sequence of the list. For the example outlined above, the call to timeLoop would look like this.

     timer => timeLoop('dates',fileType,startYear=1960,endYear=1990, &
      listMonth=(/6,7,8/),startDay=1,endDay=31,startHour=0,endHour=23, &
      incHour=6,listFcst=(/0/))

Note that the end time does not need to be present in the dataset - if it is not, then valid time up to the end time will be treated. To loop over the 12-hourly values of January 2nd to 15th fields from 1980 to 1994, your call would look something like this.

     timer => timeLoop('dates',fileType,startYear=1980,endYear=1993, &
      listMonth=(/1/),startDay=2,endDay=15,listHour=(/0,12/),listFcst=(/0/))

Suppose now that you want to treat the 12-hourly December, January and February (DJF) values for a field from 1980 to 1999. The catch here is that you actually want to use the December 1979 fields in the 1980 start year since you're doing a wintertime climatology. To do this, you must provide a list of input months, with negative values for months from the previous year. The previous December is -12, with the previous November as -11, and so on, as shown in this example.

     timer => timeLoop('dates',fileType,startYear=1980,endYear=1999, &
      listMonth=(/-12,1,2/),startDay=1,endDay=31,listHour=(/0,12/))