Skip to content

Commit 7f70aaa

Browse files
committed
save script changes
1 parent 81e618f commit 7f70aaa

4 files changed

Lines changed: 98 additions & 16 deletions

File tree

ccpp/physics_namelists/input_GFS_v17_p8_ugwpv1.nml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
&gfs_physics_nml
2-
fhzero = 1
2+
fhzero = 12
33
h2o_phys = .true.
44
ldiag3d = .true.
55
qdiag3d = .true.
@@ -12,7 +12,7 @@
1212
ltaerosol = .false.
1313
lradar = .true.
1414
ttendlim = -999
15-
dt_inner = 300
15+
dt_inner = 150
1616
sedi_semi = .true.
1717
decfl = 10
1818
oz_phys = .false.

ccpp/physics_namelists/input_GFS_v17_p8_ugwpv1.nml.C96dt150

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
&gfs_physics_nml
2-
fhzero = 12
2+
fhzero = 1
33
h2o_phys = .true.
44
ldiag3d = .true.
55
qdiag3d = .true.

test/plot_scm_out.py

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ def plot_results(file_bl, file_rt=None, vars2plt=None):
1616
vars2plot_ALL = \
1717
["pres", "pres_i","sigma","sigma_i","pres_s","qv","T","u","v","ql", \
1818
"qi","qc","qv_force_tend","T_force_tend","u_force_tend", \
19+
"rad_cloud_fraction","rad_cloud_lwp","rad_cloud_iwp","rad_cloud_rwp", \
20+
"rad_cloud_swp","rad_eff_rad_ql","rad_eff_rad_qi","rad_eff_rad_qr", \
21+
"rad_eff_rad_qs", \
1922
"v_force_tend","w_ls","u_g","v_g","dT_dt_rad_forc","h_advec_thil", \
2023
"h_advec_qt", "v_advec_thil","v_advec_qt","T_s","lhf","shf", \
2124
"tprcp_inst","tprcp_rate_inst","t2m","q2m","ustar","tsfc","tau_u", \
@@ -108,25 +111,28 @@ def plot_results(file_bl, file_rt=None, vars2plt=None):
108111

109112
# Make figure
110113
if (np.size(x1) > 1):
111-
#fig = plt.figure(figsize=(13,10))
114+
#fig = plt.figure(figsize=(8,10))
112115
fig = plt.figure(figsize=(5,10))
113116

114117
# Baselines and RTs on same plot
115118
if plot_diff: plt.subplot(2,1,1)
116119
plt.title(SCM_BL[var].description)
117-
plt.plot(x1, y1, color='orange')
118-
if plot_diff: plt.plot(x2, y2, color='red')
120+
plt.plot(x1, y1, color='red')
121+
if plot_diff: plt.plot(x2, y2, color='black')
119122
plt.ylabel('('+SCM_BL[var].units+')')
120123
plt.xlabel('(hours)')
121-
124+
#plt.xlim(0,240)
125+
plt.xlim(0,np.max(x1))
122126
# Difference (Baseline-MRT)
123127
if plot_diff:
124128
plt.subplot(2,1,2)
125-
plt.title("Difference (Orange - red)")
129+
plt.title("Difference (red - black)")
126130
plt.plot(x1, y1 - y2, color='black')
127131
plt.plot(x1, np.zeros(len(y1)), color='grey',linestyle='dashed')
128132
plt.ylabel('('+SCM_BL[var].units+')')
129133
plt.xlabel('(hours)')
134+
#plt.xlim(0,240)
135+
plt.xlim(0,np.max(x1))
130136
# Save figure
131137
fileOUT = 'scm.' + var +'.png'
132138
plt.savefig(fileOUT)
@@ -155,7 +161,7 @@ def plot_results(file_bl, file_rt=None, vars2plt=None):
155161

156162
# Finally, make figure.
157163
if (np.size(x1) > 1):
158-
#fig = plt.figure(figsize=(13,10))
164+
#fig = plt.figure(figsize=(8,10))
159165

160166
z_min = min(np.min(z1), np.min(z2))
161167
z_max = max(np.max(z1), np.max(z2))
@@ -165,10 +171,11 @@ def plot_results(file_bl, file_rt=None, vars2plt=None):
165171
#mz Compute limits for color bar
166172
vmin1, vmax1 = np.min(z1), np.max(z1)
167173
if file_rt is not None: plt.subplot(3,1,1)
168-
plt.contourf(x1, y1, z1, 20, cmap='gist_ncar', vmin=vmin1, vmax=vmax1)
169-
#plt.contourf(x1, y1, z1, levels=np.linspace(z_min, z_max, 20), cmap='gist_ncar', vmin=z_min, vmax=z_max)
174+
plt.contourf(x1, y1, z1, 30, cmap='gist_ncar', vmin=z_min, vmax=z_max)
175+
#plt.contourf(x1, y1, z1, levels=np.linspace(z_min, z_max, 20), cmap='gist_ncar')
170176
plt.ylim(1000,100)
171177
plt.xlim(0,np.max(x1))
178+
#plt.xlim(0,240)
172179
plt.ylabel('(Pa)')
173180
plt.xlabel('(hours)')
174181
cbr = plt.colorbar()
@@ -177,21 +184,26 @@ def plot_results(file_bl, file_rt=None, vars2plt=None):
177184
# Set custom y-ticks for the first subplot
178185
#y_ticks = [1000, 900, 850, 700, 500, 250, 100, 50, 0.1]
179186
y_ticks = [1000, 925, 850, 700, 500, 250, 100]
187+
#y_ticks = [1000, 950, 900, 850, 800, 750, 700]
188+
x_ticks = [0,24,48,72,96,120,144,168,192,216,240,264,288,312,336]
180189
plt.yticks(y_ticks, fontsize=10)
190+
#plt.xticks(x_ticks, fontsize=10)
181191
# Add only y-axis grid lines
182192
plt.grid(axis='y', linestyle='--', linewidth=0.5, color='gray')
183193
if file_rt is not None:
184194
# SCM RTs
185195
plt.subplot(3,1,2)
186-
plt.contourf(x2, y2, z2, 20, vmin=vmin1, vmax=vmax1, cmap='gist_ncar')
187-
#plt.contourf(x2, y2, z2, levels=np.linspace(z_min, z_max, 20), cmap='gist_ncar', vmin=z_min, vmax=z_max)
196+
plt.contourf(x2, y2, z2, 30, vmin=z_min, vmax=z_max, cmap='gist_ncar')
197+
#plt.contourf(x2, y2, z2, levels=np.linspace(z_min, z_max, 20), cmap='gist_ncar')
188198
plt.ylim(1000,100)
189199
plt.xlim(0,np.max(x1))
200+
#plt.xlim(0,240)
190201
plt.ylabel('(Pa)')
191202
plt.xlabel('(hours)')
192203
cbr = plt.colorbar()
193204
cbr.set_label('('+SCM_RT[var].units+')')
194205
plt.yticks(y_ticks, fontsize=10)
206+
#plt.xticks(x_ticks, fontsize=10)
195207
# Add only y-axis grid lines
196208
plt.grid(axis='y', linestyle='--', linewidth=0.5, color='gray')
197209
# end if
@@ -201,17 +213,20 @@ def plot_results(file_bl, file_rt=None, vars2plt=None):
201213
if (np.count_nonzero(dz) > 0):
202214
plt.subplot(3,1,3)
203215
#mz Set symmetric color limits for the difference
204-
vmin = -np.max(np.abs(dz))
205-
vmax = np.max(np.abs(dz))
206-
c3 = plt.contourf(x2, y2, dz, 20, cmap='bwr', vmin=vmin, vmax=-vmin)
216+
vmin2 = -np.max(np.abs(dz))
217+
vmax2 = np.max(np.abs(dz))
218+
c3 = plt.contourf(x2, y2, dz, 20, cmap='bwr', vmin=vmin2, vmax=vmax2)
207219
# plt.title("Difference (top - middle)", fontsize=8)
208220
# plt.contourf(x2, y2, dz, 20, cmap='bwr')
221+
#plt.xlim(0,240)
222+
plt.xlim(0,np.max(x1))
209223
plt.ylim(1000,100)
210224
plt.ylabel('(Pa)')
211225
plt.xlabel('(hours)')
212226
cbr = plt.colorbar(c3)
213227
cbr.set_label('('+SCM_RT[var].units+')')
214228
plt.yticks(y_ticks, fontsize=10)
229+
#plt.xticks(x_ticks, fontsize=10)
215230
# Add only y-axis grid lines
216231
plt.grid(axis='y', linestyle='--', linewidth=0.5, color='gray')
217232
# end if (no differences exist)

test/scm_slurm_example.py

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#!/usr/bin/env python
2+
"""
3+
-----------------------------------------------------------------------
4+
Description: Example script to submit a job through the HPC batch system
5+
6+
Assumptions: For use on Hera. This script must be copied to the bin directory.
7+
The user should edit the JOB_NAME, ACCOUNT, etc.
8+
./scm/etc/Hera_setup_intel.sh or
9+
./scm/etc/Hera_setup_intel.csh must be run before submitting this script
10+
11+
COMMAND line arguments: none
12+
13+
Usage: ./scm_slurm_example.py # from the bin directory
14+
-----------------------------------------------------------------------
15+
"""
16+
17+
from subprocess import Popen, PIPE
18+
import os
19+
import time
20+
21+
USER = os.getenv('USER')
22+
STRINGS = [USER, 'noaa.gov']
23+
MY_EMAIL = '@'.join(STRINGS)
24+
PROC = Popen('sbatch', shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True)
25+
26+
### User-editable section ###
27+
JOB_NAME = "scmout"
28+
ACCOUNT = "ufs-phys"
29+
WALLTIME = "20"
30+
PROCESSORS = "1"
31+
QUEUE = "batch"
32+
#COMMAND = "./run_scm.py --npz_type gfs --file scm_ufsens_control_c192.py --timestep 360"
33+
#COMMAND = "./run_scm.py --npz_type gfs --file scm_ufsens_HYD_control_p8_ugwpv1_intel.py --timestep 600 --n_itt_out 6 --n_itt_diag 6"
34+
#COMMAND = "./run_scm.py --npz_type gfs --file scm_ufsens_control_p8_ugwpv1_intel.py --timestep 600 --n_itt_out 6 --n_itt_diag 6"
35+
COMMAND = "./cmp_scmout.py -fbl /scratch2/BMC/ufs-phys/Man.Zhang/_case_gen/ccpp-scm_v7_hr_v4/scm/run/HR4_C96_NH/output_control_p8_ugwpv1_intel_n001_SCM_GFS_v17_p8_ugwpv1/output.nc -frt /scratch2/BMC/ufs-phys/Man.Zhang/_case_gen/ccpp-scm_v7_hr_v4/scm/run/HR4_C96_HYD/output_HYD_control_p8_ugwpv1_intel_n001_SCM_GFS_v17_p8_ugwpv1/output.nc"
36+
EMAIL_ADDR = MY_EMAIL
37+
EMAIL_OCCASION = "BEGIN,END,FAIL"
38+
SERIAL_MEM = "512M"
39+
WORKING_DIR = os.path.dirname(os.path.abspath(__file__))
40+
### End User-editable section ###
41+
42+
43+
JOB_STRING = """#!/bin/bash
44+
#SBATCH -J %s
45+
#SBATCH -A %s
46+
#SBATCH --time=%s
47+
#SBATCH -n %s
48+
#SBATCH -o ./%s.out
49+
#SBATCH -q %s
50+
#SBATCH --mail-user=%s
51+
#SBATCH --mail-type=%s
52+
#SBATCH --mem=%s
53+
#SBATCH -D%s
54+
%s""" % (JOB_NAME, ACCOUNT, WALLTIME, PROCESSORS, JOB_NAME, QUEUE, EMAIL_ADDR,
55+
EMAIL_OCCASION, SERIAL_MEM, WORKING_DIR, COMMAND)
56+
57+
58+
# Send JOB_STRING to qsub
59+
PROC.stdin.write(JOB_STRING.encode())
60+
OUT, ERR = PROC.communicate()
61+
62+
# Print your job and the system response to the screen as it's submitted
63+
print(JOB_STRING)
64+
print(OUT.decode())
65+
print(ERR.decode())
66+
67+
time.sleep(0.1)

0 commit comments

Comments
 (0)