Created
October 16, 2019 06:16
-
-
Save scbrown86/c6a1b6924464a5913ed10da31b95ac77 to your computer and use it in GitHub Desktop.
Ensemble average of CMIP5 files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd /mnt/c/Users/Stu/Desktop/CMIP5/ | |
#CCSM4 | |
cd CCSM4 | |
cdo -ensmean tas_Amon_CCSM4_rcp26_r* CCSM4_rcp26_ensAvg.nc #6 seconds | |
#CSIRO | |
cd ../CSIRO-Mk3.6.0/ | |
cdo -ensmean tas_Amon_CSIRO-Mk3-6-0_rcp26_r* CSIRO-Mk3-6-0_rcp26_ensAvg.nc #2.5 seconds | |
#MIROC5 | |
cd ../MIROC5/ | |
cdo -ensmean tas_Amon_MIROC5_rcp26_r* MIROC5_rcp26_ensAvg.nc #2.5 seconds | |
# my bash skills aren't great so I physically moved the output files to a new folder names ensAvg! | |
cd ../ensAvg | |
# There are suitable predefined grids (https://code.mpimet.mpg.de/projects/cdo/embedded/cdo.pdf - pg11) | |
# or here https://code.mpimet.mpg.de/projects/cdo/embedded/index.html#x1-150001.3.2 | |
# remap files. Each file ~2 seconds to regrid | |
cdo remapbil,global_1 CCSM4_rcp26_ensAvg.nc remap_CCSM4.nc | |
cdo remapbil,global_1 CSIRO-Mk3-6-0_rcp26_ensAvg.nc remap_CSIRO.nc | |
cdo remapbil,global_1 MIROC5_rcp26_ensAvg.nc remap_MIROC.nc | |
# Ensemble average of the regridded datasets | |
cdo -ensmean remap_* ensAvg_rcp26_1deg.nc #4 sec | |
# Calculate yearly mean | |
cdo -yearmean ensAvg_rcp26_1deg.nc ensAvg_rcp26_1deg_Annual.nc #1 sec | |
ncdump -h ensAvg_rcp26_1deg_Annual.nc | |
# Linear trend through each cell (I would recommend doing this in R or Python) | |
cdo trend ensAvg_rcp26_1deg_Annual.nc intercept.nc slope.nc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment