main_e3sm.sh 5.92 KB
Newer Older
1
2
3
#!/bin/bash
#clear

4
# 8/18 to run this script on E3SM v1 on CORI at NERSC
5

6
# alter parameters below to match desired settings in the section with machine you are using
7
8
# Key settings: 
# job case, location (path), year start and end, 
9
# location of output (outpath), does not need to exist yet, it will be created below if its not already
10
11
12
# variables to postprocess (are not yet) set to those needed for LIVV postprocessing tools
# update specialty files used for masking and regridding
# total area of GrIS in model is 1.719e6
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

if [[ $(hostname -s) = rhea* ]]; then
	project=cli115  
	case=20180215.DECKv1b_H1.ne30_oEC.edison
	year_start=1979
	year_end=2005
	base=/lustre/atlas1/$project/proj-shared/salil/archive
	path=$base/$case/archive
	obspath=/lustre/atlas1/$project/world-shared/$USER/obs_data
	outpath=/lustre/atlas1/$project/world-shared/$USER/$case/postproc
	area_file=/lustre/atlas1/$project/world-shared/$USER/surfdata_0.9x1.25_simyr1850_c110725.nc
	map_file=/ccs/home/zender/data/maps/map_ne30np4_to_fv129x256_aave.20150901.nc
	mask_file=/lustre/atlas1/$project/world-shared/4ue/$case/postproc/mask_ne30np4_notime.nc
elif [[ $(hostname -s) = cori* ]]; then
	project=piscees  
	case=20180612.B_case.T62_oEC60to30v3wLI.modified_runoff_mapping.edison
	year_start=0070
	year_end=0075
	base=/global/cscratch1/sd/dcomeau/acme_scratch/edison/archive
	path=$base/$case/run
	obspath=/project/projectdirs/piscees/postproc/obs_data
	outpath=/global/cscratch1/sd/$USER/$case/postproc
	area_file=/project/projectdirs/piscees/postproc/surfdata_0.9x1.25_simyr1850_c110725.nc
	map_file=/project/projectdirs/piscees/postproc/map_ne30np4_to_fv129x256_aave.20150901.nc
	#mask_file=/project/projectdirs/piscees/postproc/mask_ne30np4_notime.nc
else
  echo "machine not recognized"
fi
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
version=e3sm
atm_vars=("PSL" "CLDLOW" "CLDHGH" "CLDMED" "CLDTOT" "TREFHT" "TS" "TSMX" "TSMN" "PRECC" "PRECL")
lnd_h0_vars=("FSDS" "QRUNOFF" "QSOIL" "TSA" "RAIN" "SNOW" "FIRA" "FLDS" "FSH" "QSNOMELT")
#glc_vars=("acab" "thk")

postprocess=true
postprocess_obs=false
make_plots=true

mkdir -p $outpath

echo "$version"

#postprocess all components of coupled model 
	glc=cism
	lnd=clm2 
	atm=cam 

#run a check, is the requested data directory there?
if test -d $path; then
	echo "Directory $path exists"
else
	echo "Target directory $path does not exist"
	exit 
fi

#run a check, do you have the software to perform the postprocessing?
if [[ $(hostname -s) = rhea* ]]; then

export MODULEPATH=$HOME/.modulefiles:$MODULEPATH
module unload PE-pgi PE-gnu PE-intel
module unload nco ncl netcdf
module load PE-gnu/4.8.2

module load netcdf/4.4.1
module load gsl hdf5-parallel

module unload gcc
module load gcc
module load nco/4.6.9
module load ncl/6.3.0

module load anaconda-cli106/rhea
source deactivate && source activate LIVVpy2

module list

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
elif [[ $(hostname -s) = cori* ]]; then
    module unload PrgEnv-pgi PrgEnv-gnu PrgEnv-intel
    module load PrgEnv-gnu/6.0.4

    module unload nco ncl netcdf gcc
    module load gcc
    module load cray-netcdf/4.4.1.1.6 
    module load gsl
