This project contains Python scripts for calculating and analyzing reference evapotranspiration (ETo) from NetCDF files. The scripts include codes for calculating ETo with and without considering the effect of CO₂ concentration changes, analyzing the relative and percentage changes over time, and generating plots for data visualization.
- I. Setup Instructions
- II. Calculate Daily Net_radiation
- III. Calculate Daily Reference Evapotranspiration
- IV. Calculate Annual Values of Reference Evapotranspiration
- V. Calculate the Relative Change in Reference Evapotranspiration
- VI. Calculate Reference Evapotranspiration for the Four Seasons
- VII. Calculate Percentage Change in Reference Evapotranspiration
- VIII. Plotting the Data
- Install necessary Python packages:
pip install netCDF4 xarray pandas numpy matplotlib
- Download NetCDF files and set up directories as described in each section.
zenith_3652days.py
This script is used to replicate values of elevation for 3652 time steps (10 years). The new values are saved in new NetCDF file named elevation_data_for_3652_days.nc.
- Select the netcdf file with the data for elevation for one time step (The code assumes that this file has the data of elevation in the variable name 'elevation').
- Choose where to save the output file with the data of radiation for 3652 days.
calculate_radiation.py
This script calculates daily radiation input NetCDF files. The calculated values are saved in new NetCDF files.
- Select the required input files.
- Choose where to save the output daily radiation files.
calculate_Eto.py
This script calculates daily ETo using input NetCDF files. The calculated values are saved in new NetCDF files.
- Create a directory to save the output files, e.g.,
daily_ETo
. - Select the directory containing input climate data in NetCDF format.
- Choose where to save the output daily ETo files.
Calculates the annual average of daily ETo over a selected region and saves the results as an Excel file.
- Create a directory to save the Excel file, e.g.,
annual_avg
. - Select the folder containing NetCDF files with daily ETo data.
- Specify where to save the Excel file with the annual averages.
Calculates the total annual ETo for each NetCDF file, storing results in an Excel sheet.
- Create a directory to save the output, e.g.,
annual_sum
. - Select the folder with daily ETo NetCDF files.
- Specify where to save the Excel files.
Calculates the relative change in ETo due to CO₂ concentration changes, saving output as NetCDF files for 2021-2030 and 2091-2100.
- Create a directory to save the output NetCDF files, e.g.,
daily_relative_change_in_ETo
. - Select the ETo NetCDF files:
- With and without CO₂ effect for 2021-2030
- With and without CO₂ effect for 2091-2100
Calculates the spatiotemporal average of the relative change in ETo across all 5 GCMs for 2021-2030 and 2091-2100. Results are printed on the terminal.
- Create a directory to save the Excel output, e.g.,
spatiotemporal_avg
. - Select the NetCDF files for each GCM for the specified years.
Calculates the annual average of the relative change in ETo and saves it as an Excel sheet.
- Select the folder containing NetCDF files with relative change data.
seasonal_avg.py
This code calculates seasonal ETo averages for each GCM for specified years, saving data as NetCDF and Excel files, and generating plots.
- Create a directory, e.g.,
seasonal_ETo
, with subdirectories:seasonal_netcdf_files
seasonal_plots
seasonal_spatiotemporal_avg
- Select the appropriate NetCDF files (with and without CO₂ effect) for:
- 2021-2030
- 2091-2100
- Provide the shapefile of India in .shp format for visualization.
Calculates the percentage change in ETo due to CO₂ effect.
- Select NetCDF files with ETo data for 2021-2030 and 2091-2100 (both with and without CO₂ effect).
- Specify where to save the NetCDF output with percentage change data.
Calculates:
- Spatiotemporal mean of percentage change
- Maximum and minimum values over ten years
- Select files with percentage change data for specified years across GCMs.
- Specify where to save the Excel output.
Generates subplots showing ETo with and without CO₂ effect for 2021-2030 and 2091-2100.
- Select NetCDF files for each ETo scenario for the chosen GCM.
- Provide the shapefile of India and specify output directory for the plot.
Creates a plot showing the temporal mean of relative change in ETo for a single GCM over ten years.
- Select NetCDF files with relative change data for 2021-2030 and 2091-2100.
- Provide the shapefile of India and specify the output directory.
Plots the mean of relative change in ETo across all five GCMs.
- Select NetCDF files for each GCM and period.
- Provide the shapefile of India and specify the output directory.