smrf.distribute.wind.wind.
Wind
Bases: smrf.distribute.image_data.image_data
smrf.distribute.image_data.image_data
The wind class allows for variable specific distributions that go beyond the base class.
wind
Three distribution methods are available for the Wind class:
Winstral and Marks 2002 method for maximum upwind slope (maxus)
Import WindNinja simulations
Standard interpolation
self.config – The full SMRF configuration file
config
configuration from [wind] section
wind_speed
numpy matrix of the wind speed
wind_direction
numpy matrix of the wind direction
veg_type
numpy array for the veg type, from smrf.data.loadTopo.Topo.veg_type
smrf.data.loadTopo.Topo.veg_type
_maxus_file
the location of the maxus NetCDF file
maxus
the loaded library values from _maxus_file
maxus_direction
the directions associated with the maxus values
min
minimum value of wind is 0.447
max
maximum value of wind is 35
stations
stations to be used in alphabetical order
VARIABLE
distribute
Distribute given a Panda’s dataframe for a single time step. Calls smrf.distribute.image_data.image_data._distribute for the wind_model chosen.
smrf.distribute.image_data.image_data._distribute
data_speed – Pandas dataframe for single time step from wind_speed
data_direction – Pandas dataframe for single time step from wind_direction
t – time stamp
distribute_thread
Distribute the data using threading and queue. All data is provided and distribute_thread will go through each time step and call smrf.distribute.wind.wind.distribute then puts the distributed data into the queue for wind_speed.
smrf.distribute.wind.wind.distribute
queue – queue dictionary for all variables
data – pandas dataframe for all data, indexed by date time
initialize
Initialize the distribution, calls smrf.distribute.image_data.image_data._initialize. Checks for the enhancement factors for the stations and vegetation.
smrf.distribute.image_data.image_data._initialize
topo – smrf.data.loadTopo.Topo instance contain topographic data and infomation
smrf.data.loadTopo.Topo
data – data Pandas dataframe containing the station data, from smrf.data.loadData or smrf.data.loadGrid
smrf.data.loadData
smrf.data.loadGrid
output_variables
post_process_variables
smrf.distribute.wind.wind_ninja.
WindNinjaModel
The WindNinjaModel loads data from a WindNinja simulation. The WindNinja is ran externally to SMRF and the configuration points to the location of the output ascii files. SMRF takes the files and interpolates to the model domain.
DATE_FORMAT
WN_DATE_FORMAT
convert_wind_ninja
Convert the WindNinja ascii grids back to the SMRF grids and into the SMRF data streamself.
t – datetime of timestep
wind speed numpy array wd: wind direction numpy array
ws
Distribute the wind for the model
{DataFrame} -- wind speed data frame (data_speed) –
{DataFrame} -- wind direction data frame (data_direction) –
fill_data
Fill the WindNinja array that has NaN’s. This makes an assumption that all the NaN values are along the left and bottom edge. This will be the case in the Northern hemisphere. First fill the Y direction with 1d interpolation exprapolated to the edges, then do the same in the X direction. At the end, it will check to ensure that there are no NaN values left.
{np.array} -- numpy array to fill (g_vel) –
ValueError – If there are still NaN values after filling
np.array – filled numpy array
Initialize the model with data
{topo class} -- Topo class (topo) –
{None} -- Not used but needs to be there (data) –
initialize_interp
Initialize the interpolation weights
{datetime} -- initialize with this file (t) –
wind_ninja_path
Generate the path to the wind ninja data and ensure it exists.
{str} -- type of file to get (file_type) –
interpx
Interpolate in on direction
{array} -- y data to fit (yi) –
{array} -- x data to fit (xi) –
{array} -- x data to interpolate over (x) –
array – y values evaluated at x
smrf.distribute.wind.winstral.
WinstralWindModel
Estimating wind speed and direction is complex terrain can be difficult due to the interaction of the local topography with the wind. The methods described here follow the work developed by Winstral and Marks (2002) and Winstral et al. (2009) [19] [20] which parameterizes the terrain based on the upwind direction. The underlying method calulates the maximum upwind slope (maxus) within a search distance to determine if a cell is sheltered or exposed. See smrf.utils.wind.model for a more in depth description. A maxus file (library) is used to load the upwind direction and maxus values over the dem. The following steps are performed when estimating the wind speed:
smrf.utils.wind.model
Adjust measured wind speeds at the stations and determine the wind direction componenets
Distribute the flat wind speed
Distribute the wind direction components
Simulate the wind speeds based on the distribute flat wind, wind direction, and maxus values
After the maxus is calculated for multiple wind directions over the entire DEM, the measured wind speed and direction can be distirbuted. The first step is to adjust the measured wind speeds to estimate the wind speed if the site were on a flat surface. The adjustment uses the maxus value at the station location and an enhancement factor for the site based on the sheltering of that site to wind. A special consideration is performed when the station is on a peak, as artificially high wind speeds can be calcualted. Therefore, if the station is on a peak, the minimum maxus value is choosen for all wind directions. The wind direction is also broken up into the u,v componenets.
Next the flat wind speed, u wind direction component, and v wind direction compoenent are distributed using the underlying distribution methods. With the distributed flat wind speed and wind direction, the simulated wind speeds can be estimated. The distributed wind direction is binned into the upwind directions in the maxus library. This determines which maxus value to use for each pixel in the DEM. Each cell’s maxus value is further enhanced for vegetation, with larger, more dense vegetation increasing the maxus value (more sheltering) and bare ground not enhancing the maxus value (exposed). With the adjusted maxus values, wind speed is estimated using the relationships in Winstral and Marks (2002) and Winstral et al. (2009) [19] [20] based on the distributed flat wind speed and each cell’s maxus value.
Follows the following steps for station measurements:
direction componenets
direction, and maxus values
{data object} -- SMRF data object (data) –
simulateWind
Calculate the simulated wind speed at each cell from flatwind and the distributed directions. Each cell’s maxus value is pulled from the maxus library based on the distributed wind direction. The cell’s maxus is further adjusted based on the vegetation type and the factors provided in the [wind] section of the configuration file.
data_speed – Pandas dataframe for a single time step of wind speed to make the pixel locations same as the measured values
stationMaxus
Determine the maxus value at the station given the wind direction. Can specify the enhancemet for each station or use the default, along with whether or not the station is on a peak which will ensure that the station cannot be sheltered. The station enhancement and peak stations are specified in the [wind] section of the configuration file. Calculates the following for each station:
flatwind
u_direction
v_direction
data_speed – wind_speed data frame for single time step
data_direction – wind_direction data frame for single time step