ssj-delta-cu / ssj-ucd-metric

UCD Metric ET calculations.
Creative Commons Zero v1.0 Universal
1 stars 0 forks source link

Get Weather data for Brentwood and Twitchell for every day and every weather parameter #6

Closed qjhart closed 7 years ago

qjhart commented 7 years ago

We would like to independently compute ETr and ETo from station data. However, some days are missing station data, so we'd also like to validate this data with the Spatial CIMIS output. However, not every input is available via the web interface, so we run this script on the cimis computer. This data is available in a Google Sheet

inputs='Tn@,Tx@,Tm@,Tdew@,U2@,es@,ea@,Rs@,Rso@,Rnl@,ETo@,psychrometric_constant@2km';
name[47]='brentwood';
name[140]='twitchell';
loc[47]='-145702,-8519';
loc[140]='-145276,12361';
for station in 47 140; do 
  echo ${name[$station]};
  csv=${name[$station]}.csv;
  echo "station,date,x,y,,$inputs" > $csv;
  en=${loc[$station]};
  for d in `seq 0 900`; do 
    date=`date --date="2014-01-01 + $d days" --iso`
    r.what fs=',' input=`echo $inputs | sed -e "s/@,/@$date,/g"` east_north=$en | sed -e "s/^/$station,$date,/"
  done >> $csv;
done;

Here are the psuedo-equations used to calculate ETo.

K= Rs/Rso;
Tm=(Tx + Tn) / 2 
ea= 0.6108 * exp(Tdew * 17.27 / (Tdew + 237.3))
es= 0.6108 / 2 * (exp(Tn * 17.27 / (Tn + 237.3)) + exp(Tx * 17.27 / (Tx  + 237.3))) 
Rnl=-(1.35 * K - 0.35) * (0.34 - 0.14 * sqrt(ea)) * 4.9e-09 * (((Tx + 273.16) ^ 4 + (Tn + 273.16) ^ 4) / 2) 
ETo=(900 * psychrometric_constant@2km / (Tm + 273) * U2 * (es - ea) +0.408 * (4098.17 * 0.6108 * exp(Tm * 17.27 / (Tm + 237.3)) / (Tm + 237.3) ^ 2) * (Rs * (1 - 0.23) + Rnl)) / (4098.17 * 0.6108 * exp(Tm * 17.27 / (Tm + 237.3)) / (Tm + 237.3) ^ 2 +  psychrometric_constant@2km * (1 + 0.34 * U2))