Python3 code for NetCDF files. Analysis of climatology behaviour, precipitation metrics and significance testing.
climatology_prec.py
: Reads the precipitation data from .nc files and calculates the summer climatology for the given time intervals and the two experiments. Produces plots and calculates the significance of the results.land_sea_mask.py
: Contains a function to calculate a land-sea mask matrix from the landfraction data file.metrics_analysis.py
: Calculates the precipitation metrics RX1day, RX5day, R95p, R99p and CDD from .pkl files created inpickle_files_precipitation_mask.py
. Plots them for the two experiments for the given time periods and calculates the significance of the results.pickle_files_precipitation_mask.py
: Creates .pkl files for easier ingestion in other scripts. Each pickle file contains data from one experiment and one ensemble for the entire time period.
Note: The folders given in the scripts have paths with respect to my own directory. Make sure this is changed as needed.
In order to run metrics_analysis.py
, you'll need to run pickle_files_precipitation_mask.py
first.
Libraries needed (make sure the installed version is compatible with Python3):
pip3 install matplotlib
pip3 install numpy
pip3 install netCDF4
pip3 install scipy
pip3 install scikit-learn
pip3 install Cartopy
You should be able to install all the needed dependencies, but if not possible consider creating a virtual environment. Intructions for this are given below:
Create a Python3 virtual environment if you do not have admin permissions (instructions given for Linux).
python3 -m pip install --user virtualenv
python3 -m venv my_virtual_env
source my_virtual_env/bin/activate
The name of the environment will now appear in brackets on the terminal.
deactivate