**[DiurnalFromMOS v2.4]{.underline}**

Ken Pomeroy, WFO Cheyenne

November 17, 2005 (Updated October 17, 2006)

**Introduction**

DiurnalFromMOS is a tool that will create hourly temperature grids based
on the latest model data. Simply highlight the T grids you wish to
change and run DiurnalFromMOS. The tool uses the most recent MOS
bulletin of your choice (MET, MAV, or FWC).

**Usage**

This tool complements the DiurnalFromObs and DiurnalFromClimo tools that
are appropriate when a forecast of persistence or climatology is
desired. It is ideal during frontal passage situations in capturing the
proper diurnal trends across your CWA (provided these trends are found
in the MOS type you choose). But it can be applied in other
non-climatological situations, also.

**Installation**

The smart tool essentially stands alone. The only special thing that
needs to be done is to have a location in AWIPS where MOS bulletins are
stored. If you are already running something from Tim Barker's
MatchGuidanceAll/MatchMosAll family of tools, then you have set up
something like this. In the case where you have not done this, refer to
the MatchGuidanceAll documentation for a thorough set of instructions on
how to accomplish this task.

The following variables need to be configured:

1)  The directory on your system where guidance is stored

2)  The latitude and longitude for each MOS site you use.

3)  A variable called "StretchFactor" which controls how closely extreme
    hourly temperatures approach the forecast high or low temperature.
    (See Task 4 in the Technical Description section. The default value
    in the tool should be satisfactory.)

If you are running MatchGuidanceAll, you can copy and edit some of the
configuration data from that tool. It is recommended that you include
some MOS sites outside your CWA, but still within your GFE domain, to
accurately capture cases of frontal passage or other diurnal anomalies.

**Running the tool**

Highlight the T grids to be changed and select the smart tool. One can
then select the MOS bulletin to apply to the T grids.

Hourly data is computed for the first 48 hours of MOS data beginning at
either 00Z or 12Z. However, you can still use the tool beyond this
48-hour window by clicking the appropriate selection on the right half
of the menu.

![](media/image1.jpeg){width="3.1756944444444444in"
height="1.2152777777777777in"}

The tool takes the values of three-hourly temperatures in the MOS
bulletin, and scales them based on the high and low temperatures in your
forecast grids. It then computes the hourly temperatures. It does not
apply a linear interpolation between the three-hour values -- it tries
to compute a best fit curve while maintaining the integrity of the three
hourly values. A comparison of the two schemes is provided using the
example guidance below.

![](media/image2.jpeg){width="5.6875in" height="0.8541666666666666in"}

­

In the next graph, notice the difference between the linearly
interpolated values (blue) and the best-fit curve (red) based on the
highlighted portion of the guidance. The temperatures computed for 19Z
and 20Z are higher than the MOS temps for both 18Z and 21Z, which makes
more sense in this case.

![](media/image3.jpeg){width="3.5479166666666666in" height="2.8375in"}

During non-climatological and non-persistence forecast situations, the
tool can be useful to provide a first guess of hourly temperature. The
following image sequence illustrates what the tool can do during a
situation of cold frontal passage during the day. Notice the cooling
occurring in the north while warming occurs in the south between 12Z and
16Z. Eventually cooling spreads southward to cover the entire CWA.

![](media/image4.jpeg){width="2.7979166666666666in"
height="1.8069444444444445in"}![](media/image5.jpeg){width="2.6770833333333335in"
height="1.7819444444444446in"}

![](media/image6.jpeg){width="2.8in"
height="1.84375in"}![](media/image7.jpeg){width="2.745138888888889in"
height="1.8097222222222222in"}

Of course, the application of this tool is not limited to strong frontal
passage. Any distribution of hourly temperatures can be handled by
DiurnalFromMOS.

**Limitations**

\- The tool can be applied for any period, however only a MOS diurnal
curve for the first 48 hours can be computed. So applying this curve
beyond 48 hours should be done with caution. The tool will do the best
it can to adapt the diurnal curve beyond the initial 48 hour period, but
in cases of large changes in high or low temperatures from one day to
the next, the results may be less than satisfactory.

\- Using FWC guidance for the 36-48 hour period may be problematic in
cases where unusual diurnal trends are forecast. The reason for this is
the FWC guidance only goes out 48 hours, while the others go out 60
hours. For the MAV and MET, the tool uses information from the 48-60
period to properly compute hourly values in the 36-48 hour period, but
this information is not available for the FWC.

\- In areas of complex terrain, this tool will not be able to forecast
hourly trends that are terrain induced. With only a handful of MOS
points that provide three-hourly temperatures, there is no way to handle
this.

\- During any cases of large changes in highs (or lows) from one day to
the next, the tool may produce hourly temps that are outside the bounds
of the high or low. Typically, deviations are by no more than one
degree. Internal consistency checks are used to ensure that the computed
T grids are within the bounds of the appropriate MinT and MaxT grids.

