forked from manishdhasmana49/WRF-MASTER
-
Notifications
You must be signed in to change notification settings - Fork 2
/
WRF-MOSIT.sh
10559 lines (8233 loc) · 366 KB
/
WRF-MOSIT.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/bash
start=`date`
START=$(date +"%s")
############################### System Architecture Type #################
# 32 or 64 bit
##########################################################################
export SYS_ARCH=$(uname -m)
if [ "$SYS_ARCH" = "x86_64" ]; then
export SYSTEMBIT="64"
else
export SYSTEMBIT="32"
fi
############################# System OS Version #############################
# Macos or linux
# Make note that this script only works for Debian Linux kernals
#############################################################################
export SYS_OS=$(uname -s)
if [ "$SYS_OS" = "Darwin" ]; then
export SYSTEMOS="MacOS"
elif [ "$SYS_OS" = "Linux" ]; then
export SYSTEMOS="Linux"
fi
########## Centos Test #############
if [ "$SYSTEMOS" = "Linux" ]; then
export YUM=$(command -v yum)
if [ "$YUM" != "" ]; then
echo " yum found"
read -r -p "Your system is a CentOS based system which is not compatible with this script"
exit ;
fi
fi
############################### Intel or GNU Compiler Option #############
if [ "$SYSTEMBIT" = "32" ] && [ "$SYSTEMOS" = "MacOS" ]; then
echo "Your system is not compatibile with this script."
exit ;
fi
if [ "$SYSTEMBIT" = "64" ] && [ "$SYSTEMOS" = "MacOS" ]; then
echo "Your system is a 64bit version of MacOS"
echo " "
echo "Intel compilers are not compatibile with this script"
echo " "
echo "Setting compiler to GNU"
export macos_64bit_GNU=1
echo " "
echo "Xcode Command Line Tools & Homebrew are required for this script."
echo " "
echo "Installing Homebrew and Xcode Command Line Tools now"
echo " "
echo "Please enter password when prompted"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
fi
if [ "$SYSTEMBIT" = "64" ] && [ "$SYSTEMOS" = "Linux" ];
then
echo "Your system is 64bit version of Debian Linux Kernal"
echo " "
while read -r -p "Which compiler do you want to use?
-Intel
--Please note that Hurricane WRF (HWRF) is only compatibile with Intel Compilers.
-GNU
Please answer Intel or GNU and press enter (case sensative).
" yn; do
case $yn in
Intel)
echo "-------------------------------------------------- "
echo " "
echo "Intel is selected for installation"
export Ubuntu_64bit_Intel=1
break
;;
GNU)
echo "-------------------------------------------------- "
echo " "
echo "GNU is selected for installation"
export Ubuntu_64bit_GNU=1
break
;;
* )
echo " "
echo "Please answer Intel or GNU (case sensative).";;
esac
done
fi
if [ "$SYSTEMBIT" = "32" ] && [ "$SYSTEMOS" = "Linux" ]; then
echo "Your system is not compatibile with this script."
exit ;
fi
################### System Information Tests ##############################
if [ "$SYSTEMOS" = "Linux" ]; then
export HOME=`cd;pwd`
export Storage_Space_Size=$(df -h --output=avail ${HOME} | awk 'NR==2 {print $1}' | tr -cd '[:digit:]')
export Storage_Space_Units=$(df -h --output=avail ${HOME} | awk 'NR==2 {print $1}' | tr -cd '[:alpha:]')
export Storage_Space_Required="350"
echo "-------------------------------------------------- "
echo " "
echo " Testing for Storage Space for installation"
echo " "
case $Storage_Space_Units in
[Pp]* )
echo " "
echo "Sufficient storage space for installation found"
echo "-------------------------------------------------- " ;;
[Tt]* )
echo " "
echo "Sufficient storage space for installation found"
echo "-------------------------------------------------- " ;;
[Gg]* )
if [[ ${Storage_Space_Size} -lt ${Storage_Space_Required} ]]; then
echo " "
echo "Not enough storage space for installation"
echo "-------------------------------------------------- "
exit
else
echo " "
echo "Sufficient storage space for installation found."
echo "-------------------------------------------------- "
fi ;;
[MmKk]* )
echo " "
echo "Not enough storage space for installation."
echo "-------------------------------------------------- "
exit ;;
* )
echo " "
echo "Not enough storage space for installation."
echo "-------------------------------------------------- "
exit ;;
esac
echo " "
fi
if [ "$SYSTEMOS" = "MacOS" ]; then
export Storage_Space_Size=$(df -h / | awk 'NR==2 {print $1}' | tr -cd '[:digit:]')
export Storage_Space_Units=$(df -h / | awk 'NR==2 {print $1}' | tr -cd '[:alpha:]')
export Storage_Space_Required="350"
echo "-------------------------------------------------- "
echo " "
echo " Testing for Storage Space for installation"
echo " "
case $Storage_Space_Units in
[Pp]* )
echo " "
echo "Sufficient storage space for installation found"
echo "-------------------------------------------------- " ;;
[Tt]* )
echo " "
echo "Sufficient storage space for installation found"
echo "-------------------------------------------------- " ;;
[Gg]* )
if [[ ${Storage_Space_Size} -lt ${Storage_Space_Required} ]]; then
echo " "
echo "Not enough storage space for installation. 350GB is required for installation."
echo "-------------------------------------------------- "
exit
else
echo " "
echo "Sufficient storage space for installation found."
echo "-------------------------------------------------- "
fi ;;
[MmKk]* )
echo " "
echo "Not enough storage space for installation. 350GB is required for installation."
echo "-------------------------------------------------- "
exit ;;
* )
echo " "
echo "Not enough storage space for installation. 350GB is required for installation."
echo "-------------------------------------------------- "
exit ;;
esac
echo " "
fi
############################# Chose GrADS or OpenGrADS #########################
while read -r -p "Which graphic display software should be install?
-OpenGrADS
-GrADS (Not available for MacOS)
Please answer with either OpenGrADS or GrADS and press enter.
" yn; do
case $yn in
OpenGrADS)
echo " "
echo "OpenGrADS selected for installation"
echo "-------------------------------------------------- "
export GRADS_PICK=1 #variable set for grads or opengrads choice
break
;;
GrADS)
echo " "
echo "GrADS selected for installation"
echo "-------------------------------------------------- "
export GRADS_PICK=2 #variable set for grads or opengrads choice
break
;;
* )
echo " "
echo "Please answer OpenGrADS or GrADS (case sensative).";;
esac
done
echo " "
################################# Auto Configuration Test ##################
while true; do
echo " Auto Configuration Check"
read -r -p "
Would you like the script to select all the configure options for you?
Please note, that you should not have to type anything else in the terminal.
(Y/N) " yn
case $yn in
[Yy]* )
export auto_config=1 #variable set for one click config and installation
break
;;
[Nn]* )
export auto_config=0 #variable set for manual config and installation
break
;;
* ) echo "Please answer yes or no.";;
esac
done
echo " "
################################# GEOG WPS Geographical Input Data Mandatory for Specific Applications ##################
while true; do
echo "-------------------------------------------------- "
echo " "
echo "Would you like to download the WPS Geographical Input Data for Specific Applications? (Optional)"
echo " "
echo "Specific Applicaitons files can be viewed here: "
echo " "
printf '\e]8;;https://www2.mmm.ucar.edu/wrf/users/download/get_sources_wps_geog.html\e\\Specific GEOG Applications Website (right click to open link) \e]8;;\e\\\n'
echo " "
read -r -p "(Y/N) " yn
case $yn in
[Yy]* )
export WPS_Specific_Applications=1 #variable set for "YES" for specific application data
break
;;
[Nn]* )
export WPS_Specific_Applications=0 #variable set for "NO" for specific application data
break
;;
* ) echo "Please answer yes or no.";;
esac
done
echo " "
################################# GEOG Optional WPS Geographical Input Data ##################
while true; do
echo "-------------------------------------------------- "
echo " "
echo "Would you like to download the GEOG Optional WPS Geographical Input Data? (Optional)"
echo " "
echo "Optional Geogrpahical files can be viewed here: "
echo " "
printf '\e]8;;https://www2.mmm.ucar.edu/wrf/users/download/get_sources_wps_geog.html\e\\Optional GEOG File Applications Website (right click to open link) \e]8;;\e\\\n'
echo " "
read -r -p "(Y/N) " yn
echo " "
case $yn in
[Yy]* )
export Optional_GEOG=1 #variable set for "YES" for Optional GEOG Data
break
;;
[Nn]* )
export Optional_GEOG=0 #variable set for "NO" for Optional GEOG Data
break
;;
* ) echo "Please answer yes or no.";;
esac
done
echo " "
############################## Choice for which version of WRF to Install ############
while read -r -p "Which version of WRF would you like to install?
-WRF
-WRFCHEM
-WRFHYDRO_COUPLED
-WRFHYDRO_STANDALONE
-HURRICANE_WRF
Please enter one of the above options and press enter (Case Sensative):
" yn; do
case $yn in
HURRICANE_WRF)
echo " "
echo "Hurricane WRF (HWRF) selected for installation"
echo "HWRF is only compatible with Intel Compilers"
echo "All geography files are downloaded and must be installed on system."
export HWRF_PICK=1 #variable set for grads or opengrads choice
break
;;
WRF)
echo " "
echo "WRF selected for installation"
export WRF_PICK=1 #variable set for grads or opengrads choice
break
;;
WRFCHEM)
echo " "
echo "WRFCHEM selected for installation"
export WRFCHEM_PICK=1 #variable set for grads or opengrads choice
break
;;
WRFHYDRO_COUPLED)
echo " "
echo "WRFHYDRO_COUPLED selected for installation"
export WRFHYDRO_COUPLED_PICK=1 #variable set for grads or opengrads choice
break
;;
WRFHYDRO_STANDALONE)
echo " "
echo "WRFHYDRO_STANDALONE selected for installation"
export WRFHYDRO_STANDALONE_PICK=1 #variable set for grads or opengrads choice
break
;;
* )
echo " "
echo "Please answer WRF, WRFCHEM, WRFHYDRO_COUPLED, WRFHYDRO_STANDALONE (All Upper Case).";;
esac
done
############################# Enter sudo users information #############################
echo "-------------------------------------------------- "
while true; do
echo " "
read -r -s -p "
Password is only save locally and will not be seen when typing.
Please enter your sudo password:
" yn
export PASSWD=$yn
echo "-------------------------------------------------- "
break
done
echo " "
echo "Beginning Installation"
echo " "
############################ DTC's MET & METPLUS ##################################################
###################################################################################################
if [ "$Ubuntu_64bit_Intel" = "1" ]; then
echo $PASSWD | sudo -S apt -y update
echo $PASSWD | sudo -S apt -y upgrade
# download the key to system keyring; this and the following echo command are
# needed in order to install the Intel compilers
wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \
| gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
# add signed entry to apt sources and configure the APT client to use Intel repository:
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
# this update should get the Intel package info from the Intel repository
echo $PASSWD | sudo -S apt -y update
echo $PASSWD | sudo -S apt -y upgrade
echo $PASSWD | sudo -S apt -y install python3 python3-dev emacs flex bison libpixman-1-dev libjpeg-dev pkg-config libpng-dev unzip python2 python2-dev python3-pip pipenv gcc gfortran g++ libtool automake autoconf make m4 default-jre default-jdk csh ksh git libncurses5 libncurses6 mlocate pkg-config build-essential curl libcurl4-openssl-dev
# install the Intel compilers
echo $PASSWD | sudo -S apt -y install intel-basekit intel-hpckit intel-aikit
echo $PASSWD | sudo -S apt -y update
# make sure some critical packages have been installed
which cmake libxml2 libxml2-dev pkg-config make gcc g++
# add the Intel compiler file paths to various environment variables
source /opt/intel/oneapi/setvars.sh
# some of the libraries we install below need one or more of these variables
export CC=icc
export CXX=icpc
export FC=ifort
export F77=ifort
export F90=ifort
export MPIFC=mpiifort
export MPIF77=mpiifort
export MPIF90=mpiifort
export MPICC=mpiicc
export MPICXX=mpiicpc
export CFLAGS="-fPIC -fPIE -O3 -diag-disable=10441"
export FFLAGS="-m64"
export FCFLAGS="-m64"
#########################
#Downloading latest dateutil due to python3.8 running old version.
pip3 install python-dateutil==2.8
#Directory Listings
if [ "$WRFCHEM_PICK" = "1" ]; then
mkdir $HOME/WRFCHEM_Intel
export WRF_FOLDER=$HOME/WRFCHEM_Intel
fi
if [ "$WRFHYDRO_COUPLED_PICK" = "1" ]; then
mkdir $HOME/WRFHYDRO_COUPLED_Intel
export WRF_FOLDER=$HOME/WRFHYDRO_COUPLED_Intel
fi
if [ "$WRF_PICK" = "1" ]; then
mkdir $HOME/WRF_Intel
export WRF_FOLDER=$HOME/WRF_Intel
fi
if [ "$HWRF_PICK" = "1" ]; then
mkdir $HOME/HWRF
export WRF_FOLDER=$HOME/HWRF
fi
mkdir $WRF_FOLDER/MET-11.0.2
mkdir $WRF_FOLDER/MET-11.0.2/Downloads
mkdir $WRF_FOLDER/METplus-5.0.1
mkdir $WRF_FOLDER/METplus-5.0.1/Downloads
#Downloading MET and untarring files
#Note weblinks change often update as needed.
cd $WRF_FOLDER/MET-11.0.2/Downloads
wget -c -4 https://raw.githubusercontent.com/dtcenter/MET/main_v11.0/internal/scripts/installation/compile_MET_all.sh
wget -c -4 https://dtcenter.ucar.edu/dfiles/code/METplus/MET/installation/tar_files.tgz
wget -c -4 https://github.com/dtcenter/MET/archive/refs/tags/v11.0.2.tar.gz
cp compile_MET_all.sh $WRF_FOLDER/MET-11.0.2
tar -xvzf tar_files.tgz -C $WRF_FOLDER/MET-11.0.2
cp v11.0.2.tar.gz $WRF_FOLDER/MET-11.0.2/tar_files
cd $WRF_FOLDER/MET-11.0.2
cd $WRF_FOLDER/MET-11.0.2
export PYTHON_VERSION=$(/opt/intel/oneapi/intelpython/latest/bin/python3 -V 2>&1|awk '{print $2}')
export PYTHON_VERSION_MAJOR_VERSION=$(echo $PYTHON_VERSION | awk -F. '{print $1}')
export PYTHON_VERSION_MINOR_VERSION=$(echo $PYTHON_VERSION | awk -F. '{print $2}')
export PYTHON_VERSION_COMBINED=$PYTHON_VERSION_MAJOR_VERSION.$PYTHON_VERSION_MINOR_VERSION
export CC=icc
export CXX=icpc
export FC=ifort
export F77=ifort
export F90=ifort
export gcc_version=$(icc -dumpversion -diag-disable=10441)
export TEST_BASE=$WRF_FOLDER/MET-11.0.2
export COMPILER=intel_$gcc_version
export MET_SUBDIR=${TEST_BASE}
export MET_TARBALL=v11.0.2.tar.gz
export USE_MODULES=FALSE
export MET_PYTHON=/opt/intel/oneapi/intelpython/python${PYTHON_VERSION_COMBINED}
export MET_PYTHON_CC=-I${MET_PYTHON}/include/python${PYTHON_VERSION_COMBINED}
export MET_PYTHON_LD=-L${MET_PYTHON}/lib/python${PYTHON_VERSION_COMBINED}/config-${PYTHON_VERSION_COMBINED}-x86_64-linux-gnu\ -L${MET_PYTHON}/lib\ -lpython${PYTHON_VERSION_COMBINED}\ -lcrypt\ -lpthread\ -ldl\ -lm\ -lm
export SET_D64BIT=FALSE
chmod 775 compile_MET_all.sh
time ./compile_MET_all.sh
export PATH=$WRF_FOLDER/MET-11.0.2/bin:$PATH #Add MET executables to path
#Basic Package Management for Model Evaluation Tools (METplus)
echo $PASSWD | sudo -S apt -y update
echo $PASSWD | sudo -S apt -y upgrade
#Directory Listings for Model Evaluation Tools (METplus
mkdir $WRF_FOLDER/METplus-5.0.1
mkdir $WRF_FOLDER/METplus-5.0.1/Sample_Data
mkdir $WRF_FOLDER/METplus-5.0.1/Output
mkdir $WRF_FOLDER/METplus-5.0.1/Downloads
#Downloading METplus and untarring files
cd $WRF_FOLDER/METplus-5.0.1/Downloads
wget -c -4 https://github.com/dtcenter/METplus/archive/refs/tags/v5.0.1.tar.gz
tar -xvzf v5.0.1.tar.gz -C $WRF_FOLDER
# Insatlllation of Model Evaluation Tools Plus
cd $WRF_FOLDER/METplus-5.0.1/parm/metplus_config
sed -i "s|MET_INSTALL_DIR = /path/to|MET_INSTALL_DIR = $WRF_FOLDER/MET-11.0.2|" defaults.conf
sed -i "s|INPUT_BASE = /path/to|INPUT_BASE = $WRF_FOLDER/METplus-5.0.1/Sample_Data|" defaults.conf
sed -i "s|OUTPUT_BASE = /path/to|OUTPUT_BASE = $WRF_FOLDER/METplus-5.0.1/Output|" defaults.conf
# Downloading Sample Data
cd $WRF_FOLDER/METplus-5.0.1/Downloads
wget -c -4 https://dtcenter.ucar.edu/dfiles/code/METplus/METplus_Data/v5.0/sample_data-met_tool_wrapper-5.0.tgz
tar -xvzf sample_data-met_tool_wrapper-5.0.tgz -C $WRF_FOLDER/METplus-5.0.1/Sample_Data
# Testing if installation of MET & METPlus was sucessfull
# If you see in terminal "METplus has successfully finished running."
# Then MET & METPLUS is sucessfully installed
echo 'Testing MET & METPLUS Installation.'
$WRF_FOLDER/METplus-5.0.1/ush/run_metplus.py -c $WRF_FOLDER/METplus-5.0.1/parm/use_cases/met_tool_wrapper/GridStat/GridStat.conf
export PATH=$WRF_FOLDER/METplus-5.0.1/ush:$PATH
echo " "
read -r -t 5 -p "MET and METPLUS sucessfully installed with intel compilers"
fi
if [ "$Ubuntu_64bit_GNU" = "1" ]; then
export HOME=`cd;pwd`
#Basic Package Management for Model Evaluation Tools (MET)
#############################basic package managment############################
echo $PASSWD | sudo -S apt -y update
echo $PASSWD | sudo -S apt -y upgrade
echo $PASSWD | sudo -S apt -y install python3 python3-dev emacs flex bison libpixman-1-dev libjpeg-dev pkg-config libpng-dev unzip python2 python2-dev python3-pip pipenv gcc gfortran g++ libtool automake autoconf make m4 default-jre default-jdk csh ksh git libncurses5 libncurses6 mlocate pkg-config build-essential curl libcurl4-openssl-dev
#Downloading latest dateutil due to python3.8 running old version.
pip3 install python-dateutil==2.8
#Directory Listings
if [ "$WRFCHEM_PICK" = "1" ]; then
mkdir $HOME/WRFCHEM
export WRF_FOLDER=$HOME/WRFCHEM
fi
if [ "$WRFHYDRO_COUPLED_PICK" = "1" ]; then
mkdir $HOME/WRFHYDRO_COUPLED
export WRF_FOLDER=$HOME/WRFHYDRO_COUPLED
fi
if [ "$WRFHYDRO_STANDALONE_PICK" = "1" ]; then
mkdir $HOME/WRFHYDRO_STANDALONE
export WRF_FOLDER=$HOME/WRFHYDRO_STANDALONE
fi
if [ "$WRF_PICK" = "1" ]; then
mkdir $HOME/WRF
export WRF_FOLDER=$HOME/WRF
fi
if [ "$HWRF_PICK" = "1" ]; then
mkdir $HOME/HWRF
export WRF_FOLDER=$HOME/HWRF
fi
mkdir $WRF_FOLDER/MET-11.0.2
mkdir $WRF_FOLDER/MET-11.0.2/Downloads
mkdir $WRF_FOLDER/METplus-5.0.1
mkdir $WRF_FOLDER/METplus-5.0.1/Downloads
#Downloading MET and untarring files
#Note weblinks change often update as needed.
cd $WRF_FOLDER/MET-11.0.2/Downloads
wget -c -4 https://raw.githubusercontent.com/dtcenter/MET/main_v11.0/internal/scripts/installation/compile_MET_all.sh
wget -c -4 https://dtcenter.ucar.edu/dfiles/code/METplus/MET/installation/tar_files.tgz
wget -c -4 https://github.com/dtcenter/MET/archive/refs/tags/v11.0.2.tar.gz
cp compile_MET_all.sh $WRF_FOLDER/MET-11.0.2
tar -xvzf tar_files.tgz -C $WRF_FOLDER/MET-11.0.2
cp v11.0.2.tar.gz $WRF_FOLDER/MET-11.0.2/tar_files
cd $WRF_FOLDER/MET-11.0.2
# Installation of Model Evaluation Tools
export CC=/usr/bin/gcc
export CXX=/usr/bin/g++
export FC=/usr/bin/gfortran
export F77=/usr/bin/gfortran
export CFLAGS="-fPIC -fPIE -O3"
cd $WRF_FOLDER/MET-11.0.2
export GCC_VERSION=$(/usr/bin/gcc -dumpfullversion | awk '{print$1}')
export GFORTRAN_VERSION=$(/usr/bin/gfortran -dumpfullversion | awk '{print$1}')
export GPLUSPLUS_VERSION=$(/usr/bin/g++ -dumpfullversion | awk '{print$1}')
export GCC_VERSION_MAJOR_VERSION=$(echo $GCC_VERSION | awk -F. '{print $1}')
export GFORTRAN_VERSION_MAJOR_VERSION=$(echo $GFORTRAN_VERSION | awk -F. '{print $1}')
export GPLUSPLUS_VERSION_MAJOR_VERSION=$(echo $GPLUSPLUS_VERSION | awk -F. '{print $1}')
export version_10="10"
export PYTHON_VERSION=$(/usr/bin/python3 -V 2>&1|awk '{print $2}')
export PYTHON_VERSION_MAJOR_VERSION=$(echo $PYTHON_VERSION | awk -F. '{print $1}')
export PYTHON_VERSION_MINOR_VERSION=$(echo $PYTHON_VERSION | awk -F. '{print $2}')
export PYTHON_VERSION_COMBINED=$PYTHON_VERSION_MAJOR_VERSION.$PYTHON_VERSION_MINOR_VERSION
export FC=/usr/bin/gfortran
export F77=/usr/bin/gfortran
export F90=/usr/bin/gfortran
export gcc_version=$(gcc -dumpfullversion)
export TEST_BASE=$WRF_FOLDER/MET-11.0.2
export COMPILER=gnu_$gcc_version
export MET_SUBDIR=${TEST_BASE}
export MET_TARBALL=v11.0.2.tar.gz
export USE_MODULES=FALSE
export MET_PYTHON=/usr
export MET_PYTHON_CC=-I${MET_PYTHON}/include/python${PYTHON_VERSION_COMBINED}
export MET_PYTHON_LD=-L${MET_PYTHON}/lib/python${PYTHON_VERSION_COMBINED}/config-${PYTHON_VERSION_COMBINED}-x86_64-linux-gnu\ -L${MET_PYTHON}/lib\ -lpython${PYTHON_VERSION_COMBINED}\ -lcrypt\ -ldl\ -lutil\ -lm
export SET_D64BIT=FALSE
chmod 775 compile_MET_all.sh
time ./compile_MET_all.sh | tee compile_MET_all.log
export PATH=$WRF_FOLDER/MET-11.0.2/bin:$PATH
#basic Package Management for Model Evaluation Tools (METplus)
echo $PASSWD | sudo -S apt -y update
echo $PASSWD | sudo -S apt -y upgrade
#Directory Listings for Model Evaluation Tools (METplus
mkdir $WRF_FOLDER/METplus-5.0.1
mkdir $WRF_FOLDER/METplus-5.0.1/Sample_Data
mkdir $WRF_FOLDER/METplus-5.0.1/Output
mkdir $WRF_FOLDER/METplus-5.0.1/Downloads
#Downloading METplus and untarring files
cd $WRF_FOLDER/METplus-5.0.1/Downloads
wget -c -4 https://github.com/dtcenter/METplus/archive/refs/tags/v5.0.1.tar.gz
tar -xvzf v5.0.1.tar.gz -C $WRF_FOLDER
# Insatlllation of Model Evaluation Tools Plus
cd $WRF_FOLDER/METplus-5.0.1/parm/metplus_config
sed -i "s|MET_INSTALL_DIR = /path/to|MET_INSTALL_DIR = $WRF_FOLDER/MET-11.0.2|" defaults.conf
sed -i "s|INPUT_BASE = /path/to|INPUT_BASE = $WRF_FOLDER/METplus-5.0.1/Sample_Data|" defaults.conf
sed -i "s|OUTPUT_BASE = /path/to|OUTPUT_BASE = $WRF_FOLDER/METplus-5.0.1/Output|" defaults.conf
# Downloading Sample Data
cd $WRF_FOLDER/METplus-5.0.1/Downloads
wget -c -4 https://dtcenter.ucar.edu/dfiles/code/METplus/METplus_Data/v5.0/sample_data-met_tool_wrapper-5.0.tgz
tar -xvzf sample_data-met_tool_wrapper-5.0.tgz -C $WRF_FOLDER/METplus-5.0.1/Sample_Data
# Testing if installation of MET & METPlus was sucessfull
# If you see in terminal "METplus has successfully finished running."
# Then MET & METPLUS is sucessfully installed
echo 'Testing MET & METPLUS Installation.'
$WRF_FOLDER/METplus-5.0.1/ush/run_metplus.py -c $WRF_FOLDER/METplus-5.0.1/parm/use_cases/met_tool_wrapper/GridStat/GridStat.conf
export PATH=$WRF_FOLDER/METplus-5.0.1/ush:$PATH
read -r -t 5 -p "MET and METPLUS sucessfully installed with GNU compilers."
fi
##################################### WRFCHEM Tools ###############################################
# This script will install the WRFCHEM pre-processor tools.
# Information on these tools can be found here:
# https://www2.acom.ucar.edu/wrf-chem/wrf-chem-tools-community#download
#
# Addtional information on WRFCHEM can be found here:
# https://ruc.noaa.gov/wrf/wrf-chem/
#
# We ask users of the WRF-Chem preprocessor tools to include in any publications the following acknowledgement:
# "We acknowledge use of the WRF-Chem preprocessor tool {mozbc, fire_emiss, etc.} provided by the Atmospheric Chemistry Observations and Modeling Lab (ACOM) of NCAR."
#
#
# This script installs the WRFCHEM Tools with gnu or intel compilers.
####################################################################################################
if [ "$Ubuntu_64bit_GNU" = "1" ] && [ "$WRFCHEM_PICK" = "1" ]; then
cd $HOME
git clone https://github.com/HathewayWill/WRFCHEM-TOOLS-MOSIT.git
cd WRFCHEM-TOOLS-MOSIT
chmod 775 *.sh
./WRFCHEM_TOOLS_MOSIT.sh $PASSWD $Ubuntu_64bit_GNU
cd $HOME
fi
if [ "$Ubuntu_64bit_Intel" = "1" ] && [ "$WRFCHEM_PICK" = "1" ]; then
cd $HOME
git clone https://github.com/HathewayWill/WRFCHEM-TOOLS-MOSIT.git
cd WRFCHEM-TOOLS-MOSIT
chmod 775 *.sh
./WRFCHEM_TOOLS_MOSIT.sh $PASSWD $Ubuntu_64bit_Intel
cd $HOME
fi
if [ "$macos_64bit_GNU" = "1" ] && [ "$WRFCHEM_PICK" = "1" ]; then
cd $HOME
git clone https://github.com/HathewayWill/WRFCHEM-TOOLS-MOSIT.git
cd WRFCHEM-TOOLS-MOSIT
chmod 775 *.sh
./WRFCHEM_TOOLS_MOSIT.sh $PASSWD $macos_64bit_GNU
cd $HOME
fi
############################################# WRF Hydro Standalone #################################
## WRFHYDRO Standalone installation with parallel process.
# Download and install required library and data files for WRFHYDRO.
# Tested in Ubuntu 20.04.5 LTS & Ubuntu 22.04 & MacOS Ventura 64bit
# Built in 64-bit system
# Built with Intel or GNU compilers
# Tested with current available libraries on 01/01/2023
# If newer libraries exist edit script paths for changes
#Estimated Run Time ~ 30 - 60 Minutes with 10mb/s downloadspeed.
# Special thanks to:
# Youtube's meteoadriatic, GitHub user jamal919.
# University of Manchester's Doug L
# University of Tunis El Manar's Hosni
# GSL's Jordan S.
# NCAR's Mary B., Christine W., & Carl D.
# DTC's Julie P., Tara J., George M., & John H.
# UCAR's Katelyn F., Jim B., Jordan P., Kevin M.,
##############################################################
if [ "$Ubuntu_64bit_GNU" = "1" ] && [ "$WRFHYDRO_STANDALONE_PICK" = "1" ]; then
#############################basic package managment############################
echo $PASSWD | sudo -S apt -y update
echo $PASSWD | sudo -S apt -y upgrade
echo $PASSWD | sudo -S apt -y install gcc gfortran g++ libtool automake autoconf make m4 default-jre default-jdk csh ksh tcsh okular cmake libxml2 libxml2-dev time xorg openbox xauth git python3 python3-dev python2 python2-dev cmake libxml2 libxml2-dev mlocate pkg-config
echo " "
##############################Directory Listing############################
export HOME=`cd;pwd`
mkdir $HOME/WRFHYDRO_STANDALONE
export WRFHYDRO_FOLDER=$HOME/WRFHYDRO_STANDALONE
cd $WRFHYDRO_FOLDER/
mkdir Downloads
mkdir Libs
export DIR=$WRFHYDRO_FOLDER/Libs
mkdir Libs/grib2
mkdir Libs/NETCDF
mkdir Libs/MPICH
echo " "
##############################Downloading Libraries############################
cd Downloads
wget -c -4 https://github.com/madler/zlib/archive/refs/tags/v1.2.13.tar.gz
wget -c -4 https://github.com/HDFGroup/hdf5/archive/refs/tags/hdf5-1_14_0.tar.gz
wget -c -4 https://github.com/Unidata/netcdf-c/archive/refs/tags/v4.9.2.tar.gz
wget -c -4 https://github.com/Unidata/netcdf-fortran/archive/refs/tags/v4.6.0.tar.gz
wget -c -4 https://download.sourceforge.net/libpng/libpng-1.6.39.tar.gz
wget -c -4 https://www.ece.uvic.ca/~frodo/jasper/software/jasper-1.900.1.zip
wget -c -4 https://github.com/pmodels/mpich/releases/download/v4.1.1/mpich-4.1.1.tar.gz
wget -c -4 https://parallel-netcdf.github.io/Release/pnetcdf-1.12.3.tar.gz
wget -c -4 https://sourceforge.net/projects/opengrads/files/grads2/2.2.1.oga.1/Linux%20%2864%20Bits%29/opengrads-2.2.1.oga.1-bundle-x86_64-pc-linux-gnu-glibc_2.17.tar.gz
echo " "
#############################Compilers############################
export CC=gcc
export CXX=g++
export FC=gfortran
export F77=gfortran
export CFLAGS="-fPIC -fPIE -O3"
export gcc_version="$(gcc -dumpversion)"
export gfortran_version="$(gfortran -dumpversion)"
export gplusplus_version="$(g++ -dumpversion)"
export version_10="10"
if [ $gcc_version -ge $version_10 ] || [ $gfortran_version -ge $version_10 ] || [ $gplusplus_version -ge $version_10 ]
then
export fallow_argument=-fallow-argument-mismatch
export boz_argument=-fallow-invalid-boz
else
export fallow_argument=
export boz_argument=
fi
export FFLAGS="$fallow_argument -m64"
export FCFLAGS="$fallow_argument -m64"
echo " "
#############################Core Management####################################
export CPU_CORE=$(nproc) # number of available threads on system
export CPU_6CORE="6"
export CPU_HALF=$(($CPU_CORE / 2)) #half of availble cores on system
export CPU_HALF_EVEN=$(( $CPU_HALF - ($CPU_HALF % 2) )) #Forces CPU cores to even number to avoid partial core export. ie 7 cores would be 3.5 cores.
if [ $CPU_CORE -le $CPU_6CORE ] #If statement for low core systems. Forces computers to only use 1 core if there are 4 cores or less on the system.
then
export CPU_HALF_EVEN="2"
else
export CPU_HALF_EVEN=$(( $CPU_HALF - ($CPU_HALF % 2) ))
fi
echo "##########################################"
echo "Number of Threads being used $CPU_HALF_EVEN"
echo "##########################################"
echo " "
##############################MPICH############################
cd $WRFHYDRO_FOLDER/Downloads
tar -xvzf mpich-4.1.1.tar.gz
cd mpich-4.1.1/
F90= ./configure --prefix=$DIR/MPICH --with-device=ch3 FFLAGS="$fallow_argument -m64" FCFLAGS="$fallow_argument -m64"
make -j $CPU_HALF_EVEN
make -j $CPU_HALF_EVEN install | tee make.install.log
#make check
export PATH=$DIR/MPICH/bin:$PATH
echo " "
#############################zlib############################
#Uncalling compilers due to comfigure issue with zlib1.2.13
#With CC & CXX definied ./configure uses different compiler Flags
cd $WRFHYDRO_FOLDER/Downloads
tar -xvzf v1.2.13.tar.gz
cd zlib-1.2.13/
./configure --prefix=$DIR/grib2
make -j $CPU_HALF_EVEN 2>&1 | tee make.log
make -j $CPU_HALF_EVEN install 2>&1 | tee make.install.log
#make check
echo " "
##############################MPICH############################
cd $WRFHYDRO_FOLDER/Downloads
tar -xvzf mpich-4.1.1.tar.gz
cd mpich-4.1.1/
F90= ./configure --prefix=$DIR/MPICH --with-device=ch3 FFLAGS="$fallow_argument -m64" FCFLAGS="$fallow_argument -m64"
make -j $CPU_HALF_EVEN 2>&1 | tee make.log
make -j $CPU_HALF_EVEN install 2>&1 | tee make.install.log
#make check
export PATH=$DIR/MPICH/bin:$PATH
export MPIFC=$DIR/MPICH/bin/mpifort
export MPIF77=$DIR/MPICH/bin/mpifort
export MPIF90=$DIR/MPICH/bin/mpifort
export MPICC=$DIR/MPICH/bin/mpicc
export MPICXX=$DIR/MPICH/bin/mpicxx
echo " "
#############################libpng############################
cd $WRFHYDRO_FOLDER/Downloads
export LDFLAGS=-L$DIR/grib2/lib
export CPPFLAGS=-I$DIR/grib2/include
tar -xvzf libpng-1.6.39.tar.gz
cd libpng-1.6.39/
CC=$MPICC FC=$MPIFC F77=$MPIF77 F90=$MPIF90 CXX=$MPICXX ./configure --prefix=$DIR/grib2
make -j $CPU_HALF_EVEN 2>&1 | tee make.log
make -j $CPU_HALF_EVEN install 2>&1 | tee make.install.log
#make check
echo " "
#############################JasPer############################
cd $WRFHYDRO_FOLDER/Downloads
unzip jasper-1.900.1.zip
cd jasper-1.900.1/
autoreconf -i
CC=$MPICC FC=$MPIFC F77=$MPIF77 F90=$MPIF90 CXX=$MPICXX ./configure --prefix=$DIR/grib2
make -j $CPU_HALF_EVEN 2>&1 | tee make.log
make -j $CPU_HALF_EVEN install 2>&1 | tee make.install.log
#make check
export JASPERLIB=$DIR/grib2/lib
export JASPERINC=$DIR/grib2/include
echo " "
#############################hdf5 library for netcdf4 functionality############################
cd $WRFHYDRO_FOLDER/Downloads
tar -xvzf hdf5-1_14_0.tar.gz
cd hdf5-hdf5-1_14_0
CC=$MPICC FC=$MPIFC F77=$MPIF77 F90=$MPIF90 CXX=$MPICXX ./configure --prefix=$DIR/grib2 --with-zlib=$DIR/grib2 --enable-hl --enable-fortran --enable-parallel
make -j $CPU_HALF_EVEN 2>&1 | tee make.log
make -j $CPU_HALF_EVEN install 2>&1 | tee make.install.log
#make check
export HDF5=$DIR/grib2
export PHDF5=$DIR/grib2
export LD_LIBRARY_PATH=$DIR/grib2/lib:$LD_LIBRARY_PATH
#############################Install Parallel-netCDF##############################
#Make file created with half of available cpu cores
#Hard path for MPI added
##################################################################################