Here's a comparison of the ETo calculation methods in a table format:
Method | Data Requirements | Accuracy | Complexity | Advantages | Disadvantages |
---|---|---|---|---|---|
FAO Penman-Monteith | Solar radiation, air temperature, humidity, wind speed | High | High | Most accurate, widely accepted standard | Requires comprehensive meteorological data, can be complex |
Hargreaves | Minimum and maximum temperature | Moderate | Low | Simple, requires only temperature data | Less accurate than Penman-Monteith, especially in varying humidity/wind conditions |
Blaney-Criddle | Temperature | Low | Low | Simple, minimal data required | Least accurate, particularly in extreme climates |
Pan Evaporation | Pan evaporation measurements | Moderate (indirect) | Low | Simple, inexpensive to measure directly | Indirect estimation, influenced by factors not related to ET (pan size, environment), not globally applicable |
Key Considerations when choosing a method:
- Data availability: If you only have temperature data, Hargreaves or Blaney-Criddle are your options. If you have access to a weather station or more comprehensive data, Penman-Monteith is preferred.
- Required accuracy: If high accuracy is crucial (e.g., for irrigation scheduling), Penman-Monteith is the best choice. If you need a rough estimate, the simpler methods might suffice.
- Resources: Penman-Monteith requires more computational resources (or the use of a calculator/software). The other methods are easier to calculate manually.
I hope this table format makes the comparison clearer! Let me know if you have any other questions.
import pandas as pd
import numpy as np
def penman_monteith(Rs, Tair, rh, ws, latitude, day_of_year):
"""Calculates ETo using the FAO Penman-Monteith equation."""
# ... (Implementation as provided before)
return ETo
def hargreaves(Tmax, Tmin, Ra):
"""Calculates ETo using the Hargreaves equation."""
Tmean = (Tmax + Tmin) / 2
ETo = 0.0023 * Ra * np.sqrt(Tmean + 17.8) * (Tmean + 2.5)
return ETo
def blaney_criddle(Tmean, latitude):
"""Calculates ETo using the Blaney-Criddle equation (simplified)."""
K = 0.65 # Needs calibration!
ETo = K * (Tmean * (1 - 0.01 * latitude)) / 100
return ETo
def pan_evaporation(Ep, Kp):
"""Calculates ETo using the Pan Evaporation method."""
ETo = Kp * Ep
return ETo
def main():
file_path = input("Enter the path to your Excel file: ")
try:
df = pd.read_excel(file_path)
# Get latitude and day of year (needed for some methods)
latitude = float(input("Enter the latitude of the location: "))
day_of_year = int(input("Enter the day of the year (1-365): "))
Kp = float(input("Enter the pan coefficient (Kp): ")) # For pan evaporation
# Penman-Monteith
Rs = df['Solar Radiation (MJ/m2/day)'].values
Tair = df['Air Temperature (°C)'].values
rh = df['Relative Humidity (%)'].values
ws = df['Wind Speed (m/s)'].values
df['ETo_PM (mm/day)'] = [penman_monteith(Rs[i], Tair[i], rh[i], ws[i], latitude, day_of_year) for i in range(len(df))]
# Hargreaves
Tmax = df['Max Temperature (°C)'].values
Tmin = df['Min Temperature (°C)'].values
Ra_values = []
for day in range(len(df)):
delta_dec = 23.45 * np.sin(np.radians(360 * (284 + day_of_year + day) / 365))
omega_s = np.arccos(-np.tan(np.radians(latitude)) * np.tan(np.radians(delta_dec)))
Ra = (24 * 0.082 / np.pi) * (omega_s * np.sin(np.radians(latitude)) * np.sin(np.radians(delta_dec)) + np.cos(np.radians(latitude)) * np.cos(np.radians(delta_dec)) * np.sin(omega_s))
Ra_values.append(Ra)
df['ETo_Hargreaves (mm/day)'] = [hargreaves(Tmax[i], Tmin[i], Ra_values[i]) for i in range(len(df))]
# Blaney-Criddle
Tmean = df['Mean Temperature (°C)'].values
df['ETo_Blaney_Criddle (mm/day)'] = [blaney_criddle(Tmean[i], latitude) for i in range(len(df))]
# Pan Evaporation
Ep = df['Pan Evaporation (mm)'].values
df['ETo_Pan (mm/day)'] = [pan_evaporation(Ep[i], Kp) for i in range(len(df))]
print(df)
df.to_excel("eto_results.xlsx", index=False)
print("ETo calculations complete. Results saved to eto_results.xlsx")
except FileNotFoundError:
print("File not found. Please check the file path.")
except KeyError as e:
print(f"Incorrect column names. Please ensure your Excel file has the necessary columns for all methods. Error: {e}")
except Exception as e:
print(f"An error occurred: {e}")
if __name__ == "__main__":
main()
Key Changes:
- No Menu: The menu is removed. The code now calculates ETo using all methods and saves the results to the Excel file.
- All Calculations: The code now performs all four ETo calculations (Penman-Monteith, Hargreaves, Blaney-Criddle, and Pan Evaporation) sequentially.
- Output Columns: The results for each method are saved in separate columns in the Excel file (e.g., "ETo_PM (mm/day)", "ETo_Hargreaves (mm/day)", etc.).
- Input: The program takes the file path, latitude, day of the year, and pan coefficient as input at the beginning.
- Error Handling: The
KeyError
handling is more general, as it now checks for columns required by all methods.
How to Use:
-
Install Libraries:
pip install pandas numpy
-
Prepare Excel File: Your Excel file must contain all the columns required by all the methods. This includes:
- 'Solar Radiation (MJ/m2/day)'
- 'Air Temperature (°C)'
- 'Relative Humidity (%)'
- 'Wind Speed (m/s)'
- 'Max Temperature (°C)'
- 'Min Temperature (°C)'
- 'Mean Temperature (°C)'
- 'Pan Evaporation (mm)'
Make sure the column names are exactly as shown above.
-
Run the Code:
python your_script_name.py
-
Provide Inputs: Enter the file path, latitude, day of the year, and pan coefficient.
The code will calculate ETo using all four methods and save the results in separate columns in the eto_results.xlsx
file. This allows you to compare the results obtained from different methods. Remember that the Blaney-Criddle method is simplified, and the Ra calculation (used in Penman-Monteith and Hargreaves) is still an approximation. Calibrate your calculations with local data whenever possible for better accuracy.
No comments:
Post a Comment