**Technical Description**

For those interested in the "guts" of this smart tool (are you crazy?),
this section is for you.

While extrapolating hourly temperature data to forecast max and min
temperatures seems like a straightforward task, there are instances
where it is not so easy. This section attempts to explain the logic
behind the DiurnalFromMOS smart tool.

There are four tasks the tool accomplishes.

Task 1: Compute hourly temperatures for MOS.

Task 2: Determine the first extreme for MOS.

Task 3: Compute "f-values" for each hour.

Task 4: Spread the values towards the forecast extremes.

A detailed explanation of each task follows.

**Task 1: Compute hourly temperatures for MOS**

The first obstacle is that MOS bulletins only provide temperatures every
three hours. So it is necessary to create a method to compute hourly
temperatures. To explain this, let's use a simple example where
temperatures are close to climatology. First and foremost, there are
better tools to be used for this scenario (DiurnalFromClimo,
DiurnalFromObs). But the tool does work in this case, and it is the
simplest case to explain, so I'll start here. This example uses the
following MOS.

![](media/image8.png){width="5.666666666666667in"
height="0.8333333333333334in"}

Example 1

A poor man's spline curve was developed to calculate hourly temperatures
while preserving the three-hourly temps given by MOS. The following
table shows the result of this function for the example data for 15/09Z
to 16/03Z above, with a comparison to what a linear interpolation would
yield.

+-----------+------------------+-------------------+-------------------+
| Time      | MOS Temperature  | Computed Spline   | Linear            |
|           |                  | Temp              | Interpolated Temp |
| \(Z\)     |                  |                   |                   |
+-----------+------------------+-------------------+-------------------+
| 09        | 64               | 64.0              | 64.0              |
+-----------+------------------+-------------------+-------------------+
| 10        |                  | 63.7              | 63.7              |
+-----------+------------------+-------------------+-------------------+
| 11        |                  | 63.3              | 63.3              |
+-----------+------------------+-------------------+-------------------+
| 12        | 63               | 63.0              | 63.0              |
+-----------+------------------+-------------------+-------------------+
| 13        |                  | 65.9              | 66.7              |
+-----------+------------------+-------------------+-------------------+
| 14        |                  | 70.2              | 70.3              |
+-----------+------------------+-------------------+-------------------+
| 15        | 74               | 74.0              | 74.0              |
+-----------+------------------+-------------------+-------------------+
| 16        |                  | 76.8              | 76.3              |
+-----------+------------------+-------------------+-------------------+
| 17        |                  | 79.2              | 78.7              |
+-----------+------------------+-------------------+-------------------+
| 18        | 81               | 81.0              | 81.0              |
+-----------+------------------+-------------------+-------------------+
| 19        |                  | 82.2              | 81.7              |
+-----------+------------------+-------------------+-------------------+
| 20        |                  | 82.9              | 82.3              |
+-----------+------------------+-------------------+-------------------+
| 21        | 83               | 83.0              | 83.0              |
+-----------+------------------+-------------------+-------------------+
| 22        |                  | 82.6              | 82.0              |
+-----------+------------------+-------------------+-------------------+
| 23        |                  | 81.3              | 81.0              |
+-----------+------------------+-------------------+-------------------+
| 00        | 80               | 80.0              | 80.0              |
+-----------+------------------+-------------------+-------------------+
| 01        |                  | 77.7              | 77.3              |
+-----------+------------------+-------------------+-------------------+
| 02        |                  | 74.8              | 74.7              |
+-----------+------------------+-------------------+-------------------+
| 03        | 72               | 72.0              | 72.0              |
+-----------+------------------+-------------------+-------------------+

This gives what appears to be a realistic set of hourly temperatures,
considering the data that MOS provided us.

**Task 2: Determining the first extreme for MOS.**

Eventually, we need to come up a number that relates the MOS hourly temp
to MOS's high and low temp. While MOS provides us with forecast
extremes, it does not do so for the "pre-first period" of guidance. This
value is necessary for our calculations, so a guess needs to be made as
to what it is.

Using Example 1 from above...

![](media/image8.png){width="5.666666666666667in"
height="0.8333333333333334in"}

MOS does not give us an extreme for the period ending 14/00Z. The smart
tool assumes a value based on the difference between the 00Z temperature
and the corresponding high. In this case, the high assumed is based on a
value calculated from the high temp on the 15^th^ and the 16/00Z temp,
and the high temp on the 16^th^ and the 17/00Z temp.

The value is calculated as follows...

\[(87-80) + (90-85)\]/2 =6

Then we apply that value to solve for the unknown high temp on the
14^th^ using the 15/00Z temp. The result is 83+6=89.

So the guess for the high on the 14^th^ is about 89, which isn't bad
given the 18Z and 21Z temperatures of 88. It isn't imperative that this
guess be very precise.

