[英]How to calculate daily evapotranspiration by hargreaves-samani equation and using python?
I have a ten-year weather data including maximum temperature ( Tmax
), minimum temperature ( Tmin
), rainfall and solar radiation ( Ra
) for each day.我有一个十年的天气数据,包括每天的最高温度 ( Tmax
)、最低温度 ( Tmin
)、降雨量和太阳辐射 ( Ra
)。
At first, I would like to calculate evapotranspiration (ETo) for each day using the following equation:首先,我想使用以下公式计算每天的蒸散量 (ETo):
ETo=0.0023*(((Tmax+Tmin)/2)+17.8)*sqrt(Tmax-Tmin)*Ra
Then, calculation of the monthly and yearly average of all parameters (Tmax,Tmin, Rainfall, Ra and ETo)
and print them in Excel format.然后,计算所有参数(Tmax,Tmin, Rainfall, Ra and ETo)
的月和年平均值并以 Excel 格式打印。
I have written some parts.我已经写了一些部分。 could you possibly help me with completing it?你能帮我完成它吗? I think it may need a loop .我认为它可能需要一个循环。
import numpy as np
import pandas as pd
import math as mh
# load the weather data file
data_file = pd.read_excel(r'weather data.xlsx', sheet_name='city_1')
# defining time
year = data_file['Year']
month = data_file['month']
day = data_file['day']
# defining weather parameters
Tmax = data_file.loc[:,'Tmax']
Tmin = data_file.loc[:,'Tmin']
Rainfall = data_file.loc[:,'Rainfall']
Ra = data_file.loc[:,'Ra']
# adjusting time to start at zero
year = year-year[0]
month=month-month[0]
day=day-day[0]
#calculation process for estimation of evapotranspiration
ET0=(0.0023*(((Tmax+Tmin)/2)+17.8)*(mh.sqrt(Tmax-Tmin))*Ra
Looks like you've got one data row (record) per day.看起来您每天有一个数据行(记录)。
Since you already have Tmax, Tmin, Rainfall, and Sunhours in the row, you could add a net ET0 row with the calculation like this:由于您在行中已经有 Tmax、Tmin、Rainfall 和 Sunhours,您可以使用如下计算添加一个净 ET0 行:
data_file['ET0'] = data_file.apply(lambda x: 0.0023*(((x.Tmax+x.Tmin)/2)+17.8)*(mh.sqrt(x.Tmax-x.Tmin))*x.Ra, axis=0)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.