Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tb output from HISTORY #223

Merged
merged 19 commits into from
May 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions src/Applications/LDAS_App/GEOSldas_HIST.rc
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,18 @@ COLLECTIONS:
tavg24_1d_lfs_Nt.mode: 'time-averaged',
tavg24_1d_lfs_Nt.frequency: 240000,
tavg24_1d_lfs_Nt.ref_time: 000000,
tavg24_1d_lfs_Nt.fields:'Tair' , 'DATAATM' ,
'Qair' , 'DATAATM' ,
'LWdown' , 'DATAATM' ,
'SWdown' , 'DATAATM' ,
'Wind' , 'DATAATM' ,
'Psurf' , 'DATAATM' ,
'Rainf_C' , 'DATAATM' ,
'Rainf' , 'DATAATM' ,
'Snowf' , 'DATAATM' ,
'RainfSnowf' , 'DATAATM' ,
'SWnet' , 'DATAATM' ,
'RefH' , 'DATAATM' ,
tavg24_1d_lfs_Nt.fields:'Tair' , 'METFORCE' ,
'Qair' , 'METFORCE' ,
'LWdown' , 'METFORCE' ,
'SWdown' , 'METFORCE' ,
'Wind' , 'METFORCE' ,
'Psurf' , 'METFORCE' ,
'Rainf_C' , 'METFORCE' ,
'Rainf' , 'METFORCE' ,
'Snowf' , 'METFORCE' ,
'RainfSnowf' , 'METFORCE' ,
'SWnet' , 'METFORCE' ,
'RefH' , 'METFORCE' ,
'CATDEF' , 'GridComp' ,
'RZEXC' , 'GridComp' ,
'SRFEXC' , 'GridComp' ,
Expand All @@ -68,18 +68,18 @@ COLLECTIONS:
tavg24_2d_lfs_Nx.regrid_name: 'GRIDNAME',
tavg24_2d_lfs_Nx.grid_label: PC720x361-DC,
tavg24_2d_lfs_Nx.deflate: 2,
tavg24_2d_lfs_Nx.fields:'Tair' , 'DATAATM' ,
'Qair' , 'DATAATM' ,
'LWdown' , 'DATAATM' ,
'SWdown' , 'DATAATM' ,
'Wind' , 'DATAATM' ,
'Psurf' , 'DATAATM' ,
'Rainf_C' , 'DATAATM' ,
'Rainf' , 'DATAATM' ,
'Snowf' , 'DATAATM' ,
'RainfSnowf' , 'DATAATM' ,
'SWnet' , 'DATAATM' ,
'RefH' , 'DATAATM' ,
tavg24_2d_lfs_Nx.fields:'Tair' , 'METFORCE' ,
'Qair' , 'METFORCE' ,
'LWdown' , 'METFORCE' ,
'SWdown' , 'METFORCE' ,
'Wind' , 'METFORCE' ,
'Psurf' , 'METFORCE' ,
'Rainf_C' , 'METFORCE' ,
'Rainf' , 'METFORCE' ,
'Snowf' , 'METFORCE' ,
'RainfSnowf' , 'METFORCE' ,
'SWnet' , 'METFORCE' ,
'RefH' , 'METFORCE' ,
'CATDEF' , 'GridComp' ,
'RZEXC' , 'GridComp' ,
'SRFEXC' , 'GridComp' ,
Expand Down
7 changes: 6 additions & 1 deletion src/Applications/LDAS_App/GEOSldas_LDAS.rc
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,12 @@ FIRST_ENS_ID: 0
# NML_INPUT_PATH: ''


# ---- Microwave Radiative Transfer Model (mwRTM) parameter file name (nc4 format) used for Tb assimilation
# ---- Microwave Radiative Transfer Model (mwRTM) parameter file name (nc4 format)
#
# Must be provided for
# - output of Tb through HISTORY or
# - Tb assimilation.
# Otherwise, leave unspecified (i.e., use default empty string).
#
# This file can be converted from binary with the program mwrtm_bin2nc4.x.
# If empty or commented out, GEOSldas will search the restart directory.
Expand Down
57 changes: 22 additions & 35 deletions src/Applications/LDAS_App/ldas_setup
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ class LDASsetup:
assert os.path.isdir(self.exphome) # exphome should exist
self.verbose = cmdLineArgs['verbose']
self.runmodel = cmdLineArgs['runmodel']
if self.runmodel :
print('\n The option "--runmodel" is out of date, not necessary anymore. \n')
self.daysperjob = cmdLineArgs['daysperjob']
self.monthsperjob = cmdLineArgs['monthsperjob']
self.rqdExeInp = OrderedDict()
Expand All @@ -97,6 +99,7 @@ class LDASsetup:
self.islocal = False
self.catch = ''
self.has_mwrtm = False
self.assim = False
self.has_landassim_seed = False
self.has_geos_pert = False
self.has_ldassa_pert = False
Expand Down Expand Up @@ -138,8 +141,9 @@ class LDASsetup:
_mydir = self.exphome + '/' + self.rqdExeInp['EXP_ID']
assert not os.path.isdir(_mydir), 'Dir [%s] already exists!' % _mydir
_mydir = None
self.ensdirs = ['ens%04d'%iens for iens in xrange(self.nens)]
self.ensids = ['%04d'%iens for iens in xrange(self.nens)]
_first_ens_id = int(self.rqdExeInp.get('FIRST_ENS_ID',0))
self.ensdirs = ['ens%04d'%iens for iens in range(_first_ens_id, self.nens + _first_ens_id)]
self.ensids = ['%04d'%iens for iens in range(_first_ens_id, self.nens + _first_ens_id)]
if (self.nens == 1) :
self.ensdirs_avg = self.ensdirs
self.ensids=['']
Expand Down Expand Up @@ -350,15 +354,13 @@ class LDASsetup:
self.has_ldassa_pert = True

