Skip to content

Commit 0df22b1

Browse files
Revised processing of HISTORY template (#118)
2 parents dd54caa + 1ed3029 commit 0df22b1

File tree

4 files changed

+106
-81
lines changed

4 files changed

+106
-81
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1818

1919
### Changed
2020

21+
- Revised processing of HISTORY template (GEOSldas_HIST.rc).
2122
- Switch to using EASE grid tools in MAPL.
2223
- Specify only ntasks_model for SLURM resource request.
2324
- Revisions for handling of Nens and special nml and mwtrm path/files in coupled land-atm DAS.

GEOSldas_App/GEOSldas_HIST.rc

Lines changed: 42 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
# Sample HISTORY.rc file for GEOSldas
22
#
33
# This HISTORY template is edited by "ldas_setup" via "process_hist.csh".
4-
# The strings '#ASSIM', '#EASE', and '#CUBE' are *not* linked to MAPL HISTORY
5-
# functionality. For example, the line
6-
# "#CUBE 'tavg24_2d_lnd_Nx'"
7-
# does *not* mean that the 'lnd' output will be on a cube-sphere grid.
84

9-
#CUBE VERSION: 1
5+
VERSION: 1
6+
7+
# Must edit 'EXPID' manually if HISTORY file is re-used without going through "ldas_setup".
108

11-
# Must edit 'EXPID' manually if HISTORY file is re-used without going
12-
# through "ldas_setup".
13-
#
149
EXPID: GEOSldas_expid
1510

11+
# ------------------------------------------------------------------------------------------------
12+
13+
# pre-defined Collections
14+
1615
COLLECTIONS:
17-
#EASE 'tavg24_1d_lfs_Nt'
18-
#CUBE 'tavg24_2d_lfs_Nx'
19-
#EASE 'tavg24_1d_lnd_Nt'
20-
#CUBE 'tavg24_2d_lnd_Nx'
21-
#ASSIM 'SMAP_L4_SM_gph'
16+
#OUT1d 'tavg24_1d_lfs_Nt'
17+
#OUT2d 'tavg24_2d_lfs_Nx'
18+
#OUT1d 'tavg24_1d_lnd_Nt'
19+
#OUT2d 'tavg24_2d_lnd_Nx'
20+
# 'SMAP_L4_SM_gph'
2221
# 'inst1_1d_lnr_Nt'
2322
# 'catch_progn_incr'
2423
# 'inst3_1d_lndfcstana_Nt'
@@ -29,24 +28,34 @@ COLLECTIONS:
2928
# 'tavg24_1d_glc_Nt'
3029
::
3130

32-
#CUBE GRID_LABELS: PC720x361-DC
33-
#CUBE PC1440x721-DC
31+
# --------------------------------------------------------------------------------------------------
32+
33+
# 2d output can be on the following grids (see [COLLECTION_NAME].grid_label])
34+
35+
GRID_LABELS: PC720x361-DC
36+
PC1440x721-DC
37+
EASEv2_M36
38+
::
39+
40+
PC720x361-DC.GRID_TYPE: LatLon
41+
PC720x361-DC.IM_WORLD: 720
42+
PC720x361-DC.JM_WORLD: 361
43+
PC720x361-DC.POLE: PC
44+
PC720x361-DC.DATELINE: DC
45+
PC720x361-DC.LM: 1
3446

35-
#CUBE ::
47+
PC1440x721-DC.GRID_TYPE: LatLon
48+
PC1440x721-DC.IM_WORLD: 1440
49+
PC1440x721-DC.JM_WORLD: 721
50+
PC1440x721-DC.POLE: PC
51+
PC1440x721-DC.DATELINE: DC
52+
PC1440x721-DC.LM: 1
3653

37-
#CUBE PC720x361-DC.GRID_TYPE: LatLon
38-
#CUBE PC720x361-DC.IM_WORLD: 720
39-
#CUBE PC720x361-DC.JM_WORLD: 361
40-
#CUBE PC720x361-DC.POLE: PC
41-
#CUBE PC720x361-DC.DATELINE: DC
42-
#CUBE PC720x361-DC.LM: 1
54+
EASEv2_M36.GRID_TYPE: EASE
55+
EASEv2_M36.GRIDNAME: EASEv2_M36
56+
EASEv2_M36.LM: 1
4357

44-
#CUBE PC1440x721-DC.GRID_TYPE: LatLon
45-
#CUBE PC1440x721-DC.IM_WORLD: 1440
46-
#CUBE PC1440x721-DC.JM_WORLD: 721
47-
#CUBE PC1440x721-DC.POLE: PC
48-
#CUBE PC1440x721-DC.DATELINE: DC
49-
#CUBE PC1440x721-DC.LM: 1
58+
# --------------------------------------------------------------------------------------------------
5059

5160
# Detailed definition of the collections listed above
5261
#
@@ -219,15 +228,16 @@ COLLECTIONS:
219228

220229
tavg24_2d_lnd_Nx.format: 'CFIO',
221230
tavg24_2d_lnd_Nx.descr: '2d,Daily,Time-Averaged,Single-Level,Assimilation,Land Surface Diagnostics',
222-
tavg24_2d_lnd_Nx.nbits: 12,
231+
tavg24_2d_lnd_Nx.nbits: 12,
223232
tavg24_2d_lnd_Nx.template: '%y4%m2%d2_%h2%n2z.nc4',
224233
tavg24_2d_lnd_Nx.mode: 'time-averaged',
225234
tavg24_2d_lnd_Nx.frequency: 240000,
226235
tavg24_2d_lnd_Nx.ref_time: 000000,
227-
tavg24_2d_lnd_Nx.regrid_exch: '../input/tile.data'
228-
tavg24_2d_lnd_Nx.regrid_name: 'GRIDNAME'
236+
tavg24_2d_lnd_Nx.regrid_exch: '../input/tile.data',
237+
tavg24_2d_lnd_Nx.regrid_name: 'GRIDNAME',
229238
# tavg24_2d_lnd_Nx.regrid_method: 'BILINEAR_MONOTONIC' ,
230-
tavg24_2d_lnd_Nx.grid_label: PC720x361-DC
239+
tavg24_2d_lnd_Nx.grid_label: PC720x361-DC,
240+
# tavg24_2d_lnd_Nx.grid_label: EASEv2_M36,
231241
tavg24_2d_lnd_Nx.deflate: 2,
232242
tavg24_2d_lnd_Nx.fields: 'GRN' , 'VEGDYN' ,
233243
'LAI' , 'VEGDYN' ,

GEOSldas_App/ldas_setup

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,12 +1283,18 @@ class LDASsetup:
12831283
shutil.copy2(histrc_file,tmprcfile)
12841284
else :
12851285
shutil.copy2(histrc_file,tmprcfile)
1286-
GRID='EASE ' + self.rqdExeInp['GRIDNAME'] + ' ' +tmprcfile
1287-
if '-CF' in self.rqdExeInp['GRIDNAME'] :
1288-
GRID ='CUBE ' + self.rqdExeInp['GRIDNAME'] + ' ' +tmprcfile
1289-
_assim = '1' if self.assim else '0'
1290-
cmd =self.bindir +'/process_hist.csh '+ str(self.rqdExeInp['LSM_CHOICE']) + ' ' + str(self.rqdExeInp['AEROSOL_DEPOSITION']) + \
1291-
' ' + GRID + ' ' + str(self.rqdExeInp['RUN_IRRIG']) + ' ' + _assim + ' '+ str(self.nens)
1286+
if 'EASE' in self.rqdExeInp['GRIDNAME'] :
1287+
TMPSTR='OUT1d'
1288+
else :
1289+
TMPSTR='OUT2d'
1290+
cmd = self.bindir +'/process_hist.csh' + ' ' \
1291+
+ tmprcfile + ' ' \
1292+
+ TMPSTR + ' ' \
1293+
+ self.rqdExeInp['GRIDNAME'] + ' ' \
1294+
+ str(self.rqdExeInp['LSM_CHOICE']) + ' ' \
1295+
+ str(self.rqdExeInp['AEROSOL_DEPOSITION']) + ' ' \
1296+
+ str(self.rqdExeInp['RUN_IRRIG']) + ' ' \
1297+
+ str(self.nens)
12921298
print(cmd)
12931299
#os.system(cmd)
12941300
sp.call(shlex.split(cmd))

GEOSldas_App/process_hist.csh

Lines changed: 51 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,74 @@
11
#!/bin/csh -f
22

3-
## I am changed the CUBE/EASE logic
4-
## if CUBE we produce 2D
5-
## anything else, SMAP and other offline grids we produce tile space
6-
7-
setenv LSM_CHOICE $1
8-
setenv AEROSOL_DEPOSITION $2
9-
setenv GRID $3
10-
setenv GRIDNAME $4
11-
setenv HISTRC $5
12-
setenv RUN_IRRIG $6
13-
setenv ASSIM $7
14-
setenv NENS $8
3+
# process GEOSldas_HIST.rc (=$HISTRC) template
4+
#
5+
# - turn on/off HIST collections depending on tile space
6+
# - EASE: turn on tile-space (1d) output
7+
# - otherwise: turn on gridded (2d) output
8+
# - turn on/off output variables depending on LSM_CHOICE, AEROSOL_DEPOSITION, and RUN_IRRIG
9+
# - fill in source 'GridComp' info for variables depending on NENS
10+
11+
# process command line args
12+
13+
setenv HISTRC $1 # file name of HIST rc template (GEOSldas_HIST.rc)
14+
setenv OUTxd $2 # "OUT1d" or "OUT2d" (to turn on/off collections)
15+
setenv GRIDNAME "'$3'" # full name of grid associated with tile space
16+
setenv LSM_CHOICE $4
17+
setenv AEROSOL_DEPOSITION $5
18+
setenv RUN_IRRIG $6
19+
setenv NENS $7
20+
21+
# -------------------------------------------------
1522

1623
echo $GRIDNAME
1724

18-
if($ASSIM == 1) then
19-
sed -i 's|\#ASSIM|''|g' $HISTRC
20-
sed -i '/^\#EASE/d' $HISTRC
21-
sed -i '/^\#CUBE/d' $HISTRC
22-
else
23-
sed -i '/^\#ASSIM/d' $HISTRC
24-
endif
25+
# uncomment 2d or 1d collections, depending on "OUT1d" (EASE tile space) or "OUT2d" (non-EASE tile space)
2526

26-
if($GRID == CUBE) then
27-
sed -i '/^\#EASE/d' $HISTRC
28-
sed -i 's|\#CUBE|''|g' $HISTRC
29-
sed -i 's|GRIDNAME|'"$GRIDNAME"'|g' $HISTRC
27+
if($OUTxd == OUT1d) then
28+
sed -i 's|\#OUT1d|''|g' $HISTRC
3029
else
31-
sed -i '/^\#CUBE/d' $HISTRC
32-
sed -i 's|\#EASE|''|g' $HISTRC
33-
sed -i 's|GRIDNAME|'"$GRIDNAME"'|g' $HISTRC
30+
sed -i 's|\#OUT2d|''|g' $HISTRC
3431
endif
3532

33+
# fill in name of grid associated with tile space
34+
35+
sed -i -e s/\'GRIDNAME\'/$GRIDNAME/g $HISTRC
36+
37+
# set 'GridComp' based on LSM_CHOICE;
38+
# turn on/off variables associated with CATCHCN, AEROSOL_DEPOSITION, RUN_IRRIG
39+
3640
if($LSM_CHOICE == 1) then
3741
set GridComp = CATCH
38-
sed -i '/^>>>HIST_CATCHCN<<</d' $HISTRC
39-
sed -i '/^>>>HIST_CATCHCNCLM45<<</d' $HISTRC
42+
sed -i '/^>>>HIST_CATCHCN<<</d' $HISTRC
43+
sed -i '/^>>>HIST_CATCHCNCLM45<<</d' $HISTRC
4044
endif
4145

4246
if($LSM_CHOICE == 2) then
4347
set GridComp = CATCHCN
44-
sed -i '/^>>>HIST_CATCHCNCLM45<<</d' $HISTRC
45-
sed -i 's/>>>HIST_CATCHCN<<</''/g' $HISTRC
48+
sed -i '/^>>>HIST_CATCHCNCLM45<<</d' $HISTRC
49+
sed -i 's/>>>HIST_CATCHCN<<</''/g' $HISTRC
4650
endif
4751

4852
if($LSM_CHOICE == 3) then
4953
set GridComp = CATCHCN
50-
sed -i 's/>>>HIST_CATCHCN<<</''/g' $HISTRC
54+
sed -i 's/>>>HIST_CATCHCN<<</''/g' $HISTRC
5155
sed -i 's/>>>HIST_CATCHCNCLM45<<</''/g' $HISTRC
5256
endif
5357

58+
if($AEROSOL_DEPOSITION == 0) then
59+
sed -i '/^>>>HIST_AEROSOL<<</d' $HISTRC
60+
else
61+
sed -i 's/>>>HIST_AEROSOL<<</''/g' $HISTRC
62+
endif
63+
64+
if($RUN_IRRIG == 0) then
65+
sed -i '/^>>>HIST_IRRIG<<</d' $HISTRC
66+
else
67+
sed -i 's/>>>HIST_IRRIG<<</''/g' $HISTRC
68+
endif
69+
70+
# for ensemble simulations, set 'GridComp' to ENSAVG
71+
5472
if($NENS > 1) then
5573
set GridComp = ENSAVG
5674
sed -i 's|VEGDYN|'VEGDYN_e0000'|g' $HISTRC
@@ -63,16 +81,6 @@ if($NENS > 1) then
6381
# sed -i 's|DATAATM|'DATAATM0000'|g' $HISTRC
6482
endif
6583

66-
sed -i 's|GridComp|'$GridComp'|g' $HISTRC
84+
# fill in source 'GridComp' information for output variables
6785

68-
if($AEROSOL_DEPOSITION == 0) then
69-
sed -i '/^>>>HIST_AEROSOL<<</d' $HISTRC
70-
else
71-
sed -i 's/>>>HIST_AEROSOL<<</''/g' $HISTRC
72-
endif
73-
74-
if($RUN_IRRIG == 0) then
75-
sed -i '/^>>>HIST_IRRIG<<</d' $HISTRC
76-
else
77-
sed -i 's/>>>HIST_IRRIG<<</''/g' $HISTRC
78-
endif
86+
sed -i 's|GridComp|'$GridComp'|g' $HISTRC

0 commit comments

Comments
 (0)