A similar procedure is followed if the pre-first period extreme is a
low.

**Task 3: Computing f-values for each hour.**

The next step is to compute something like the "f-table" in the
DiurnalFromClimo procedure. Fractional values are computed each hour to
scale the relationship between the forecast hourly temperature and the
forecast high and low temperature. Then the f-values are used to create
T grids using the temperatures in the MaxT and MinT grids.

The difficult part is determining which high and low to use to compute
f-values. For instance, let's take the case of 18Z on the 15^th^ in the
data listed above. This solution is straightforward in this case -- one
can use the current day's forecast high (87) and the morning's forecast
low (61). Using the 18Z forecast temperature of 81, the f-value would be
(81-61)/(87-61) or .769.

The case described above is the easy case, but the intent of this tool
is to work properly in non-climatological situations. So the exceptional
cases drive the formulation in the smart tool. Consider the situation of
strong frontal passage with falling daytime temperatures. Here's some
example data.

![](media/image9.png){width="5.666666666666667in" height="0.84375in"}

Example 2

Now try to compute an f-value for 16/18Z. The result is (48-51)/(51-51)
or undefined. Note that even if there were separation between the high
and low -- say the forecast high was 53 - the f-value would be unusual,
(48-51)/(53-51) or -1.5.

In order to cope with this situation, the concept of a scaled high and
low is used in the smart tool. For each hour in the forecast, a scaled
high and low is created for the purposes of computing f-values.

The "anchor time" for the lows is 12Z. So at 12Z, the scaled low is
equal to that morning's low. As one moves forward in time, the scaled
low becomes a weighted average of the previous morning low and the next
morning low. Originally, this weighting was linear, but it is more
realistic to use a different approach.

The system chosen was a cosine-weighted algorithm. This allows values
closer to the anchor time to be more heavily weighted by the value at
that particular extreme than a linear system would.

Weighting for the most recent anchor value is based on the function
(1+cos\[(hr/24)\*π\])/2, where **hr** is the distance from the most
recent anchor value. Weighting for the nearest future value must be
equal to this value subtracted from 1.

Therefore at 13Z, the scaled low is (0.996)\*previous morning's low +
(.004)\*next morning's low. For each successive hour, more weight is
given to the next morning's low. The same principle applies to the high
temps using an anchor time of 00Z.

For this example at 16/18Z, the scaled low is (.85)\*51 + (.15)\*35 =
48.6. At 00Z, the scaled low would be the average of the previous low
and the next low (in this case it's 43). At 06Z, the scaled low is
(.15)\*51+ (.85)\*35 = 37.4. All f-values in the smart tool are
transferred to the forecast grids in the same manner, using the MinT and
MaxT grids and applying scaling based on the hour of the T grid being
created.

Continuing with this example, the f-value at 16/18Z is
(48-48.6)/(53.1-48.6) = -.133. Note that the scaled high of 53.1 is
used. It is still possible to come up with a small negative f-value with
this system, but in the way it is applied, a small negative f-value will
still translate to a realistic hourly temperature. This value is
computed for all MOS sites and the serp function is used to create a
grid of f-values. The grid of f-values is applied to the forecaster's
hourly T grids based on their MaxT and MinT grids, with the forecast
MaxT and MinT values scaled by time.

The computation of f-values begins with the first occurrence of 00Z or
12Z in the guidance and continues for the next 48 hours.

**Task 4: Spread the values towards the forecast extremes.**

Getting back to Example 1 demonstrating the spline curve, the MOS high
temperature for the day was 87 and the maximum hourly temperature
computed from the spline method was 83. Seldom does the maximum hourly
temperature differ from the high temperature by as much as four degrees
at KCYS. For instance, from May 1 to August 31, 2005, the daily maximum
*never* exceeded the hourly maximum by four degrees (and by three
degrees only four times). Therefore, a formula is used in the smart tool
that compensates for this artifact of MOS. After the f-values are
computed, extreme values are pushed more towards zero or 1.

The formula used is f -- 1.0\*f\*(f^2^-1.5f+.5)

The coefficient of 1.0 can be adjusted by changing the StretchFactor
variable in the configuration section of the tool. **A value of zero
will eliminate this effect.** The following table shows the effect the
default value of 1 has on the f-values.

  ------------------------------------ ----------------------------------
  Original f-value                     Stretched f-value

  0                                    0

  .1                                   .064

  .2                                   .152

  .3                                   .258

  .4                                   .376

  .5                                   .500

  .6                                   .624

  .7                                   .742

  .8                                   .848

  .9                                   .936

  1                                    1
  ------------------------------------ ----------------------------------

This appears to produce more realistic hourly values in relationship to
the forecast high and low. However, other than the cursory study at KCYS
mentioned earlier, no type of verification has been done to determine
the most accurate value.

**Bugs and Comments**

Please submit bugs or any other comments/questions to
<ken.pomeroy@noaa.gov>.