Wind profile program

How the code works

Determining the wind at a given location is all down to interpolating the data from the MERRA re-analysis: taking the data that is nearest the desired location in the MERRA re-analysis and weighting this data accordingly - depending on how close this data is to our desired position.

The MERRA re-analysis data is stored in daily files. The code loops over the daily files, beginning with the date in the startDate variable and ending with the date in the endDate variable (see `Running wind profile program' for more information on setting these variables). For each day, the steps employed by the code are described in the sections below.

1) Average onto desired latitude and longitude

The two latitudes, which we will call lat1 and lat2, that sandwich the desired and latitude and the two longitudes, which we will call lon1 and lon2, that sandwich the desired latitude are found in the MERRA re-analysis. For a given time and variable, they are four values required from the MERRA re-analysis data: the values at (lon1, lat1), (lon1, lat2), (lon2, lat1) and (lon2, lat). The value of our variable is then given by a simple linear interpolation

  variable(longitude, latitude) = 
      weightLowLon * weightLowLat * variable(lon1, lat1) +
      weightLowLon * (1.0 - weightLowLoat) * variable(lon1, lat2) +
      (1.0 - weightLowLon) * weightLowLat * variable(lon2, lat1) +
      (1.0 - weightLowLon) * (1.0 - weightLowLoat) * variable(lon2, lat2)
where variable is any of the variables extracted from the MERRA data,
  weightLowLon = (lon2 - longitude) / (lon2 - lon1)
and
  weightLowLat = (lat2 - latitude) / (lat2 - lat1).
This is done in the subroutine WindAtPoint in ReadWindData.F90.

The variables which are extracted from the MERRA data are U2M, V2M, U10M, V10M, U50M and V50M, which are the u and v components (or longitude and latitude components) at heights of 2m, 10m and 50m respectively.

2) Converting the u and v components to a speed and angle

It was decided that 0 degrees should refer to a Northerly wind (a wind from the North) and other angles would be measured in a clockwise direction from this, so an Easterly is 90 degrees, Southerly is 180 degrees and Westerly is 270 degrees. At each height, the speed is given by

  speed = √(u * u + v * v) 
and the angle is given by
         { tan-1(u / v)                    if v < 0
 angle = { 180 + tan-1(u / v)              if v > 0
         { 90                              if v ≈ 0 and u < 0
         { 270                             if v ≈ 0 and u > 0
and the angle is moved into the range 0 to 360 if it is negative, where u is either u at 2m, 10m or 50m and similarly for v.

These calculations are done in subroutine WindSpeed in ReadWindData.F90.

3) Average the angle

The angle is not expected to vary much between 2m and 50m, but a linear interpolation is carried out anyway,

  angle(height) = weightHeight2m * angle(2m) +
                  weightHeight10m * angle(10m) +
                  weightHeight50m * angle(50m) +
where if height < 10m
  weightHeight2m  = (10.0 - height) / (10.0 - 2.0)
  weightHeight10m = (height - 2.0)  / (10.0 - 2.0)
  weigthHeight50m = 0.0
and if height ≥ 10m
  weightHeight2m  = 0.0
  weightHeight10m = (50.0 - height) / (50.0 - 10.0)
  weightHeight50m = (height - 10.0) / (50.0 - 10.0)

In the special case that the desired height is one of the heights we have, the weight at this height will be 1.0 and other weights will be 0.0. So Effectively, the only angle used is the angle at the desired height.

The weights, weightHeight2m, weightHeight10m and weightHeight50m are calculated in the subroutine GetAngleWeights in ReadWindData.F90, while the calculation is done in the function VarAtHeight in the same file.

4) Average the speed onto desired height

There are two options to averaging the speed onto the desired height. If lLogSpeed is set to FALSE, a linear interpolation using the speed at nearest heights is used (see `Running wind profile program' for more information on setting lLogSpeed). The same equations are used as for the angle, as described in the subsection above.

However, it is expected that the wind speed will fit a logarithmic profile, and so there's an option of setting lLogSpeed to TRUE - when the log equation will be fitted to the speeds we have at the three different heights. This is possible for nearly all speed profiles. Problems seems to occur when the speed at two heights are very similar while the third speed is very different, which makes fitting a log equation very difficult. In these cases a warning is displayed by the code and the alternative averaging described above is used. Between almost the start of 1979 and the almost the end of 2011, there were 13 profiles at a location in Reading where a log equation could not be used with this program. More information on this can be found on the logarithmic wind profile web page, which describes the theory for doing this and how it is done.

These calculations are done in the subroutine SpeedAtHeight in ReadWindData.F90.

If the desired height is 2m, 10m or 50m it is better to set lLogSpeed to FALSE, because the calculation is much simpler and the result will be same, namely the value of the speed that we already have at this height.

Things to do now

Contact

Page navigation