├── README.md ├── WRF4.0.1_Install.bash ├── WRF4.0.3_Install.bash ├── WRF4.0_Install.bash ├── WRF4.1.2_Install.bash ├── WRF4.1.3_Install.bash ├── WRF4.1.5_Install.bash ├── WRF4.1_Install.bash ├── WRF4.2.2_Install.bash ├── WRF4.3.1_Install.bash ├── WRF4.3.3_Install.bash ├── WRF4.3_Install.bash ├── WRF4.4.1_Install.bash ├── WRF4.4.2_Install.bash ├── WRF4.4_Install.bash ├── WRF4.5.1_Install.bash ├── WRF4.5.2_Install.bash ├── WRF4.5_Install.bash ├── WRF4.6.0_Install.bash └── WRF4.6.1_Install.bash /README.md: -------------------------------------------------------------------------------- 1 | # WRF-Install-Script 2 | 3 | 4 | WRF Install scripts will install the WRF and WPS with the needed libraries(netcdf4 hdf5, mpich, zlib, libpng, jasper). You can choose the version that you want to install. These scripts are written for Debian and Ubuntu based Linux operating systems, such as Ubuntu, Debian, Linux Mint, Pardus, etc. 5 | 6 | Since WRF-Install-Script uses operating system libraries, it installs much faster than manually installing the libraries and then installing the WRF model. 7 | 8 | You can download each version from the [releases](https://github.com/bakamotokatas/WRF-Install-Script/releases). 9 | 10 | Currently only WRF4.6.1_Install.bash, WRF4.6.0_Install.bash, WRF4.5.2_Install.bash, WRF4.5.1_Install.bash, WRF4.5_Install.bash, WRF4.4.2_Install.bash, WRF4.4.1_Install.bash, WRF4.4_Install.bash and WRF4.3.3_Install.bash support Ubuntu 22.04. Therefore if you are using Ubuntu 22.04, please use WRF4.6.1_Install.bash, WRF4.6.0_Install.bash, WRF4.5.2_Install.bash, WRF4.5.1_Install.bash, WRF4.5_Install.bash, WRF4.4.2_Install.bash, WRF4.4.1_Install.bash, WRF4.4_Install.bash and WRF4.3.3_Install.bash, otherwise it will fail to build. All other releases will be updated soon to support Ubuntu 22.04. 11 | 12 | To run the scripts, you should run the commands below. 13 | 14 | For WRF4.6.1 with ARW option(default) 15 | 16 | ``` 17 | bash WRF4.6.1_Install.bash 18 | ``` 19 | or 20 | ``` 21 | bash WRF4.6.1_Install.bash -arw 22 | ``` 23 | 24 | For WRF4.6.1 with Chem option (WRF-Chem) 25 | ``` 26 | bash WRF4.6.1_Install.bash -chem 27 | ``` 28 | 29 | For WRF4.6.1 with Hydro option (WRF-Hydro) 30 | ``` 31 | bash WRF4.6.1_Install.bash -hydro 32 | ``` 33 | 34 | For WRF4.5.2 with ARW option(default) 35 | 36 | ``` 37 | bash WRF4.5.2_Install.bash 38 | ``` 39 | or 40 | ``` 41 | bash WRF4.5.2_Install.bash -arw 42 | ``` 43 | 44 | For WRF4.5.2 with Chem option (WRF-Chem) 45 | ``` 46 | bash WRF4.5.2_Install.bash -chem 47 | ``` 48 | 49 | For WRF4.5.2 with Hydro option (WRF-Hydro) 50 | ``` 51 | bash WRF4.5.2_Install.bash -hydro 52 | ``` 53 | 54 | For WRF4.4.2 with ARW option(default) 55 | 56 | ``` 57 | bash WRF4.4.2_Install.bash 58 | ``` 59 | or 60 | ``` 61 | bash WRF4.4.2_Install.bash -arw 62 | ``` 63 | 64 | For WRF4.4.2 with Chem option (WRF-Chem) 65 | ``` 66 | bash WRF4.4.2_Install.bash -chem 67 | ``` 68 | 69 | For WRF4.4.2 with Hydro option (WRF-Hydro) 70 | ``` 71 | bash WRF4.4.2_Install.bash -hydro 72 | ``` 73 | 74 | For WRF4.3.3 with ARW option(default) 75 | 76 | ``` 77 | bash WRF4.3.3_Install.bash 78 | ``` 79 | or 80 | ``` 81 | bash WRF4.3.3_Install.bash -arw 82 | ``` 83 | 84 | For WRF4.3.3 with Chem option (WRF-Chem) 85 | ``` 86 | bash WRF4.3.3_Install.bash -chem 87 | ``` 88 | For WRF4.3.3 with NMM option 89 | ``` 90 | bash WRF4.3.3_Install.bash -nmm 91 | ``` 92 | 93 | 94 | 95 | For WRF4.2.2 with ARW option(default) 96 | 97 | ``` 98 | bash WRF4.2.2_Install.bash 99 | ``` 100 | or 101 | ``` 102 | bash WRF4.2.2_Install.bash -arw 103 | ``` 104 | 105 | For WRF4.2.2 with Chem option 106 | ``` 107 | bash WRF4.2.2_Install.bash -chem 108 | ``` 109 | For WRF4.2.2 with NMM option 110 | ``` 111 | bash WRF4.2.2_Install.bash -nmm 112 | ``` 113 | Chem and NMM options not available before WRF4.2.2_Install script 114 | 115 | For WRF4.1.5 116 | 117 | ``` 118 | bash WRF4.1.5_Install.bash 119 | ``` 120 | 121 | For WRF4.1.3 122 | 123 | ``` 124 | bash WRF4.1.3_Install.bash 125 | ``` 126 | 127 | For WRF4.1.2 128 | 129 | ``` 130 | bash WRF4.1.2_Install.bash 131 | ``` 132 | 133 | For WRF4.1 134 | 135 | ``` 136 | bash WRF4.1_Install.bash 137 | ``` 138 | 139 | For WRF4.0.3 140 | 141 | ``` 142 | bash WRF4.0.3_Install.bash 143 | ``` 144 | 145 | For WRF4.0.1 146 | 147 | ``` 148 | bash WRF4.0.1_Install.bash 149 | ``` 150 | 151 | 152 | For WRF4.0 153 | 154 | ``` 155 | bash WRF4.0_Install.bash 156 | ``` 157 | 158 | 159 | 160 | You will be asked the write number(No need after 4.0.3 install script), while it is installing the WRF. You should choose the number 34, when it is configuring WRF which will be asked first,and you should choose the number 1, when it is configuring WPS which will be asked second. 161 | -------------------------------------------------------------------------------- /WRF4.0.1_Install.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ######################################################### 3 | # WRF Install Script # 4 | # This Script was written by Umur Dinç # 5 | # To execute this script "bash WRF4.0.1_Install.bash" # 6 | ######################################################### 7 | echo "Welcome! This Script will install the WRF4.0.1" 8 | ######################################################### 9 | # Definitions # 10 | ######################################################### 11 | wget=/usr/bin/wget 12 | ######################################################### 13 | # Controls # 14 | ######################################################### 15 | osbit=$(uname -m) 16 | if [ "$osbit" = "x86_64" ]; then 17 | echo "64 bit operating system is used" 18 | else 19 | echo "Error! This script was written for 64 bit operating systems." 20 | exit 21 | fi 22 | ######## 23 | packagemanagement=$(which apt) 24 | if [ -n "$packagemanagement" ]; then 25 | echo "Operating system uses apt packagemanagement" 26 | else 27 | echo "Error! This script is written for the operating systems which uses apt packagemanagement. Please try this script with debian based operating systems, such as, Ubuntu, Linux Mint, Debian, Pardus etc." 28 | exit 29 | fi 30 | ######################################################### 31 | # Installing neccesary packages # 32 | ######################################################### 33 | yuklumu=$(apt version build-essential) 34 | if [ -n "$yuklumu" ]; then 35 | unset yuklumu 36 | echo "Build Essential has already installed" 37 | else 38 | yukle="build-essential" 39 | fi 40 | yuklumu=$(apt version csh) 41 | if [ -n "$yuklumu" ]; then 42 | unset yuklumu 43 | echo "Csh has already installed" 44 | else 45 | yukle="${yukle} csh" 46 | fi 47 | yuklumu=$(apt version gfortran) 48 | if [ -n "$yuklumu" ]; then 49 | unset yuklumu 50 | echo "gfortran has already installed" 51 | else 52 | yukle="${yukle} gfortran" 53 | fi 54 | yuklumu=$(apt version m4) 55 | if [ -n "$yuklumu" ]; then 56 | unset yuklumu 57 | echo "m4 has already installed" 58 | else 59 | yukle="${yukle} m4" 60 | fi 61 | yuklumu=$(apt version curl) 62 | if [ -n "$yuklumu" ]; then 63 | unset yuklumu 64 | echo "curl has already installed" 65 | else 66 | yukle="${yukle} curl" 67 | fi 68 | yuklumu=$(apt version perl) 69 | if [ -n "$yuklumu" ]; then 70 | unset yuklumu 71 | echo "perl has already installed" 72 | else 73 | yukle="${yukle} perl" 74 | fi 75 | ##### 76 | if [ -z "$yukle" ] ; then 77 | echo "Starting installing libraries" 78 | else 79 | sudo apt-get update 80 | sudo apt-get install -y $yukle 81 | fi 82 | ############################# 83 | cd ~ 84 | mkdir Build_WRF 85 | cd Build_WRF 86 | mkdir LIBRARIES 87 | cd LIBRARIES 88 | echo "" >> ~/.bashrc 89 | echo "#WRF Variables" >> ~/.bashrc 90 | echo "export DIR="$(pwd) >> ~/.bashrc 91 | echo "export CC=gcc" >> ~/.bashrc 92 | echo "export CXX=g++" >> ~/.bashrc 93 | echo "export FC=gfortran" >> ~/.bashrc 94 | echo "export FCFLAGS=-m64" >> ~/.bashrc 95 | echo "export F77=gfortran" >> ~/.bashrc 96 | echo "export FFLAGS=-m64" >> ~/.bashrc 97 | DIR=$(pwd) 98 | export CC=gcc 99 | export CXX=g++ 100 | export FC=gfortran 101 | export FCFLAGS=-m64 102 | export F77=gfortran 103 | export FFLAGS=-m64 104 | ######################################### 105 | # Installing Libraries # 106 | ######################################### 107 | ############################################## 108 | # MPICH Installation # 109 | ############################################ 110 | corerun=$(which mpirun) 111 | if [ -n "$corerun" ]; then 112 | echo "mpirun has already installed" 113 | else 114 | echo "mpirun will be installed" 115 | $wget "http://www.mpich.org/static/downloads/3.2.1/mpich-3.2.1.tar.gz" 116 | tar -zxvf mpich-3.2.1.tar.gz 117 | cd mpich-3.2.1/ 118 | ./configure --prefix=$DIR/mpich 119 | make 120 | make install 121 | echo "export PATH=$DIR/mpich/bin:$PATH" >> ~/.bashrc 122 | export PATH=$DIR/mpich/bin:$PATH 123 | cd .. 124 | fi 125 | ############################################ 126 | # Zlib Installation # 127 | ############################################ 128 | echo "export LDFLAGS=-L$DIR/grib2/lib" >> ~/.bashrc 129 | echo "export CPPFLAGS=-I$DIR/grib2/include" >> ~/.bashrc 130 | export LDFLAGS=-L$DIR/grib2/lib 131 | export CPPFLAGS=-I$DIR/grib2/include 132 | $wget "https://zlib.net/zlib-1.2.11.tar.gz" 133 | tar -zxvf zlib-1.2.11.tar.gz 134 | cd zlib-1.2.11/ 135 | ./configure --prefix=$DIR/grib2 136 | make 137 | make install 138 | cd .. 139 | ########################################## 140 | # Jasper Installation # 141 | ######################################### 142 | $wget "http://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/jasper-1.900.1.tar.gz" 143 | tar -zxvf jasper-1.900.1.tar.gz 144 | cd jasper-1.900.1/ 145 | ./configure --prefix=$DIR/grib2 146 | make 147 | make install 148 | echo "export JASPERLIB=$DIR/grib2/lib" >> ~/.bashrc 149 | echo "export JASPERINC=$DIR/grib2/include" >> ~/.bashrc 150 | export JASPERLIB=$DIR/grib2/lib 151 | export JASPERINC=$DIR/grib2/include 152 | cd .. 153 | ######################################### 154 | # LIBPNG Installation # 155 | ########################################## 156 | $wget "ftp://ftp-osl.osuosl.org/pub/libpng/src/libpng16/libpng-1.6.34.tar.gz" 157 | tar -zxvf libpng-1.6.34.tar.gz 158 | cd libpng-1.6.34/ 159 | ./configure --prefix=$DIR/grib2 160 | make 161 | make install 162 | cd .. 163 | ########################################## 164 | # HDF5 Installation # 165 | ########################################## 166 | $wget "https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.8/hdf5-1.8.20/src/hdf5-1.8.20.tar.gz" 167 | tar -zxvf hdf5-1.8.20.tar.gz 168 | cd hdf5-1.8.20/ 169 | ./configure --with-zlib=$DIR/grib2 --prefix=$DIR/hdf5 --enable-fortran --enable-cxx --enable-fortran2003 170 | make 171 | make install 172 | echo "export PATH=$DIR/hdf5/bin:$PATH" >> ~/.bashrc 173 | echo "export HDF5=$DIR/hdf5" >> ~/.bashrc 174 | export PATH=$DIR/hdf5/bin:$PATH 175 | export HDF5=$DIR/hdf5 176 | sed -i 's#export LDFLAGS.*#export LDFLAGS="-L$DIR/grib2/lib -L$DIR/hdf5/lib"#' ~/.bashrc 177 | sed -i 's#export CPPFLAGS.*#export CPPFLAGS="-I$DIR/grib2/include -I$DIR/hdf5/include"#' ~/.bashrc 178 | export LDFLAGS="-L$DIR/grib2/lib -L$DIR/hdf5/lib" 179 | export CPPFLAGS="-I$DIR/grib2/include -I$DIR/hdf5/include" 180 | cd .. 181 | ######################################### 182 | # NETCDF Installation # 183 | ######################################### 184 | $wget "http://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/netcdf-4.1.3.tar.gz" 185 | tar -zxvf netcdf-4.1.3.tar.gz 186 | cd netcdf-4.1.3/ 187 | ./configure --with-zlib=$DIR/grib2 --with-hdf5=$DIR/hdf5 --prefix=$DIR/netcdf --disable-dap-remote-tests 188 | make 189 | make install 190 | cd .. 191 | echo "export PATH=$DIR/netcdf/bin:$PATH" >> ~/.bashrc 192 | echo "export NETCDF=$DIR/netcdf" >> ~/.bashrc 193 | echo "export LD_LIBRARY_PATH=$DIR/netcdf/lib" >> ~/.bashrc 194 | sed -i 's#export LDFLAGS.*#export LDFLAGS="-L$DIR/grib2/lib -L$DIR/hdf5/lib -L$DIR/netcdf/lib"#' ~/.bashrc 195 | sed -i 's#export CPPFLAGS.*#export CPPFLAGS="-I$DIR/grib2/include -I$DIR/hdf5/include -I$DIR/netcdf/include"#' ~/.bashrc 196 | export PATH=$DIR/netcdf/bin:$PATH 197 | export NETCDF=$DIR/netcdf 198 | export LD_LIBRARY_PATH=$DIR/netcdf/lib 199 | ######################################### 200 | # WRF Installation # 201 | ######################################### 202 | cd .. 203 | $wget "https://github.com/wrf-model/WRF/archive/v4.0.1.tar.gz" 204 | mv v4.0.1.tar.gz WRFV4.0.1.tar.gz 205 | tar -zxvf WRFV4.0.1.tar.gz 206 | cd WRF-4.0.1 207 | ./configure 208 | ./compile em_real 209 | cd .. 210 | ######################################### 211 | # WPS Installation # 212 | ######################################### 213 | $wget "https://github.com/wrf-model/WPS/archive/v4.0.1.tar.gz" 214 | mv v4.0.1.tar.gz WPSV4.0.1.TAR.gz 215 | tar -zxvf WPSV4.0.1.TAR.gz 216 | cd WPS-4.0.1 217 | ./clean 218 | ./configure 219 | ./compile 220 | sed -i "s# geog_data_path.*# geog_data_path = '../WPS_GEOG/'#" namelist.wps 221 | cd .. 222 | ######################################### 223 | # Opening Geog Data Files # 224 | ######################################### 225 | $wget "http://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz" 226 | tar -zxvf geog_high_res_mandatory.tar.gz 227 | ######################################### 228 | # NCL Installation # 229 | ######################################### 230 | #cd $DIR 231 | #mkdir ncl 232 | #cd ncl 233 | #$wget "https://www.earthsystemgrid.org/dataset/ncl.640.dap/file/ncl_ncarg-6.4.0-Debian8.6_64bit_gnu492.tar.gz" 234 | #tar -zxvf ncl_ncarg-6.4.0-Debian8.6_64bit_gnu492.tar.gz 235 | #echo "export NCARG_ROOT=$DIR/ncl" >> ~/.bashrc 236 | #echo "export PATH=$NCARG_ROOT/bin:$PATH" >> ~/.bashrc 237 | #echo "export DISPLAY=:0.0" >> ~/.bashrc 238 | ########################################################## 239 | # Son # 240 | ########################################################## 241 | echo "Installation has completed" 242 | exec bash 243 | exit 244 | -------------------------------------------------------------------------------- /WRF4.0.3_Install.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ######################################################### 3 | # WRF Install Script # 4 | # This Script was written by Umur Dinç # 5 | # To execute this script "bash WRF4.0.3_Install.bash" # 6 | ######################################################### 7 | echo "Welcome! This Script will install the WRF4.0.3" 8 | ######################################################### 9 | # Controls # 10 | ######################################################### 11 | osbit=$(uname -m) 12 | if [ "$osbit" = "x86_64" ]; then 13 | echo "64 bit operating system is used" 14 | else 15 | echo "Error! This script was written for 64 bit operating systems." 16 | exit 17 | fi 18 | ######## 19 | packagemanagement=$(which apt) 20 | if [ -n "$packagemanagement" ]; then 21 | echo "Operating system uses apt packagemanagement" 22 | else 23 | echo "Error! This script is written for the operating systems which uses apt packagemanagement. Please try this script with debian based operating systems, such as, Ubuntu, Linux Mint, Debian, Pardus etc." 24 | exit 25 | fi 26 | ######################################################### 27 | # Installing neccesary packages # 28 | ######################################################### 29 | sudo apt-get update 30 | sudo apt-get install -y build-essential csh gfortran m4 curl perl mpich libhdf5-mpich-dev libpng-dev netcdf-bin libnetcdff-dev 31 | ######################################### 32 | cd ~ 33 | mkdir Build_WRF 34 | cd Build_WRF 35 | mkdir LIBRARIES 36 | cd LIBRARIES 37 | echo "" >> ~/.bashrc 38 | echo "#WRF Variables" >> ~/.bashrc 39 | echo "export DIR="$(pwd) >> ~/.bashrc 40 | echo "export CC=gcc" >> ~/.bashrc 41 | echo "export CXX=g++" >> ~/.bashrc 42 | echo "export FC=gfortran" >> ~/.bashrc 43 | echo "export FCFLAGS=-m64" >> ~/.bashrc 44 | echo "export F77=gfortran" >> ~/.bashrc 45 | echo "export FFLAGS=-m64" >> ~/.bashrc 46 | echo "export NETCDF=/usr" >> ~/.bashrc 47 | echo "export HDF5=/usr/lib/x86_64-linux-gnu/hdf5/serial" >> ~/.bashrc 48 | echo "export LDFLAGS=-L/usr/lib/x86_64-linux-gnu/hdf5/serial" >> ~/.bashrc 49 | echo "export CPPFLAGS=-I/usr/include/hdf5/serial" >> ~/.bashrc 50 | DIR=$(pwd) 51 | export CC=gcc 52 | export CXX=g++ 53 | export FC=gfortran 54 | export FCFLAGS=-m64 55 | export F77=gfortran 56 | export FFLAGS=-m64 57 | export NETCDF=/usr 58 | export HDF5=/usr/lib/x86_64-linux-gnu/hdf5/serial 59 | export LDFLAGS="-L/usr/lib/x86_64-linux-gnu/hdf5/serial/ -L/usr/lib" 60 | export CPPFLAGS="-I/usr/include/hdf5/serial/ -I/usr/include" 61 | ########################################## 62 | # Jasper Installation # 63 | ######################################### 64 | wget http://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/jasper-1.900.1.tar.gz 65 | tar -zxvf jasper-1.900.1.tar.gz 66 | cd jasper-1.900.1/ 67 | ./configure --prefix=$DIR/grib2 68 | make 69 | make install 70 | echo "export JASPERLIB=$DIR/grib2/lib" >> ~/.bashrc 71 | echo "export JASPERINC=$DIR/grib2/include" >> ~/.bashrc 72 | export JASPERLIB=$DIR/grib2/lib 73 | export JASPERINC=$DIR/grib2/include 74 | cd .. 75 | ######################################### 76 | # WRF Installation # 77 | ######################################### 78 | cd .. 79 | wget https://github.com/wrf-model/WRF/archive/v4.0.3.tar.gz 80 | mv v4.0.3.tar.gz WRFV4.0.3.tar.gz 81 | tar -zxvf WRFV4.0.3.tar.gz 82 | cd WRF-4.0.3 83 | sed -i 's# export USENETCDF=$USENETCDF.*# export USENETCDF="-lnetcdf"#' configure 84 | sed -i 's# export USENETCDFF=$USENETCDFF.*# export USENETCDFF="-lnetcdff"#' configure 85 | cd arch 86 | cp Config.pl Config.pl_backup 87 | sed -i '405s/.*/ $response = 34 ;/' Config.pl 88 | sed -i '664s/.*/ $response = 1 ;/' Config.pl 89 | cd .. 90 | ./configure 91 | ./compile em_real 92 | cd arch 93 | cp Config.pl_backup Config.pl 94 | cd .. 95 | cd .. 96 | ######################################### 97 | # WPS Installation # 98 | ######################################### 99 | wget https://github.com/wrf-model/WPS/archive/v4.0.3.tar.gz 100 | mv v4.0.3.tar.gz WPSV4.0.3.TAR.gz 101 | tar -zxvf WPSV4.0.3.TAR.gz 102 | cd WPS-4.0.3 103 | cd arch 104 | cp Config.pl Config.pl_backup 105 | sed -i '141s/.*/ $response = 3 ;/' Config.pl 106 | cd .. 107 | ./clean 108 | sed -i '122s/.*/ NETCDFF="-lnetcdff"/' configure 109 | ./configure 110 | ./compile 111 | sed -i "s# geog_data_path.*# geog_data_path = '../WPS_GEOG/'#" namelist.wps 112 | cd arch 113 | cp Config.pl_backup Config.pl 114 | cd .. 115 | cd .. 116 | ######################################### 117 | # Opening Geog Data Files # 118 | ######################################### 119 | wget http://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz 120 | tar -zxvf geog_high_res_mandatory.tar.gz 121 | ########################################################## 122 | # End # 123 | ########################################################## 124 | echo "Installation has completed" 125 | exec bash 126 | exit 127 | -------------------------------------------------------------------------------- /WRF4.0_Install.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ######################################################### 3 | # WRF Install Script # 4 | # This Script was written by Umur Dinç # 5 | # To execute this script "bash WRF4.0_Install.bash" # 6 | ######################################################### 7 | echo "Welcome! This Script will install the WRF4.0" 8 | ######################################################### 9 | # Definitions # 10 | ######################################################### 11 | wget=/usr/bin/wget 12 | ######################################################### 13 | # Controls # 14 | ######################################################### 15 | osbit=$(uname -m) 16 | if [ "$osbit" = "x86_64" ]; then 17 | echo "64 bit operating system is used" 18 | else 19 | echo "Error! This script was written for 64 bit operating systems." 20 | exit 21 | fi 22 | ######## 23 | packagemanagement=$(which apt) 24 | if [ -n "$packagemanagement" ]; then 25 | echo "Operating system uses apt packagemanagement" 26 | else 27 | echo "Error! This script is written for the operating systems which uses apt packagemanagement. Please try this script with debian based operating systems, such as, Ubuntu, Linux Mint, Debian, Pardus etc." 28 | exit 29 | fi 30 | ######################################################### 31 | # Installing neccesary packages # 32 | ######################################################### 33 | yuklumu=$(apt version build-essential) 34 | if [ -n "$yuklumu" ]; then 35 | unset yuklumu 36 | echo "Build Essential has already installed" 37 | else 38 | yukle="build-essential" 39 | fi 40 | yuklumu=$(apt version csh) 41 | if [ -n "$yuklumu" ]; then 42 | unset yuklumu 43 | echo "Csh has already installed" 44 | else 45 | yukle="${yukle} csh" 46 | fi 47 | yuklumu=$(apt version gfortran) 48 | if [ -n "$yuklumu" ]; then 49 | unset yuklumu 50 | echo "gfortran has already installed" 51 | else 52 | yukle="${yukle} gfortran" 53 | fi 54 | yuklumu=$(apt version m4) 55 | if [ -n "$yuklumu" ]; then 56 | unset yuklumu 57 | echo "m4 has already installed" 58 | else 59 | yukle="${yukle} m4" 60 | fi 61 | yuklumu=$(apt version curl) 62 | if [ -n "$yuklumu" ]; then 63 | unset yuklumu 64 | echo "curl has already installed" 65 | else 66 | yukle="${yukle} curl" 67 | fi 68 | yuklumu=$(apt version perl) 69 | if [ -n "$yuklumu" ]; then 70 | unset yuklumu 71 | echo "perl has already installed" 72 | else 73 | yukle="${yukle} perl" 74 | fi 75 | ##### 76 | if [ -z "$yukle" ] ; then 77 | echo "Starting installing libraries" 78 | else 79 | sudo apt-get update 80 | sudo apt-get install -y $yukle 81 | fi 82 | ############################# 83 | cd ~ 84 | mkdir Build_WRF 85 | cd Build_WRF 86 | mkdir LIBRARIES 87 | cd LIBRARIES 88 | echo "" >> ~/.bashrc 89 | echo "#WRF Variables" >> ~/.bashrc 90 | echo "export DIR="$(pwd) >> ~/.bashrc 91 | echo "export CC=gcc" >> ~/.bashrc 92 | echo "export CXX=g++" >> ~/.bashrc 93 | echo "export FC=gfortran" >> ~/.bashrc 94 | echo "export FCFLAGS=-m64" >> ~/.bashrc 95 | echo "export F77=gfortran" >> ~/.bashrc 96 | echo "export FFLAGS=-m64" >> ~/.bashrc 97 | DIR=$(pwd) 98 | export CC=gcc 99 | export CXX=g++ 100 | export FC=gfortran 101 | export FCFLAGS=-m64 102 | export F77=gfortran 103 | export FFLAGS=-m64 104 | ######################################### 105 | # Installing Libraries # 106 | ######################################### 107 | ############################################## 108 | # MPICH Installation # 109 | ############################################ 110 | corerun=$(which mpirun) 111 | if [ -n "$corerun" ]; then 112 | echo "mpirun has already installed" 113 | else 114 | echo "mpirun will be installed" 115 | $wget "http://www.mpich.org/static/downloads/3.2.1/mpich-3.2.1.tar.gz" 116 | tar -zxvf mpich-3.2.1.tar.gz 117 | cd mpich-3.2.1/ 118 | ./configure --prefix=$DIR/mpich 119 | make 120 | make install 121 | echo "export PATH=$DIR/mpich/bin:$PATH" >> ~/.bashrc 122 | export PATH=$DIR/mpich/bin:$PATH 123 | cd .. 124 | fi 125 | ############################################ 126 | # Zlib Installation # 127 | ############################################ 128 | echo "export LDFLAGS=-L$DIR/grib2/lib" >> ~/.bashrc 129 | echo "export CPPFLAGS=-I$DIR/grib2/include" >> ~/.bashrc 130 | export LDFLAGS=-L$DIR/grib2/lib 131 | export CPPFLAGS=-I$DIR/grib2/include 132 | $wget "https://zlib.net/zlib-1.2.11.tar.gz" 133 | tar -zxvf zlib-1.2.11.tar.gz 134 | cd zlib-1.2.11/ 135 | ./configure --prefix=$DIR/grib2 136 | make 137 | make install 138 | cd .. 139 | ########################################## 140 | # Jasper Installation # 141 | ######################################### 142 | $wget "http://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/jasper-1.900.1.tar.gz" 143 | tar -zxvf jasper-1.900.1.tar.gz 144 | cd jasper-1.900.1/ 145 | ./configure --prefix=$DIR/grib2 146 | make 147 | make install 148 | echo "export JASPERLIB=$DIR/grib2/lib" >> ~/.bashrc 149 | echo "export JASPERINC=$DIR/grib2/include" >> ~/.bashrc 150 | export JASPERLIB=$DIR/grib2/lib 151 | export JASPERINC=$DIR/grib2/include 152 | cd .. 153 | ######################################### 154 | # LIBPNG Installation # 155 | ########################################## 156 | $wget "ftp://ftp-osl.osuosl.org/pub/libpng/src/libpng16/libpng-1.6.34.tar.gz" 157 | tar -zxvf libpng-1.6.34.tar.gz 158 | cd libpng-1.6.34/ 159 | ./configure --prefix=$DIR/grib2 160 | make 161 | make install 162 | cd .. 163 | ########################################## 164 | # HDF5 Installation # 165 | ########################################## 166 | $wget "https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.8/hdf5-1.8.20/src/hdf5-1.8.20.tar.gz" 167 | tar -zxvf hdf5-1.8.20.tar.gz 168 | cd hdf5-1.8.20/ 169 | ./configure --with-zlib=$DIR/grib2 --prefix=$DIR/hdf5 --enable-fortran --enable-cxx --enable-fortran2003 170 | make 171 | make install 172 | echo "export PATH=$DIR/hdf5/bin:$PATH" >> ~/.bashrc 173 | echo "export HDF5=$DIR/hdf5" >> ~/.bashrc 174 | export PATH=$DIR/hdf5/bin:$PATH 175 | export HDF5=$DIR/hdf5 176 | sed -i 's#export LDFLAGS.*#export LDFLAGS="-L$DIR/grib2/lib -L$DIR/hdf5/lib"#' ~/.bashrc 177 | sed -i 's#export CPPFLAGS.*#export CPPFLAGS="-I$DIR/grib2/include -I$DIR/hdf5/include"#' ~/.bashrc 178 | export LDFLAGS="-L$DIR/grib2/lib -L$DIR/hdf5/lib" 179 | export CPPFLAGS="-I$DIR/grib2/include -I$DIR/hdf5/include" 180 | cd .. 181 | ######################################### 182 | # NETCDF Installation # 183 | ######################################### 184 | $wget "http://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/netcdf-4.1.3.tar.gz" 185 | tar -zxvf netcdf-4.1.3.tar.gz 186 | cd netcdf-4.1.3/ 187 | ./configure --with-zlib=$DIR/grib2 --with-hdf5=$DIR/hdf5 --prefix=$DIR/netcdf --disable-dap-remote-tests 188 | make 189 | make install 190 | cd .. 191 | echo "export PATH=$DIR/netcdf/bin:$PATH" >> ~/.bashrc 192 | echo "export NETCDF=$DIR/netcdf" >> ~/.bashrc 193 | echo "export LD_LIBRARY_PATH=$DIR/netcdf/lib" >> ~/.bashrc 194 | sed -i 's#export LDFLAGS.*#export LDFLAGS="-L$DIR/grib2/lib -L$DIR/hdf5/lib -L$DIR/netcdf/lib"#' ~/.bashrc 195 | sed -i 's#export CPPFLAGS.*#export CPPFLAGS="-I$DIR/grib2/include -I$DIR/hdf5/include -I$DIR/netcdf/include"#' ~/.bashrc 196 | export PATH=$DIR/netcdf/bin:$PATH 197 | export NETCDF=$DIR/netcdf 198 | export LD_LIBRARY_PATH=$DIR/netcdf/lib 199 | ######################################### 200 | # WRF Installation # 201 | ######################################### 202 | cd .. 203 | $wget "http://www2.mmm.ucar.edu/wrf/src/WRFV4.0.TAR.gz" 204 | tar -zxvf WRFV4.0.TAR.gz 205 | cd WRF 206 | ./configure 207 | sed -i '/-DBUILD_RRTMG_FAST=1/d' configure.wrf 208 | cd dyn_em 209 | $wget "http://www2.mmm.ucar.edu/wrf/src/fix/start_em.F_theta_m_pressure_fix.tar" 210 | tar -xvf start_em.F_theta_m_pressure_fix.tar 211 | cd .. 212 | ./compile em_real 213 | cd .. 214 | ######################################### 215 | # WPS Installation # 216 | ######################################### 217 | $wget "http://www2.mmm.ucar.edu/wrf/src/WPSV4.0.TAR.gz" 218 | tar -zxvf WPSV4.0.TAR.gz 219 | cd WPS 220 | ./clean 221 | ./configure 222 | ./compile 223 | sed -i "s# geog_data_path.*# geog_data_path = '../WPS_GEOG/'#" namelist.wps 224 | cd .. 225 | ######################################### 226 | # Opening Geog Data Files # 227 | ######################################### 228 | $wget "http://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz" 229 | tar -zxvf geog_high_res_mandatory.tar.gz 230 | ######################################### 231 | # NCL Installation # 232 | ######################################### 233 | #cd $DIR 234 | #mkdir ncl 235 | #cd ncl 236 | #$wget "https://www.earthsystemgrid.org/dataset/ncl.640.dap/file/ncl_ncarg-6.4.0-Debian8.6_64bit_gnu492.tar.gz" 237 | #tar -zxvf ncl_ncarg-6.4.0-Debian8.6_64bit_gnu492.tar.gz 238 | #echo "export NCARG_ROOT=$DIR/ncl" >> ~/.bashrc 239 | #echo "export PATH=$NCARG_ROOT/bin:$PATH" >> ~/.bashrc 240 | #echo "export DISPLAY=:0.0" >> ~/.bashrc 241 | ########################################################## 242 | # Son # 243 | ########################################################## 244 | echo "Installation has completed" 245 | exec bash 246 | exit 247 | -------------------------------------------------------------------------------- /WRF4.1.2_Install.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ######################################################### 3 | # WRF Install Script # 4 | # This Script was written by Umur Dinç # 5 | # To execute this script "bash WRF4.1.2_Install.bash" # 6 | ######################################################### 7 | echo "Welcome! This Script will install the WRF4.1.2" 8 | ######################################################### 9 | # Controls # 10 | ######################################################### 11 | osbit=$(uname -m) 12 | if [ "$osbit" = "x86_64" ]; then 13 | echo "64 bit operating system is used" 14 | else 15 | echo "Error! This script was written for 64 bit operating systems." 16 | exit 17 | fi 18 | ######## 19 | packagemanagement=$(which apt) 20 | if [ -n "$packagemanagement" ]; then 21 | echo "Operating system uses apt packagemanagement" 22 | else 23 | echo "Error! This script is written for the operating systems which uses apt packagemanagement. Please try this script with debian based operating systems, such as, Ubuntu, Linux Mint, Debian, Pardus etc." 24 | exit 25 | fi 26 | ######################################################### 27 | # Installing neccesary packages # 28 | ######################################################### 29 | sudo apt-get update 30 | sudo apt-get install -y build-essential csh gfortran m4 curl perl mpich libhdf5-mpich-dev libpng-dev netcdf-bin libnetcdff-dev 31 | ######################################### 32 | cd ~ 33 | mkdir Build_WRF 34 | cd Build_WRF 35 | mkdir LIBRARIES 36 | cd LIBRARIES 37 | echo "" >> ~/.bashrc 38 | echo "#WRF Variables" >> ~/.bashrc 39 | echo "export DIR="$(pwd) >> ~/.bashrc 40 | echo "export CC=gcc" >> ~/.bashrc 41 | echo "export CXX=g++" >> ~/.bashrc 42 | echo "export FC=gfortran" >> ~/.bashrc 43 | echo "export FCFLAGS=-m64" >> ~/.bashrc 44 | echo "export F77=gfortran" >> ~/.bashrc 45 | echo "export FFLAGS=-m64" >> ~/.bashrc 46 | echo "export NETCDF=/usr" >> ~/.bashrc 47 | echo "export HDF5=/usr/lib/x86_64-linux-gnu/hdf5/serial" >> ~/.bashrc 48 | echo "export LDFLAGS="\""-L/usr/lib/x86_64-linux-gnu/hdf5/serial/ -L/usr/lib"\""" >> ~/.bashrc 49 | echo "export CPPFLAGS="\""-I/usr/include/hdf5/serial/ -I/usr/include"\""" >> ~/.bashrc 50 | echo "export LD_LIBRARY_PATH=/usr/lib" >> ~/.bashrc 51 | DIR=$(pwd) 52 | export CC=gcc 53 | export CXX=g++ 54 | export FC=gfortran 55 | export FCFLAGS=-m64 56 | export F77=gfortran 57 | export FFLAGS=-m64 58 | export NETCDF=/usr 59 | export HDF5=/usr/lib/x86_64-linux-gnu/hdf5/serial 60 | export LDFLAGS="-L/usr/lib/x86_64-linux-gnu/hdf5/serial/ -L/usr/lib" 61 | export CPPFLAGS="-I/usr/include/hdf5/serial/ -I/usr/include" 62 | export LD_LIBRARY_PATH=/usr/lib 63 | ########################################## 64 | # Jasper Installation # 65 | ######################################### 66 | wget http://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/jasper-1.900.1.tar.gz 67 | tar -zxvf jasper-1.900.1.tar.gz 68 | cd jasper-1.900.1/ 69 | ./configure --prefix=$DIR/grib2 70 | make 71 | make install 72 | echo "export JASPERLIB=$DIR/grib2/lib" >> ~/.bashrc 73 | echo "export JASPERINC=$DIR/grib2/include" >> ~/.bashrc 74 | export JASPERLIB=$DIR/grib2/lib 75 | export JASPERINC=$DIR/grib2/include 76 | cd .. 77 | ######################################### 78 | # WRF Installation # 79 | ######################################### 80 | cd .. 81 | wget https://github.com/wrf-model/WRF/archive/v4.1.2.tar.gz 82 | mv v4.1.2.tar.gz WRFV4.1.2.tar.gz 83 | tar -zxvf WRFV4.1.2.tar.gz 84 | cd WRF-4.1.2 85 | sed -i 's# export USENETCDF=$USENETCDF.*# export USENETCDF="-lnetcdf"#' configure 86 | sed -i 's# export USENETCDFF=$USENETCDFF.*# export USENETCDFF="-lnetcdff"#' configure 87 | cd arch 88 | cp Config.pl Config.pl_backup 89 | sed -i '405s/.*/ $response = 34 ;/' Config.pl 90 | sed -i '668s/.*/ $response = 1 ;/' Config.pl 91 | cd .. 92 | ./configure 93 | gfortversion=$(gfortran -dumpversion | cut -c1) 94 | if [ "$gfortversion" -lt 8 ] && [ "$gfortversion" -ge 6 ]; then 95 | sed -i '/-DBUILD_RRTMG_FAST=1/d' configure.wrf 96 | fi 97 | ./compile em_real 98 | cd arch 99 | cp Config.pl_backup Config.pl 100 | cd .. 101 | cd .. 102 | ######################################### 103 | # WPS Installation # 104 | ######################################### 105 | wget https://github.com/wrf-model/WPS/archive/v4.1.tar.gz 106 | mv v4.1.tar.gz WPSV4.1.TAR.gz 107 | tar -zxvf WPSV4.1.TAR.gz 108 | cd WPS-4.1 109 | cd arch 110 | cp Config.pl Config.pl_backup 111 | sed -i '141s/.*/ $response = 3 ;/' Config.pl 112 | cd .. 113 | ./clean 114 | sed -i '122s/.*/ NETCDFF="-lnetcdff"/' configure 115 | sed -i '154s/.*/standard_wrf_dirs="WRF-4.1.2 WRF WRF-4.0.3 WRF-4.0.2 WRF-4.0.1 WRF-4.0 WRFV3"/' configure 116 | ./configure 117 | ./compile 118 | sed -i "s# geog_data_path.*# geog_data_path = '../WPS_GEOG/'#" namelist.wps 119 | cd arch 120 | cp Config.pl_backup Config.pl 121 | cd .. 122 | cd .. 123 | ######################################### 124 | # Opening Geog Data Files # 125 | ######################################### 126 | wget http://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz 127 | tar -zxvf geog_high_res_mandatory.tar.gz 128 | ########################################################## 129 | # End # 130 | ########################################################## 131 | echo "Installation has completed" 132 | exec bash 133 | exit 134 | -------------------------------------------------------------------------------- /WRF4.1.3_Install.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ######################################################### 3 | # WRF Install Script # 4 | # This Script was written by Umur Dinç # 5 | # To execute this script "bash WRF4.1.3_Install.bash" # 6 | ######################################################### 7 | echo "Welcome! This Script will install the WRF4.1.3" 8 | echo "Installation may take several hours and it takes 52 GB storage. Be sure that you have enough time and storage" 9 | ######################################################### 10 | # Controls # 11 | ######################################################### 12 | osbit=$(uname -m) 13 | if [ "$osbit" = "x86_64" ]; then 14 | echo "64 bit operating system is used" 15 | else 16 | echo "Error! This script was written for 64 bit operating systems." 17 | exit 18 | fi 19 | ######## 20 | packagemanagement=$(which apt) 21 | if [ -n "$packagemanagement" ]; then 22 | echo "Operating system uses apt packagemanagement" 23 | else 24 | echo "Error! This script is written for the operating systems which uses apt packagemanagement. Please try this script with debian based operating systems, such as, Ubuntu, Linux Mint, Debian, Pardus etc." 25 | exit 26 | fi 27 | ######################################################### 28 | # Installing neccesary packages # 29 | ######################################################### 30 | sudo apt-get update 31 | sudo apt-get install -y build-essential csh gfortran m4 curl perl mpich libhdf5-mpich-dev libpng-dev netcdf-bin libnetcdff-dev 32 | ######################################### 33 | cd ~ 34 | mkdir Build_WRF 35 | cd Build_WRF 36 | mkdir LIBRARIES 37 | cd LIBRARIES 38 | echo "" >> ~/.bashrc 39 | echo "#WRF Variables" >> ~/.bashrc 40 | echo "export DIR="$(pwd) >> ~/.bashrc 41 | echo "export CC=gcc" >> ~/.bashrc 42 | echo "export CXX=g++" >> ~/.bashrc 43 | echo "export FC=gfortran" >> ~/.bashrc 44 | echo "export FCFLAGS=-m64" >> ~/.bashrc 45 | echo "export F77=gfortran" >> ~/.bashrc 46 | echo "export FFLAGS=-m64" >> ~/.bashrc 47 | echo "export NETCDF=/usr" >> ~/.bashrc 48 | echo "export HDF5=/usr/lib/x86_64-linux-gnu/hdf5/serial" >> ~/.bashrc 49 | echo "export LDFLAGS="\""-L/usr/lib/x86_64-linux-gnu/hdf5/serial/ -L/usr/lib"\""" >> ~/.bashrc 50 | echo "export CPPFLAGS="\""-I/usr/include/hdf5/serial/ -I/usr/include"\""" >> ~/.bashrc 51 | echo "export LD_LIBRARY_PATH=/usr/lib" >> ~/.bashrc 52 | DIR=$(pwd) 53 | export CC=gcc 54 | export CXX=g++ 55 | export FC=gfortran 56 | export FCFLAGS=-m64 57 | export F77=gfortran 58 | export FFLAGS=-m64 59 | export NETCDF=/usr 60 | export HDF5=/usr/lib/x86_64-linux-gnu/hdf5/serial 61 | export LDFLAGS="-L/usr/lib/x86_64-linux-gnu/hdf5/serial/ -L/usr/lib" 62 | export CPPFLAGS="-I/usr/include/hdf5/serial/ -I/usr/include" 63 | export LD_LIBRARY_PATH=/usr/lib 64 | ########################################## 65 | # Jasper Installation # 66 | ######################################### 67 | [ -d "jasper-1.900.1" ] && mv jasper-1.900.1 jasper-1.900.1-old 68 | [ -d "jasper-1.900.1.tar.gz" ] && mv jasper-1.900.1.tar.gz jasper-1.900.1.tar.gz-old 69 | wget http://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/jasper-1.900.1.tar.gz 70 | tar -zxvf jasper-1.900.1.tar.gz 71 | cd jasper-1.900.1/ 72 | ./configure --prefix=$DIR/grib2 73 | make 74 | make install 75 | echo "export JASPERLIB=$DIR/grib2/lib" >> ~/.bashrc 76 | echo "export JASPERINC=$DIR/grib2/include" >> ~/.bashrc 77 | export JASPERLIB=$DIR/grib2/lib 78 | export JASPERINC=$DIR/grib2/include 79 | cd .. 80 | ######################################### 81 | # WRF Installation # 82 | ######################################### 83 | cd .. 84 | [ -d "WRF-4.1.3" ] && mv WRF-4.1.3 WRF-4.1.3-old 85 | [ -d "v4.1.3.tar.gz" ] && mv v4.1.3.tar.gz v4.1.3.tar.gz-old 86 | wget https://github.com/wrf-model/WRF/archive/v4.1.3.tar.gz 87 | mv v4.1.3.tar.gz WRFV4.1.3.tar.gz 88 | tar -zxvf WRFV4.1.3.tar.gz 89 | cd WRF-4.1.3 90 | sed -i 's# export USENETCDF=$USENETCDF.*# export USENETCDF="-lnetcdf"#' configure 91 | sed -i 's# export USENETCDFF=$USENETCDFF.*# export USENETCDFF="-lnetcdff"#' configure 92 | cd arch 93 | cp Config.pl Config.pl_backup 94 | sed -i '405s/.*/ $response = 34 ;/' Config.pl 95 | sed -i '668s/.*/ $response = 1 ;/' Config.pl 96 | cd .. 97 | ./configure 98 | gfortversion=$(gfortran -dumpversion | cut -c1) 99 | if [ "$gfortversion" -lt 8 ] && [ "$gfortversion" -ge 6 ]; then 100 | sed -i '/-DBUILD_RRTMG_FAST=1/d' configure.wrf 101 | fi 102 | ./compile em_real 103 | cd arch 104 | cp Config.pl_backup Config.pl 105 | cd .. 106 | cd .. 107 | ######################################### 108 | # WPS Installation # 109 | ######################################### 110 | [ -d "WPS-4.1" ] && mv WPS-4.1 WPS-4.1-old 111 | [ -d "v4.1.tar.gz" ] && mv v4.1.tar.gz v4.1.tar.gz-old 112 | wget https://github.com/wrf-model/WPS/archive/v4.1.tar.gz 113 | mv v4.1.tar.gz WPSV4.1.TAR.gz 114 | tar -zxvf WPSV4.1.TAR.gz 115 | cd WPS-4.1 116 | cd arch 117 | cp Config.pl Config.pl_backup 118 | sed -i '141s/.*/ $response = 3 ;/' Config.pl 119 | cd .. 120 | ./clean 121 | sed -i '122s/.*/ NETCDFF="-lnetcdff"/' configure 122 | sed -i '154s/.*/standard_wrf_dirs="WRF-4.1.3 WRF WRF-4.0.3 WRF-4.0.2 WRF-4.0.1 WRF-4.0 WRFV3"/' configure 123 | ./configure 124 | ./compile 125 | sed -i "s# geog_data_path.*# geog_data_path = '../WPS_GEOG/'#" namelist.wps 126 | cd arch 127 | cp Config.pl_backup Config.pl 128 | cd .. 129 | cd .. 130 | ######################################### 131 | # Opening Geog Data Files # 132 | ######################################### 133 | if [ -d "WPS_GEOG" ]; then 134 | echo "WRF and WPS are installed successfully" 135 | echo "Directory WPS_GEOG is already exists." 136 | echo "Do you want WPS_GEOG files to be redownloaded and reexracted?" 137 | echo "please type yes or no" 138 | read GEOG_validation 139 | if [ ${GEOG_validation} = "yes" ]; then 140 | wget http://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz 141 | tar -zxvf geog_high_res_mandatory.tar.gz 142 | else 143 | echo "You can download it later from http://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz and extract it" 144 | exit 145 | fi 146 | else 147 | wget http://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz 148 | tar -zxvf geog_high_res_mandatory.tar.gz 149 | fi 150 | ########################################################## 151 | # End # 152 | ########################################################## 153 | echo "Installation has completed" 154 | exec bash 155 | exit 156 | -------------------------------------------------------------------------------- /WRF4.1.5_Install.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ######################################################### 3 | # WRF Install Script # 4 | # This Script was written by Umur Dinç # 5 | # To execute this script "bash WRF4.1.5_Install.bash" # 6 | ######################################################### 7 | echo "Welcome! This Script will install the WRF4.1.5" 8 | echo "Installation may take several hours and it takes 52 GB storage. Be sure that you have enough time and storage." 9 | ######################################################### 10 | # Controls # 11 | ######################################################### 12 | osbit=$(uname -m) 13 | if [ "$osbit" = "x86_64" ]; then 14 | echo "64 bit operating system is used" 15 | else 16 | echo "Error! This script was written for 64 bit operating systems." 17 | exit 18 | fi 19 | ######## 20 | packagemanagement=$(which apt) 21 | if [ -n "$packagemanagement" ]; then 22 | echo "Operating system uses apt packagemanagement" 23 | else 24 | echo "Error! This script is written for the operating systems which uses apt packagemanagement. Please try this script with debian based operating systems, such as, Ubuntu, Linux Mint, Debian, Pardus etc." 25 | #Tested on Linux Mint 19.3 26 | exit 27 | fi 28 | ######################################################### 29 | # Installing neccesary packages # 30 | ######################################################### 31 | sudo apt-get update 32 | sudo apt-get install -y build-essential csh gfortran m4 curl perl mpich libhdf5-mpich-dev libpng-dev netcdf-bin libnetcdff-dev 33 | ######################################### 34 | cd ~ 35 | mkdir Build_WRF 36 | cd Build_WRF 37 | mkdir LIBRARIES 38 | cd LIBRARIES 39 | echo "" >> ~/.bashrc 40 | echo "#WRF Variables" >> ~/.bashrc 41 | echo "export DIR="$(pwd) >> ~/.bashrc 42 | echo "export CC=gcc" >> ~/.bashrc 43 | echo "export CXX=g++" >> ~/.bashrc 44 | echo "export FC=gfortran" >> ~/.bashrc 45 | echo "export FCFLAGS=-m64" >> ~/.bashrc 46 | echo "export F77=gfortran" >> ~/.bashrc 47 | echo "export FFLAGS=-m64" >> ~/.bashrc 48 | echo "export NETCDF=/usr" >> ~/.bashrc 49 | echo "export HDF5=/usr/lib/x86_64-linux-gnu/hdf5/serial" >> ~/.bashrc 50 | echo "export LDFLAGS="\""-L/usr/lib/x86_64-linux-gnu/hdf5/serial/ -L/usr/lib"\""" >> ~/.bashrc 51 | echo "export CPPFLAGS="\""-I/usr/include/hdf5/serial/ -I/usr/include"\""" >> ~/.bashrc 52 | echo "export LD_LIBRARY_PATH=/usr/lib" >> ~/.bashrc 53 | DIR=$(pwd) 54 | export CC=gcc 55 | export CXX=g++ 56 | export FC=gfortran 57 | export FCFLAGS=-m64 58 | export F77=gfortran 59 | export FFLAGS=-m64 60 | export NETCDF=/usr 61 | export HDF5=/usr/lib/x86_64-linux-gnu/hdf5/serial 62 | export LDFLAGS="-L/usr/lib/x86_64-linux-gnu/hdf5/serial/ -L/usr/lib" 63 | export CPPFLAGS="-I/usr/include/hdf5/serial/ -I/usr/include" 64 | export LD_LIBRARY_PATH=/usr/lib 65 | ########################################## 66 | # Jasper Installation # 67 | ######################################### 68 | [ -d "jasper-1.900.1" ] && mv jasper-1.900.1 jasper-1.900.1-old 69 | [ -d "jasper-1.900.1.tar.gz" ] && mv jasper-1.900.1.tar.gz jasper-1.900.1.tar.gz-old 70 | wget http://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/jasper-1.900.1.tar.gz 71 | tar -zxvf jasper-1.900.1.tar.gz 72 | cd jasper-1.900.1/ 73 | ./configure --prefix=$DIR/grib2 74 | make 75 | make install 76 | echo "export JASPERLIB=$DIR/grib2/lib" >> ~/.bashrc 77 | echo "export JASPERINC=$DIR/grib2/include" >> ~/.bashrc 78 | export JASPERLIB=$DIR/grib2/lib 79 | export JASPERINC=$DIR/grib2/include 80 | cd .. 81 | ######################################### 82 | # WRF Installation # 83 | ######################################### 84 | cd .. 85 | [ -d "WRF-4.1.5" ] && mv WRF-4.1.5 WRF-4.1.5-old 86 | [ -d "v4.1.5.tar.gz" ] && mv v4.1.5.tar.gz v4.1.5.tar.gz-old 87 | wget https://github.com/wrf-model/WRF/archive/v4.1.5.tar.gz 88 | mv v4.1.5.tar.gz WRFV4.1.5.tar.gz 89 | tar -zxvf WRFV4.1.5.tar.gz 90 | cd WRF-4.1.5 91 | sed -i 's# export USENETCDF=$USENETCDF.*# export USENETCDF="-lnetcdf"#' configure 92 | sed -i 's# export USENETCDFF=$USENETCDFF.*# export USENETCDFF="-lnetcdff"#' configure 93 | cd arch 94 | cp Config.pl Config.pl_backup 95 | sed -i '405s/.*/ $response = 34 ;/' Config.pl 96 | sed -i '668s/.*/ $response = 1 ;/' Config.pl 97 | cd .. 98 | ./configure 99 | gfortversion=$(gfortran -dumpversion | cut -c1) 100 | if [ "$gfortversion" -lt 8 ] && [ "$gfortversion" -ge 6 ]; then 101 | sed -i '/-DBUILD_RRTMG_FAST=1/d' configure.wrf 102 | fi 103 | logsave compile.log ./compile em_real 104 | cd arch 105 | cp Config.pl_backup Config.pl 106 | cd .. 107 | if [ -n "$(grep "Problems building executables, look for errors in the build log" compile.log)" ]; then 108 | echo "Sorry, There were some errors while installing WRF." 109 | echo "Please create new issue for the problem, https://github.com/bakamotokatas/WRF-Install-Script/issues" 110 | exit 111 | fi 112 | cd .. 113 | ######################################### 114 | # WPS Installation # 115 | ######################################### 116 | [ -d "WPS-4.1" ] && mv WPS-4.1 WPS-4.1-old 117 | [ -d "v4.1.tar.gz" ] && mv v4.1.tar.gz v4.1.tar.gz-old 118 | wget https://github.com/wrf-model/WPS/archive/v4.1.tar.gz 119 | mv v4.1.tar.gz WPSV4.1.TAR.gz 120 | tar -zxvf WPSV4.1.TAR.gz 121 | cd WPS-4.1 122 | cd arch 123 | cp Config.pl Config.pl_backup 124 | sed -i '141s/.*/ $response = 3 ;/' Config.pl 125 | cd .. 126 | ./clean 127 | sed -i '122s/.*/ NETCDFF="-lnetcdff"/' configure 128 | sed -i '154s/.*/standard_wrf_dirs="WRF-4.1.5 WRF WRF-4.0.3 WRF-4.0.2 WRF-4.0.1 WRF-4.0 WRFV3"/' configure 129 | ./configure 130 | logsave compile.log ./compile 131 | sed -i "s# geog_data_path.*# geog_data_path = '../WPS_GEOG/'#" namelist.wps 132 | cd arch 133 | cp Config.pl_backup Config.pl 134 | cd .. 135 | cd .. 136 | ######################################### 137 | # Opening Geog Data Files # 138 | ######################################### 139 | if [ -d "WPS_GEOG" ]; then 140 | echo "WRF and WPS are installed successfully" 141 | echo "Directory WPS_GEOG is already exists." 142 | echo "Do you want WPS_GEOG files to be redownloaded and reexracted?" 143 | echo "please type yes or no" 144 | read GEOG_validation 145 | if [ ${GEOG_validation} = "yes" ]; then 146 | wget http://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz 147 | tar -zxvf geog_high_res_mandatory.tar.gz 148 | else 149 | echo "You can download it later from http://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz and extract it" 150 | exit 151 | fi 152 | else 153 | wget http://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz 154 | tar -zxvf geog_high_res_mandatory.tar.gz 155 | fi 156 | ########################################################## 157 | # End # 158 | ########################################################## 159 | echo "Installation has completed" 160 | exec bash 161 | exit 162 | -------------------------------------------------------------------------------- /WRF4.1_Install.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ######################################################### 3 | # WRF Install Script # 4 | # This Script was written by Umur Dinç # 5 | # To execute this script "bash WRF4.1_Install.bash" # 6 | ######################################################### 7 | echo "Welcome! This Script will install the WRF4.1" 8 | ######################################################### 9 | # Controls # 10 | ######################################################### 11 | osbit=$(uname -m) 12 | if [ "$osbit" = "x86_64" ]; then 13 | echo "64 bit operating system is used" 14 | else 15 | echo "Error! This script was written for 64 bit operating systems." 16 | exit 17 | fi 18 | ######## 19 | packagemanagement=$(which apt) 20 | if [ -n "$packagemanagement" ]; then 21 | echo "Operating system uses apt packagemanagement" 22 | else 23 | echo "Error! This script is written for the operating systems which uses apt packagemanagement. Please try this script with debian based operating systems, such as, Ubuntu, Linux Mint, Debian, Pardus etc." 24 | exit 25 | fi 26 | ######################################################### 27 | # Installing neccesary packages # 28 | ######################################################### 29 | sudo apt-get update 30 | sudo apt-get install -y build-essential csh gfortran m4 curl perl mpich libhdf5-mpich-dev libpng-dev netcdf-bin libnetcdff-dev 31 | ######################################### 32 | cd ~ 33 | mkdir Build_WRF 34 | cd Build_WRF 35 | mkdir LIBRARIES 36 | cd LIBRARIES 37 | echo "" >> ~/.bashrc 38 | echo "#WRF Variables" >> ~/.bashrc 39 | echo "export DIR="$(pwd) >> ~/.bashrc 40 | echo "export CC=gcc" >> ~/.bashrc 41 | echo "export CXX=g++" >> ~/.bashrc 42 | echo "export FC=gfortran" >> ~/.bashrc 43 | echo "export FCFLAGS=-m64" >> ~/.bashrc 44 | echo "export F77=gfortran" >> ~/.bashrc 45 | echo "export FFLAGS=-m64" >> ~/.bashrc 46 | echo "export NETCDF=/usr" >> ~/.bashrc 47 | echo "export HDF5=/usr/lib/x86_64-linux-gnu/hdf5/serial" >> ~/.bashrc 48 | echo "export LDFLAGS=-L/usr/lib/x86_64-linux-gnu/hdf5/serial" >> ~/.bashrc 49 | echo "export CPPFLAGS=-I/usr/include/hdf5/serial" >> ~/.bashrc 50 | DIR=$(pwd) 51 | export CC=gcc 52 | export CXX=g++ 53 | export FC=gfortran 54 | export FCFLAGS=-m64 55 | export F77=gfortran 56 | export FFLAGS=-m64 57 | export NETCDF=/usr 58 | export HDF5=/usr/lib/x86_64-linux-gnu/hdf5/serial 59 | export LDFLAGS="-L/usr/lib/x86_64-linux-gnu/hdf5/serial/ -L/usr/lib" 60 | export CPPFLAGS="-I/usr/include/hdf5/serial/ -I/usr/include" 61 | ########################################## 62 | # Jasper Installation # 63 | ######################################### 64 | wget http://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/jasper-1.900.1.tar.gz 65 | tar -zxvf jasper-1.900.1.tar.gz 66 | cd jasper-1.900.1/ 67 | ./configure --prefix=$DIR/grib2 68 | make 69 | make install 70 | echo "export JASPERLIB=$DIR/grib2/lib" >> ~/.bashrc 71 | echo "export JASPERINC=$DIR/grib2/include" >> ~/.bashrc 72 | export JASPERLIB=$DIR/grib2/lib 73 | export JASPERINC=$DIR/grib2/include 74 | cd .. 75 | ######################################### 76 | # WRF Installation # 77 | ######################################### 78 | cd .. 79 | wget https://github.com/wrf-model/WRF/archive/v4.1.tar.gz 80 | mv v4.1.tar.gz WRFV4.1.tar.gz 81 | tar -zxvf WRFV4.1.tar.gz 82 | cd WRF-4.1 83 | sed -i 's# export USENETCDF=$USENETCDF.*# export USENETCDF="-lnetcdf"#' configure 84 | sed -i 's# export USENETCDFF=$USENETCDFF.*# export USENETCDFF="-lnetcdff"#' configure 85 | cd arch 86 | cp Config.pl Config.pl_backup 87 | sed -i '405s/.*/ $response = 34 ;/' Config.pl 88 | sed -i '668s/.*/ $response = 1 ;/' Config.pl 89 | cd .. 90 | ./configure 91 | sed -i '/-DBUILD_RRTMG_FAST=1/d' configure.wrf 92 | ./compile em_real 93 | cd arch 94 | cp Config.pl_backup Config.pl 95 | cd .. 96 | cd .. 97 | ######################################### 98 | # WPS Installation # 99 | ######################################### 100 | wget https://github.com/wrf-model/WPS/archive/v4.1.tar.gz 101 | mv v4.1.tar.gz WPSV4.1.TAR.gz 102 | tar -zxvf WPSV4.1.TAR.gz 103 | cd WPS-4.1 104 | cd arch 105 | cp Config.pl Config.pl_backup 106 | sed -i '141s/.*/ $response = 3 ;/' Config.pl 107 | cd .. 108 | ./clean 109 | sed -i '122s/.*/ NETCDFF="-lnetcdff"/' configure 110 | sed -i '154s/.*/standard_wrf_dirs="WRF-4.1 WRF WRF-4.0.3 WRF-4.0.2 WRF-4.0.1 WRF-4.0 WRFV3"/' configure 111 | ./configure 112 | ./compile 113 | sed -i "s# geog_data_path.*# geog_data_path = '../WPS_GEOG/'#" namelist.wps 114 | cd arch 115 | cp Config.pl_backup Config.pl 116 | cd .. 117 | cd .. 118 | ######################################### 119 | # Opening Geog Data Files # 120 | ######################################### 121 | wget http://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz 122 | tar -zxvf geog_high_res_mandatory.tar.gz 123 | ########################################################## 124 | # End # 125 | ########################################################## 126 | echo "Installation has completed" 127 | exec bash 128 | exit 129 | -------------------------------------------------------------------------------- /WRF4.2.2_Install.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ######################################################### 3 | # WRF Install Script # 4 | # This Script was written by Umur Dinç # 5 | # To execute this script "bash WRF4.2.2_Install.bash" # 6 | ######################################################### 7 | WRFversion="4.2.2" 8 | type="ARW" 9 | if [ -n "$1" ]; then 10 | if [ "$1" = "-chem" ]; then 11 | type="Chem" 12 | extra_packages="flex-old bison" 13 | elif [ "$1" = "-nmm" ]; then 14 | type="NMM" 15 | elif [ "$1" = "-arw" ]; then 16 | type="ARW" 17 | else 18 | echo "Unrecognized option, please run as" 19 | echo "For WRF-ARW \"bash WRF${WRFversion}_Install.bash -arw\"" 20 | echo "For WRF-Chem \"bash WRF${WRFversion}_Install.bash -chem\"" 21 | echo "For WRF-NMM \"bash WRF${WRFversion}_Install.bash -nmm\"" 22 | exit 23 | fi 24 | fi 25 | echo "Welcome! This Script will install the WRF${WRFversion}-${type}" 26 | echo "Installation may take several hours and it takes 52 GB storage. Be sure that you have enough time and storage." 27 | ######################################################### 28 | # Controls # 29 | ######################################################### 30 | osbit=$(uname -m) 31 | if [ "$osbit" = "x86_64" ]; then 32 | echo "64 bit operating system is used" 33 | else 34 | echo "Error! This script was written for 64 bit operating systems." 35 | exit 36 | fi 37 | ######## 38 | packagemanagement=$(which apt) 39 | if [ -n "$packagemanagement" ]; then 40 | echo "Operating system uses apt packagemanagement" 41 | else 42 | echo "Error! This script is written for the operating systems which uses apt packagemanagement. Please try this script with debian based operating systems, such as, Ubuntu, Linux Mint, Debian, Pardus etc." 43 | #Tested on Linux Mint 19.3 and Linux Mint 20.1 44 | exit 45 | fi 46 | ######################################################### 47 | # Installing neccesary packages # 48 | ######################################################### 49 | echo "Please enter your sudo password, so necessary packages can be installed." 50 | sudo apt-get update 51 | sudo apt-get install -y build-essential csh gfortran m4 curl perl mpich libhdf5-mpich-dev libpng-dev netcdf-bin libnetcdff-dev ${extra_packages} 52 | 53 | package4checks="build-essential csh gfortran m4 curl perl mpich libhdf5-mpich-dev libpng-dev netcdf-bin libnetcdff-dev ${extra_packages}" 54 | for packagecheck in ${package4checks}; do 55 | packagechecked=$(dpkg-query --show --showformat='${db:Status-Status}\n' $packagecheck | grep not-installed) 56 | if [ "$packagechecked" = "not-installed" ]; then 57 | echo $packagecheck "$packagechecked" 58 | packagesnotinstalled=yes 59 | fi 60 | done 61 | if [ "$packagesnotinstalled" = "yes" ]; then 62 | echo "Some packages were not installed, please re-run the script and enter your root password, when it is requested." 63 | exit 64 | fi 65 | ######################################### 66 | cd ~ 67 | mkdir Build_WRF 68 | cd Build_WRF 69 | mkdir LIBRARIES 70 | cd LIBRARIES 71 | echo "" >> ~/.bashrc 72 | bashrc_exports=("#WRF Variables" "export DIR=$(pwd)" "export CC=gcc" "export CXX=g++" "export FC=gfortran" "export FCFLAGS=-m64" "export F77=gfortran" "export FFLAGS=-m64" 73 | "export NETCDF=/usr" "export HDF5=/usr/lib/x86_64-linux-gnu/hdf5/serial" "export LDFLAGS="\""-L/usr/lib/x86_64-linux-gnu/hdf5/serial/ -L/usr/lib"\""" 74 | "export CPPFLAGS="\""-I/usr/include/hdf5/serial/ -I/usr/include"\""" "export LD_LIBRARY_PATH=/usr/lib") 75 | for bashrc_export in "${bashrc_exports[@]}" ; do 76 | [[ -z $(grep "${bashrc_export}" ~/.bashrc) ]] && echo "${bashrc_export}" >> ~/.bashrc 77 | done 78 | DIR=$(pwd) 79 | export CC=gcc 80 | export CXX=g++ 81 | export FC=gfortran 82 | export FCFLAGS=-m64 83 | export F77=gfortran 84 | export FFLAGS=-m64 85 | export NETCDF=/usr 86 | export HDF5=/usr/lib/x86_64-linux-gnu/hdf5/serial 87 | export LDFLAGS="-L/usr/lib/x86_64-linux-gnu/hdf5/serial/ -L/usr/lib" 88 | export CPPFLAGS="-I/usr/include/hdf5/serial/ -I/usr/include" 89 | export LD_LIBRARY_PATH=/usr/lib 90 | if [ "$type" = "Chem" ]; then 91 | echo "export FLEX_LIB_DIR=/usr/lib" >> ~/.bashrc 92 | echo "export YACC='yacc -d'" >> ~/.bashrc 93 | export FLEX_LIB_DIR=/usr/lib 94 | export YACC='yacc -d' 95 | fi 96 | ########################################## 97 | # Jasper Installation # 98 | ######################################### 99 | [ -d "jasper-1.900.1" ] && mv jasper-1.900.1 jasper-1.900.1-old 100 | [ -f "jasper-1.900.1.tar.gz" ] && mv jasper-1.900.1.tar.gz jasper-1.900.1.tar.gz-old 101 | wget http://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/jasper-1.900.1.tar.gz 102 | tar -zxvf jasper-1.900.1.tar.gz 103 | cd jasper-1.900.1/ 104 | ./configure --prefix=$DIR/grib2 105 | make 106 | make install 107 | echo "export JASPERLIB=$DIR/grib2/lib" >> ~/.bashrc 108 | echo "export JASPERINC=$DIR/grib2/include" >> ~/.bashrc 109 | export JASPERLIB=$DIR/grib2/lib 110 | export JASPERINC=$DIR/grib2/include 111 | cd .. 112 | ######################################### 113 | # WRF Installation # 114 | ######################################### 115 | cd .. 116 | [ -d "WRF-${WRFversion}" ] && mv WRF-${WRFversion} WRF-${WRFversion}-old 117 | [ -f "v${WRFversion}.tar.gz" ] && mv v${WRFversion}.tar.gz v${WRFversion}.tar.gz-old 118 | wget https://github.com/wrf-model/WRF/archive/v${WRFversion}.tar.gz 119 | mv v${WRFversion}.tar.gz WRFV${WRFversion}.tar.gz 120 | tar -zxvf WRFV${WRFversion}.tar.gz 121 | cd WRF-${WRFversion} 122 | if [ "$type" = "Chem" ]; then 123 | export WRF_CHEM=1 124 | export WRF_KPP=1 125 | elif [ "$type" = "NMM" ]; then 126 | export WRF_NMM_CORE=1 127 | export wrf_core=NMM_CORE 128 | fi 129 | sed -i 's# export USENETCDF=$USENETCDF.*# export USENETCDF="-lnetcdf"#' configure 130 | sed -i 's# export USENETCDFF=$USENETCDFF.*# export USENETCDFF="-lnetcdff"#' configure 131 | cd arch 132 | cp Config.pl Config.pl_backup 133 | sed -i '405s/.*/ $response = 34 ;/' Config.pl 134 | sed -i '667s/.*/ $response = 1 ;/' Config.pl 135 | cd .. 136 | ./configure 137 | gfortversion=$(gfortran -dumpversion | cut -c1) 138 | if [ "$gfortversion" -lt 8 ] && [ "$gfortversion" -ge 6 ]; then 139 | sed -i '/-DBUILD_RRTMG_FAST=1/d' configure.wrf 140 | fi 141 | if [ "$type" = "NMM" ]; then 142 | logsave compile.log ./compile nmm_real 143 | else 144 | logsave compile.log ./compile em_real 145 | fi 146 | cd arch 147 | cp Config.pl_backup Config.pl 148 | cd .. 149 | if [ -n "$(grep "Problems building executables, look for errors in the build log" compile.log)" ]; then 150 | echo "Sorry, There were some errors while installing WRF." 151 | echo "Please create new issue for the problem, https://github.com/bakamotokatas/WRF-Install-Script/issues" 152 | exit 153 | fi 154 | cd .. 155 | [ -d "WRF-${WRFversion}-${type}" ] && mv WRF-${WRFversion}-${type} WRF-${WRFversion}-${type}-old 156 | mv WRF-${WRFversion} WRF-${WRFversion}-${type} 157 | ######################################### 158 | # WPS Installation # 159 | ######################################### 160 | WPSversion="4.2" 161 | [ -d "WPS-${WPSversion}" ] && mv WPS-${WPSversion} WPS-${WPSversion}-old 162 | [ -f "v${WPSversion}.tar.gz" ] && mv v${WPSversion}.tar.gz v${WPSversion}.tar.gz-old 163 | wget https://github.com/wrf-model/WPS/archive/v${WPSversion}.tar.gz 164 | mv v${WPSversion}.tar.gz WPSV${WPSversion}.TAR.gz 165 | tar -zxvf WPSV${WPSversion}.TAR.gz 166 | cd WPS-${WPSversion} 167 | cd arch 168 | cp Config.pl Config.pl_backup 169 | sed -i '141s/.*/ $response = 3 ;/' Config.pl 170 | cd .. 171 | ./clean 172 | sed -i '122s/.*/ NETCDFF="-lnetcdff"/' configure 173 | sed -i "154s/.*/standard_wrf_dirs=\"WRF-${WRFversion}-${type} WRF WRF-4.0.3 WRF-4.0.2 WRF-4.0.1 WRF-4.0 WRFV3\"/" configure 174 | ./configure 175 | logsave compile.log ./compile 176 | sed -i "s# geog_data_path.*# geog_data_path = '../WPS_GEOG/'#" namelist.wps 177 | cd arch 178 | cp Config.pl_backup Config.pl 179 | cd .. 180 | cd .. 181 | ######################################### 182 | # Opening Geog Data Files # 183 | ######################################### 184 | if [ -d "WPS_GEOG" ]; then 185 | echo "WRF and WPS are installed successfully" 186 | echo "Directory WPS_GEOG is already exists." 187 | echo "Do you want WPS_GEOG files to be redownloaded and reexracted?" 188 | echo "please type yes or no" 189 | read GEOG_validation 190 | if [ ${GEOG_validation} = "yes" ]; then 191 | wget http://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz 192 | tar -zxvf geog_high_res_mandatory.tar.gz 193 | else 194 | echo "You can download it later from http://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz and extract it" 195 | exit 196 | fi 197 | else 198 | wget http://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz 199 | tar -zxvf geog_high_res_mandatory.tar.gz 200 | fi 201 | if [ "$type" = "Chem" ]; then 202 | cd WPS_GEOG 203 | Chem_Geog="modis_landuse_21class_30s soiltype_top_2m soiltype_bot_2m albedo_ncep maxsnowalb erod clayfrac_5m sandfrac_5m" 204 | for i in ${Chem_Geog}; do 205 | if [ ! -d $i ]; then 206 | echo $i 207 | wget https://www2.mmm.ucar.edu/wrf/src/wps_files/${i}.tar.bz2 208 | tar -xvf ${i}.tar.bz2 209 | rm ${i}.tar.bz2 210 | fi 211 | done 212 | fi 213 | ########################################################## 214 | # End # 215 | ########################################################## 216 | echo "Installation has completed" 217 | exec bash 218 | exit 219 | -------------------------------------------------------------------------------- /WRF4.3.1_Install.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ######################################################### 3 | # WRF Install Script # 4 | # This Script was written by Umur Dinç # 5 | # To execute this script "bash WRF4.3.1_Install.bash" # 6 | ######################################################### 7 | WRFversion="4.3.1" 8 | type="ARW" 9 | if [ -n "$1" ]; then 10 | if [ "$1" = "-chem" ]; then 11 | type="Chem" 12 | extra_packages="flex-old bison" 13 | elif [ "$1" = "-nmm" ]; then 14 | type="NMM" 15 | elif [ "$1" = "-arw" ]; then 16 | type="ARW" 17 | else 18 | echo "Unrecognized option, please run as" 19 | echo "For WRF-ARW \"bash WRF${WRFversion}_Install.bash -arw\"" 20 | echo "For WRF-Chem \"bash WRF${WRFversion}_Install.bash -chem\"" 21 | echo "For WRF-NMM \"bash WRF${WRFversion}_Install.bash -nmm\"" 22 | exit 23 | fi 24 | fi 25 | echo "Welcome! This Script will install the WRF${WRFversion}-${type}" 26 | echo "Installation may take several hours and it takes 52 GB storage. Be sure that you have enough time and storage." 27 | ######################################################### 28 | # Controls # 29 | ######################################################### 30 | osbit=$(uname -m) 31 | if [ "$osbit" = "x86_64" ]; then 32 | echo "64 bit operating system is used" 33 | else 34 | echo "Sorry! This script was written for 64 bit operating systems." 35 | exit 36 | fi 37 | ######## 38 | packagemanagement=$(which apt) 39 | if [ -n "$packagemanagement" ]; then 40 | echo "Operating system uses apt packagemanagement" 41 | else 42 | echo "Sorry! This script is written for the operating systems which uses apt packagemanagement. Please try this script with debian based operating systems, such as, Ubuntu, Linux Mint, Debian, Pardus etc." 43 | #Tested on Linux Mint 19.3 and Linux Mint 20.1 44 | exit 45 | fi 46 | ######################################################### 47 | # Installing neccesary packages # 48 | ######################################################### 49 | echo "Please enter your sudo password, so necessary packages can be installed." 50 | sudo apt-get update 51 | sudo apt-get install -y build-essential csh gfortran m4 curl perl mpich libhdf5-mpich-dev libpng-dev netcdf-bin libnetcdff-dev ${extra_packages} 52 | 53 | package4checks="build-essential csh gfortran m4 curl perl mpich libhdf5-mpich-dev libpng-dev netcdf-bin libnetcdff-dev ${extra_packages}" 54 | for packagecheck in ${package4checks}; do 55 | packagechecked=$(dpkg-query --show --showformat='${db:Status-Status}\n' $packagecheck | grep not-installed) 56 | if [ "$packagechecked" = "not-installed" ]; then 57 | echo $packagecheck "$packagechecked" 58 | packagesnotinstalled=yes 59 | fi 60 | done 61 | if [ "$packagesnotinstalled" = "yes" ]; then 62 | echo "Some packages were not installed, please re-run the script and enter your root password, when it is requested." 63 | exit 64 | fi 65 | ######################################### 66 | cd ~ 67 | mkdir Build_WRF 68 | cd Build_WRF 69 | mkdir LIBRARIES 70 | cd LIBRARIES 71 | echo "" >> ~/.bashrc 72 | bashrc_exports=("#WRF Variables" "export DIR=$(pwd)" "export CC=gcc" "export CXX=g++" "export FC=gfortran" "export FCFLAGS=-m64" "export F77=gfortran" "export FFLAGS=-m64" 73 | "export NETCDF=/usr" "export HDF5=/usr/lib/x86_64-linux-gnu/hdf5/serial" "export LDFLAGS="\""-L/usr/lib/x86_64-linux-gnu/hdf5/serial/ -L/usr/lib"\""" 74 | "export CPPFLAGS="\""-I/usr/include/hdf5/serial/ -I/usr/include"\""" "export LD_LIBRARY_PATH=/usr/lib") 75 | for bashrc_export in "${bashrc_exports[@]}" ; do 76 | [[ -z $(grep "${bashrc_export}" ~/.bashrc) ]] && echo "${bashrc_export}" >> ~/.bashrc 77 | done 78 | DIR=$(pwd) 79 | export CC=gcc 80 | export CXX=g++ 81 | export FC=gfortran 82 | export FCFLAGS=-m64 83 | export F77=gfortran 84 | export FFLAGS=-m64 85 | export NETCDF=/usr 86 | export HDF5=/usr/lib/x86_64-linux-gnu/hdf5/serial 87 | export LDFLAGS="-L/usr/lib/x86_64-linux-gnu/hdf5/serial/ -L/usr/lib" 88 | export CPPFLAGS="-I/usr/include/hdf5/serial/ -I/usr/include" 89 | export LD_LIBRARY_PATH=/usr/lib 90 | if [ "$type" = "Chem" ]; then 91 | echo "export FLEX_LIB_DIR=/usr/lib" >> ~/.bashrc 92 | echo "export YACC='yacc -d'" >> ~/.bashrc 93 | export FLEX_LIB_DIR=/usr/lib 94 | export YACC='yacc -d' 95 | fi 96 | ########################################## 97 | # Jasper Installation # 98 | ######################################### 99 | [ -d "jasper-1.900.1" ] && mv jasper-1.900.1 jasper-1.900.1-old 100 | [ -f "jasper-1.900.1.tar.gz" ] && mv jasper-1.900.1.tar.gz jasper-1.900.1.tar.gz-old 101 | wget http://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/jasper-1.900.1.tar.gz 102 | tar -zxvf jasper-1.900.1.tar.gz 103 | cd jasper-1.900.1/ 104 | ./configure --prefix=$DIR/grib2 105 | make 106 | make install 107 | echo "export JASPERLIB=$DIR/grib2/lib" >> ~/.bashrc 108 | echo "export JASPERINC=$DIR/grib2/include" >> ~/.bashrc 109 | export JASPERLIB=$DIR/grib2/lib 110 | export JASPERINC=$DIR/grib2/include 111 | cd .. 112 | ######################################### 113 | # WRF Installation # 114 | ######################################### 115 | cd .. 116 | [ -d "WRF-${WRFversion}" ] && mv WRF-${WRFversion} WRF-${WRFversion}-old 117 | [ -f "v${WRFversion}.tar.gz" ] && mv v${WRFversion}.tar.gz v${WRFversion}.tar.gz-old 118 | wget https://github.com/wrf-model/WRF/archive/v${WRFversion}.tar.gz 119 | mv v${WRFversion}.tar.gz WRFV${WRFversion}.tar.gz 120 | tar -zxvf WRFV${WRFversion}.tar.gz 121 | cd WRF-${WRFversion} 122 | if [ "$type" = "Chem" ]; then 123 | export WRF_CHEM=1 124 | export WRF_KPP=1 125 | elif [ "$type" = "NMM" ]; then 126 | export WRF_NMM_CORE=1 127 | export wrf_core=NMM_CORE 128 | fi 129 | sed -i 's# export USENETCDF=$USENETCDF.*# export USENETCDF="-lnetcdf"#' configure 130 | sed -i 's# export USENETCDFF=$USENETCDFF.*# export USENETCDFF="-lnetcdff"#' configure 131 | cd arch 132 | cp Config.pl Config.pl_backup 133 | sed -i '420s/.*/ $response = 34 ;/' Config.pl 134 | sed -i '695s/.*/ $response = 1 ;/' Config.pl 135 | cd .. 136 | ./configure 137 | gfortversion=$(gfortran -dumpversion | cut -c1) 138 | if [ "$gfortversion" -lt 8 ] && [ "$gfortversion" -ge 6 ]; then 139 | sed -i '/-DBUILD_RRTMG_FAST=1/d' configure.wrf 140 | fi 141 | if [ "$type" = "NMM" ]; then 142 | logsave compile.log ./compile nmm_real 143 | else 144 | logsave compile.log ./compile em_real 145 | fi 146 | cd arch 147 | cp Config.pl_backup Config.pl 148 | cd .. 149 | if [ -n "$(grep "Problems building executables, look for errors in the build log" compile.log)" ]; then 150 | echo "Sorry, There were some errors while installing WRF." 151 | echo "Please create new issue for the problem, https://github.com/bakamotokatas/WRF-Install-Script/issues" 152 | exit 153 | fi 154 | cd .. 155 | [ -d "WRF-${WRFversion}-${type}" ] && mv WRF-${WRFversion}-${type} WRF-${WRFversion}-${type}-old 156 | mv WRF-${WRFversion} WRF-${WRFversion}-${type} 157 | ######################################### 158 | # WPS Installation # 159 | ######################################### 160 | WPSversion="4.3.1" 161 | [ -d "WPS-${WPSversion}" ] && mv WPS-${WPSversion} WPS-${WPSversion}-old 162 | [ -f "v${WPSversion}.tar.gz" ] && mv v${WPSversion}.tar.gz v${WPSversion}.tar.gz-old 163 | wget https://github.com/wrf-model/WPS/archive/v${WPSversion}.tar.gz 164 | mv v${WPSversion}.tar.gz WPSV${WPSversion}.TAR.gz 165 | tar -zxvf WPSV${WPSversion}.TAR.gz 166 | cd WPS-${WPSversion} 167 | cd arch 168 | cp Config.pl Config.pl_backup 169 | sed -i '141s/.*/ $response = 3 ;/' Config.pl 170 | cd .. 171 | ./clean 172 | sed -i '133s/.*/ NETCDFF="-lnetcdff"/' configure 173 | sed -i "165s/.*/standard_wrf_dirs=\"WRF-${WRFversion}-${type} WRF WRF-4.0.3 WRF-4.0.2 WRF-4.0.1 WRF-4.0 WRFV3\"/" configure 174 | ./configure 175 | logsave compile.log ./compile 176 | sed -i "s# geog_data_path.*# geog_data_path = '../WPS_GEOG/'#" namelist.wps 177 | cd arch 178 | cp Config.pl_backup Config.pl 179 | cd .. 180 | cd .. 181 | ######################################### 182 | # Opening Geog Data Files # 183 | ######################################### 184 | if [ -d "WPS_GEOG" ]; then 185 | echo "WRF and WPS are installed successfully" 186 | echo "Directory WPS_GEOG is already exists." 187 | echo "Do you want WPS_GEOG files to be redownloaded and reexracted?" 188 | echo "please type yes or no" 189 | read GEOG_validation 190 | if [ ${GEOG_validation} = "yes" ]; then 191 | wget http://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz 192 | tar -zxvf geog_high_res_mandatory.tar.gz 193 | else 194 | echo "You can download it later from http://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz and extract it" 195 | fi 196 | else 197 | wget http://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz 198 | tar -zxvf geog_high_res_mandatory.tar.gz 199 | fi 200 | if [ "$type" = "Chem" ]; then 201 | cd WPS_GEOG 202 | Chem_Geog="modis_landuse_21class_30s soiltype_top_2m soiltype_bot_2m albedo_ncep maxsnowalb erod clayfrac_5m sandfrac_5m" 203 | for i in ${Chem_Geog}; do 204 | if [ ! -d $i ]; then 205 | echo $i 206 | wget https://www2.mmm.ucar.edu/wrf/src/wps_files/${i}.tar.bz2 207 | tar -xvf ${i}.tar.bz2 208 | rm ${i}.tar.bz2 209 | fi 210 | done 211 | fi 212 | ########################################################## 213 | # End # 214 | ########################################################## 215 | echo "Installation has completed" 216 | exec bash 217 | exit 218 | -------------------------------------------------------------------------------- /WRF4.3.3_Install.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ######################################################### 3 | # WRF Install Script # 4 | # This Script was written by Umur Dinç # 5 | # To execute this script "bash WRF4.3.3_Install.bash" # 6 | ######################################################### 7 | WRFversion="4.3.3" 8 | type="ARW" 9 | if [ -n "$1" ]; then 10 | if [ "$1" = "-chem" ]; then 11 | type="Chem" 12 | elif [ "$1" = "-nmm" ]; then 13 | type="NMM" 14 | elif [ "$1" = "-arw" ]; then 15 | type="ARW" 16 | else 17 | echo "Unrecognized option, please run as" 18 | echo "For WRF-ARW \"bash WRF${WRFversion}_Install.bash -arw\"" 19 | echo "For WRF-Chem \"bash WRF${WRFversion}_Install.bash -chem\"" 20 | echo "For WRF-NMM \"bash WRF${WRFversion}_Install.bash -nmm\"" 21 | exit 22 | fi 23 | fi 24 | echo "Welcome! This Script will install the WRF${WRFversion}-${type}" 25 | echo "Installation may take several hours and it takes 52 GB storage. Be sure that you have enough time and storage." 26 | ######################################################### 27 | # Controls # 28 | ######################################################### 29 | osbit=$(uname -m) 30 | if [ "$osbit" = "x86_64" ]; then 31 | echo "64 bit operating system is used" 32 | else 33 | echo "Sorry! This script was written for 64 bit operating systems." 34 | exit 35 | fi 36 | ######## 37 | packagemanagement=$(which apt) 38 | if [ -n "$packagemanagement" ]; then 39 | echo "Operating system uses apt packagemanagement" 40 | else 41 | echo "Sorry! This script is written for the operating systems which uses apt packagemanagement. Please try this script with debian based operating systems, such as, Ubuntu, Linux Mint, Debian, Pardus etc." 42 | #Tested on Ubuntu 20.04 43 | exit 44 | fi 45 | local_language=$(locale | grep LANG | grep tr_TR) 46 | if [ -n "$local_language" ]; then 47 | echo "Merhaba, WRF modelinin kodundaki hatadan dolayı, WRF kurulumu işletim sistemi dili Türkçe olduğunda, Türkçedeki i ve ı harflerinin farklı olması sebebiyle hata vermektedir. Lütfen işletim sisteminizin dilini başka bir dile çevirip yeniden çalıştırınız. Kurulum bittikten sonra işletim sistemi dilini tekrar Türkçe'ye çevirebilirsiniz." 48 | exit 49 | fi 50 | ######################################################### 51 | # Installing neccesary packages # 52 | ######################################################### 53 | if [ "$type" = "Chem" ]; then 54 | extra_packages="flex-old bison" 55 | fi 56 | echo "Please enter your sudo password, so necessary packages can be installed." 57 | sudo apt-get update 58 | mpich_repoversion=$(apt-cache policy mpich | grep Candidate | cut -d ':' -f 2 | cut -d '-' -f 1 | cut -c2) 59 | if [ "$mpich_repoversion" -ge 4 ]; then 60 | mpirun_packages="libopenmpi-dev libhdf5-openmpi-dev" 61 | else 62 | mpirun_packages="mpich libhdf5-mpich-dev" 63 | fi 64 | sudo apt-get install -y build-essential csh gfortran m4 curl perl ${mpirun_packages} libpng-dev netcdf-bin libnetcdff-dev ${extra_packages} 65 | 66 | package4checks="build-essential csh gfortran m4 curl perl ${mpirun_packages} libpng-dev netcdf-bin libnetcdff-dev ${extra_packages}" 67 | for packagecheck in ${package4checks}; do 68 | packagechecked=$(dpkg-query --show --showformat='${db:Status-Status}\n' $packagecheck | grep not-installed) 69 | if [ "$packagechecked" = "not-installed" ]; then 70 | echo $packagecheck "$packagechecked" 71 | packagesnotinstalled=yes 72 | fi 73 | done 74 | if [ "$packagesnotinstalled" = "yes" ]; then 75 | echo "Some packages were not installed, please re-run the script and enter your root password, when it is requested." 76 | exit 77 | fi 78 | ######################################### 79 | cd ~ 80 | mkdir Build_WRF 81 | cd Build_WRF 82 | mkdir LIBRARIES 83 | cd LIBRARIES 84 | echo "" >> ~/.bashrc 85 | bashrc_exports=("#WRF Variables" "export DIR=$(pwd)" "export CC=gcc" "export CXX=g++" "export FC=gfortran" "export FCFLAGS=-m64" "export F77=gfortran" "export FFLAGS=-m64" 86 | "export NETCDF=/usr" "export HDF5=/usr/lib/x86_64-linux-gnu/hdf5/serial" "export LDFLAGS="\""-L/usr/lib/x86_64-linux-gnu/hdf5/serial/ -L/usr/lib"\""" 87 | "export CPPFLAGS="\""-I/usr/include/hdf5/serial/ -I/usr/include"\""" "export LD_LIBRARY_PATH=/usr/lib") 88 | for bashrc_export in "${bashrc_exports[@]}" ; do 89 | [[ -z $(grep "${bashrc_export}" ~/.bashrc) ]] && echo "${bashrc_export}" >> ~/.bashrc 90 | done 91 | DIR=$(pwd) 92 | export CC=gcc 93 | export CXX=g++ 94 | export FC=gfortran 95 | export FCFLAGS=-m64 96 | export F77=gfortran 97 | export FFLAGS=-m64 98 | export NETCDF=/usr 99 | export HDF5=/usr/lib/x86_64-linux-gnu/hdf5/serial 100 | export LDFLAGS="-L/usr/lib/x86_64-linux-gnu/hdf5/serial/ -L/usr/lib" 101 | export CPPFLAGS="-I/usr/include/hdf5/serial/ -I/usr/include" 102 | export LD_LIBRARY_PATH=/usr/lib 103 | if [ "$type" = "Chem" ]; then 104 | [[ -z $(grep "export FLEX_LIB_DIR=/usr/lib" ~/.bashrc) ]] && echo "export FLEX_LIB_DIR=/usr/lib" >> ~/.bashrc 105 | [[ -z $(grep "export YACC='yacc -d'" ~/.bashrc) ]] && echo "export YACC='yacc -d'" >> ~/.bashrc 106 | export FLEX_LIB_DIR=/usr/lib 107 | export YACC='yacc -d' 108 | fi 109 | ########################################## 110 | # Jasper Installation # 111 | ######################################### 112 | [ -d "jasper-1.900.1" ] && mv jasper-1.900.1 jasper-1.900.1-old 113 | [ -f "jasper-1.900.1.tar.gz" ] && mv jasper-1.900.1.tar.gz jasper-1.900.1.tar.gz-old 114 | wget http://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/jasper-1.900.1.tar.gz 115 | tar -zxvf jasper-1.900.1.tar.gz 116 | cd jasper-1.900.1/ 117 | ./configure --prefix=$DIR/grib2 118 | make 119 | make install 120 | echo "export JASPERLIB=$DIR/grib2/lib" >> ~/.bashrc 121 | echo "export JASPERINC=$DIR/grib2/include" >> ~/.bashrc 122 | export JASPERLIB=$DIR/grib2/lib 123 | export JASPERINC=$DIR/grib2/include 124 | cd .. 125 | ######################################### 126 | # WRF Installation # 127 | ######################################### 128 | cd .. 129 | [ -d "WRF-${WRFversion}" ] && mv WRF-${WRFversion} WRF-${WRFversion}-old 130 | [ -f "v${WRFversion}.tar.gz" ] && mv v${WRFversion}.tar.gz v${WRFversion}.tar.gz-old 131 | wget https://github.com/wrf-model/WRF/archive/v${WRFversion}.tar.gz 132 | mv v${WRFversion}.tar.gz WRFV${WRFversion}.tar.gz 133 | tar -zxvf WRFV${WRFversion}.tar.gz 134 | cd WRF-${WRFversion} 135 | if [ "$type" = "Chem" ]; then 136 | export WRF_CHEM=1 137 | export WRF_KPP=1 138 | elif [ "$type" = "NMM" ]; then 139 | export WRF_NMM_CORE=1 140 | export wrf_core=NMM_CORE 141 | fi 142 | sed -i 's# export USENETCDF=$USENETCDF.*# export USENETCDF="-lnetcdf"#' configure 143 | sed -i 's# export USENETCDFF=$USENETCDFF.*# export USENETCDFF="-lnetcdff"#' configure 144 | cd arch 145 | cp Config.pl Config.pl_backup 146 | sed -i '420s/.*/ $response = 34 ;/' Config.pl 147 | sed -i '695s/.*/ $response = 1 ;/' Config.pl 148 | cd .. 149 | ./configure 150 | gfortversion=$(gfortran -dumpversion | cut -c1) 151 | if [ "$gfortversion" -lt 8 ] && [ "$gfortversion" -ge 6 ]; then 152 | sed -i '/-DBUILD_RRTMG_FAST=1/d' configure.wrf 153 | fi 154 | if [ "$type" = "NMM" ]; then 155 | logsave compile.log ./compile nmm_real 156 | else 157 | logsave compile.log ./compile em_real 158 | fi 159 | cd arch 160 | cp Config.pl_backup Config.pl 161 | cd .. 162 | if [ -n "$(grep "Problems building executables, look for errors in the build log" compile.log)" ]; then 163 | echo "Sorry, There were some errors while installing WRF." 164 | echo "Please create new issue for the problem, https://github.com/bakamotokatas/WRF-Install-Script/issues" 165 | exit 166 | fi 167 | cd .. 168 | [ -d "WRF-${WRFversion}-${type}" ] && mv WRF-${WRFversion}-${type} WRF-${WRFversion}-${type}-old 169 | mv WRF-${WRFversion} WRF-${WRFversion}-${type} 170 | ######################################### 171 | # WPS Installation # 172 | ######################################### 173 | WPSversion="4.3.1" 174 | [ -d "WPS-${WPSversion}" ] && mv WPS-${WPSversion} WPS-${WPSversion}-old 175 | [ -f "v${WPSversion}.tar.gz" ] && mv v${WPSversion}.tar.gz v${WPSversion}.tar.gz-old 176 | wget https://github.com/wrf-model/WPS/archive/v${WPSversion}.tar.gz 177 | mv v${WPSversion}.tar.gz WPSV${WPSversion}.TAR.gz 178 | tar -zxvf WPSV${WPSversion}.TAR.gz 179 | cd WPS-${WPSversion} 180 | cd arch 181 | cp Config.pl Config.pl_backup 182 | sed -i '141s/.*/ $response = 3 ;/' Config.pl 183 | cd .. 184 | ./clean 185 | sed -i '133s/.*/ NETCDFF="-lnetcdff"/' configure 186 | sed -i "165s/.*/standard_wrf_dirs=\"WRF-${WRFversion}-${type} WRF WRF-4.0.3 WRF-4.0.2 WRF-4.0.1 WRF-4.0 WRFV3\"/" configure 187 | ./configure 188 | logsave compile.log ./compile 189 | sed -i "s# geog_data_path.*# geog_data_path = '../WPS_GEOG/'#" namelist.wps 190 | cd arch 191 | cp Config.pl_backup Config.pl 192 | cd .. 193 | cd .. 194 | ######################################### 195 | # Opening Geog Data Files # 196 | ######################################### 197 | if [ -d "WPS_GEOG" ]; then 198 | echo "WRF and WPS are installed successfully" 199 | echo "Directory WPS_GEOG is already exists." 200 | echo "Do you want WPS_GEOG files to be redownloaded and reexracted?" 201 | echo "please type yes or no" 202 | read GEOG_validation 203 | if [ ${GEOG_validation} = "yes" ]; then 204 | wget http://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz 205 | tar -zxvf geog_high_res_mandatory.tar.gz 206 | else 207 | echo "You can download it later from http://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz and extract it" 208 | fi 209 | else 210 | wget http://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz 211 | tar -zxvf geog_high_res_mandatory.tar.gz 212 | fi 213 | if [ "$type" = "Chem" ]; then 214 | cd WPS_GEOG 215 | Chem_Geog="modis_landuse_21class_30s soiltype_top_2m soiltype_bot_2m albedo_ncep maxsnowalb erod clayfrac_5m sandfrac_5m" 216 | for i in ${Chem_Geog}; do 217 | if [ ! -d $i ]; then 218 | echo $i 219 | wget https://www2.mmm.ucar.edu/wrf/src/wps_files/${i}.tar.bz2 220 | tar -xvf ${i}.tar.bz2 221 | rm ${i}.tar.bz2 222 | fi 223 | done 224 | cd .. 225 | fi 226 | ####################################### 227 | # PREP_CHEM_SRC # 228 | ####################################### 229 | if [ "$type" = "Chem" ]; then 230 | echo "Do you want the PREP-CHEM-SRC program to be installed? PREP-CHEM-SRC is a widely used emission preparation program for WRF-Chem." 231 | echo "please type yes or no" 232 | read prep_chem_validation 233 | if [ ${prep_chem_validation} = "yes" ]; then 234 | echo "firstly starting to compile convert_emiss.exe. convert_emiss.exe is needed for convert emissions which are created from PREP-CHEM-SRC." 235 | cd WRF-${WRFversion}-${type} 236 | logsave convert_emi.log ./compile emi_conv 237 | cd .. 238 | echo "Compilation of convert_emiss.exe is finished, now PREP-CHEM-SRC download and compilation has started." 239 | [ -d "PREP-CHEM-SRC-1.5" ] && mv PREP-CHEM-SRC-1.5 PREP-CHEM-SRC-1.5-old 240 | [ -f "prep_chem_sources_v1.5_24aug2015.tar.gz" ] && mv prep_chem_sources_v1.5_24aug2015.tar.gz prep_chem_sources_v1.5_24aug2015.tar.gz-old 241 | wget ftp://aftp.fsl.noaa.gov/divisions/taq/global_emissions/prep_chem_sources_v1.5_24aug2015.tar.gz 242 | tar -zxvf prep_chem_sources_v1.5_24aug2015.tar.gz 243 | cd PREP-CHEM-SRC-1.5/bin/build 244 | sed -i "s#NETCDF=.*#NETCDF=/usr#" include.mk.gfortran.wrf 245 | sed -i 's#-L$(NETCDF)/lib#-L/usr/lib/x86_64-linux-gnu#' include.mk.gfortran.wrf 246 | sed -i "s#HDF5=.*#HDF5=/usr/lib/x86_64-linux-gnu/hdf5/serial#" include.mk.gfortran.wrf 247 | sed -i "s#HDF5_INC=.*#HDF5_INC=-I/usr/include/hdf5/serial#" include.mk.gfortran.wrf 248 | sed -i 's#-L$(HDF5)/lib#-L/usr/lib/x86_64-linux-gnu/hdf5/serial#' include.mk.gfortran.wrf 249 | sed -i "s#-L/scratchin/grupos/catt-brams/shared/libs/gfortran/zlib-1.2.8/lib#-L/usr/lib#" include.mk.gfortran.wrf 250 | sed -i "842s#.*# 'ENERGY ',\&#" ../../src/edgar_emissions.f90 251 | sed -i "843s#.*# 'INDUSTRY ',\&#" ../../src/edgar_emissions.f90 252 | sed -i "845s#.*# 'TRANSPORT '/)#" ../../src/edgar_emissions.f90 253 | make OPT=gfortran.wrf CHEM=RADM_WRF_FIM 254 | cd .. 255 | mkdir datain 256 | cd datain 257 | wget ftp://aftp.fsl.noaa.gov/divisions/taq/global_emissions/global_emissions_v3_24aug2015.tar.gz 258 | tar -zxvf global_emissions_v3_24aug2015.tar.gz 259 | mv Global_emissions_v3/* . 260 | rm -r Global_emissions_v3 261 | mv Emission_data/ EMISSION_DATA 262 | mv surface_data/ SURFACE_DATA 263 | cd ../../.. 264 | echo "PREP-CHEM-SRC compilation has finished." 265 | fi 266 | fi 267 | ########################################################## 268 | # End # 269 | ########################################################## 270 | echo "Installation has completed" 271 | exec bash 272 | exit 273 | -------------------------------------------------------------------------------- /WRF4.3_Install.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ######################################################### 3 | # WRF Install Script # 4 | # This Script was written by Umur Dinç # 5 | # To execute this script "bash WRF4.3_Install.bash" # 6 | ######################################################### 7 | WRFversion="4.3" 8 | type="ARW" 9 | if [ -n "$1" ]; then 10 | if [ "$1" = "-chem" ]; then 11 | type="Chem" 12 | extra_packages="flex-old bison" 13 | elif [ "$1" = "-nmm" ]; then 14 | type="NMM" 15 | elif [ "$1" = "-arw" ]; then 16 | type="ARW" 17 | else 18 | echo "Unrecognized option, please run as" 19 | echo "For WRF-ARW \"bash WRF${WRFversion}_Install.bash -arw\"" 20 | echo "For WRF-Chem \"bash WRF${WRFversion}_Install.bash -chem\"" 21 | echo "For WRF-NMM \"bash WRF${WRFversion}_Install.bash -nmm\"" 22 | exit 23 | fi 24 | fi 25 | echo "Welcome! This Script will install the WRF${WRFversion}-${type}" 26 | echo "Installation may take several hours and it takes 52 GB storage. Be sure that you have enough time and storage." 27 | ######################################################### 28 | # Controls # 29 | ######################################################### 30 | osbit=$(uname -m) 31 | if [ "$osbit" = "x86_64" ]; then 32 | echo "64 bit operating system is used" 33 | else 34 | echo "Sorry! This script was written for 64 bit operating systems." 35 | exit 36 | fi 37 | ######## 38 | packagemanagement=$(which apt) 39 | if [ -n "$packagemanagement" ]; then 40 | echo "Operating system uses apt packagemanagement" 41 | else 42 | echo "Sorry! This script is written for the operating systems which uses apt packagemanagement. Please try this script with debian based operating systems, such as, Ubuntu, Linux Mint, Debian, Pardus etc." 43 | #Tested on Linux Mint 19.3 and Linux Mint 20.1 44 | exit 45 | fi 46 | ######################################################### 47 | # Installing neccesary packages # 48 | ######################################################### 49 | echo "Please enter your sudo password, so necessary packages can be installed." 50 | sudo apt-get update 51 | sudo apt-get install -y build-essential csh gfortran m4 curl perl mpich libhdf5-mpich-dev libpng-dev netcdf-bin libnetcdff-dev ${extra_packages} 52 | 53 | package4checks="build-essential csh gfortran m4 curl perl mpich libhdf5-mpich-dev libpng-dev netcdf-bin libnetcdff-dev ${extra_packages}" 54 | for packagecheck in ${package4checks}; do 55 | packagechecked=$(dpkg-query --show --showformat='${db:Status-Status}\n' $packagecheck | grep not-installed) 56 | if [ "$packagechecked" = "not-installed" ]; then 57 | echo $packagecheck "$packagechecked" 58 | packagesnotinstalled=yes 59 | fi 60 | done 61 | if [ "$packagesnotinstalled" = "yes" ]; then 62 | echo "Some packages were not installed, please re-run the script and enter your root password, when it is requested." 63 | exit 64 | fi 65 | ######################################### 66 | cd ~ 67 | mkdir Build_WRF 68 | cd Build_WRF 69 | mkdir LIBRARIES 70 | cd LIBRARIES 71 | echo "" >> ~/.bashrc 72 | bashrc_exports=("#WRF Variables" "export DIR=$(pwd)" "export CC=gcc" "export CXX=g++" "export FC=gfortran" "export FCFLAGS=-m64" "export F77=gfortran" "export FFLAGS=-m64" 73 | "export NETCDF=/usr" "export HDF5=/usr/lib/x86_64-linux-gnu/hdf5/serial" "export LDFLAGS="\""-L/usr/lib/x86_64-linux-gnu/hdf5/serial/ -L/usr/lib"\""" 74 | "export CPPFLAGS="\""-I/usr/include/hdf5/serial/ -I/usr/include"\""" "export LD_LIBRARY_PATH=/usr/lib") 75 | for bashrc_export in "${bashrc_exports[@]}" ; do 76 | [[ -z $(grep "${bashrc_export}" ~/.bashrc) ]] && echo "${bashrc_export}" >> ~/.bashrc 77 | done 78 | DIR=$(pwd) 79 | export CC=gcc 80 | export CXX=g++ 81 | export FC=gfortran 82 | export FCFLAGS=-m64 83 | export F77=gfortran 84 | export FFLAGS=-m64 85 | export NETCDF=/usr 86 | export HDF5=/usr/lib/x86_64-linux-gnu/hdf5/serial 87 | export LDFLAGS="-L/usr/lib/x86_64-linux-gnu/hdf5/serial/ -L/usr/lib" 88 | export CPPFLAGS="-I/usr/include/hdf5/serial/ -I/usr/include" 89 | export LD_LIBRARY_PATH=/usr/lib 90 | if [ "$type" = "Chem" ]; then 91 | echo "export FLEX_LIB_DIR=/usr/lib" >> ~/.bashrc 92 | echo "export YACC='yacc -d'" >> ~/.bashrc 93 | export FLEX_LIB_DIR=/usr/lib 94 | export YACC='yacc -d' 95 | fi 96 | ########################################## 97 | # Jasper Installation # 98 | ######################################### 99 | [ -d "jasper-1.900.1" ] && mv jasper-1.900.1 jasper-1.900.1-old 100 | [ -f "jasper-1.900.1.tar.gz" ] && mv jasper-1.900.1.tar.gz jasper-1.900.1.tar.gz-old 101 | wget http://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/jasper-1.900.1.tar.gz 102 | tar -zxvf jasper-1.900.1.tar.gz 103 | cd jasper-1.900.1/ 104 | ./configure --prefix=$DIR/grib2 105 | make 106 | make install 107 | echo "export JASPERLIB=$DIR/grib2/lib" >> ~/.bashrc 108 | echo "export JASPERINC=$DIR/grib2/include" >> ~/.bashrc 109 | export JASPERLIB=$DIR/grib2/lib 110 | export JASPERINC=$DIR/grib2/include 111 | cd .. 112 | ######################################### 113 | # WRF Installation # 114 | ######################################### 115 | cd .. 116 | [ -d "WRF-${WRFversion}" ] && mv WRF-${WRFversion} WRF-${WRFversion}-old 117 | [ -f "v${WRFversion}.tar.gz" ] && mv v${WRFversion}.tar.gz v${WRFversion}.tar.gz-old 118 | wget https://github.com/wrf-model/WRF/archive/v${WRFversion}.tar.gz 119 | mv v${WRFversion}.tar.gz WRFV${WRFversion}.tar.gz 120 | tar -zxvf WRFV${WRFversion}.tar.gz 121 | cd WRF-${WRFversion} 122 | if [ "$type" = "Chem" ]; then 123 | export WRF_CHEM=1 124 | export WRF_KPP=1 125 | elif [ "$type" = "NMM" ]; then 126 | export WRF_NMM_CORE=1 127 | export wrf_core=NMM_CORE 128 | fi 129 | sed -i 's# export USENETCDF=$USENETCDF.*# export USENETCDF="-lnetcdf"#' configure 130 | sed -i 's# export USENETCDFF=$USENETCDFF.*# export USENETCDFF="-lnetcdff"#' configure 131 | cd arch 132 | cp Config.pl Config.pl_backup 133 | sed -i '420s/.*/ $response = 34 ;/' Config.pl 134 | sed -i '695s/.*/ $response = 1 ;/' Config.pl 135 | cd .. 136 | ./configure 137 | gfortversion=$(gfortran -dumpversion | cut -c1) 138 | if [ "$gfortversion" -lt 8 ] && [ "$gfortversion" -ge 6 ]; then 139 | sed -i '/-DBUILD_RRTMG_FAST=1/d' configure.wrf 140 | fi 141 | if [ "$type" = "NMM" ]; then 142 | logsave compile.log ./compile nmm_real 143 | else 144 | logsave compile.log ./compile em_real 145 | fi 146 | cd arch 147 | cp Config.pl_backup Config.pl 148 | cd .. 149 | if [ -n "$(grep "Problems building executables, look for errors in the build log" compile.log)" ]; then 150 | echo "Sorry, There were some errors while installing WRF." 151 | echo "Please create new issue for the problem, https://github.com/bakamotokatas/WRF-Install-Script/issues" 152 | exit 153 | fi 154 | cd .. 155 | [ -d "WRF-${WRFversion}-${type}" ] && mv WRF-${WRFversion}-${type} WRF-${WRFversion}-${type}-old 156 | mv WRF-${WRFversion} WRF-${WRFversion}-${type} 157 | ######################################### 158 | # WPS Installation # 159 | ######################################### 160 | WPSversion="4.3" 161 | [ -d "WPS-${WPSversion}" ] && mv WPS-${WPSversion} WPS-${WPSversion}-old 162 | [ -f "v${WPSversion}.tar.gz" ] && mv v${WPSversion}.tar.gz v${WPSversion}.tar.gz-old 163 | wget https://github.com/wrf-model/WPS/archive/v${WPSversion}.tar.gz 164 | mv v${WPSversion}.tar.gz WPSV${WPSversion}.TAR.gz 165 | tar -zxvf WPSV${WPSversion}.TAR.gz 166 | cd WPS-${WPSversion} 167 | cd arch 168 | cp Config.pl Config.pl_backup 169 | sed -i '141s/.*/ $response = 3 ;/' Config.pl 170 | cd .. 171 | ./clean 172 | sed -i '133s/.*/ NETCDFF="-lnetcdff"/' configure 173 | sed -i "165s/.*/standard_wrf_dirs=\"WRF-${WRFversion}-${type} WRF WRF-4.0.3 WRF-4.0.2 WRF-4.0.1 WRF-4.0 WRFV3\"/" configure 174 | ./configure 175 | logsave compile.log ./compile 176 | sed -i "s# geog_data_path.*# geog_data_path = '../WPS_GEOG/'#" namelist.wps 177 | cd arch 178 | cp Config.pl_backup Config.pl 179 | cd .. 180 | cd .. 181 | ######################################### 182 | # Opening Geog Data Files # 183 | ######################################### 184 | if [ -d "WPS_GEOG" ]; then 185 | echo "WRF and WPS are installed successfully" 186 | echo "Directory WPS_GEOG is already exists." 187 | echo "Do you want WPS_GEOG files to be redownloaded and reexracted?" 188 | echo "please type yes or no" 189 | read GEOG_validation 190 | if [ ${GEOG_validation} = "yes" ]; then 191 | wget http://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz 192 | tar -zxvf geog_high_res_mandatory.tar.gz 193 | else 194 | echo "You can download it later from http://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz and extract it" 195 | fi 196 | else 197 | wget http://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz 198 | tar -zxvf geog_high_res_mandatory.tar.gz 199 | fi 200 | if [ "$type" = "Chem" ]; then 201 | cd WPS_GEOG 202 | Chem_Geog="modis_landuse_21class_30s soiltype_top_2m soiltype_bot_2m albedo_ncep maxsnowalb erod clayfrac_5m sandfrac_5m" 203 | for i in ${Chem_Geog}; do 204 | if [ ! -d $i ]; then 205 | echo $i 206 | wget https://www2.mmm.ucar.edu/wrf/src/wps_files/${i}.tar.bz2 207 | tar -xvf ${i}.tar.bz2 208 | rm ${i}.tar.bz2 209 | fi 210 | done 211 | fi 212 | ########################################################## 213 | # End # 214 | ########################################################## 215 | echo "Installation has completed" 216 | exec bash 217 | exit 218 | -------------------------------------------------------------------------------- /WRF4.4.1_Install.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ######################################################### 3 | # WRF Install Script # 4 | # This Script was written by Umur Dinç # 5 | # To execute this script "bash WRF4.4.1_Install.bash" # 6 | ######################################################### 7 | WRFversion="4.4.1" 8 | type="ARW" 9 | if [ -n "$1" ]; then 10 | if [ "$1" = "-chem" ]; then 11 | type="Chem" 12 | elif [ "$1" = "-arw" ]; then 13 | type="ARW" 14 | elif [ "$1" = "-hydro" ]; then 15 | type="Hydro" 16 | else 17 | echo "Unrecognized option, please run as" 18 | echo "For WRF-ARW \"bash WRF${WRFversion}_Install.bash -arw\"" 19 | echo "For WRF-Chem \"bash WRF${WRFversion}_Install.bash -chem\"" 20 | echo "For WRF-Hydro \"bash WRF${WRFversion}_Install.bash -hydro\"" 21 | exit 22 | fi 23 | fi 24 | echo "Welcome! This Script will install the WRF${WRFversion}-${type}" 25 | echo "Installation may take several hours and it takes 52 GB storage. Be sure that you have enough time and storage." 26 | ######################################################### 27 | # Controls # 28 | ######################################################### 29 | osbit=$(uname -m) 30 | if [ "$osbit" = "x86_64" ]; then 31 | echo "64 bit operating system is used" 32 | else 33 | echo "Sorry! This script was written for 64 bit operating systems." 34 | exit 35 | fi 36 | ######## 37 | packagemanagement=$(which apt) 38 | if [ -n "$packagemanagement" ]; then 39 | echo "Operating system uses apt packagemanagement" 40 | else 41 | echo "Sorry! This script is written for the operating systems which uses apt packagemanagement. Please try this script with debian based operating systems, such as, Ubuntu, Linux Mint, Debian, Pardus etc." 42 | #Tested on Ubuntu 20.04 43 | exit 44 | fi 45 | local_language=$(locale | grep LANG | grep tr_TR) 46 | if [ -n "$local_language" ]; then 47 | echo "Merhaba, WRF modelinin kodundaki hatadan dolayı, WRF kurulumu işletim sistemi dili Türkçe olduğunda, Türkçedeki i ve ı harflerinin farklı olması sebebiyle hata vermektedir. Lütfen işletim sisteminizin dilini başka bir dile çevirip yeniden çalıştırınız. Kurulum bittikten sonra işletim sistemi dilini tekrar Türkçe'ye çevirebilirsiniz." 48 | exit 49 | fi 50 | ######################################################### 51 | # Installing neccesary packages # 52 | ######################################################### 53 | 54 | if [ "$type" = "Chem" ]; then 55 | extra_packages="flex-old bison" 56 | fi 57 | echo "Please enter your sudo password, so necessary packages can be installed." 58 | sudo apt-get update 59 | mpich_repoversion=$(apt-cache policy mpich | grep Candidate | cut -d ':' -f 2 | cut -d '-' -f 1 | cut -c2) 60 | if [ "$mpich_repoversion" -ge 4 ]; then 61 | mpirun_packages="libopenmpi-dev libhdf5-openmpi-dev" 62 | else 63 | mpirun_packages="mpich libhdf5-mpich-dev" 64 | fi 65 | sudo apt-get install -y build-essential csh gfortran m4 curl perl ${mpirun_packages} libpng-dev netcdf-bin libnetcdff-dev ${extra_packages} 66 | 67 | package4checks="build-essential csh gfortran m4 curl perl ${mpirun_packages} libpng-dev netcdf-bin libnetcdff-dev ${extra_packages}" 68 | for packagecheck in ${package4checks}; do 69 | packagechecked=$(dpkg-query --show --showformat='${db:Status-Status}\n' $packagecheck | grep not-installed) 70 | if [ "$packagechecked" = "not-installed" ]; then 71 | echo $packagecheck "$packagechecked" 72 | packagesnotinstalled=yes 73 | fi 74 | done 75 | if [ "$packagesnotinstalled" = "yes" ]; then 76 | echo "Some packages were not installed, please re-run the script and enter your root password, when it is requested." 77 | exit 78 | fi 79 | ######################################### 80 | cd ~ 81 | mkdir Build_WRF 82 | cd Build_WRF 83 | mkdir LIBRARIES 84 | cd LIBRARIES 85 | echo "" >> ~/.bashrc 86 | bashrc_exports=("#WRF Variables" "export DIR=$(pwd)" "export CC=gcc" "export CXX=g++" "export FC=gfortran" "export FCFLAGS=-m64" "export F77=gfortran" "export FFLAGS=-m64" 87 | "export NETCDF=/usr" "export HDF5=/usr/lib/x86_64-linux-gnu/hdf5/serial" "export LDFLAGS="\""-L/usr/lib/x86_64-linux-gnu/hdf5/serial/ -L/usr/lib"\""" 88 | "export CPPFLAGS="\""-I/usr/include/hdf5/serial/ -I/usr/include"\""" "export LD_LIBRARY_PATH=/usr/lib") 89 | for bashrc_export in "${bashrc_exports[@]}" ; do 90 | [[ -z $(grep "${bashrc_export}" ~/.bashrc) ]] && echo "${bashrc_export}" >> ~/.bashrc 91 | done 92 | DIR=$(pwd) 93 | export CC=gcc 94 | export CXX=g++ 95 | export FC=gfortran 96 | export FCFLAGS=-m64 97 | export F77=gfortran 98 | export FFLAGS=-m64 99 | export NETCDF=/usr 100 | export HDF5=/usr/lib/x86_64-linux-gnu/hdf5/serial 101 | export LDFLAGS="-L/usr/lib/x86_64-linux-gnu/hdf5/serial/ -L/usr/lib" 102 | export CPPFLAGS="-I/usr/include/hdf5/serial/ -I/usr/include" 103 | export LD_LIBRARY_PATH=/usr/lib 104 | if [ "$type" = "Chem" ]; then 105 | [[ -z $(grep "export FLEX_LIB_DIR=/usr/lib" ~/.bashrc) ]] && echo "export FLEX_LIB_DIR=/usr/lib" >> ~/.bashrc 106 | [[ -z $(grep "export YACC='yacc -d'" ~/.bashrc) ]] && echo "export YACC='yacc -d'" >> ~/.bashrc 107 | export FLEX_LIB_DIR=/usr/lib 108 | export YACC='yacc -d' 109 | fi 110 | ########################################## 111 | # Jasper Installation # 112 | ######################################### 113 | [ -d "jasper-1.900.1" ] && mv jasper-1.900.1 jasper-1.900.1-old 114 | [ -f "jasper-1.900.1.tar.gz" ] && mv jasper-1.900.1.tar.gz jasper-1.900.1.tar.gz-old 115 | wget http://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/jasper-1.900.1.tar.gz 116 | tar -zxvf jasper-1.900.1.tar.gz 117 | cd jasper-1.900.1/ 118 | ./configure --prefix=$DIR/grib2 119 | make 120 | make install 121 | echo "export JASPERLIB=$DIR/grib2/lib" >> ~/.bashrc 122 | echo "export JASPERINC=$DIR/grib2/include" >> ~/.bashrc 123 | export JASPERLIB=$DIR/grib2/lib 124 | export JASPERINC=$DIR/grib2/include 125 | cd .. 126 | ######################################### 127 | # WRF Installation # 128 | ######################################### 129 | cd .. 130 | [ -d "WRFV${WRFversion}" ] && mv WRFV${WRFversion} WRFV${WRFversion}-old 131 | [ -f "v${WRFversion}.tar.gz" ] && mv v${WRFversion}.tar.gz v${WRFversion}.tar.gz-old 132 | wget https://github.com/wrf-model/WRF/releases/download/v${WRFversion}/v${WRFversion}.tar.gz 133 | mv v${WRFversion}.tar.gz WRFV${WRFversion}.tar.gz 134 | tar -zxvf WRFV${WRFversion}.tar.gz 135 | if [ "$type" = "Hydro" ]; then 136 | export WRF_HYDRO=1 137 | [ -f "v5.2.0.tar.gz" ] && mv v5.2.0.tar.gz v5.2.0.tar.gz-old 138 | wget https://github.com/NCAR/wrf_hydro_nwm_public/archive/refs/tags/v5.2.0.tar.gz 139 | tar -zxvf v5.2.0.tar.gz 140 | /bin/cp -rf wrf_hydro_nwm_public-5.2.0/trunk/NDHMS/* WRFV${WRFversion}/hydro/ 141 | rm v5.2.0.tar.gz 142 | rm -r wrf_hydro_nwm_public-5.2.0 143 | fi 144 | cd WRFV${WRFversion} 145 | if [ "$type" = "Chem" ]; then 146 | export WRF_CHEM=1 147 | export WRF_KPP=1 148 | fi 149 | sed -i 's#$NETCDF/lib#$NETCDF/lib/x86_64-linux-gnu#g' configure 150 | cd arch 151 | cp Config.pl Config.pl_backup 152 | sed -i '428s/.*/ $response = 34 ;/' Config.pl 153 | sed -i '869s/.*/ $response = 1 ;/' Config.pl 154 | cd .. 155 | ./configure 156 | sed -i 's#-L/usr/lib -lnetcdff -lnetcdf#-L/usr/lib/x86_64-linux-gnu -lnetcdff -lnetcdf#g' configure.wrf 157 | gfortversion=$(gfortran -dumpversion | cut -c1) 158 | if [ "$gfortversion" -lt 8 ] && [ "$gfortversion" -ge 6 ]; then 159 | sed -i '/-DBUILD_RRTMG_FAST=1/d' configure.wrf 160 | fi 161 | logsave compile.log ./compile em_real 162 | cd arch 163 | cp Config.pl_backup Config.pl 164 | cd .. 165 | if [ -n "$(grep "Problems building executables, look for errors in the build log" compile.log)" ]; then 166 | echo "Sorry, There were some errors while installing WRF." 167 | echo "Please create new issue for the problem, https://github.com/bakamotokatas/WRF-Install-Script/issues" 168 | exit 169 | fi 170 | cd .. 171 | [ -d "WRF-${WRFversion}-${type}" ] && mv WRF-${WRFversion}-${type} WRF-${WRFversion}-${type}-old 172 | mv WRFV${WRFversion} WRF-${WRFversion}-${type} 173 | ######################################### 174 | # WPS Installation # 175 | ######################################### 176 | WPSversion="4.4" 177 | [ -d "WPS-${WPSversion}" ] && mv WPS-${WPSversion} WPS-${WPSversion}-old 178 | [ -f "v${WPSversion}.tar.gz" ] && mv v${WPSversion}.tar.gz v${WPSversion}.tar.gz-old 179 | wget https://github.com/wrf-model/WPS/archive/v${WPSversion}.tar.gz 180 | mv v${WPSversion}.tar.gz WPSV${WPSversion}.TAR.gz 181 | tar -zxvf WPSV${WPSversion}.TAR.gz 182 | cd WPS-${WPSversion} 183 | cd arch 184 | cp Config.pl Config.pl_backup 185 | sed -i '154s/.*/ $response = 3 ;/' Config.pl 186 | cd .. 187 | ./clean 188 | sed -i '141s/.*/ NETCDFF="-lnetcdff"/' configure 189 | sed -i "173s/.*/standard_wrf_dirs=\"WRF-${WRFversion}-${type} WRF WRF-4.0.3 WRF-4.0.2 WRF-4.0.1 WRF-4.0 WRFV3\"/" configure 190 | ./configure 191 | logsave compile.log ./compile 192 | sed -i "s# geog_data_path.*# geog_data_path = '../WPS_GEOG/'#" namelist.wps 193 | cd arch 194 | cp Config.pl_backup Config.pl 195 | cd .. 196 | cd .. 197 | ######################################### 198 | # Opening Geog Data Files # 199 | ######################################### 200 | if [ -d "WPS_GEOG" ]; then 201 | echo "WRF and WPS are installed successfully" 202 | echo "Directory WPS_GEOG is already exists." 203 | echo "Do you want WPS_GEOG files to be redownloaded and reexracted?" 204 | echo "please type yes or no" 205 | read GEOG_validation 206 | if [ ${GEOG_validation} = "yes" ]; then 207 | wget http://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz 208 | tar -zxvf geog_high_res_mandatory.tar.gz 209 | else 210 | echo "You can download it later from http://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz and extract it" 211 | fi 212 | else 213 | wget http://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz 214 | tar -zxvf geog_high_res_mandatory.tar.gz 215 | fi 216 | if [ "$type" = "Chem" ]; then 217 | cd WPS_GEOG 218 | Chem_Geog="modis_landuse_21class_30s soiltype_top_2m soiltype_bot_2m albedo_ncep maxsnowalb erod clayfrac_5m sandfrac_5m" 219 | for i in ${Chem_Geog}; do 220 | if [ ! -d $i ]; then 221 | echo $i 222 | wget https://www2.mmm.ucar.edu/wrf/src/wps_files/${i}.tar.bz2 223 | tar -xvf ${i}.tar.bz2 224 | rm ${i}.tar.bz2 225 | fi 226 | done 227 | cd .. 228 | fi 229 | ####################################### 230 | # PREP_CHEM_SRC # 231 | ####################################### 232 | if [ "$type" = "Chem" ]; then 233 | echo "Do you want the PREP-CHEM-SRC program to be installed? PREP-CHEM-SRC is a widely used emission preparation program for WRF-Chem." 234 | echo "please type yes or no" 235 | read prep_chem_validation 236 | if [ ${prep_chem_validation} = "yes" ]; then 237 | echo "firstly starting to compile convert_emiss.exe. convert_emiss.exe is needed for convert emissions which are created from PREP-CHEM-SRC." 238 | cd WRF-${WRFversion}-${type} 239 | logsave convert_emi.log ./compile emi_conv 240 | cd .. 241 | echo "Compilation of convert_emiss.exe is finished, now PREP-CHEM-SRC download and compilation has started." 242 | [ -d "PREP-CHEM-SRC-1.5" ] && mv PREP-CHEM-SRC-1.5 PREP-CHEM-SRC-1.5-old 243 | [ -f "prep_chem_sources_v1.5_24aug2015.tar.gz" ] && mv prep_chem_sources_v1.5_24aug2015.tar.gz prep_chem_sources_v1.5_24aug2015.tar.gz-old 244 | wget ftp://aftp.fsl.noaa.gov/divisions/taq/global_emissions/prep_chem_sources_v1.5_24aug2015.tar.gz 245 | tar -zxvf prep_chem_sources_v1.5_24aug2015.tar.gz 246 | cd PREP-CHEM-SRC-1.5/bin/build 247 | sed -i "s#NETCDF=.*#NETCDF=/usr#" include.mk.gfortran.wrf 248 | sed -i 's#-L$(NETCDF)/lib#-L/usr/lib/x86_64-linux-gnu#' include.mk.gfortran.wrf 249 | sed -i "s#HDF5=.*#HDF5=/usr/lib/x86_64-linux-gnu/hdf5/serial#" include.mk.gfortran.wrf 250 | sed -i "s#HDF5_INC=.*#HDF5_INC=-I/usr/include/hdf5/serial#" include.mk.gfortran.wrf 251 | sed -i 's#-L$(HDF5)/lib#-L/usr/lib/x86_64-linux-gnu/hdf5/serial#' include.mk.gfortran.wrf 252 | gfortversion=$(gfortran -dumpversion) 253 | if [ "$gfortversion" -ge 10 ]; then 254 | sed -i 's#F_OPTS=.*#F_OPTS= -Xpreprocessor -D$(CHEM) -O2 -fconvert=big-endian -frecord-marker=4 -fallow-argument-mismatch#' include.mk.gfortran.wrf 255 | fi 256 | sed -i "s#-L/scratchin/grupos/catt-brams/shared/libs/gfortran/zlib-1.2.8/lib#-L/usr/lib#" include.mk.gfortran.wrf 257 | sed -i "842s#.*# 'ENERGY ',\&#" ../../src/edgar_emissions.f90 258 | sed -i "843s#.*# 'INDUSTRY ',\&#" ../../src/edgar_emissions.f90 259 | sed -i "845s#.*# 'TRANSPORT '/)#" ../../src/edgar_emissions.f90 260 | make OPT=gfortran.wrf CHEM=RADM_WRF_FIM 261 | cd .. 262 | mkdir datain 263 | cd datain 264 | wget ftp://aftp.fsl.noaa.gov/divisions/taq/global_emissions/global_emissions_v3_24aug2015.tar.gz 265 | tar -zxvf global_emissions_v3_24aug2015.tar.gz 266 | mv Global_emissions_v3/* . 267 | rm -r Global_emissions_v3 268 | mv Emission_data/ EMISSION_DATA 269 | mv surface_data/ SURFACE_DATA 270 | cd ../../.. 271 | echo "PREP-CHEM-SRC compilation has finished." 272 | fi 273 | fi 274 | ########################################################## 275 | # End # 276 | ########################################################## 277 | echo "Installation has completed" 278 | exec bash 279 | exit 280 | Footer 281 | -------------------------------------------------------------------------------- /WRF4.4.2_Install.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ######################################################### 3 | # WRF Install Script # 4 | # This Script was written by Umur Dinç # 5 | # To execute this script "bash WRF4.4.2_Install.bash" # 6 | ######################################################### 7 | WRFversion="4.4.2" 8 | type="ARW" 9 | if [ -n "$1" ]; then 10 | if [ "$1" = "-chem" ]; then 11 | type="Chem" 12 | elif [ "$1" = "-arw" ]; then 13 | type="ARW" 14 | elif [ "$1" = "-hydro" ]; then 15 | type="Hydro" 16 | else 17 | echo "Unrecognized option, please run as" 18 | echo "For WRF-ARW \"bash WRF${WRFversion}_Install.bash -arw\"" 19 | echo "For WRF-Chem \"bash WRF${WRFversion}_Install.bash -chem\"" 20 | echo "For WRF-Hydro \"bash WRF${WRFversion}_Install.bash -hydro\"" 21 | exit 22 | fi 23 | fi 24 | echo "Welcome! This Script will install the WRF${WRFversion}-${type}" 25 | echo "Installation may take several hours and it takes 52 GB storage. Be sure that you have enough time and storage." 26 | ######################################################### 27 | # Controls # 28 | ######################################################### 29 | osbit=$(uname -m) 30 | if [ "$osbit" = "x86_64" ]; then 31 | echo "64 bit operating system is used" 32 | else 33 | echo "Sorry! This script was written for 64 bit operating systems." 34 | exit 35 | fi 36 | ######## 37 | packagemanagement=$(which apt) 38 | if [ -n "$packagemanagement" ]; then 39 | echo "Operating system uses apt packagemanagement" 40 | else 41 | echo "Sorry! This script is written for the operating systems which uses apt packagemanagement. Please try this script with debian based operating systems, such as, Ubuntu, Linux Mint, Debian, Pardus etc." 42 | #Tested on Ubuntu 20.04 43 | exit 44 | fi 45 | local_language=$(locale | grep LANG | grep tr_TR) 46 | if [ -n "$local_language" ]; then 47 | echo "Merhaba, WRF modelinin kodundaki hatadan dolayı, WRF kurulumu işletim sistemi dili Türkçe olduğunda, Türkçedeki i ve ı harflerinin farklı olması sebebiyle hata vermektedir. Lütfen işletim sisteminizin dilini başka bir dile çevirip yeniden çalıştırınız. Kurulum bittikten sonra işletim sistemi dilini tekrar Türkçe'ye çevirebilirsiniz." 48 | exit 49 | fi 50 | ######################################################### 51 | # Installing neccesary packages # 52 | ######################################################### 53 | 54 | if [ "$type" = "Chem" ]; then 55 | extra_packages="flex-old bison" 56 | fi 57 | echo "Please enter your sudo password, so necessary packages can be installed." 58 | sudo apt-get update 59 | mpich_repoversion=$(apt-cache policy mpich | grep Candidate | cut -d ':' -f 2 | cut -d '-' -f 1 | cut -c2) 60 | if [ "$mpich_repoversion" -ge 4 ]; then 61 | mpirun_packages="libopenmpi-dev libhdf5-openmpi-dev" 62 | else 63 | mpirun_packages="mpich libhdf5-mpich-dev" 64 | fi 65 | sudo apt-get install -y build-essential csh gfortran m4 curl perl ${mpirun_packages} libpng-dev netcdf-bin libnetcdff-dev ${extra_packages} 66 | 67 | package4checks="build-essential csh gfortran m4 curl perl ${mpirun_packages} libpng-dev netcdf-bin libnetcdff-dev ${extra_packages}" 68 | for packagecheck in ${package4checks}; do 69 | packagechecked=$(dpkg-query --show --showformat='${db:Status-Status}\n' $packagecheck | grep not-installed) 70 | if [ "$packagechecked" = "not-installed" ]; then 71 | echo $packagecheck "$packagechecked" 72 | packagesnotinstalled=yes 73 | fi 74 | done 75 | if [ "$packagesnotinstalled" = "yes" ]; then 76 | echo "Some packages were not installed, please re-run the script and enter your root password, when it is requested." 77 | exit 78 | fi 79 | ######################################### 80 | cd ~ 81 | mkdir Build_WRF 82 | cd Build_WRF 83 | mkdir LIBRARIES 84 | cd LIBRARIES 85 | echo "" >> ~/.bashrc 86 | bashrc_exports=("#WRF Variables" "export DIR=$(pwd)" "export CC=gcc" "export CXX=g++" "export FC=gfortran" "export FCFLAGS=-m64" "export F77=gfortran" "export FFLAGS=-m64" 87 | "export NETCDF=/usr" "export HDF5=/usr/lib/x86_64-linux-gnu/hdf5/serial" "export LDFLAGS="\""-L/usr/lib/x86_64-linux-gnu/hdf5/serial/ -L/usr/lib"\""" 88 | "export CPPFLAGS="\""-I/usr/include/hdf5/serial/ -I/usr/include"\""" "export LD_LIBRARY_PATH=/usr/lib") 89 | for bashrc_export in "${bashrc_exports[@]}" ; do 90 | [[ -z $(grep "${bashrc_export}" ~/.bashrc) ]] && echo "${bashrc_export}" >> ~/.bashrc 91 | done 92 | DIR=$(pwd) 93 | export CC=gcc 94 | export CXX=g++ 95 | export FC=gfortran 96 | export FCFLAGS=-m64 97 | export F77=gfortran 98 | export FFLAGS=-m64 99 | export NETCDF=/usr 100 | export HDF5=/usr/lib/x86_64-linux-gnu/hdf5/serial 101 | export LDFLAGS="-L/usr/lib/x86_64-linux-gnu/hdf5/serial/ -L/usr/lib" 102 | export CPPFLAGS="-I/usr/include/hdf5/serial/ -I/usr/include" 103 | export LD_LIBRARY_PATH=/usr/lib 104 | if [ "$type" = "Chem" ]; then 105 | [[ -z $(grep "export FLEX_LIB_DIR=/usr/lib" ~/.bashrc) ]] && echo "export FLEX_LIB_DIR=/usr/lib" >> ~/.bashrc 106 | [[ -z $(grep "export YACC='yacc -d'" ~/.bashrc) ]] && echo "export YACC='yacc -d'" >> ~/.bashrc 107 | export FLEX_LIB_DIR=/usr/lib 108 | export YACC='yacc -d' 109 | fi 110 | ########################################## 111 | # Jasper Installation # 112 | ######################################### 113 | [ -d "jasper-1.900.1" ] && mv jasper-1.900.1 jasper-1.900.1-old 114 | [ -f "jasper-1.900.1.tar.gz" ] && mv jasper-1.900.1.tar.gz jasper-1.900.1.tar.gz-old 115 | wget https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/jasper-1.900.1.tar.gz -O jasper-1.900.1.tar.gz 116 | tar -zxvf jasper-1.900.1.tar.gz 117 | cd jasper-1.900.1/ 118 | ./configure --prefix=$DIR/grib2 119 | make 120 | make install 121 | echo "export JASPERLIB=$DIR/grib2/lib" >> ~/.bashrc 122 | echo "export JASPERINC=$DIR/grib2/include" >> ~/.bashrc 123 | export JASPERLIB=$DIR/grib2/lib 124 | export JASPERINC=$DIR/grib2/include 125 | cd .. 126 | ######################################### 127 | # WRF Installation # 128 | ######################################### 129 | cd .. 130 | [ -d "WRF" ] && mv WRF WRF-old 131 | [ -d "WRFV${WRFversion}" ] && mv WRFV${WRFversion} WRFV${WRFversion}-old 132 | [ -f "v${WRFversion}.tar.gz" ] && mv v${WRFversion}.tar.gz v${WRFversion}.tar.gz-old 133 | wget https://github.com/wrf-model/WRF/releases/download/v${WRFversion}/v${WRFversion}.tar.gz -O WRFV${WRFversion}.tar.gz 134 | tar -zxvf WRFV${WRFversion}.tar.gz && mv WRF WRFV${WRFversion} 135 | if [ "$type" = "Hydro" ]; then 136 | export WRF_HYDRO=1 137 | [ -f "v5.2.0.tar.gz" ] && mv v5.2.0.tar.gz v5.2.0.tar.gz-old 138 | wget https://github.com/NCAR/wrf_hydro_nwm_public/archive/refs/tags/v5.2.0.tar.gz -O v5.2.0.tar.gz 139 | tar -zxvf v5.2.0.tar.gz 140 | /bin/cp -rf wrf_hydro_nwm_public-5.2.0/trunk/NDHMS/* WRFV${WRFversion}/hydro/ 141 | rm v5.2.0.tar.gz 142 | rm -r wrf_hydro_nwm_public-5.2.0 143 | fi 144 | cd WRFV${WRFversion} 145 | if [ "$type" = "Chem" ]; then 146 | export WRF_CHEM=1 147 | export WRF_KPP=1 148 | fi 149 | sed -i 's#$NETCDF/lib#$NETCDF/lib/x86_64-linux-gnu#g' configure 150 | cd arch 151 | cp Config.pl Config.pl_backup 152 | sed -i '428s/.*/ $response = 34 ;/' Config.pl 153 | sed -i '869s/.*/ $response = 1 ;/' Config.pl 154 | cd .. 155 | ./configure 156 | sed -i 's#-L/usr/lib -lnetcdff -lnetcdf#-L/usr/lib/x86_64-linux-gnu -lnetcdff -lnetcdf#g' configure.wrf 157 | gfortversion=$(gfortran -dumpversion | cut -c1) 158 | if [ "$gfortversion" -lt 8 ] && [ "$gfortversion" -ge 6 ]; then 159 | sed -i '/-DBUILD_RRTMG_FAST=1/d' configure.wrf 160 | fi 161 | logsave compile.log ./compile em_real 162 | cd arch 163 | cp Config.pl_backup Config.pl 164 | cd .. 165 | if [ -n "$(grep "Problems building executables, look for errors in the build log" compile.log)" ]; then 166 | echo "Sorry, There were some errors while installing WRF." 167 | echo "Please create new issue for the problem, https://github.com/bakamotokatas/WRF-Install-Script/issues" 168 | exit 169 | fi 170 | cd .. 171 | [ -d "WRF-${WRFversion}-${type}" ] && mv WRF-${WRFversion}-${type} WRF-${WRFversion}-${type}-old 172 | mv WRFV${WRFversion} WRF-${WRFversion}-${type} 173 | ######################################### 174 | # WPS Installation # 175 | ######################################### 176 | WPSversion="4.4" 177 | [ -d "WPS-${WPSversion}" ] && mv WPS-${WPSversion} WPS-${WPSversion}-old 178 | [ -f "v${WPSversion}.tar.gz" ] && mv v${WPSversion}.tar.gz v${WPSversion}.tar.gz-old 179 | wget https://github.com/wrf-model/WPS/archive/v${WPSversion}.tar.gz -O WPSV${WPSversion}.TAR.gz 180 | tar -zxvf WPSV${WPSversion}.TAR.gz 181 | cd WPS-${WPSversion} 182 | cd arch 183 | cp Config.pl Config.pl_backup 184 | sed -i '154s/.*/ $response = 3 ;/' Config.pl 185 | cd .. 186 | ./clean 187 | sed -i '141s/.*/ NETCDFF="-lnetcdff"/' configure 188 | sed -i "173s/.*/standard_wrf_dirs=\"WRF-${WRFversion}-${type} WRF WRF-4.0.3 WRF-4.0.2 WRF-4.0.1 WRF-4.0 WRFV3\"/" configure 189 | ./configure 190 | logsave compile.log ./compile 191 | sed -i "s# geog_data_path.*# geog_data_path = '../WPS_GEOG/'#" namelist.wps 192 | cd arch 193 | cp Config.pl_backup Config.pl 194 | cd .. 195 | cd .. 196 | ######################################### 197 | # Opening Geog Data Files # 198 | ######################################### 199 | if [ -d "WPS_GEOG" ]; then 200 | echo "WRF and WPS are installed successfully" 201 | echo "Directory WPS_GEOG is already exists." 202 | echo "Do you want WPS_GEOG files to be redownloaded and reexracted?" 203 | echo "please type yes or no" 204 | read GEOG_validation 205 | if [ ${GEOG_validation} = "yes" ]; then 206 | wget https://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz -O geog_high_res_mandatory.tar.gz 207 | tar -zxvf geog_high_res_mandatory.tar.gz 208 | else 209 | echo "You can download it later from http://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz and extract it" 210 | fi 211 | else 212 | wget https://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz -O geog_high_res_mandatory.tar.gz 213 | tar -zxvf geog_high_res_mandatory.tar.gz 214 | fi 215 | if [ "$type" = "Chem" ]; then 216 | cd WPS_GEOG 217 | Chem_Geog="modis_landuse_21class_30s soiltype_top_2m soiltype_bot_2m albedo_ncep maxsnowalb erod clayfrac_5m sandfrac_5m" 218 | for i in ${Chem_Geog}; do 219 | if [ ! -d $i ]; then 220 | echo $i 221 | wget https://www2.mmm.ucar.edu/wrf/src/wps_files/${i}.tar.bz2 -O ${i}.tar.bz2 222 | tar -xvf ${i}.tar.bz2 223 | rm ${i}.tar.bz2 224 | fi 225 | done 226 | cd .. 227 | fi 228 | ####################################### 229 | # PREP_CHEM_SRC # 230 | ####################################### 231 | if [ "$type" = "Chem" ]; then 232 | echo "Do you want the PREP-CHEM-SRC program to be installed? PREP-CHEM-SRC is a widely used emission preparation program for WRF-Chem." 233 | echo "please type yes or no" 234 | read prep_chem_validation 235 | if [ ${prep_chem_validation} = "yes" ]; then 236 | echo "firstly starting to compile convert_emiss.exe. convert_emiss.exe is needed for convert emissions which are created from PREP-CHEM-SRC." 237 | cd WRF-${WRFversion}-${type} 238 | logsave convert_emi.log ./compile emi_conv 239 | cd .. 240 | echo "Compilation of convert_emiss.exe is finished, now PREP-CHEM-SRC download and compilation has started." 241 | [ -d "PREP-CHEM-SRC-1.5" ] && mv PREP-CHEM-SRC-1.5 PREP-CHEM-SRC-1.5-old 242 | [ -f "prep_chem_sources_v1.5_24aug2015.tar.gz" ] && mv prep_chem_sources_v1.5_24aug2015.tar.gz prep_chem_sources_v1.5_24aug2015.tar.gz-old 243 | wget ftp://aftp.fsl.noaa.gov/divisions/taq/global_emissions/prep_chem_sources_v1.5_24aug2015.tar.gz -O prep_chem_sources_v1.5_24aug2015.tar.gz 244 | tar -zxvf prep_chem_sources_v1.5_24aug2015.tar.gz 245 | cd PREP-CHEM-SRC-1.5/bin/build 246 | sed -i "s#NETCDF=.*#NETCDF=/usr#" include.mk.gfortran.wrf 247 | sed -i 's#-L$(NETCDF)/lib#-L/usr/lib/x86_64-linux-gnu#' include.mk.gfortran.wrf 248 | sed -i "s#HDF5=.*#HDF5=/usr/lib/x86_64-linux-gnu/hdf5/serial#" include.mk.gfortran.wrf 249 | sed -i "s#HDF5_INC=.*#HDF5_INC=-I/usr/include/hdf5/serial#" include.mk.gfortran.wrf 250 | sed -i 's#-L$(HDF5)/lib#-L/usr/lib/x86_64-linux-gnu/hdf5/serial#' include.mk.gfortran.wrf 251 | gfortversion=$(gfortran -dumpversion) 252 | if [ "$gfortversion" -ge 10 ]; then 253 | sed -i 's#F_OPTS=.*#F_OPTS= -Xpreprocessor -D$(CHEM) -O2 -fconvert=big-endian -frecord-marker=4 -fallow-argument-mismatch#' include.mk.gfortran.wrf 254 | fi 255 | sed -i "s#-L/scratchin/grupos/catt-brams/shared/libs/gfortran/zlib-1.2.8/lib#-L/usr/lib#" include.mk.gfortran.wrf 256 | sed -i "842s#.*# 'ENERGY ',\&#" ../../src/edgar_emissions.f90 257 | sed -i "843s#.*# 'INDUSTRY ',\&#" ../../src/edgar_emissions.f90 258 | sed -i "845s#.*# 'TRANSPORT '/)#" ../../src/edgar_emissions.f90 259 | make OPT=gfortran.wrf CHEM=RADM_WRF_FIM 260 | cd .. 261 | mkdir datain 262 | cd datain 263 | wget ftp://aftp.fsl.noaa.gov/divisions/taq/global_emissions/global_emissions_v3_24aug2015.tar.gz -O global_emissions_v3_24aug2015.tar.gz 264 | tar -zxvf global_emissions_v3_24aug2015.tar.gz 265 | mv Global_emissions_v3/* . 266 | rm -r Global_emissions_v3 267 | mv Emission_data/ EMISSION_DATA 268 | mv surface_data/ SURFACE_DATA 269 | cd ../../.. 270 | echo "PREP-CHEM-SRC compilation has finished." 271 | fi 272 | fi 273 | ########################################################## 274 | # End # 275 | ########################################################## 276 | echo "Installation has completed" 277 | exec bash 278 | exit 279 | -------------------------------------------------------------------------------- /WRF4.4_Install.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ######################################################### 3 | # WRF Install Script # 4 | # This Script was written by Umur Dinç # 5 | # To execute this script "bash WRF4.4_Install.bash" # 6 | ######################################################### 7 | WRFversion="4.4" 8 | type="ARW" 9 | if [ -n "$1" ]; then 10 | if [ "$1" = "-chem" ]; then 11 | type="Chem" 12 | elif [ "$1" = "-arw" ]; then 13 | type="ARW" 14 | elif [ "$1" = "-hydro" ]; then 15 | type="Hydro" 16 | else 17 | echo "Unrecognized option, please run as" 18 | echo "For WRF-ARW \"bash WRF${WRFversion}_Install.bash -arw\"" 19 | echo "For WRF-Chem \"bash WRF${WRFversion}_Install.bash -chem\"" 20 | echo "For WRF-Hydro \"bash WRF${WRFversion}_Install.bash -hydro\"" 21 | exit 22 | fi 23 | fi 24 | echo "Welcome! This Script will install the WRF${WRFversion}-${type}" 25 | echo "Installation may take several hours and it takes 52 GB storage. Be sure that you have enough time and storage." 26 | ######################################################### 27 | # Controls # 28 | ######################################################### 29 | osbit=$(uname -m) 30 | if [ "$osbit" = "x86_64" ]; then 31 | echo "64 bit operating system is used" 32 | else 33 | echo "Sorry! This script was written for 64 bit operating systems." 34 | exit 35 | fi 36 | ######## 37 | packagemanagement=$(which apt) 38 | if [ -n "$packagemanagement" ]; then 39 | echo "Operating system uses apt packagemanagement" 40 | else 41 | echo "Sorry! This script is written for the operating systems which uses apt packagemanagement. Please try this script with debian based operating systems, such as, Ubuntu, Linux Mint, Debian, Pardus etc." 42 | #Tested on Ubuntu 20.04 43 | exit 44 | fi 45 | local_language=$(locale | grep LANG | grep tr_TR) 46 | if [ -n "$local_language" ]; then 47 | echo "Merhaba, WRF modelinin kodundaki hatadan dolayı, WRF kurulumu işletim sistemi dili Türkçe olduğunda, Türkçedeki i ve ı harflerinin farklı olması sebebiyle hata vermektedir. Lütfen işletim sisteminizin dilini başka bir dile çevirip yeniden çalıştırınız. Kurulum bittikten sonra işletim sistemi dilini tekrar Türkçe'ye çevirebilirsiniz." 48 | exit 49 | fi 50 | ######################################################### 51 | # Installing neccesary packages # 52 | ######################################################### 53 | 54 | if [ "$type" = "Chem" ]; then 55 | extra_packages="flex-old bison" 56 | fi 57 | echo "Please enter your sudo password, so necessary packages can be installed." 58 | sudo apt-get update 59 | mpich_repoversion=$(apt-cache policy mpich | grep Candidate | cut -d ':' -f 2 | cut -d '-' -f 1 | cut -c2) 60 | if [ "$mpich_repoversion" -ge 4 ]; then 61 | mpirun_packages="libopenmpi-dev libhdf5-openmpi-dev" 62 | else 63 | mpirun_packages="mpich libhdf5-mpich-dev" 64 | fi 65 | sudo apt-get install -y build-essential csh gfortran m4 curl perl ${mpirun_packages} libpng-dev netcdf-bin libnetcdff-dev ${extra_packages} 66 | 67 | package4checks="build-essential csh gfortran m4 curl perl ${mpirun_packages} libpng-dev netcdf-bin libnetcdff-dev ${extra_packages}" 68 | for packagecheck in ${package4checks}; do 69 | packagechecked=$(dpkg-query --show --showformat='${db:Status-Status}\n' $packagecheck | grep not-installed) 70 | if [ "$packagechecked" = "not-installed" ]; then 71 | echo $packagecheck "$packagechecked" 72 | packagesnotinstalled=yes 73 | fi 74 | done 75 | if [ "$packagesnotinstalled" = "yes" ]; then 76 | echo "Some packages were not installed, please re-run the script and enter your root password, when it is requested." 77 | exit 78 | fi 79 | ######################################### 80 | cd ~ 81 | mkdir Build_WRF 82 | cd Build_WRF 83 | mkdir LIBRARIES 84 | cd LIBRARIES 85 | echo "" >> ~/.bashrc 86 | bashrc_exports=("#WRF Variables" "export DIR=$(pwd)" "export CC=gcc" "export CXX=g++" "export FC=gfortran" "export FCFLAGS=-m64" "export F77=gfortran" "export FFLAGS=-m64" 87 | "export NETCDF=/usr" "export HDF5=/usr/lib/x86_64-linux-gnu/hdf5/serial" "export LDFLAGS="\""-L/usr/lib/x86_64-linux-gnu/hdf5/serial/ -L/usr/lib"\""" 88 | "export CPPFLAGS="\""-I/usr/include/hdf5/serial/ -I/usr/include"\""" "export LD_LIBRARY_PATH=/usr/lib") 89 | for bashrc_export in "${bashrc_exports[@]}" ; do 90 | [[ -z $(grep "${bashrc_export}" ~/.bashrc) ]] && echo "${bashrc_export}" >> ~/.bashrc 91 | done 92 | DIR=$(pwd) 93 | export CC=gcc 94 | export CXX=g++ 95 | export FC=gfortran 96 | export FCFLAGS=-m64 97 | export F77=gfortran 98 | export FFLAGS=-m64 99 | export NETCDF=/usr 100 | export HDF5=/usr/lib/x86_64-linux-gnu/hdf5/serial 101 | export LDFLAGS="-L/usr/lib/x86_64-linux-gnu/hdf5/serial/ -L/usr/lib" 102 | export CPPFLAGS="-I/usr/include/hdf5/serial/ -I/usr/include" 103 | export LD_LIBRARY_PATH=/usr/lib 104 | if [ "$type" = "Chem" ]; then 105 | [[ -z $(grep "export FLEX_LIB_DIR=/usr/lib" ~/.bashrc) ]] && echo "export FLEX_LIB_DIR=/usr/lib" >> ~/.bashrc 106 | [[ -z $(grep "export YACC='yacc -d'" ~/.bashrc) ]] && echo "export YACC='yacc -d'" >> ~/.bashrc 107 | export FLEX_LIB_DIR=/usr/lib 108 | export YACC='yacc -d' 109 | fi 110 | ########################################## 111 | # Jasper Installation # 112 | ######################################### 113 | [ -d "jasper-1.900.1" ] && mv jasper-1.900.1 jasper-1.900.1-old 114 | [ -f "jasper-1.900.1.tar.gz" ] && mv jasper-1.900.1.tar.gz jasper-1.900.1.tar.gz-old 115 | wget http://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/jasper-1.900.1.tar.gz 116 | tar -zxvf jasper-1.900.1.tar.gz 117 | cd jasper-1.900.1/ 118 | ./configure --prefix=$DIR/grib2 119 | make 120 | make install 121 | echo "export JASPERLIB=$DIR/grib2/lib" >> ~/.bashrc 122 | echo "export JASPERINC=$DIR/grib2/include" >> ~/.bashrc 123 | export JASPERLIB=$DIR/grib2/lib 124 | export JASPERINC=$DIR/grib2/include 125 | cd .. 126 | ######################################### 127 | # WRF Installation # 128 | ######################################### 129 | cd .. 130 | [ -d "WRFV${WRFversion}" ] && mv WRFV${WRFversion} WRFV${WRFversion}-old 131 | [ -f "v${WRFversion}.tar.gz" ] && mv v${WRFversion}.tar.gz v${WRFversion}.tar.gz-old 132 | wget https://github.com/wrf-model/WRF/releases/download/v${WRFversion}/v${WRFversion}.tar.gz 133 | mv v${WRFversion}.tar.gz WRFV${WRFversion}.tar.gz 134 | tar -zxvf WRFV${WRFversion}.tar.gz 135 | if [ "$type" = "Hydro" ]; then 136 | export WRF_HYDRO=1 137 | [ -f "v5.2.0.tar.gz" ] && mv v5.2.0.tar.gz v5.2.0.tar.gz-old 138 | wget https://github.com/NCAR/wrf_hydro_nwm_public/archive/refs/tags/v5.2.0.tar.gz 139 | tar -zxvf v5.2.0.tar.gz 140 | /bin/cp -rf wrf_hydro_nwm_public-5.2.0/trunk/NDHMS/* WRFV${WRFversion}/hydro/ 141 | rm v5.2.0.tar.gz 142 | rm -r wrf_hydro_nwm_public-5.2.0 143 | fi 144 | cd WRFV${WRFversion} 145 | if [ "$type" = "Chem" ]; then 146 | export WRF_CHEM=1 147 | export WRF_KPP=1 148 | sed -i '232s/.*/module_mosaic_addemiss.o: module_data_mosaic_asect.o module_data_sorgam.o module_gocart_dust.o/' chem/depend.chem 149 | fi 150 | sed -i 's#$NETCDF/lib#$NETCDF/lib/x86_64-linux-gnu#g' configure 151 | cd arch 152 | cp Config.pl Config.pl_backup 153 | sed -i '428s/.*/ $response = 34 ;/' Config.pl 154 | sed -i '869s/.*/ $response = 1 ;/' Config.pl 155 | cd .. 156 | ./configure 157 | sed -i 's#-L/usr/lib -lnetcdff -lnetcdf#-L/usr/lib/x86_64-linux-gnu -lnetcdff -lnetcdf#g' configure.wrf 158 | gfortversion=$(gfortran -dumpversion | cut -c1) 159 | if [ "$gfortversion" -lt 8 ] && [ "$gfortversion" -ge 6 ]; then 160 | sed -i '/-DBUILD_RRTMG_FAST=1/d' configure.wrf 161 | fi 162 | logsave compile.log ./compile em_real 163 | cd arch 164 | cp Config.pl_backup Config.pl 165 | cd .. 166 | if [ -n "$(grep "Problems building executables, look for errors in the build log" compile.log)" ]; then 167 | echo "Sorry, There were some errors while installing WRF." 168 | echo "Please create new issue for the problem, https://github.com/bakamotokatas/WRF-Install-Script/issues" 169 | exit 170 | fi 171 | cd .. 172 | [ -d "WRF-${WRFversion}-${type}" ] && mv WRF-${WRFversion}-${type} WRF-${WRFversion}-${type}-old 173 | mv WRFV${WRFversion} WRF-${WRFversion}-${type} 174 | ######################################### 175 | # WPS Installation # 176 | ######################################### 177 | WPSversion="4.4" 178 | [ -d "WPS-${WPSversion}" ] && mv WPS-${WPSversion} WPS-${WPSversion}-old 179 | [ -f "v${WPSversion}.tar.gz" ] && mv v${WPSversion}.tar.gz v${WPSversion}.tar.gz-old 180 | wget https://github.com/wrf-model/WPS/archive/v${WPSversion}.tar.gz 181 | mv v${WPSversion}.tar.gz WPSV${WPSversion}.TAR.gz 182 | tar -zxvf WPSV${WPSversion}.TAR.gz 183 | cd WPS-${WPSversion} 184 | cd arch 185 | cp Config.pl Config.pl_backup 186 | sed -i '154s/.*/ $response = 3 ;/' Config.pl 187 | cd .. 188 | ./clean 189 | sed -i '141s/.*/ NETCDFF="-lnetcdff"/' configure 190 | sed -i "173s/.*/standard_wrf_dirs=\"WRF-${WRFversion}-${type} WRF WRF-4.0.3 WRF-4.0.2 WRF-4.0.1 WRF-4.0 WRFV3\"/" configure 191 | ./configure 192 | logsave compile.log ./compile 193 | sed -i "s# geog_data_path.*# geog_data_path = '../WPS_GEOG/'#" namelist.wps 194 | cd arch 195 | cp Config.pl_backup Config.pl 196 | cd .. 197 | cd .. 198 | ######################################### 199 | # Opening Geog Data Files # 200 | ######################################### 201 | if [ -d "WPS_GEOG" ]; then 202 | echo "WRF and WPS are installed successfully" 203 | echo "Directory WPS_GEOG is already exists." 204 | echo "Do you want WPS_GEOG files to be redownloaded and reexracted?" 205 | echo "please type yes or no" 206 | read GEOG_validation 207 | if [ ${GEOG_validation} = "yes" ]; then 208 | wget http://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz 209 | tar -zxvf geog_high_res_mandatory.tar.gz 210 | else 211 | echo "You can download it later from http://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz and extract it" 212 | fi 213 | else 214 | wget http://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz 215 | tar -zxvf geog_high_res_mandatory.tar.gz 216 | fi 217 | if [ "$type" = "Chem" ]; then 218 | cd WPS_GEOG 219 | Chem_Geog="modis_landuse_21class_30s soiltype_top_2m soiltype_bot_2m albedo_ncep maxsnowalb erod clayfrac_5m sandfrac_5m" 220 | for i in ${Chem_Geog}; do 221 | if [ ! -d $i ]; then 222 | echo $i 223 | wget https://www2.mmm.ucar.edu/wrf/src/wps_files/${i}.tar.bz2 224 | tar -xvf ${i}.tar.bz2 225 | rm ${i}.tar.bz2 226 | fi 227 | done 228 | cd .. 229 | fi 230 | ####################################### 231 | # PREP_CHEM_SRC # 232 | ####################################### 233 | if [ "$type" = "Chem" ]; then 234 | echo "Do you want the PREP-CHEM-SRC program to be installed? PREP-CHEM-SRC is a widely used emission preparation program for WRF-Chem." 235 | echo "please type yes or no" 236 | read prep_chem_validation 237 | if [ ${prep_chem_validation} = "yes" ]; then 238 | echo "firstly starting to compile convert_emiss.exe. convert_emiss.exe is needed for convert emissions which are created from PREP-CHEM-SRC." 239 | cd WRF-${WRFversion}-${type} 240 | logsave convert_emi.log ./compile emi_conv 241 | cd .. 242 | echo "Compilation of convert_emiss.exe is finished, now PREP-CHEM-SRC download and compilation has started." 243 | [ -d "PREP-CHEM-SRC-1.5" ] && mv PREP-CHEM-SRC-1.5 PREP-CHEM-SRC-1.5-old 244 | [ -f "prep_chem_sources_v1.5_24aug2015.tar.gz" ] && mv prep_chem_sources_v1.5_24aug2015.tar.gz prep_chem_sources_v1.5_24aug2015.tar.gz-old 245 | wget ftp://aftp.fsl.noaa.gov/divisions/taq/global_emissions/prep_chem_sources_v1.5_24aug2015.tar.gz 246 | tar -zxvf prep_chem_sources_v1.5_24aug2015.tar.gz 247 | cd PREP-CHEM-SRC-1.5/bin/build 248 | sed -i "s#NETCDF=.*#NETCDF=/usr#" include.mk.gfortran.wrf 249 | sed -i 's#-L$(NETCDF)/lib#-L/usr/lib/x86_64-linux-gnu#' include.mk.gfortran.wrf 250 | sed -i "s#HDF5=.*#HDF5=/usr/lib/x86_64-linux-gnu/hdf5/serial#" include.mk.gfortran.wrf 251 | sed -i "s#HDF5_INC=.*#HDF5_INC=-I/usr/include/hdf5/serial#" include.mk.gfortran.wrf 252 | sed -i 's#-L$(HDF5)/lib#-L/usr/lib/x86_64-linux-gnu/hdf5/serial#' include.mk.gfortran.wrf 253 | sed -i "s#-L/scratchin/grupos/catt-brams/shared/libs/gfortran/zlib-1.2.8/lib#-L/usr/lib#" include.mk.gfortran.wrf 254 | sed -i "842s#.*# 'ENERGY ',\&#" ../../src/edgar_emissions.f90 255 | sed -i "843s#.*# 'INDUSTRY ',\&#" ../../src/edgar_emissions.f90 256 | sed -i "845s#.*# 'TRANSPORT '/)#" ../../src/edgar_emissions.f90 257 | make OPT=gfortran.wrf CHEM=RADM_WRF_FIM 258 | cd .. 259 | mkdir datain 260 | cd datain 261 | wget ftp://aftp.fsl.noaa.gov/divisions/taq/global_emissions/global_emissions_v3_24aug2015.tar.gz 262 | tar -zxvf global_emissions_v3_24aug2015.tar.gz 263 | mv Global_emissions_v3/* . 264 | rm -r Global_emissions_v3 265 | mv Emission_data/ EMISSION_DATA 266 | mv surface_data/ SURFACE_DATA 267 | cd ../../.. 268 | echo "PREP-CHEM-SRC compilation has finished." 269 | fi 270 | fi 271 | ########################################################## 272 | # End # 273 | ########################################################## 274 | echo "Installation has completed" 275 | exec bash 276 | exit 277 | -------------------------------------------------------------------------------- /WRF4.5.1_Install.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ######################################################### 3 | # WRF Install Script # 4 | # This Script was written by Umur Dinç # 5 | # To execute this script "bash WRF4.5.1_Install.bash" # 6 | ######################################################### 7 | WRFversion="4.5.1" 8 | type="ARW" 9 | if [ -n "$1" ]; then 10 | if [ "$1" = "-chem" ]; then 11 | type="Chem" 12 | elif [ "$1" = "-arw" ]; then 13 | type="ARW" 14 | elif [ "$1" = "-hydro" ]; then 15 | type="Hydro" 16 | else 17 | echo "Unrecognized option, please run as" 18 | echo "For WRF-ARW \"bash WRF${WRFversion}_Install.bash -arw\"" 19 | echo "For WRF-Chem \"bash WRF${WRFversion}_Install.bash -chem\"" 20 | echo "For WRF-Hydro \"bash WRF${WRFversion}_Install.bash -hydro\"" 21 | exit 22 | fi 23 | fi 24 | echo "Welcome! This Script will install the WRF${WRFversion}-${type}" 25 | echo "Installation may take several hours and it takes 52 GB storage. Be sure that you have enough time and storage." 26 | ######################################################### 27 | # Controls # 28 | ######################################################### 29 | if [ "$EUID" -eq 0 ] 30 | then echo "Running this script as root or sudo, is not suggested" 31 | exit 32 | fi 33 | osbit=$(uname -m) 34 | if [ "$osbit" = "x86_64" ]; then 35 | echo "64 bit operating system is used" 36 | else 37 | echo "Sorry! This script was written for 64 bit operating systems." 38 | exit 39 | fi 40 | ######## 41 | packagemanagement=$(which apt) 42 | if [ -n "$packagemanagement" ]; then 43 | echo "Operating system uses apt packagemanagement" 44 | else 45 | echo "Sorry! This script is written for the operating systems which uses apt packagemanagement. Please try this script with debian based operating systems, such as, Ubuntu, Linux Mint, Debian, Pardus etc." 46 | #Tested on Ubuntu 20.04 47 | exit 48 | fi 49 | local_language=$(locale | grep LANG | grep tr_TR) 50 | if [ -n "$local_language" ]; then 51 | echo "Merhaba, WRF modelinin kodundaki hatadan dolayı, WRF kurulumu işletim sistemi dili Türkçe olduğunda, Türkçedeki i ve ı harflerinin farklı olması sebebiyle hata vermektedir. Lütfen işletim sisteminizin dilini başka bir dile çevirip yeniden çalıştırınız. Kurulum bittikten sonra işletim sistemi dilini tekrar Türkçe'ye çevirebilirsiniz." 52 | exit 53 | fi 54 | ######################################################### 55 | # Installing neccesary packages # 56 | ######################################################### 57 | 58 | if [ "$type" = "Chem" ]; then 59 | extra_packages="flex-old bison" 60 | fi 61 | echo "Please enter your sudo password, so necessary packages can be installed." 62 | sudo apt-get update 63 | mpich_repoversion=$(apt-cache policy mpich | grep Candidate | cut -d ':' -f 2 | cut -d '-' -f 1 | cut -c2) 64 | if [ "$mpich_repoversion" -ge 4 ]; then 65 | mpirun_packages="libopenmpi-dev libhdf5-openmpi-dev" 66 | else 67 | mpirun_packages="mpich libhdf5-mpich-dev" 68 | fi 69 | sudo apt-get install -y build-essential csh gfortran m4 curl perl ${mpirun_packages} libpng-dev netcdf-bin libnetcdff-dev ${extra_packages} 70 | 71 | package4checks="build-essential csh gfortran m4 curl perl ${mpirun_packages} libpng-dev netcdf-bin libnetcdff-dev ${extra_packages}" 72 | for packagecheck in ${package4checks}; do 73 | packagechecked=$(dpkg-query --show --showformat='${db:Status-Status}\n' $packagecheck | grep not-installed) 74 | if [ "$packagechecked" = "not-installed" ]; then 75 | echo $packagecheck "$packagechecked" 76 | packagesnotinstalled=yes 77 | fi 78 | done 79 | if [ "$packagesnotinstalled" = "yes" ]; then 80 | echo "Some packages were not installed, please re-run the script and enter your root password, when it is requested." 81 | exit 82 | fi 83 | ######################################### 84 | cd ~ 85 | mkdir Build_WRF 86 | cd Build_WRF 87 | mkdir LIBRARIES 88 | cd LIBRARIES 89 | echo "" >> ~/.bashrc 90 | bashrc_exports=("#WRF Variables" "export DIR=$(pwd)" "export CC=gcc" "export CXX=g++" "export FC=gfortran" "export FCFLAGS=-m64" "export F77=gfortran" "export FFLAGS=-m64" 91 | "export NETCDF=/usr" "export HDF5=/usr/lib/x86_64-linux-gnu/hdf5/serial" "export LDFLAGS="\""-L/usr/lib/x86_64-linux-gnu/hdf5/serial/ -L/usr/lib"\""" 92 | "export CPPFLAGS="\""-I/usr/include/hdf5/serial/ -I/usr/include"\""" "export LD_LIBRARY_PATH=/usr/lib") 93 | for bashrc_export in "${bashrc_exports[@]}" ; do 94 | [[ -z $(grep "${bashrc_export}" ~/.bashrc) ]] && echo "${bashrc_export}" >> ~/.bashrc 95 | done 96 | DIR=$(pwd) 97 | export CC=gcc 98 | export CXX=g++ 99 | export FC=gfortran 100 | export FCFLAGS=-m64 101 | export F77=gfortran 102 | export FFLAGS=-m64 103 | export NETCDF=/usr 104 | export HDF5=/usr/lib/x86_64-linux-gnu/hdf5/serial 105 | export LDFLAGS="-L/usr/lib/x86_64-linux-gnu/hdf5/serial/ -L/usr/lib" 106 | export CPPFLAGS="-I/usr/include/hdf5/serial/ -I/usr/include" 107 | export LD_LIBRARY_PATH=/usr/lib 108 | if [ "$type" = "Chem" ]; then 109 | [[ -z $(grep "export FLEX_LIB_DIR=/usr/lib" ~/.bashrc) ]] && echo "export FLEX_LIB_DIR=/usr/lib" >> ~/.bashrc 110 | [[ -z $(grep "export YACC='yacc -d'" ~/.bashrc) ]] && echo "export YACC='yacc -d'" >> ~/.bashrc 111 | export FLEX_LIB_DIR=/usr/lib 112 | export YACC='yacc -d' 113 | fi 114 | ########################################## 115 | # Jasper Installation # 116 | ######################################### 117 | [ -d "jasper-1.900.1" ] && mv jasper-1.900.1 jasper-1.900.1-old 118 | [ -f "jasper-1.900.1.tar.gz" ] && mv jasper-1.900.1.tar.gz jasper-1.900.1.tar.gz-old 119 | wget https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/jasper-1.900.1.tar.gz -O jasper-1.900.1.tar.gz 120 | tar -zxvf jasper-1.900.1.tar.gz 121 | cd jasper-1.900.1/ 122 | ./configure --prefix=$DIR/grib2 123 | make 124 | make install 125 | [[ -z $(grep "export JASPERLIB=$DIR/grib2/lib" ~/.bashrc) ]] && echo "export JASPERLIB=$DIR/grib2/lib" >> ~/.bashrc 126 | [[ -z $(grep "export JASPERINC=$DIR/grib2/include" ~/.bashrc) ]] && echo "export JASPERINC=$DIR/grib2/include" >> ~/.bashrc 127 | export JASPERLIB=$DIR/grib2/lib 128 | export JASPERINC=$DIR/grib2/include 129 | cd .. 130 | ######################################### 131 | # WRF Installation # 132 | ######################################### 133 | cd .. 134 | [ -d "WRFV${WRFversion}" ] && mv WRFV${WRFversion} WRFV${WRFversion}-old 135 | [ -f "WRFV${WRFversion}.tar.gz" ] && mv WRFV${WRFversion}.tar.gz WRFV${WRFversion}.tar.gz-old 136 | wget https://github.com/wrf-model/WRF/releases/download/v${WRFversion}/v${WRFversion}.tar.gz -O WRFV${WRFversion}.tar.gz 137 | tar -zxvf WRFV${WRFversion}.tar.gz 138 | if [ "$type" = "Hydro" ]; then 139 | export WRF_HYDRO=1 140 | [ -f "v5.2.0.tar.gz" ] && mv v5.2.0.tar.gz v5.2.0.tar.gz-old 141 | wget https://github.com/NCAR/wrf_hydro_nwm_public/archive/refs/tags/v5.2.0.tar.gz -O v5.2.0.tar.gz 142 | tar -zxvf v5.2.0.tar.gz 143 | /bin/cp -rf wrf_hydro_nwm_public-5.2.0/trunk/NDHMS/* WRFV${WRFversion}/hydro/ 144 | rm v5.2.0.tar.gz 145 | rm -r wrf_hydro_nwm_public-5.2.0 146 | fi 147 | cd WRFV${WRFversion} 148 | if [ "$type" = "Chem" ]; then 149 | export WRF_CHEM=1 150 | export WRF_KPP=1 151 | fi 152 | sed -i 's#$NETCDF/lib#$NETCDF/lib/x86_64-linux-gnu#g' configure 153 | ( echo 34 ; echo 1 ) | ./configure 154 | sed -i 's#-L/usr/lib -lnetcdff -lnetcdf#-L/usr/lib/x86_64-linux-gnu -lnetcdff -lnetcdf#g' configure.wrf 155 | gfortversion=$(gfortran -dumpversion | cut -c1) 156 | if [ "$gfortversion" -lt 8 ] && [ "$gfortversion" -ge 6 ]; then 157 | sed -i '/-DBUILD_RRTMG_FAST=1/d' configure.wrf 158 | fi 159 | logsave compile.log ./compile em_real 160 | if [ -n "$(grep "Problems building executables, look for errors in the build log" compile.log)" ]; then 161 | echo "Sorry, There were some errors while installing WRF." 162 | echo "Please create new issue for the problem, https://github.com/bakamotokatas/WRF-Install-Script/issues" 163 | exit 164 | fi 165 | cd .. 166 | [ -d "WRF-${WRFversion}-${type}" ] && mv WRF-${WRFversion}-${type} WRF-${WRFversion}-${type}-old 167 | mv WRFV${WRFversion} WRF-${WRFversion}-${type} 168 | ######################################### 169 | # WPS Installation # 170 | ######################################### 171 | WPSversion="4.5" 172 | [ -d "WPS-${WPSversion}" ] && mv WPS-${WPSversion} WPS-${WPSversion}-old 173 | [ -f "WPSV${WPSversion}.TAR.gz" ] && mv WPSV${WPSversion}.TAR.gz WPSV${WPSversion}.TAR.gz-old 174 | wget https://github.com/wrf-model/WPS/archive/v${WPSversion}.tar.gz -O WPSV${WPSversion}.TAR.gz 175 | tar -zxvf WPSV${WPSversion}.TAR.gz 176 | cd WPS-${WPSversion} 177 | ./clean 178 | sed -i '163s/.*/ NETCDFF="-lnetcdff"/' configure 179 | sed -i "s/standard_wrf_dirs=.*/standard_wrf_dirs=\"WRF-${WRFversion}-${type} WRF WRF-4.0.3 WRF-4.0.2 WRF-4.0.1 WRF-4.0 WRFV3\"/" configure 180 | echo 3 | ./configure 181 | logsave compile.log ./compile 182 | sed -i "s# geog_data_path.*# geog_data_path = '../WPS_GEOG/'#" namelist.wps 183 | cd .. 184 | ######################################### 185 | # Opening Geog Data Files # 186 | ######################################### 187 | if [ -d "WPS_GEOG" ]; then 188 | echo "WRF and WPS are installed successfully" 189 | echo "Directory WPS_GEOG is already exists." 190 | echo "Do you want WPS_GEOG files to be redownloaded and reexracted?" 191 | echo "please type yes or no" 192 | read GEOG_validation 193 | if [ ${GEOG_validation} = "yes" ]; then 194 | wget https://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz -O geog_high_res_mandatory.tar.gz 195 | tar -zxvf geog_high_res_mandatory.tar.gz 196 | else 197 | echo "You can download it later from http://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz and extract it" 198 | fi 199 | else 200 | wget https://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz -O geog_high_res_mandatory.tar.gz 201 | tar -zxvf geog_high_res_mandatory.tar.gz 202 | fi 203 | if [ "$type" = "Chem" ]; then 204 | cd WPS_GEOG 205 | Chem_Geog="modis_landuse_21class_30s soiltype_top_2m soiltype_bot_2m albedo_ncep maxsnowalb erod clayfrac_5m sandfrac_5m" 206 | for i in ${Chem_Geog}; do 207 | if [ ! -d $i ]; then 208 | echo $i 209 | wget https://www2.mmm.ucar.edu/wrf/src/wps_files/${i}.tar.bz2 -O ${i}.tar.bz2 210 | tar -xvf ${i}.tar.bz2 211 | rm ${i}.tar.bz2 212 | fi 213 | done 214 | cd .. 215 | fi 216 | ####################################### 217 | # PREP_CHEM_SRC # 218 | ####################################### 219 | if [ "$type" = "Chem" ]; then 220 | echo "Do you want the PREP-CHEM-SRC program to be installed? PREP-CHEM-SRC is a widely used emission preparation program for WRF-Chem." 221 | echo "please type yes or no" 222 | read prep_chem_validation 223 | if [ ${prep_chem_validation} = "yes" ]; then 224 | echo "firstly starting to compile convert_emiss.exe. convert_emiss.exe is needed for convert emissions which are created from PREP-CHEM-SRC." 225 | cd WRF-${WRFversion}-${type} 226 | logsave convert_emi.log ./compile emi_conv 227 | cd .. 228 | echo "Compilation of convert_emiss.exe is finished, now PREP-CHEM-SRC download and compilation has started." 229 | [ -d "PREP-CHEM-SRC-1.5" ] && mv PREP-CHEM-SRC-1.5 PREP-CHEM-SRC-1.5-old 230 | [ -f "prep_chem_sources_v1.5_24aug2015.tar.gz" ] && mv prep_chem_sources_v1.5_24aug2015.tar.gz prep_chem_sources_v1.5_24aug2015.tar.gz-old 231 | wget ftp://aftp.fsl.noaa.gov/divisions/taq/global_emissions/prep_chem_sources_v1.5_24aug2015.tar.gz -O prep_chem_sources_v1.5_24aug2015.tar.gz 232 | tar -zxvf prep_chem_sources_v1.5_24aug2015.tar.gz 233 | cd PREP-CHEM-SRC-1.5/bin/build 234 | sed -i "s#NETCDF=.*#NETCDF=/usr#" include.mk.gfortran.wrf 235 | sed -i 's#-L$(NETCDF)/lib#-L/usr/lib/x86_64-linux-gnu#' include.mk.gfortran.wrf 236 | sed -i "s#HDF5=.*#HDF5=/usr/lib/x86_64-linux-gnu/hdf5/serial#" include.mk.gfortran.wrf 237 | sed -i "s#HDF5_INC=.*#HDF5_INC=-I/usr/include/hdf5/serial#" include.mk.gfortran.wrf 238 | sed -i 's#-L$(HDF5)/lib#-L/usr/lib/x86_64-linux-gnu/hdf5/serial#' include.mk.gfortran.wrf 239 | gfortversion=$(gfortran -dumpversion) 240 | if [ "$gfortversion" -ge 10 ]; then 241 | sed -i 's#F_OPTS=.*#F_OPTS= -Xpreprocessor -D$(CHEM) -O2 -fconvert=big-endian -frecord-marker=4 -fallow-argument-mismatch#' include.mk.gfortran.wrf 242 | fi 243 | sed -i "s#-L/scratchin/grupos/catt-brams/shared/libs/gfortran/zlib-1.2.8/lib#-L/usr/lib#" include.mk.gfortran.wrf 244 | sed -i "842s#.*# 'ENERGY ',\&#" ../../src/edgar_emissions.f90 245 | sed -i "843s#.*# 'INDUSTRY ',\&#" ../../src/edgar_emissions.f90 246 | sed -i "845s#.*# 'TRANSPORT '/)#" ../../src/edgar_emissions.f90 247 | make OPT=gfortran.wrf CHEM=RADM_WRF_FIM 248 | cd .. 249 | mkdir datain 250 | cd datain 251 | wget ftp://aftp.fsl.noaa.gov/divisions/taq/global_emissions/global_emissions_v3_24aug2015.tar.gz -O global_emissions_v3_24aug2015.tar.gz 252 | tar -zxvf global_emissions_v3_24aug2015.tar.gz 253 | mv Global_emissions_v3/* . 254 | rm -r Global_emissions_v3 255 | mv Emission_data/ EMISSION_DATA 256 | mv surface_data/ SURFACE_DATA 257 | cd ../../.. 258 | echo "PREP-CHEM-SRC compilation has finished." 259 | fi 260 | fi 261 | ########################################################## 262 | # End # 263 | ########################################################## 264 | echo "Installation has completed" 265 | exec bash 266 | exit 267 | -------------------------------------------------------------------------------- /WRF4.5.2_Install.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ######################################################### 3 | # WRF Install Script # 4 | # This Script was written by Umur Dinç # 5 | # To execute this script "bash WRF4.5.2_Install.bash" # 6 | ######################################################### 7 | WRFversion="4.5.2" 8 | type="ARW" 9 | if [ -n "$1" ]; then 10 | if [ "$1" = "-chem" ]; then 11 | type="Chem" 12 | elif [ "$1" = "-arw" ]; then 13 | type="ARW" 14 | elif [ "$1" = "-hydro" ]; then 15 | type="Hydro" 16 | else 17 | echo "Unrecognized option, please run as" 18 | echo "For WRF-ARW \"bash WRF${WRFversion}_Install.bash -arw\"" 19 | echo "For WRF-Chem \"bash WRF${WRFversion}_Install.bash -chem\"" 20 | echo "For WRF-Hydro \"bash WRF${WRFversion}_Install.bash -hydro\"" 21 | exit 22 | fi 23 | fi 24 | echo "Welcome! This Script will install the WRF${WRFversion}-${type}" 25 | echo "Installation may take several hours and it takes 52 GB storage. Be sure that you have enough time and storage." 26 | ######################################################### 27 | # Controls # 28 | ######################################################### 29 | if [ "$EUID" -eq 0 ] 30 | then echo "Running this script as root or sudo, is not suggested" 31 | exit 32 | fi 33 | osbit=$(uname -m) 34 | if [ "$osbit" = "x86_64" ]; then 35 | echo "64 bit operating system is used" 36 | else 37 | echo "Sorry! This script was written for 64 bit operating systems." 38 | exit 39 | fi 40 | ######## 41 | packagemanagement=$(which apt) 42 | if [ -n "$packagemanagement" ]; then 43 | echo "Operating system uses apt packagemanagement" 44 | else 45 | echo "Sorry! This script is written for the operating systems which uses apt packagemanagement. Please try this script with debian based operating systems, such as, Ubuntu, Linux Mint, Debian, Pardus etc." 46 | #Tested on Ubuntu 20.04 47 | exit 48 | fi 49 | local_language=$(locale | grep LANG | grep tr_TR) 50 | if [ -n "$local_language" ]; then 51 | echo "Merhaba, WRF modelinin kodundaki hatadan dolayı, WRF kurulumu işletim sistemi dili Türkçe olduğunda, Türkçedeki i ve ı harflerinin farklı olması sebebiyle hata vermektedir. Lütfen işletim sisteminizin dilini başka bir dile çevirip yeniden çalıştırınız. Kurulum bittikten sonra işletim sistemi dilini tekrar Türkçe'ye çevirebilirsiniz." 52 | exit 53 | fi 54 | ######################################################### 55 | # Installing neccesary packages # 56 | ######################################################### 57 | 58 | if [ "$type" = "Chem" ]; then 59 | extra_packages="flex-old bison" 60 | fi 61 | echo "Please enter your sudo password, so necessary packages can be installed." 62 | sudo apt-get update 63 | mpich_repoversion=$(apt-cache policy mpich | grep Candidate | cut -d ':' -f 2 | cut -d '-' -f 1 | cut -c2) 64 | if [ "$mpich_repoversion" -ge 4 ]; then 65 | mpirun_packages="libopenmpi-dev libhdf5-openmpi-dev" 66 | else 67 | mpirun_packages="mpich libhdf5-mpich-dev" 68 | fi 69 | sudo apt-get install -y build-essential csh gfortran m4 curl perl ${mpirun_packages} libpng-dev netcdf-bin libnetcdff-dev ${extra_packages} 70 | 71 | package4checks="build-essential csh gfortran m4 curl perl ${mpirun_packages} libpng-dev netcdf-bin libnetcdff-dev ${extra_packages}" 72 | for packagecheck in ${package4checks}; do 73 | packagechecked=$(dpkg-query --show --showformat='${db:Status-Status}\n' $packagecheck | grep not-installed) 74 | if [ "$packagechecked" = "not-installed" ]; then 75 | echo $packagecheck "$packagechecked" 76 | packagesnotinstalled=yes 77 | fi 78 | done 79 | if [ "$packagesnotinstalled" = "yes" ]; then 80 | echo "Some packages were not installed, please re-run the script and enter your root password, when it is requested." 81 | exit 82 | fi 83 | ######################################### 84 | cd ~ 85 | mkdir Build_WRF 86 | cd Build_WRF 87 | mkdir LIBRARIES 88 | cd LIBRARIES 89 | echo "" >> ~/.bashrc 90 | bashrc_exports=("#WRF Variables" "export DIR=$(pwd)" "export CC=gcc" "export CXX=g++" "export FC=gfortran" "export FCFLAGS=-m64" "export F77=gfortran" "export FFLAGS=-m64" 91 | "export NETCDF=/usr" "export HDF5=/usr/lib/x86_64-linux-gnu/hdf5/serial" "export LDFLAGS="\""-L/usr/lib/x86_64-linux-gnu/hdf5/serial/ -L/usr/lib"\""" 92 | "export CPPFLAGS="\""-I/usr/include/hdf5/serial/ -I/usr/include"\""" "export LD_LIBRARY_PATH=/usr/lib") 93 | for bashrc_export in "${bashrc_exports[@]}" ; do 94 | [[ -z $(grep "${bashrc_export}" ~/.bashrc) ]] && echo "${bashrc_export}" >> ~/.bashrc 95 | done 96 | DIR=$(pwd) 97 | export CC=gcc 98 | export CXX=g++ 99 | export FC=gfortran 100 | export FCFLAGS=-m64 101 | export F77=gfortran 102 | export FFLAGS=-m64 103 | export NETCDF=/usr 104 | export HDF5=/usr/lib/x86_64-linux-gnu/hdf5/serial 105 | export LDFLAGS="-L/usr/lib/x86_64-linux-gnu/hdf5/serial/ -L/usr/lib" 106 | export CPPFLAGS="-I/usr/include/hdf5/serial/ -I/usr/include" 107 | export LD_LIBRARY_PATH=/usr/lib 108 | if [ "$type" = "Chem" ]; then 109 | [[ -z $(grep "export FLEX_LIB_DIR=/usr/lib" ~/.bashrc) ]] && echo "export FLEX_LIB_DIR=/usr/lib" >> ~/.bashrc 110 | [[ -z $(grep "export YACC='yacc -d'" ~/.bashrc) ]] && echo "export YACC='yacc -d'" >> ~/.bashrc 111 | export FLEX_LIB_DIR=/usr/lib 112 | export YACC='yacc -d' 113 | fi 114 | ########################################## 115 | # Jasper Installation # 116 | ######################################### 117 | [ -d "jasper-1.900.1" ] && mv jasper-1.900.1 jasper-1.900.1-old 118 | [ -f "jasper-1.900.1.tar.gz" ] && mv jasper-1.900.1.tar.gz jasper-1.900.1.tar.gz-old 119 | wget https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/jasper-1.900.1.tar.gz -O jasper-1.900.1.tar.gz 120 | tar -zxvf jasper-1.900.1.tar.gz 121 | cd jasper-1.900.1/ 122 | ./configure --prefix=$DIR/grib2 123 | make 124 | make install 125 | [[ -z $(grep "export JASPERLIB=$DIR/grib2/lib" ~/.bashrc) ]] && echo "export JASPERLIB=$DIR/grib2/lib" >> ~/.bashrc 126 | [[ -z $(grep "export JASPERINC=$DIR/grib2/include" ~/.bashrc) ]] && echo "export JASPERINC=$DIR/grib2/include" >> ~/.bashrc 127 | export JASPERLIB=$DIR/grib2/lib 128 | export JASPERINC=$DIR/grib2/include 129 | cd .. 130 | ######################################### 131 | # WRF Installation # 132 | ######################################### 133 | cd .. 134 | [ -d "WRFV${WRFversion}" ] && mv WRFV${WRFversion} WRFV${WRFversion}-old 135 | [ -f "WRFV${WRFversion}.tar.gz" ] && mv WRFV${WRFversion}.tar.gz WRFV${WRFversion}.tar.gz-old 136 | wget https://github.com/wrf-model/WRF/releases/download/v${WRFversion}/v${WRFversion}.tar.gz -O WRFV${WRFversion}.tar.gz 137 | tar -zxvf WRFV${WRFversion}.tar.gz 138 | if [ "$type" = "Hydro" ]; then 139 | export WRF_HYDRO=1 140 | [ -f "v5.2.0.tar.gz" ] && mv v5.2.0.tar.gz v5.2.0.tar.gz-old 141 | wget https://github.com/NCAR/wrf_hydro_nwm_public/archive/refs/tags/v5.2.0.tar.gz -O v5.2.0.tar.gz 142 | tar -zxvf v5.2.0.tar.gz 143 | /bin/cp -rf wrf_hydro_nwm_public-5.2.0/trunk/NDHMS/* WRFV${WRFversion}/hydro/ 144 | rm v5.2.0.tar.gz 145 | rm -r wrf_hydro_nwm_public-5.2.0 146 | fi 147 | cd WRFV${WRFversion} 148 | if [ "$type" = "Chem" ]; then 149 | export WRF_CHEM=1 150 | export WRF_KPP=1 151 | fi 152 | sed -i 's#$NETCDF/lib#$NETCDF/lib/x86_64-linux-gnu#g' configure 153 | ( echo 34 ; echo 1 ) | ./configure 154 | sed -i 's#-L/usr/lib -lnetcdff -lnetcdf#-L/usr/lib/x86_64-linux-gnu -lnetcdff -lnetcdf#g' configure.wrf 155 | gfortversion=$(gfortran -dumpversion | cut -d '.' -f 1) 156 | if [ "$gfortversion" -lt 8 ] && [ "$gfortversion" -ge 6 ]; then 157 | sed -i '/-DBUILD_RRTMG_FAST=1/d' configure.wrf 158 | fi 159 | logsave compile.log ./compile em_real 160 | if [ -n "$(grep "Problems building executables, look for errors in the build log" compile.log)" ]; then 161 | echo "Sorry, There were some errors while installing WRF." 162 | echo "Please create new issue for the problem, https://github.com/bakamotokatas/WRF-Install-Script/issues" 163 | exit 164 | fi 165 | cd .. 166 | [ -d "WRF-${WRFversion}-${type}" ] && mv WRF-${WRFversion}-${type} WRF-${WRFversion}-${type}-old 167 | mv WRFV${WRFversion} WRF-${WRFversion}-${type} 168 | ######################################### 169 | # WPS Installation # 170 | ######################################### 171 | WPSversion="4.5" 172 | [ -d "WPS-${WPSversion}" ] && mv WPS-${WPSversion} WPS-${WPSversion}-old 173 | [ -f "WPSV${WPSversion}.TAR.gz" ] && mv WPSV${WPSversion}.TAR.gz WPSV${WPSversion}.TAR.gz-old 174 | wget https://github.com/wrf-model/WPS/archive/v${WPSversion}.tar.gz -O WPSV${WPSversion}.TAR.gz 175 | tar -zxvf WPSV${WPSversion}.TAR.gz 176 | cd WPS-${WPSversion} 177 | ./clean 178 | sed -i '163s/.*/ NETCDFF="-lnetcdff"/' configure 179 | sed -i "s/standard_wrf_dirs=.*/standard_wrf_dirs=\"WRF-${WRFversion}-${type} WRF WRF-4.0.3 WRF-4.0.2 WRF-4.0.1 WRF-4.0 WRFV3\"/" configure 180 | echo 3 | ./configure 181 | logsave compile.log ./compile 182 | sed -i "s# geog_data_path.*# geog_data_path = '../WPS_GEOG/'#" namelist.wps 183 | cd .. 184 | ######################################### 185 | # Opening Geog Data Files # 186 | ######################################### 187 | if [ -d "WPS_GEOG" ]; then 188 | echo "WRF and WPS are installed successfully" 189 | echo "Directory WPS_GEOG is already exists." 190 | echo "Do you want WPS_GEOG files to be redownloaded and reexracted?" 191 | echo "please type yes or no" 192 | read GEOG_validation 193 | if [ ${GEOG_validation} = "yes" ]; then 194 | wget https://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz -O geog_high_res_mandatory.tar.gz 195 | tar -zxvf geog_high_res_mandatory.tar.gz 196 | else 197 | echo "You can download it later from http://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz and extract it" 198 | fi 199 | else 200 | wget https://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz -O geog_high_res_mandatory.tar.gz 201 | tar -zxvf geog_high_res_mandatory.tar.gz 202 | fi 203 | if [ "$type" = "Chem" ]; then 204 | cd WPS_GEOG 205 | Chem_Geog="modis_landuse_21class_30s soiltype_top_2m soiltype_bot_2m albedo_ncep maxsnowalb erod clayfrac_5m sandfrac_5m" 206 | for i in ${Chem_Geog}; do 207 | if [ ! -d $i ]; then 208 | echo $i 209 | wget https://www2.mmm.ucar.edu/wrf/src/wps_files/${i}.tar.bz2 -O ${i}.tar.bz2 210 | tar -xvf ${i}.tar.bz2 211 | rm ${i}.tar.bz2 212 | fi 213 | done 214 | cd .. 215 | fi 216 | ####################################### 217 | # PREP_CHEM_SRC # 218 | ####################################### 219 | if [ "$type" = "Chem" ]; then 220 | echo "Do you want the PREP-CHEM-SRC program to be installed? PREP-CHEM-SRC is a widely used emission preparation program for WRF-Chem." 221 | echo "please type yes or no" 222 | read prep_chem_validation 223 | if [ ${prep_chem_validation} = "yes" ]; then 224 | echo "firstly starting to compile convert_emiss.exe. convert_emiss.exe is needed for convert emissions which are created from PREP-CHEM-SRC." 225 | cd WRF-${WRFversion}-${type} 226 | logsave convert_emi.log ./compile emi_conv 227 | cd .. 228 | echo "Compilation of convert_emiss.exe is finished, now PREP-CHEM-SRC download and compilation has started." 229 | [ -d "PREP-CHEM-SRC-1.5" ] && mv PREP-CHEM-SRC-1.5 PREP-CHEM-SRC-1.5-old 230 | [ -f "prep_chem_sources_v1.5_24aug2015.tar.gz" ] && mv prep_chem_sources_v1.5_24aug2015.tar.gz prep_chem_sources_v1.5_24aug2015.tar.gz-old 231 | wget ftp://aftp.fsl.noaa.gov/divisions/taq/global_emissions/prep_chem_sources_v1.5_24aug2015.tar.gz -O prep_chem_sources_v1.5_24aug2015.tar.gz 232 | tar -zxvf prep_chem_sources_v1.5_24aug2015.tar.gz 233 | cd PREP-CHEM-SRC-1.5/bin/build 234 | sed -i "s#NETCDF=.*#NETCDF=/usr#" include.mk.gfortran.wrf 235 | sed -i 's#-L$(NETCDF)/lib#-L/usr/lib/x86_64-linux-gnu#' include.mk.gfortran.wrf 236 | sed -i "s#HDF5=.*#HDF5=/usr/lib/x86_64-linux-gnu/hdf5/serial#" include.mk.gfortran.wrf 237 | sed -i "s#HDF5_INC=.*#HDF5_INC=-I/usr/include/hdf5/serial#" include.mk.gfortran.wrf 238 | sed -i 's#-L$(HDF5)/lib#-L/usr/lib/x86_64-linux-gnu/hdf5/serial#' include.mk.gfortran.wrf 239 | gfortversion=$(gfortran -dumpversion | cut -d '.' -f 1) 240 | if [ "$gfortversion" -ge 10 ]; then 241 | sed -i 's#F_OPTS=.*#F_OPTS= -Xpreprocessor -D$(CHEM) -O2 -fconvert=big-endian -frecord-marker=4 -fallow-argument-mismatch#' include.mk.gfortran.wrf 242 | fi 243 | sed -i "s#-L/scratchin/grupos/catt-brams/shared/libs/gfortran/zlib-1.2.8/lib#-L/usr/lib#" include.mk.gfortran.wrf 244 | sed -i "842s#.*# 'ENERGY ',\&#" ../../src/edgar_emissions.f90 245 | sed -i "843s#.*# 'INDUSTRY ',\&#" ../../src/edgar_emissions.f90 246 | sed -i "845s#.*# 'TRANSPORT '/)#" ../../src/edgar_emissions.f90 247 | make OPT=gfortran.wrf CHEM=RADM_WRF_FIM 248 | cd .. 249 | mkdir datain 250 | cd datain 251 | wget ftp://aftp.fsl.noaa.gov/divisions/taq/global_emissions/global_emissions_v3_24aug2015.tar.gz -O global_emissions_v3_24aug2015.tar.gz 252 | tar -zxvf global_emissions_v3_24aug2015.tar.gz 253 | mv Global_emissions_v3/* . 254 | rm -r Global_emissions_v3 255 | mv Emission_data/ EMISSION_DATA 256 | mv surface_data/ SURFACE_DATA 257 | cd ../../.. 258 | echo "PREP-CHEM-SRC compilation has finished." 259 | fi 260 | fi 261 | ########################################################## 262 | # End # 263 | ########################################################## 264 | echo "Installation has completed" 265 | exec bash 266 | exit 267 | -------------------------------------------------------------------------------- /WRF4.5_Install.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ######################################################### 3 | # WRF Install Script # 4 | # This Script was written by Umur Dinç # 5 | # To execute this script "bash WRF4.5_Install.bash" # 6 | ######################################################### 7 | WRFversion="4.5" 8 | type="ARW" 9 | if [ -n "$1" ]; then 10 | if [ "$1" = "-chem" ]; then 11 | type="Chem" 12 | elif [ "$1" = "-arw" ]; then 13 | type="ARW" 14 | elif [ "$1" = "-hydro" ]; then 15 | type="Hydro" 16 | else 17 | echo "Unrecognized option, please run as" 18 | echo "For WRF-ARW \"bash WRF${WRFversion}_Install.bash -arw\"" 19 | echo "For WRF-Chem \"bash WRF${WRFversion}_Install.bash -chem\"" 20 | echo "For WRF-Hydro \"bash WRF${WRFversion}_Install.bash -hydro\"" 21 | exit 22 | fi 23 | fi 24 | echo "Welcome! This Script will install the WRF${WRFversion}-${type}" 25 | echo "Installation may take several hours and it takes 52 GB storage. Be sure that you have enough time and storage." 26 | ######################################################### 27 | # Controls # 28 | ######################################################### 29 | if [ "$EUID" -eq 0 ] 30 | then echo "Running this script as root or sudo, is not suggested" 31 | exit 32 | fi 33 | osbit=$(uname -m) 34 | if [ "$osbit" = "x86_64" ]; then 35 | echo "64 bit operating system is used" 36 | else 37 | echo "Sorry! This script was written for 64 bit operating systems." 38 | exit 39 | fi 40 | ######## 41 | packagemanagement=$(which apt) 42 | if [ -n "$packagemanagement" ]; then 43 | echo "Operating system uses apt packagemanagement" 44 | else 45 | echo "Sorry! This script is written for the operating systems which uses apt packagemanagement. Please try this script with debian based operating systems, such as, Ubuntu, Linux Mint, Debian, Pardus etc." 46 | #Tested on Ubuntu 20.04 47 | exit 48 | fi 49 | local_language=$(locale | grep LANG | grep tr_TR) 50 | if [ -n "$local_language" ]; then 51 | echo "Merhaba, WRF modelinin kodundaki hatadan dolayı, WRF kurulumu işletim sistemi dili Türkçe olduğunda, Türkçedeki i ve ı harflerinin farklı olması sebebiyle hata vermektedir. Lütfen işletim sisteminizin dilini başka bir dile çevirip yeniden çalıştırınız. Kurulum bittikten sonra işletim sistemi dilini tekrar Türkçe'ye çevirebilirsiniz." 52 | exit 53 | fi 54 | ######################################################### 55 | # Installing neccesary packages # 56 | ######################################################### 57 | 58 | if [ "$type" = "Chem" ]; then 59 | extra_packages="flex-old bison" 60 | fi 61 | echo "Please enter your sudo password, so necessary packages can be installed." 62 | sudo apt-get update 63 | mpich_repoversion=$(apt-cache policy mpich | grep Candidate | cut -d ':' -f 2 | cut -d '-' -f 1 | cut -c2) 64 | if [ "$mpich_repoversion" -ge 4 ]; then 65 | mpirun_packages="libopenmpi-dev libhdf5-openmpi-dev" 66 | else 67 | mpirun_packages="mpich libhdf5-mpich-dev" 68 | fi 69 | sudo apt-get install -y build-essential csh gfortran m4 curl perl ${mpirun_packages} libpng-dev netcdf-bin libnetcdff-dev ${extra_packages} 70 | 71 | package4checks="build-essential csh gfortran m4 curl perl ${mpirun_packages} libpng-dev netcdf-bin libnetcdff-dev ${extra_packages}" 72 | for packagecheck in ${package4checks}; do 73 | packagechecked=$(dpkg-query --show --showformat='${db:Status-Status}\n' $packagecheck | grep not-installed) 74 | if [ "$packagechecked" = "not-installed" ]; then 75 | echo $packagecheck "$packagechecked" 76 | packagesnotinstalled=yes 77 | fi 78 | done 79 | if [ "$packagesnotinstalled" = "yes" ]; then 80 | echo "Some packages were not installed, please re-run the script and enter your root password, when it is requested." 81 | exit 82 | fi 83 | ######################################### 84 | cd ~ 85 | mkdir Build_WRF 86 | cd Build_WRF 87 | mkdir LIBRARIES 88 | cd LIBRARIES 89 | echo "" >> ~/.bashrc 90 | bashrc_exports=("#WRF Variables" "export DIR=$(pwd)" "export CC=gcc" "export CXX=g++" "export FC=gfortran" "export FCFLAGS=-m64" "export F77=gfortran" "export FFLAGS=-m64" 91 | "export NETCDF=/usr" "export HDF5=/usr/lib/x86_64-linux-gnu/hdf5/serial" "export LDFLAGS="\""-L/usr/lib/x86_64-linux-gnu/hdf5/serial/ -L/usr/lib"\""" 92 | "export CPPFLAGS="\""-I/usr/include/hdf5/serial/ -I/usr/include"\""" "export LD_LIBRARY_PATH=/usr/lib") 93 | for bashrc_export in "${bashrc_exports[@]}" ; do 94 | [[ -z $(grep "${bashrc_export}" ~/.bashrc) ]] && echo "${bashrc_export}" >> ~/.bashrc 95 | done 96 | DIR=$(pwd) 97 | export CC=gcc 98 | export CXX=g++ 99 | export FC=gfortran 100 | export FCFLAGS=-m64 101 | export F77=gfortran 102 | export FFLAGS=-m64 103 | export NETCDF=/usr 104 | export HDF5=/usr/lib/x86_64-linux-gnu/hdf5/serial 105 | export LDFLAGS="-L/usr/lib/x86_64-linux-gnu/hdf5/serial/ -L/usr/lib" 106 | export CPPFLAGS="-I/usr/include/hdf5/serial/ -I/usr/include" 107 | export LD_LIBRARY_PATH=/usr/lib 108 | if [ "$type" = "Chem" ]; then 109 | [[ -z $(grep "export FLEX_LIB_DIR=/usr/lib" ~/.bashrc) ]] && echo "export FLEX_LIB_DIR=/usr/lib" >> ~/.bashrc 110 | [[ -z $(grep "export YACC='yacc -d'" ~/.bashrc) ]] && echo "export YACC='yacc -d'" >> ~/.bashrc 111 | export FLEX_LIB_DIR=/usr/lib 112 | export YACC='yacc -d' 113 | fi 114 | ########################################## 115 | # Jasper Installation # 116 | ######################################### 117 | [ -d "jasper-1.900.1" ] && mv jasper-1.900.1 jasper-1.900.1-old 118 | [ -f "jasper-1.900.1.tar.gz" ] && mv jasper-1.900.1.tar.gz jasper-1.900.1.tar.gz-old 119 | wget https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/jasper-1.900.1.tar.gz -O jasper-1.900.1.tar.gz 120 | tar -zxvf jasper-1.900.1.tar.gz 121 | cd jasper-1.900.1/ 122 | ./configure --prefix=$DIR/grib2 123 | make 124 | make install 125 | [[ -z $(grep "export JASPERLIB=$DIR/grib2/lib" ~/.bashrc) ]] && echo "export JASPERLIB=$DIR/grib2/lib" >> ~/.bashrc 126 | [[ -z $(grep "export JASPERINC=$DIR/grib2/include" ~/.bashrc) ]] && echo "export JASPERINC=$DIR/grib2/include" >> ~/.bashrc 127 | export JASPERLIB=$DIR/grib2/lib 128 | export JASPERINC=$DIR/grib2/include 129 | cd .. 130 | ######################################### 131 | # WRF Installation # 132 | ######################################### 133 | cd .. 134 | [ -d "WRFV${WRFversion}" ] && mv WRFV${WRFversion} WRFV${WRFversion}-old 135 | [ -f "WRFV${WRFversion}.tar.gz" ] && mv WRFV${WRFversion}.tar.gz WRFV${WRFversion}.tar.gz-old 136 | wget https://github.com/wrf-model/WRF/releases/download/v${WRFversion}/v${WRFversion}.tar.gz -O WRFV${WRFversion}.tar.gz 137 | tar -zxvf WRFV${WRFversion}.tar.gz 138 | if [ "$type" = "Hydro" ]; then 139 | export WRF_HYDRO=1 140 | [ -f "v5.2.0.tar.gz" ] && mv v5.2.0.tar.gz v5.2.0.tar.gz-old 141 | wget https://github.com/NCAR/wrf_hydro_nwm_public/archive/refs/tags/v5.2.0.tar.gz -O v5.2.0.tar.gz 142 | tar -zxvf v5.2.0.tar.gz 143 | /bin/cp -rf wrf_hydro_nwm_public-5.2.0/trunk/NDHMS/* WRFV${WRFversion}/hydro/ 144 | rm v5.2.0.tar.gz 145 | rm -r wrf_hydro_nwm_public-5.2.0 146 | fi 147 | cd WRFV${WRFversion} 148 | if [ "$type" = "Chem" ]; then 149 | export WRF_CHEM=1 150 | export WRF_KPP=1 151 | fi 152 | sed -i 's#$NETCDF/lib#$NETCDF/lib/x86_64-linux-gnu#g' configure 153 | ( echo 34 ; echo 1 ) | ./configure 154 | sed -i 's#-L/usr/lib -lnetcdff -lnetcdf#-L/usr/lib/x86_64-linux-gnu -lnetcdff -lnetcdf#g' configure.wrf 155 | gfortversion=$(gfortran -dumpversion | cut -c1) 156 | if [ "$gfortversion" -lt 8 ] && [ "$gfortversion" -ge 6 ]; then 157 | sed -i '/-DBUILD_RRTMG_FAST=1/d' configure.wrf 158 | fi 159 | logsave compile.log ./compile em_real 160 | if [ -n "$(grep "Problems building executables, look for errors in the build log" compile.log)" ]; then 161 | echo "Sorry, There were some errors while installing WRF." 162 | echo "Please create new issue for the problem, https://github.com/bakamotokatas/WRF-Install-Script/issues" 163 | exit 164 | fi 165 | cd .. 166 | [ -d "WRF-${WRFversion}-${type}" ] && mv WRF-${WRFversion}-${type} WRF-${WRFversion}-${type}-old 167 | mv WRFV${WRFversion} WRF-${WRFversion}-${type} 168 | ######################################### 169 | # WPS Installation # 170 | ######################################### 171 | WPSversion="4.5" 172 | [ -d "WPS-${WPSversion}" ] && mv WPS-${WPSversion} WPS-${WPSversion}-old 173 | [ -f "WPSV${WPSversion}.TAR.gz" ] && mv WPSV${WPSversion}.TAR.gz WPSV${WPSversion}.TAR.gz-old 174 | wget https://github.com/wrf-model/WPS/archive/v${WPSversion}.tar.gz -O WPSV${WPSversion}.TAR.gz 175 | tar -zxvf WPSV${WPSversion}.TAR.gz 176 | cd WPS-${WPSversion} 177 | ./clean 178 | sed -i '163s/.*/ NETCDFF="-lnetcdff"/' configure 179 | sed -i "195s/.*/standard_wrf_dirs=\"WRF-${WRFversion}-${type} WRF WRF-4.0.3 WRF-4.0.2 WRF-4.0.1 WRF-4.0 WRFV3\"/" configure 180 | echo 3 | ./configure 181 | logsave compile.log ./compile 182 | sed -i "s# geog_data_path.*# geog_data_path = '../WPS_GEOG/'#" namelist.wps 183 | cd .. 184 | ######################################### 185 | # Opening Geog Data Files # 186 | ######################################### 187 | if [ -d "WPS_GEOG" ]; then 188 | echo "WRF and WPS are installed successfully" 189 | echo "Directory WPS_GEOG is already exists." 190 | echo "Do you want WPS_GEOG files to be redownloaded and reexracted?" 191 | echo "please type yes or no" 192 | read GEOG_validation 193 | if [ ${GEOG_validation} = "yes" ]; then 194 | wget https://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz -O geog_high_res_mandatory.tar.gz 195 | tar -zxvf geog_high_res_mandatory.tar.gz 196 | else 197 | echo "You can download it later from http://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz and extract it" 198 | fi 199 | else 200 | wget https://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz -O geog_high_res_mandatory.tar.gz 201 | tar -zxvf geog_high_res_mandatory.tar.gz 202 | fi 203 | if [ "$type" = "Chem" ]; then 204 | cd WPS_GEOG 205 | Chem_Geog="modis_landuse_21class_30s soiltype_top_2m soiltype_bot_2m albedo_ncep maxsnowalb erod clayfrac_5m sandfrac_5m" 206 | for i in ${Chem_Geog}; do 207 | if [ ! -d $i ]; then 208 | echo $i 209 | wget https://www2.mmm.ucar.edu/wrf/src/wps_files/${i}.tar.bz2 -O ${i}.tar.bz2 210 | tar -xvf ${i}.tar.bz2 211 | rm ${i}.tar.bz2 212 | fi 213 | done 214 | cd .. 215 | fi 216 | ####################################### 217 | # PREP_CHEM_SRC # 218 | ####################################### 219 | if [ "$type" = "Chem" ]; then 220 | echo "Do you want the PREP-CHEM-SRC program to be installed? PREP-CHEM-SRC is a widely used emission preparation program for WRF-Chem." 221 | echo "please type yes or no" 222 | read prep_chem_validation 223 | if [ ${prep_chem_validation} = "yes" ]; then 224 | echo "firstly starting to compile convert_emiss.exe. convert_emiss.exe is needed for convert emissions which are created from PREP-CHEM-SRC." 225 | cd WRF-${WRFversion}-${type} 226 | logsave convert_emi.log ./compile emi_conv 227 | cd .. 228 | echo "Compilation of convert_emiss.exe is finished, now PREP-CHEM-SRC download and compilation has started." 229 | [ -d "PREP-CHEM-SRC-1.5" ] && mv PREP-CHEM-SRC-1.5 PREP-CHEM-SRC-1.5-old 230 | [ -f "prep_chem_sources_v1.5_24aug2015.tar.gz" ] && mv prep_chem_sources_v1.5_24aug2015.tar.gz prep_chem_sources_v1.5_24aug2015.tar.gz-old 231 | wget ftp://aftp.fsl.noaa.gov/divisions/taq/global_emissions/prep_chem_sources_v1.5_24aug2015.tar.gz -O prep_chem_sources_v1.5_24aug2015.tar.gz 232 | tar -zxvf prep_chem_sources_v1.5_24aug2015.tar.gz 233 | cd PREP-CHEM-SRC-1.5/bin/build 234 | sed -i "s#NETCDF=.*#NETCDF=/usr#" include.mk.gfortran.wrf 235 | sed -i 's#-L$(NETCDF)/lib#-L/usr/lib/x86_64-linux-gnu#' include.mk.gfortran.wrf 236 | sed -i "s#HDF5=.*#HDF5=/usr/lib/x86_64-linux-gnu/hdf5/serial#" include.mk.gfortran.wrf 237 | sed -i "s#HDF5_INC=.*#HDF5_INC=-I/usr/include/hdf5/serial#" include.mk.gfortran.wrf 238 | sed -i 's#-L$(HDF5)/lib#-L/usr/lib/x86_64-linux-gnu/hdf5/serial#' include.mk.gfortran.wrf 239 | gfortversion=$(gfortran -dumpversion) 240 | if [ "$gfortversion" -ge 10 ]; then 241 | sed -i 's#F_OPTS=.*#F_OPTS= -Xpreprocessor -D$(CHEM) -O2 -fconvert=big-endian -frecord-marker=4 -fallow-argument-mismatch#' include.mk.gfortran.wrf 242 | fi 243 | sed -i "s#-L/scratchin/grupos/catt-brams/shared/libs/gfortran/zlib-1.2.8/lib#-L/usr/lib#" include.mk.gfortran.wrf 244 | sed -i "842s#.*# 'ENERGY ',\&#" ../../src/edgar_emissions.f90 245 | sed -i "843s#.*# 'INDUSTRY ',\&#" ../../src/edgar_emissions.f90 246 | sed -i "845s#.*# 'TRANSPORT '/)#" ../../src/edgar_emissions.f90 247 | make OPT=gfortran.wrf CHEM=RADM_WRF_FIM 248 | cd .. 249 | mkdir datain 250 | cd datain 251 | wget ftp://aftp.fsl.noaa.gov/divisions/taq/global_emissions/global_emissions_v3_24aug2015.tar.gz -O global_emissions_v3_24aug2015.tar.gz 252 | tar -zxvf global_emissions_v3_24aug2015.tar.gz 253 | mv Global_emissions_v3/* . 254 | rm -r Global_emissions_v3 255 | mv Emission_data/ EMISSION_DATA 256 | mv surface_data/ SURFACE_DATA 257 | cd ../../.. 258 | echo "PREP-CHEM-SRC compilation has finished." 259 | fi 260 | fi 261 | ########################################################## 262 | # End # 263 | ########################################################## 264 | echo "Installation has completed" 265 | exec bash 266 | exit 267 | -------------------------------------------------------------------------------- /WRF4.6.0_Install.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ######################################################### 3 | # WRF Install Script # 4 | # This Script was written by Umur Dinç # 5 | # To execute this script "bash WRF4.6.0_Install.bash" # 6 | ######################################################### 7 | WRFversion="4.6.0" 8 | type="ARW" 9 | if [ -n "$1" ]; then 10 | if [ "$1" = "-chem" ]; then 11 | type="Chem" 12 | elif [ "$1" = "-arw" ]; then 13 | type="ARW" 14 | elif [ "$1" = "-hydro" ]; then 15 | type="Hydro" 16 | else 17 | echo "Unrecognized option, please run as" 18 | echo "For WRF-ARW \"bash WRF${WRFversion}_Install.bash -arw\"" 19 | echo "For WRF-Chem \"bash WRF${WRFversion}_Install.bash -chem\"" 20 | echo "For WRF-Hydro \"bash WRF${WRFversion}_Install.bash -hydro\"" 21 | exit 22 | fi 23 | fi 24 | echo "Welcome! This Script will install the WRF${WRFversion}-${type}" 25 | echo "Installation may take several hours and it takes 52 GB storage. Be sure that you have enough time and storage." 26 | ######################################################### 27 | # Controls # 28 | ######################################################### 29 | if [ "$EUID" -eq 0 ] 30 | then echo "Running this script as root or sudo, is not suggested" 31 | exit 32 | fi 33 | osbit=$(uname -m) 34 | if [ "$osbit" = "x86_64" ]; then 35 | echo "64 bit operating system is used" 36 | else 37 | echo "Sorry! This script was written for 64 bit operating systems." 38 | exit 39 | fi 40 | ######## 41 | packagemanagement=$(which apt) 42 | if [ -n "$packagemanagement" ]; then 43 | echo "Operating system uses apt packagemanagement" 44 | else 45 | echo "Sorry! This script is written for the operating systems which uses apt packagemanagement. Please try this script with debian based operating systems, such as, Ubuntu, Linux Mint, Debian, Pardus etc." 46 | #Tested on Ubuntu 22.04 47 | exit 48 | fi 49 | local_language=$(locale | grep LANG | grep tr_TR) 50 | if [ -n "$local_language" ]; then 51 | echo "Merhaba, WRF modelinin kodundaki hatadan dolayı, WRF kurulumu işletim sistemi dili Türkçe olduğunda, Türkçedeki i ve ı harflerinin farklı olması sebebiyle hata vermektedir. Lütfen işletim sisteminizin dilini başka bir dile çevirip yeniden çalıştırınız. Kurulum bittikten sonra işletim sistemi dilini tekrar Türkçe'ye çevirebilirsiniz." 52 | exit 53 | fi 54 | ######################################################### 55 | # Installing neccesary packages # 56 | ######################################################### 57 | 58 | if [ "$type" = "Chem" ]; then 59 | extra_packages="flex bison" 60 | fi 61 | echo "Please enter your sudo password, so necessary packages can be installed." 62 | sudo apt-get update 63 | mpich_repoversion=$(apt-cache policy mpich | grep Candidate | cut -d ':' -f 2 | cut -d '-' -f 1 | cut -c2) 64 | if [ "$mpich_repoversion" -ge 4 ]; then 65 | mpirun_packages="libopenmpi-dev libhdf5-openmpi-dev" 66 | else 67 | mpirun_packages="mpich libhdf5-mpich-dev" 68 | fi 69 | sudo apt-get install -y build-essential csh gfortran m4 curl perl ${mpirun_packages} libpng-dev netcdf-bin libnetcdff-dev ${extra_packages} 70 | 71 | package4checks="build-essential csh gfortran m4 curl perl ${mpirun_packages} libpng-dev netcdf-bin libnetcdff-dev ${extra_packages}" 72 | for packagecheck in ${package4checks}; do 73 | packagechecked=$(dpkg-query --show --showformat='${db:Status-Status}\n' $packagecheck | grep not-installed) 74 | if [ "$packagechecked" = "not-installed" ]; then 75 | echo $packagecheck "$packagechecked" 76 | packagesnotinstalled=yes 77 | fi 78 | done 79 | if [ "$packagesnotinstalled" = "yes" ]; then 80 | echo "Some packages were not installed, please re-run the script and enter your root password, when it is requested." 81 | exit 82 | fi 83 | ######################################### 84 | cd ~ 85 | mkdir Build_WRF 86 | cd Build_WRF 87 | mkdir LIBRARIES 88 | cd LIBRARIES 89 | echo "" >> ~/.bashrc 90 | bashrc_exports=("#WRF Variables" "export DIR=$(pwd)" "export CC=gcc" "export CXX=g++" "export FC=gfortran" "export FCFLAGS=-m64" "export F77=gfortran" "export FFLAGS=-m64" 91 | "export NETCDF=/usr" "export HDF5=/usr/lib/x86_64-linux-gnu/hdf5/serial" "export LDFLAGS="\""-L/usr/lib/x86_64-linux-gnu/hdf5/serial/ -L/usr/lib"\""" 92 | "export CPPFLAGS="\""-I/usr/include/hdf5/serial/ -I/usr/include"\""" "export LD_LIBRARY_PATH=/usr/lib") 93 | for bashrc_export in "${bashrc_exports[@]}" ; do 94 | [[ -z $(grep "${bashrc_export}" ~/.bashrc) ]] && echo "${bashrc_export}" >> ~/.bashrc 95 | done 96 | DIR=$(pwd) 97 | export CC=gcc 98 | export CXX=g++ 99 | export FC=gfortran 100 | export FCFLAGS=-m64 101 | export F77=gfortran 102 | export FFLAGS=-m64 103 | export NETCDF=/usr 104 | export HDF5=/usr/lib/x86_64-linux-gnu/hdf5/serial 105 | export LDFLAGS="-L/usr/lib/x86_64-linux-gnu/hdf5/serial/ -L/usr/lib" 106 | export CPPFLAGS="-I/usr/include/hdf5/serial/ -I/usr/include" 107 | export LD_LIBRARY_PATH=/usr/lib 108 | if [ "$type" = "Chem" ]; then 109 | [[ -z $(grep "export FLEX_LIB_DIR=/usr/lib/x86_64-linux-gnu" ~/.bashrc) ]] && echo "export FLEX_LIB_DIR=/usr/lib/x86_64-linux-gnu" >> ~/.bashrc 110 | [[ -z $(grep "export YACC='yacc -d'" ~/.bashrc) ]] && echo "export YACC='yacc -d'" >> ~/.bashrc 111 | export FLEX_LIB_DIR=/usr/lib/x86_64-linux-gnu 112 | export YACC='yacc -d' 113 | fi 114 | ########################################## 115 | # Jasper Installation # 116 | ######################################### 117 | [ -d "jasper-1.900.1" ] && mv jasper-1.900.1 jasper-1.900.1-old 118 | [ -f "jasper-1.900.1.tar.gz" ] && mv jasper-1.900.1.tar.gz jasper-1.900.1.tar.gz-old 119 | wget https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/jasper-1.900.1.tar.gz -O jasper-1.900.1.tar.gz 120 | tar -zxvf jasper-1.900.1.tar.gz 121 | cd jasper-1.900.1/ 122 | ./configure --prefix=$DIR/grib2 123 | make 124 | make install 125 | [[ -z $(grep "export JASPERLIB=$DIR/grib2/lib" ~/.bashrc) ]] && echo "export JASPERLIB=$DIR/grib2/lib" >> ~/.bashrc 126 | [[ -z $(grep "export JASPERINC=$DIR/grib2/include" ~/.bashrc) ]] && echo "export JASPERINC=$DIR/grib2/include" >> ~/.bashrc 127 | export JASPERLIB=$DIR/grib2/lib 128 | export JASPERINC=$DIR/grib2/include 129 | cd .. 130 | ######################################### 131 | # WRF Installation # 132 | ######################################### 133 | cd .. 134 | [ -d "WRFV${WRFversion}" ] && mv WRFV${WRFversion} WRFV${WRFversion}-old 135 | [ -f "WRFV${WRFversion}.tar.gz" ] && mv WRFV${WRFversion}.tar.gz WRFV${WRFversion}.tar.gz-old 136 | wget https://github.com/wrf-model/WRF/releases/download/v${WRFversion}/v${WRFversion}.tar.gz -O WRFV${WRFversion}.tar.gz 137 | tar -zxvf WRFV${WRFversion}.tar.gz 138 | if [ "$type" = "Hydro" ]; then 139 | export WRF_HYDRO=1 140 | [ -f "v5.3.0.tar.gz" ] && mv v5.3.0.tar.gz v5.3.0.tar.gz-old 141 | wget https://github.com/NCAR/wrf_hydro_nwm_public/archive/refs/tags/v5.3.0.tar.gz -O v5.3.0.tar.gz 142 | tar -zxvf v5.3.0.tar.gz 143 | /bin/cp -rf wrf_hydro_nwm_public-5.3.0/trunk/NDHMS/* WRFV${WRFversion}/hydro/ 144 | rm v5.3.0.tar.gz 145 | rm -r wrf_hydro_nwm_public-5.3.0 146 | fi 147 | cd WRFV${WRFversion} 148 | if [ "$type" = "Chem" ]; then 149 | export WRF_CHEM=1 150 | export WRF_KPP=1 151 | fi 152 | sed -i 's#$NETCDF/lib#$NETCDF/lib/x86_64-linux-gnu#g' configure 153 | ( echo 34 ; echo 1 ) | ./configure 154 | sed -i 's#-L/usr/lib -lnetcdff -lnetcdf#-L/usr/lib/x86_64-linux-gnu -lnetcdff -lnetcdf#g' configure.wrf 155 | gfortversion=$(gfortran -dumpversion | cut -d '.' -f 1) 156 | if [ "$gfortversion" -lt 8 ] && [ "$gfortversion" -ge 6 ]; then 157 | sed -i '/-DBUILD_RRTMG_FAST=1/d' configure.wrf 158 | fi 159 | logsave compile.log ./compile em_real 160 | if [ -n "$(grep "Problems building executables, look for errors in the build log" compile.log)" ]; then 161 | echo "Sorry, There were some errors while installing WRF." 162 | echo "Please create new issue for the problem, https://github.com/bakamotokatas/WRF-Install-Script/issues" 163 | exit 164 | fi 165 | cd .. 166 | [ -d "WRF-${WRFversion}-${type}" ] && mv WRF-${WRFversion}-${type} WRF-${WRFversion}-${type}-old 167 | mv WRFV${WRFversion} WRF-${WRFversion}-${type} 168 | ######################################### 169 | # WPS Installation # 170 | ######################################### 171 | WPSversion="4.6.0" 172 | [ -d "WPS-${WPSversion}" ] && mv WPS-${WPSversion} WPS-${WPSversion}-old 173 | [ -f "WPSV${WPSversion}.TAR.gz" ] && mv WPSV${WPSversion}.TAR.gz WPSV${WPSversion}.TAR.gz-old 174 | wget https://github.com/wrf-model/WPS/archive/v${WPSversion}.tar.gz -O WPSV${WPSversion}.TAR.gz 175 | tar -zxvf WPSV${WPSversion}.TAR.gz 176 | cd WPS-${WPSversion} 177 | ./clean 178 | sed -i '163s/.*/ NETCDFF="-lnetcdff"/' configure 179 | sed -i "s/standard_wrf_dirs=.*/standard_wrf_dirs=\"WRF-${WRFversion}-${type} WRF WRF-4.0.3 WRF-4.0.2 WRF-4.0.1 WRF-4.0 WRFV3\"/" configure 180 | echo 3 | ./configure 181 | logsave compile.log ./compile 182 | sed -i "s# geog_data_path.*# geog_data_path = '../WPS_GEOG/'#" namelist.wps 183 | cd .. 184 | ######################################### 185 | # Opening Geog Data Files # 186 | ######################################### 187 | if [ -d "WPS_GEOG" ]; then 188 | echo "WRF and WPS are installed successfully" 189 | echo "Directory WPS_GEOG is already exists." 190 | echo "Do you want WPS_GEOG files to be redownloaded and reexracted?" 191 | echo "please type yes or no" 192 | read GEOG_validation 193 | if [ ${GEOG_validation} = "yes" ]; then 194 | wget https://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz -O geog_high_res_mandatory.tar.gz 195 | tar -zxvf geog_high_res_mandatory.tar.gz 196 | else 197 | echo "You can download it later from http://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz and extract it" 198 | fi 199 | else 200 | wget https://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz -O geog_high_res_mandatory.tar.gz 201 | tar -zxvf geog_high_res_mandatory.tar.gz 202 | fi 203 | if [ "$type" = "Chem" ]; then 204 | cd WPS_GEOG 205 | Chem_Geog="modis_landuse_21class_30s soiltype_top_2m soiltype_bot_2m albedo_ncep maxsnowalb erod clayfrac_5m sandfrac_5m" 206 | for i in ${Chem_Geog}; do 207 | if [ ! -d $i ]; then 208 | echo $i 209 | wget https://www2.mmm.ucar.edu/wrf/src/wps_files/${i}.tar.bz2 -O ${i}.tar.bz2 210 | tar -xvf ${i}.tar.bz2 211 | rm ${i}.tar.bz2 212 | fi 213 | done 214 | cd .. 215 | fi 216 | ####################################### 217 | # PREP_CHEM_SRC # 218 | ####################################### 219 | if [ "$type" = "Chem" ]; then 220 | echo "Do you want the PREP-CHEM-SRC program to be installed? PREP-CHEM-SRC is a widely used emission preparation program for WRF-Chem." 221 | echo "please type yes or no" 222 | read prep_chem_validation 223 | if [ ${prep_chem_validation} = "yes" ]; then 224 | echo "firstly starting to compile convert_emiss.exe. convert_emiss.exe is needed for convert emissions which are created from PREP-CHEM-SRC." 225 | cd WRF-${WRFversion}-${type} 226 | logsave convert_emi.log ./compile emi_conv 227 | cd .. 228 | echo "Compilation of convert_emiss.exe is finished, now PREP-CHEM-SRC download and compilation has started." 229 | [ -d "PREP-CHEM-SRC-1.5" ] && mv PREP-CHEM-SRC-1.5 PREP-CHEM-SRC-1.5-old 230 | [ -f "prep_chem_sources_v1.5_24aug2015.tar.gz" ] && mv prep_chem_sources_v1.5_24aug2015.tar.gz prep_chem_sources_v1.5_24aug2015.tar.gz-old 231 | wget ftp://aftp.fsl.noaa.gov/divisions/taq/global_emissions/prep_chem_sources_v1.5_24aug2015.tar.gz -O prep_chem_sources_v1.5_24aug2015.tar.gz 232 | tar -zxvf prep_chem_sources_v1.5_24aug2015.tar.gz 233 | cd PREP-CHEM-SRC-1.5/bin/build 234 | sed -i "s#NETCDF=.*#NETCDF=/usr#" include.mk.gfortran.wrf 235 | sed -i 's#-L$(NETCDF)/lib#-L/usr/lib/x86_64-linux-gnu#' include.mk.gfortran.wrf 236 | sed -i "s#HDF5=.*#HDF5=/usr/lib/x86_64-linux-gnu/hdf5/serial#" include.mk.gfortran.wrf 237 | sed -i "s#HDF5_INC=.*#HDF5_INC=-I/usr/include/hdf5/serial#" include.mk.gfortran.wrf 238 | sed -i 's#-L$(HDF5)/lib#-L/usr/lib/x86_64-linux-gnu/hdf5/serial#' include.mk.gfortran.wrf 239 | gfortversion=$(gfortran -dumpversion | cut -d '.' -f 1) 240 | if [ "$gfortversion" -ge 10 ]; then 241 | sed -i 's#F_OPTS=.*#F_OPTS= -Xpreprocessor -D$(CHEM) -O2 -fconvert=big-endian -frecord-marker=4 -fallow-argument-mismatch#' include.mk.gfortran.wrf 242 | fi 243 | sed -i "s#-L/scratchin/grupos/catt-brams/shared/libs/gfortran/zlib-1.2.8/lib#-L/usr/lib#" include.mk.gfortran.wrf 244 | sed -i "842s#.*# 'ENERGY ',\&#" ../../src/edgar_emissions.f90 245 | sed -i "843s#.*# 'INDUSTRY ',\&#" ../../src/edgar_emissions.f90 246 | sed -i "845s#.*# 'TRANSPORT '/)#" ../../src/edgar_emissions.f90 247 | make OPT=gfortran.wrf CHEM=RADM_WRF_FIM 248 | cd .. 249 | mkdir datain 250 | cd datain 251 | wget ftp://aftp.fsl.noaa.gov/divisions/taq/global_emissions/global_emissions_v3_24aug2015.tar.gz -O global_emissions_v3_24aug2015.tar.gz 252 | tar -zxvf global_emissions_v3_24aug2015.tar.gz 253 | mv Global_emissions_v3/* . 254 | rm -r Global_emissions_v3 255 | mv Emission_data/ EMISSION_DATA 256 | mv surface_data/ SURFACE_DATA 257 | cd ../../.. 258 | echo "PREP-CHEM-SRC compilation has finished." 259 | fi 260 | fi 261 | ########################################################## 262 | # End # 263 | ########################################################## 264 | echo "Installation has completed" 265 | exec bash 266 | exit 267 | -------------------------------------------------------------------------------- /WRF4.6.1_Install.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ######################################################### 3 | # WRF Install Script # 4 | # This Script was written by Umur Dinç # 5 | # To execute this script "bash WRF4.6.1_Install.bash" # 6 | ######################################################### 7 | WRFversion="4.6.1" 8 | type="ARW" 9 | if [ -n "$1" ]; then 10 | if [ "$1" = "-chem" ]; then 11 | type="Chem" 12 | elif [ "$1" = "-arw" ]; then 13 | type="ARW" 14 | elif [ "$1" = "-hydro" ]; then 15 | type="Hydro" 16 | else 17 | echo "Unrecognized option, please run as" 18 | echo "For WRF-ARW \"bash WRF${WRFversion}_Install.bash -arw\"" 19 | echo "For WRF-Chem \"bash WRF${WRFversion}_Install.bash -chem\"" 20 | echo "For WRF-Hydro \"bash WRF${WRFversion}_Install.bash -hydro\"" 21 | exit 22 | fi 23 | fi 24 | echo "Welcome! This Script will install the WRF${WRFversion}-${type}" 25 | echo "Installation may take several hours and it takes 52 GB storage. Be sure that you have enough time and storage." 26 | ######################################################### 27 | # Controls # 28 | ######################################################### 29 | if [ "$EUID" -eq 0 ] 30 | then echo "Running this script as root or sudo, is not suggested" 31 | exit 32 | fi 33 | osbit=$(uname -m) 34 | if [ "$osbit" = "x86_64" ]; then 35 | echo "64 bit operating system is used" 36 | else 37 | echo "Sorry! This script was written for 64 bit operating systems." 38 | exit 39 | fi 40 | ######## 41 | packagemanagement=$(which apt) 42 | if [ -n "$packagemanagement" ]; then 43 | echo "Operating system uses apt packagemanagement" 44 | else 45 | echo "Sorry! This script is written for the operating systems which uses apt packagemanagement. Please try this script with debian based operating systems, such as, Ubuntu, Linux Mint, Debian, Pardus etc." 46 | #Tested on Ubuntu 22.04 47 | exit 48 | fi 49 | local_language=$(locale | grep LANG | grep tr_TR) 50 | if [ -n "$local_language" ]; then 51 | echo "Merhaba, WRF modelinin kodundaki hatadan dolayı, WRF kurulumu işletim sistemi dili Türkçe olduğunda, Türkçedeki i ve ı harflerinin farklı olması sebebiyle hata vermektedir. Lütfen işletim sisteminizin dilini başka bir dile çevirip yeniden çalıştırınız. Kurulum bittikten sonra işletim sistemi dilini tekrar Türkçe'ye çevirebilirsiniz." 52 | exit 53 | fi 54 | ######################################################### 55 | # Installing neccesary packages # 56 | ######################################################### 57 | 58 | if [ "$type" = "Chem" ]; then 59 | extra_packages="flex bison" 60 | fi 61 | echo "Please enter your sudo password, so necessary packages can be installed." 62 | sudo apt-get update 63 | mpich_repoversion=$(apt-cache policy mpich | grep Candidate | cut -d ':' -f 2 | cut -d '-' -f 1 | cut -c2) 64 | if [ "$mpich_repoversion" -ge 4 ]; then 65 | mpirun_packages="libopenmpi-dev libhdf5-openmpi-dev" 66 | else 67 | mpirun_packages="mpich libhdf5-mpich-dev" 68 | fi 69 | sudo apt-get install -y build-essential csh gfortran m4 curl perl ${mpirun_packages} libpng-dev netcdf-bin libnetcdff-dev ${extra_packages} 70 | 71 | package4checks="build-essential csh gfortran m4 curl perl ${mpirun_packages} libpng-dev netcdf-bin libnetcdff-dev ${extra_packages}" 72 | for packagecheck in ${package4checks}; do 73 | packagechecked=$(dpkg-query --show --showformat='${db:Status-Status}\n' $packagecheck | grep not-installed) 74 | if [ "$packagechecked" = "not-installed" ]; then 75 | echo $packagecheck "$packagechecked" 76 | packagesnotinstalled=yes 77 | fi 78 | done 79 | if [ "$packagesnotinstalled" = "yes" ]; then 80 | echo "Some packages were not installed, please re-run the script and enter your root password, when it is requested." 81 | exit 82 | fi 83 | ######################################### 84 | cd ~ 85 | mkdir Build_WRF 86 | cd Build_WRF 87 | mkdir LIBRARIES 88 | cd LIBRARIES 89 | echo "" >> ~/.bashrc 90 | bashrc_exports=("#WRF Variables" "export DIR=$(pwd)" "export CC=gcc" "export CXX=g++" "export FC=gfortran" "export FCFLAGS=-m64" "export F77=gfortran" "export FFLAGS=-m64" 91 | "export NETCDF=/usr" "export HDF5=/usr/lib/x86_64-linux-gnu/hdf5/serial" "export LDFLAGS="\""-L/usr/lib/x86_64-linux-gnu/hdf5/serial/ -L/usr/lib"\""" 92 | "export CPPFLAGS="\""-I/usr/include/hdf5/serial/ -I/usr/include"\""" "export LD_LIBRARY_PATH=/usr/lib") 93 | for bashrc_export in "${bashrc_exports[@]}" ; do 94 | [[ -z $(grep "${bashrc_export}" ~/.bashrc) ]] && echo "${bashrc_export}" >> ~/.bashrc 95 | done 96 | DIR=$(pwd) 97 | export CC=gcc 98 | export CXX=g++ 99 | export FC=gfortran 100 | export FCFLAGS=-m64 101 | export F77=gfortran 102 | export FFLAGS=-m64 103 | export NETCDF=/usr 104 | export HDF5=/usr/lib/x86_64-linux-gnu/hdf5/serial 105 | export LDFLAGS="-L/usr/lib/x86_64-linux-gnu/hdf5/serial/ -L/usr/lib" 106 | export CPPFLAGS="-I/usr/include/hdf5/serial/ -I/usr/include" 107 | export LD_LIBRARY_PATH=/usr/lib 108 | if [ "$type" = "Chem" ]; then 109 | [[ -z $(grep "export FLEX_LIB_DIR=/usr/lib/x86_64-linux-gnu" ~/.bashrc) ]] && echo "export FLEX_LIB_DIR=/usr/lib/x86_64-linux-gnu" >> ~/.bashrc 110 | [[ -z $(grep "export YACC='yacc -d'" ~/.bashrc) ]] && echo "export YACC='yacc -d'" >> ~/.bashrc 111 | export FLEX_LIB_DIR=/usr/lib/x86_64-linux-gnu 112 | export YACC='yacc -d' 113 | fi 114 | ########################################## 115 | # Jasper Installation # 116 | ######################################### 117 | [ -d "jasper-1.900.1" ] && mv jasper-1.900.1 jasper-1.900.1-old 118 | [ -f "jasper-1.900.1.tar.gz" ] && mv jasper-1.900.1.tar.gz jasper-1.900.1.tar.gz-old 119 | wget https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/jasper-1.900.1.tar.gz -O jasper-1.900.1.tar.gz 120 | tar -zxvf jasper-1.900.1.tar.gz 121 | cd jasper-1.900.1/ 122 | ./configure --prefix=$DIR/grib2 123 | make 124 | make install 125 | [[ -z $(grep "export JASPERLIB=$DIR/grib2/lib" ~/.bashrc) ]] && echo "export JASPERLIB=$DIR/grib2/lib" >> ~/.bashrc 126 | [[ -z $(grep "export JASPERINC=$DIR/grib2/include" ~/.bashrc) ]] && echo "export JASPERINC=$DIR/grib2/include" >> ~/.bashrc 127 | export JASPERLIB=$DIR/grib2/lib 128 | export JASPERINC=$DIR/grib2/include 129 | cd .. 130 | ######################################### 131 | # WRF Installation # 132 | ######################################### 133 | cd .. 134 | [ -d "WRFV${WRFversion}" ] && mv WRFV${WRFversion} WRFV${WRFversion}-old 135 | [ -f "WRFV${WRFversion}.tar.gz" ] && mv WRFV${WRFversion}.tar.gz WRFV${WRFversion}.tar.gz-old 136 | wget https://github.com/wrf-model/WRF/releases/download/v${WRFversion}/v${WRFversion}.tar.gz -O WRFV${WRFversion}.tar.gz 137 | tar -zxvf WRFV${WRFversion}.tar.gz 138 | if [ "$type" = "Hydro" ]; then 139 | export WRF_HYDRO=1 140 | [ -f "v5.3.0.tar.gz" ] && mv v5.3.0.tar.gz v5.3.0.tar.gz-old 141 | wget https://github.com/NCAR/wrf_hydro_nwm_public/archive/refs/tags/v5.3.0.tar.gz -O v5.3.0.tar.gz 142 | tar -zxvf v5.3.0.tar.gz 143 | /bin/cp -rf wrf_hydro_nwm_public-5.3.0/trunk/NDHMS/* WRFV${WRFversion}/hydro/ 144 | rm v5.3.0.tar.gz 145 | rm -r wrf_hydro_nwm_public-5.3.0 146 | fi 147 | cd WRFV${WRFversion} 148 | if [ "$type" = "Chem" ]; then 149 | export WRF_CHEM=1 150 | export WRF_KPP=1 151 | fi 152 | sed -i 's#$NETCDF/lib#$NETCDF/lib/x86_64-linux-gnu#g' configure 153 | ( echo 34 ; echo 1 ) | ./configure 154 | sed -i 's#-L/usr/lib -lnetcdff -lnetcdf#-L/usr/lib/x86_64-linux-gnu -lnetcdff -lnetcdf#g' configure.wrf 155 | gfortversion=$(gfortran -dumpversion | cut -d '.' -f 1) 156 | if [ "$gfortversion" -lt 8 ] && [ "$gfortversion" -ge 6 ]; then 157 | sed -i '/-DBUILD_RRTMG_FAST=1/d' configure.wrf 158 | fi 159 | logsave compile.log ./compile em_real 160 | if [ -n "$(grep "Problems building executables, look for errors in the build log" compile.log)" ]; then 161 | echo "Sorry, There were some errors while installing WRF." 162 | echo "Please create new issue for the problem, https://github.com/bakamotokatas/WRF-Install-Script/issues" 163 | exit 164 | fi 165 | cd .. 166 | [ -d "WRF-${WRFversion}-${type}" ] && mv WRF-${WRFversion}-${type} WRF-${WRFversion}-${type}-old 167 | mv WRFV${WRFversion} WRF-${WRFversion}-${type} 168 | ######################################### 169 | # WPS Installation # 170 | ######################################### 171 | WPSversion="4.6.0" 172 | [ -d "WPS-${WPSversion}" ] && mv WPS-${WPSversion} WPS-${WPSversion}-old 173 | [ -f "WPSV${WPSversion}.TAR.gz" ] && mv WPSV${WPSversion}.TAR.gz WPSV${WPSversion}.TAR.gz-old 174 | wget https://github.com/wrf-model/WPS/archive/v${WPSversion}.tar.gz -O WPSV${WPSversion}.TAR.gz 175 | tar -zxvf WPSV${WPSversion}.TAR.gz 176 | cd WPS-${WPSversion} 177 | ./clean 178 | sed -i '163s/.*/ NETCDFF="-lnetcdff"/' configure 179 | sed -i "s/standard_wrf_dirs=.*/standard_wrf_dirs=\"WRF-${WRFversion}-${type} WRF WRF-4.0.3 WRF-4.0.2 WRF-4.0.1 WRF-4.0 WRFV3\"/" configure 180 | echo 3 | ./configure 181 | logsave compile.log ./compile 182 | sed -i "s# geog_data_path.*# geog_data_path = '../WPS_GEOG/'#" namelist.wps 183 | cd .. 184 | ######################################### 185 | # Opening Geog Data Files # 186 | ######################################### 187 | if [ -d "WPS_GEOG" ]; then 188 | echo "WRF and WPS are installed successfully" 189 | echo "Directory WPS_GEOG is already exists." 190 | echo "Do you want WPS_GEOG files to be redownloaded and reexracted?" 191 | echo "please type yes or no" 192 | read GEOG_validation 193 | if [ ${GEOG_validation} = "yes" ]; then 194 | wget https://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz -O geog_high_res_mandatory.tar.gz 195 | tar -zxvf geog_high_res_mandatory.tar.gz 196 | else 197 | echo "You can download it later from http://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz and extract it" 198 | fi 199 | else 200 | wget https://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz -O geog_high_res_mandatory.tar.gz 201 | tar -zxvf geog_high_res_mandatory.tar.gz 202 | fi 203 | if [ "$type" = "Chem" ]; then 204 | cd WPS_GEOG 205 | Chem_Geog="modis_landuse_21class_30s soiltype_top_2m soiltype_bot_2m albedo_ncep maxsnowalb erod clayfrac_5m sandfrac_5m" 206 | for i in ${Chem_Geog}; do 207 | if [ ! -d $i ]; then 208 | echo $i 209 | wget https://www2.mmm.ucar.edu/wrf/src/wps_files/${i}.tar.bz2 -O ${i}.tar.bz2 210 | tar -xvf ${i}.tar.bz2 211 | rm ${i}.tar.bz2 212 | fi 213 | done 214 | cd .. 215 | fi 216 | ####################################### 217 | # PREP_CHEM_SRC # 218 | ####################################### 219 | if [ "$type" = "Chem" ]; then 220 | echo "Do you want the PREP-CHEM-SRC program to be installed? PREP-CHEM-SRC is a widely used emission preparation program for WRF-Chem." 221 | echo "please type yes or no" 222 | read prep_chem_validation 223 | if [ ${prep_chem_validation} = "yes" ]; then 224 | echo "firstly starting to compile convert_emiss.exe. convert_emiss.exe is needed for convert emissions which are created from PREP-CHEM-SRC." 225 | cd WRF-${WRFversion}-${type} 226 | logsave convert_emi.log ./compile emi_conv 227 | cd .. 228 | echo "Compilation of convert_emiss.exe is finished, now PREP-CHEM-SRC download and compilation has started." 229 | [ -d "PREP-CHEM-SRC-1.5" ] && mv PREP-CHEM-SRC-1.5 PREP-CHEM-SRC-1.5-old 230 | [ -f "prep_chem_sources_v1.5_24aug2015.tar.gz" ] && mv prep_chem_sources_v1.5_24aug2015.tar.gz prep_chem_sources_v1.5_24aug2015.tar.gz-old 231 | wget ftp://aftp.fsl.noaa.gov/divisions/taq/global_emissions/prep_chem_sources_v1.5_24aug2015.tar.gz -O prep_chem_sources_v1.5_24aug2015.tar.gz 232 | tar -zxvf prep_chem_sources_v1.5_24aug2015.tar.gz 233 | cd PREP-CHEM-SRC-1.5/bin/build 234 | sed -i "s#NETCDF=.*#NETCDF=/usr#" include.mk.gfortran.wrf 235 | sed -i 's#-L$(NETCDF)/lib#-L/usr/lib/x86_64-linux-gnu#' include.mk.gfortran.wrf 236 | sed -i "s#HDF5=.*#HDF5=/usr/lib/x86_64-linux-gnu/hdf5/serial#" include.mk.gfortran.wrf 237 | sed -i "s#HDF5_INC=.*#HDF5_INC=-I/usr/include/hdf5/serial#" include.mk.gfortran.wrf 238 | sed -i 's#-L$(HDF5)/lib#-L/usr/lib/x86_64-linux-gnu/hdf5/serial#' include.mk.gfortran.wrf 239 | gfortversion=$(gfortran -dumpversion | cut -d '.' -f 1) 240 | if [ "$gfortversion" -ge 10 ]; then 241 | sed -i 's#F_OPTS=.*#F_OPTS= -Xpreprocessor -D$(CHEM) -O2 -fconvert=big-endian -frecord-marker=4 -fallow-argument-mismatch#' include.mk.gfortran.wrf 242 | fi 243 | sed -i "s#-L/scratchin/grupos/catt-brams/shared/libs/gfortran/zlib-1.2.8/lib#-L/usr/lib#" include.mk.gfortran.wrf 244 | sed -i "842s#.*# 'ENERGY ',\&#" ../../src/edgar_emissions.f90 245 | sed -i "843s#.*# 'INDUSTRY ',\&#" ../../src/edgar_emissions.f90 246 | sed -i "845s#.*# 'TRANSPORT '/)#" ../../src/edgar_emissions.f90 247 | make OPT=gfortran.wrf CHEM=RADM_WRF_FIM 248 | cd .. 249 | mkdir datain 250 | cd datain 251 | wget ftp://aftp.fsl.noaa.gov/divisions/taq/global_emissions/global_emissions_v3_24aug2015.tar.gz -O global_emissions_v3_24aug2015.tar.gz 252 | tar -zxvf global_emissions_v3_24aug2015.tar.gz 253 | mv Global_emissions_v3/* . 254 | rm -r Global_emissions_v3 255 | mv Emission_data/ EMISSION_DATA 256 | mv surface_data/ SURFACE_DATA 257 | cd ../../.. 258 | echo "PREP-CHEM-SRC compilation has finished." 259 | fi 260 | fi 261 | ########################################################## 262 | # End # 263 | ########################################################## 264 | echo "Installation has completed" 265 | exec bash 266 | exit 267 | --------------------------------------------------------------------------------