How can I determine weibull parameters from data? I have a histogram of wind speed data which is often represented using a weibull distribution. I would like to calculate the weibull shape and scale factors which give the best fit to the histogram.
I need a numerical solution (as opposed to graphic solutions) because the goal is to determine the weibull form programmatically.
Edit:
Samples are collected every 10 minutes, the wind speed is averaged over the 10 minutes. Samples also include the maximum and minimum wind speed recorded during each interval which are ignored at present but I would like to incorporate later. Bin width is 0.5 m/s

 A: Use fitdistrplus:
Need help identifying a distribution by its histogram
Here's an example of how the Weibull Distribution is fit:
library(fitdistrplus)

#Generate fake data
shape <- 1.9
x <- rweibull(n=1000, shape=shape, scale=1)

#Fit x data with fitdist
fit.w <- fitdist(x, "weibull")
summary(fit.w)
plot(fit.w)


Fitting of the distribution ' weibull ' by maximum likelihood 
Parameters : 
       estimate Std. Error
shape 1.8720133 0.04596699
scale 0.9976703 0.01776794
Loglikelihood:  -636.1181   AIC:  1276.236   BIC:  1286.052 
Correlation matrix:
          shape     scale
shape 1.0000000 0.3166085
scale 0.3166085 1.0000000


A: Maximum Likelihood Estimation of Weibull parameters may be a good idea in your case. A form of Weibull distribution looks like this:
$$(\gamma / \theta) (x)^{\gamma-1}\exp(-x^{\gamma}/\theta)$$
Where $\theta, \gamma > 0$ are parameters. Given observations $X_1, \ldots, X_n$, the log-likelihood function is 
$$L(\theta, \gamma)=\displaystyle \sum_{i=1}^{n}\log f(X_i| \theta, \gamma)$$
One "programming based" solution would be optimize this function using constrained optimization. Solving for optimum solution:
$$\frac {\partial \log L} {\partial \gamma} = \frac{n}{\gamma} + \sum_1^n \log x_i - \frac{1}{\theta}\sum_1^nx_i^{\gamma}\log x_i = 0 $$
$$\frac {\partial \log L} {\partial \theta} = -\frac{n}{\theta} + \frac{1}{\theta^2}\sum_1^nx_i^{\gamma}=0$$ 
On eliminating $\theta$ we get:
$$\Bigg[ \frac {\sum_1^n x_i^{\gamma} \log x_i}{\sum_1^n x_i^{\gamma}} - \frac {1}{\gamma}\Bigg]=\frac{1}{n}\sum_1^n \log x_i$$
Now this can be solved for ML estimate $\hat \gamma$. This can be accomplished with the aid of standard iterative procedures which solve are used to find the solution of equation such as -- Newton-Raphson or other numerical procedures.
Now $\theta$ can be found in terms of $\hat \gamma$ as:
$$\hat \theta = \frac {\sum_1^n x_i^{\hat \gamma}}{n}$$