#   module load hdf5-parallel/1.10.1 conflit with netcdf
    module load nco/4.7.4

    module load python/2.7-anaconda-4.4
    module list

#   load the conda environment
    source /global/homes/k/kennedyj/LIVVkit/conda/etc/profile.d/conda.sh
# For python 3
    conda activate lex_py3
# For python 2
#   conda activate lex_py2

#    . deactivate && . activate LIVVpy2

module list

113
114
115
116
117
118
119
120
121
122
123
124
elif [[ $(hostname -s) = titan* ]]; then
  module load netcdf/cray
  module load nco/4.6.9
  module load ncl/6.3.0
else
  echo "machine not recognized, make sure your path: 
 	$PATH 
  	points to a version of nco/4.6.9 or later"
	exit
fi

# this is a hack- all files from E3SM runs we care about should have a gris_mask in the data
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#if [ "$version" == "cesm1" ]; then
#
#if test -a $outpath/masks/${case}.$lnd.gris_mask.nc; then
#        echo "already created gris_mask and area file, moving on"
#else
#        echo "gris_mask file does not exist, creating"
#
#	mkdir -p $outpath/masks
#       	ncks -O -v gris_mask,area $path/lnd/hist/${case}.${lnd}.h0.${year_start}-01.nc $outpath/masks/${case}.${lnd}.gris_mask_time.nc 
#       	ncwa -a time $outpath/masks/${case}.${lnd}.gris_mask_time.nc $outpath/masks/${case}.${lnd}.gris_mask.nc 
#
#fi # if mask file needs to be created

#fi  # CESM
139
140
141
142

if [ "$postprocess_obs" = "true" ]; then

echo "process and remap cloud obs"
143
../obs/atm_obs.sh 
144
echo "process RACMO"
145
../obs/lnd_obs.sh 
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

./remap_RACMO_to_CESM2_inline.sh

fi

echo "executing post processing of atm data for validation"
. atm.sh 

echo "executing post processing of lnd data for validation"
. lnd.sh  


if [ "$make_plots" = "true" ]; then
echo "make the atmosphere plots"
mkdir -p "$outpath/atm/plots"

python plot_files/E3SM_cldhgh_ANN.py
python plot_files/E3SM_cldtot_ANN.py 
python plot_files/yearly_cycle_CLDTOT_e3sm.py 
python plot_files/yearly_cycle_CLDHGH_e3sm.py 
python plot_files/yearly_cycle_CLDLOW_e3sm.py 

echo "Areal annual avgd values of radiation vars: E3SM"
python e3sm_rad_aavg.py

echo "Areal annual avgd values of radiation vars: RACMO"
python racmo_rad_aavg.py

echo "make the land plots"
mkdir -p "$outpath/lnd/plots"

if [ "$version" = "cesm1" ]; then
python plot_files/CESM_RACMO23_t2m_JJA.py
python plot_files/CESM_RACMO23_t2m_DJF.py 
python plot_files/CESM_RACMO23_t2m_ANN.py
python plot_files/CESM_RACMO23_albedo.py
python plot_files/CESM_RACMO23_latf.py 
python plot_files/CESM_RACMO23_senf.py
python plot_files/CESM_RACMO23_rnet.py
python plot_files/CESM_RACMO23_swsn.py
python plot_files/CESM_RACMO23_swsd.py
python plot_files/CESM_RACMO23_lwsn.py
python plot_files/CESM_RACMO23_lwsd.py

python plot_files/CESM_RACMO23_smb.py
python plot_files/TimeSeries_QICE.py 

elif [ "$version" = "e3sm" ]; then
python plot_files/E3SM_RACMO23_t2m_JJA.py
python plot_files/E3SM_RACMO23_t2m_DJF.py 
python plot_files/E3SM_RACMO23_albedo.py
python plot_files/E3SM_RACMO23_rnet.py
python plot_files/E3SM_RACMO23_smb.py
python plot_files/TimeSeries_smblike.py 
fi

fi # to make plots or not