# DEAL WITH mwRTM input from exec
_assim = 1 if self.rqdExeInp.get('LAND_ASSIM', 'NO').upper() == 'YES' else 0
if _assim == 0 :
_result = self.rqdExeInp.pop('MWRTM_FILE', None)


self.assim = True if self.rqdExeInp.get('LAND_ASSIM', 'NO').upper() == 'YES' else False
# verify mwrtm file
if 'MWRTM_FILE' in self.rqdExeInp :
_tmpfile = self.rqdExeInp['MWRTM_FILE'].replace("'",'').replace('"','')
if os.path.isfile(_tmpfile) :
assert int(self.rqdExeInp['RST_FROM_GLOBAL']) == 1, 'if MWRTM_FILE is specified,it should be global'
self.has_mwrtm = True
self.rqdExeInp['MWRTM_FILE'] = _tmpfile
else :
assert not _tmpfile.strip(), ' MWRTM_FILE: %s should point to mwrtm param file'% _tmpfile
del self.rqdExeInp['MWRTM_FILE']
Expand Down Expand Up @@ -531,7 +533,7 @@ class LDASsetup:

# ensxxxx directories
nSegments = self.nSegments
for iseg in xrange(nSegments):
for iseg in range(nSegments):
_start = self.begDates[iseg]
_end = self.endDates[iseg]

Expand Down Expand Up @@ -629,7 +631,7 @@ class LDASsetup:
sp.call(cmd,shell=True)
# check if it is local or global
with open('f2g.txt') as f2gfile :
head=[next(f2gfile) for x in xrange(2)]
head=[next(f2gfile) for x in range(2)]
if(head[0].strip() != head[1].strip()) :
self.islocal= True

Expand Down Expand Up @@ -708,11 +710,11 @@ class LDASsetup:
rstpath0 = self.rqdExeInp['RESTART_PATH']

# just copy the landassim pert seed if it exists
for iens in xrange(self.nens) :
for iens in range(self.nens) :
_ensdir = self.ensdirs[iens]
_ensid = self.ensids[iens]
landassim_seeds = rstpath + _ensdir + '/' + y4m2+'/' + rstid + '.landassim_obspertrseed_rst.'+y4m2d2_h2m2
if os.path.isfile(landassim_seeds) and self.rqdExeInp.get('LAND_ASSIM', 'NO').upper() == 'YES' :
if os.path.isfile(landassim_seeds) and self.assim :
_seeds = self.rstdir + _ensdir + '/' + y4m2+'/' + exp_id + '.landassim_obspertrseed_rst.'+y4m2d2_h2m2
shutil.copy(landassim_seeds, _seeds)
os.symlink(_seeds, myRstDir+ '/landassim_obspertrseed'+ _ensid +'_rst')
Expand All @@ -739,7 +741,7 @@ class LDASsetup:
#for ens in self.ensdirs :
catchRstFile0 = ''
vegdynRstFile0 = ''
for iens in xrange(self.nens) :
for iens in range(self.nens) :
ens = self.ensdirs[iens]
ensid = self.ensids[iens]
myCatchRst = myRstDir+'/'+self.catch +ensid +'_internal_rst'
Expand Down Expand Up @@ -833,16 +835,8 @@ class LDASsetup:
catch_param_file = self.bcsdir+'/'+ y4m2+'/'+self.rqdExeInp['EXP_ID']+'.ldas_catparam.'+y4m2d2_h2m2+'z.bin'
assert os.path.isfile(catch_param_file), "need catch_param file %s" % catch_param_file

# mwRTM restart file
mwRTMRstFile = ""
_assim = 1 if self.rqdExeInp.get('LAND_ASSIM', 'NO').upper() == 'YES' else 0
if 'MWRTM_FILE' in self.rqdExeInp :
if self.has_mwrtm :
mwRTMRstFile = self.rqdExeInp['MWRTM_FILE']
elif _assim ==1 :
mwRTMRstFile= rcoutpath +'/' + y4m2+'/'+self.rqdExeInp['RESTART_ID']+'.ldas_mwRTMparam.'+y4m2d2_h2m2+'z.nc4'

if os.path.isfile(mwRTMRstFile) :
self.has_mwrtm = True
mwRTMLocal = self.bcsdir+'/'+ y4m2+'/'+self.rqdExeInp['EXP_ID']+'.ldas_mwRTMparam.'+y4m2d2_h2m2+'z.nc4'
if self.islocal :
print "Creating the local mwRTM restart file... \n"
Expand Down Expand Up @@ -963,7 +957,7 @@ class LDASsetup:
GRID='EASE ' + self.rqdExeInp['GRIDNAME'] + ' ' +tmprcfile
if '-CF' in self.rqdExeInp['GRIDNAME'] :
GRID ='CUBE ' + self.rqdExeInp['GRIDNAME'] + ' ' +tmprcfile
_assim = '1' if self.rqdExeInp.get('LAND_ASSIM', 'NO').upper() == 'YES' else '0'
_assim = '1' if self.assim else '0'
_perturb = '1' if self.nens > 1 else '0'
cmd ='./process_hist.csh '+ str(self.rqdExeInp['LSM_CHOICE']) + ' ' + str(self.rqdExeInp['AEROSOL_DEPOSITION']) + \
' ' + GRID + ' ' + str(self.rqdExeInp['RUN_IRRIG']) + ' ' + _assim + ' '+ _perturb
Expand Down Expand Up @@ -1012,12 +1006,6 @@ class LDASsetup:
#for key,val in optinxny.iteritems():
# ldasrcInp[key]= val


if (self.runmodel) :
assert ldasrcInp['LAND_ASSIM'].upper() == 'NO', "--runmodel is used,should set LAND_ASSIM to NO"
else :
assert ldasrcInp['LAND_ASSIM'].upper() == 'YES', "--runmodel is not used,should set LAND_ASSIM to YES"

# create BC in rc file
tmpl_ = ''
if self.nens >1 :
Expand Down Expand Up @@ -1049,18 +1037,17 @@ class LDASsetup:
rstkey=[catch_,'VEGDYN','LANDPERT']
rstval=[self.catch,'vegdyn','landpert']

_assim = 1 if self.rqdExeInp.get('LAND_ASSIM', 'NO').upper() == 'YES' else 0
if self.has_mwrtm and _assim ==1 :
if self.has_mwrtm : # and _assim ==1 :
keyn='LANDASSIM_INTERNAL_RESTART_FILE'
valn='../input/restart/mwrtm_param_rst'
ldasrcInp[keyn]= valn

if self.has_landassim_seed and _assim ==1 :
if self.has_landassim_seed and self.assim :
keyn='LANDASSIM_OBSPERTRSEED_RESTART_FILE'
valn='../input/restart/landassim_obspertrseed%s_rst'
ldasrcInp[keyn]= valn

if _assim == 1:
if self.assim:
keyn='LANDASSIM_OBSPERTRSEED_CHECKPOINT_FILE'
valn='landassim_obspertrseed%s_checkpoint'
ldasrcInp[keyn]= valn
Expand Down Expand Up @@ -1170,7 +1157,7 @@ class LDASsetup:
expid = self.rqdExeInp['EXP_ID']
fout.write("\nsed -i 's/if($capdate<$enddate) sbatch /#if($capdate<$enddate) sbatch /g' lenkf.j\n\n")
nSegments = self.nSegments
for iseg in xrange(nSegments):
for iseg in range(nSegments):
if iseg ==0 :
fout.write("jobid%d=$(echo $(sbatch lenkf.j) | cut -d' ' -f 4)\n"%(iseg))
fout.write("echo $jobid%d\n"%iseg )
Expand Down Expand Up @@ -1549,7 +1536,7 @@ def parseCmdLine():
)
p_setup.add_argument(
'--runmodel',
help='model run (no assimilation)',
help='obsolete, no effect any more',
action='store_true',
)
p_setup.add_argument(
Expand Down
2 changes: 1 addition & 1 deletion src/Applications/LDAS_App/process_hist.csh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ endif
if($PERTURB == 1 ) then
set GridComp = ENSAVG
sed -i 's|VEGDYN|'VEGDYN0000'|g' $HISTRC
sed -i 's|DATAATM|'DATAATM0000'|g' $HISTRC
# sed -i 's|DATAATM|'DATAATM0000'|g' $HISTRC
endif

sed -i 's|GridComp|'$GridComp'|g' $HISTRC
Expand Down
Loading