Skip to content

Commit

Permalink
create zoomin landice restart and more cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
weiyuan-jiang committed Aug 14, 2024
1 parent 0242100 commit 72c8daf
Show file tree
Hide file tree
Showing 3 changed files with 187 additions and 41 deletions.
32 changes: 26 additions & 6 deletions GEOSldas_App/ldas_setup
Original file line number Diff line number Diff line change
Expand Up @@ -752,8 +752,8 @@ class LDASsetup:
if self.isZoomIn:
newlocalTile = tile+'.domain'
print ("\nCreating local tile file :"+ newlocalTile)
print ("\n by excluding land type MAPL_Land_ExcludeFromDomain=1100...\n")
cmd = self.bindir +'/preprocess_ldas.x c_localtile ' + tile + ' ' + newlocalTile + ' '+ tmp_f2g_file.name
print ("\nExcluding tiles not in the domain by adding 1000 to the type ...\n")
cmd = self.bindir +'/preprocess_ldas.x zoomin_tile ' + tile + ' ' + newlocalTile + ' '+ tmp_f2g_file.name
print ("cmd: " + cmd)
sp.call(shlex.split(cmd))
short_tile=short_tile +'.domain'
Expand Down Expand Up @@ -782,7 +782,7 @@ class LDASsetup:
print ("Creating the boundary files for the simulation domain...\n")
bcs_tmp=[]
for bcf in bcs :
cmd = self.bindir +'/preprocess_ldas.x c_localbc ' + bcf + ' '+ bcf+'.domain' + ' '+ tmp_f2g_file.name
cmd = self.bindir +'/preprocess_ldas.x zoomin_bc ' + bcf + ' '+ bcf+'.domain' + ' '+ tmp_f2g_file.name
print ("cmd: " + cmd)
sp.call(shlex.split(cmd))
bcs_tmp=bcs_tmp+[bcf+'.domain']
Expand Down Expand Up @@ -910,6 +910,7 @@ class LDASsetup:
ensdir = self.ensdirs[iens]
ensid = self.ensids[iens]
myCatchRst = myRstDir+'/'+self.catch +ensid +'_internal_rst'
myLandiceRst = myRstDir+'/'+ 'landice' +ensid +'_internal_rst'
myVegRst = myRstDir+'/'+'vegdyn'+ensid +'_internal_rst'
myPertRst = myRstDir+'/'+ 'landpert' +ensid +'_internal_rst'

Expand Down Expand Up @@ -938,7 +939,7 @@ class LDASsetup:
catchLocal = self.rstdir+ensdir +'/'+ y4m2+'/'+self.rqdExeInp['EXP_ID']+'.'+self.catch+'_internal_rst.'+y4m2d2_h2m2
if self.isZoomIn :
print( "Creating local catchment restart file... \n")
cmd=self.bindir +'/preprocess_ldas.x c_localcatchrst '+ catchRstFile +' ' + catchLocal + ' '+ tmp_f2g_file.name
cmd=self.bindir +'/preprocess_ldas.x zoomin_catchrst '+ catchRstFile +' ' + catchLocal + ' '+ tmp_f2g_file.name
print ("cmd: "+cmd)
sp.call(shlex.split(cmd))
else :
Expand All @@ -956,7 +957,7 @@ class LDASsetup:
vegdynLocal = self.rstdir+ensdir +'/'+self.rqdExeInp['EXP_ID']+'.vegdyn_internal_rst'
if self.isZoomIn :
print ("Creating the local veg restart file... \n")
cmd=self.bindir + '/preprocess_ldas.x c_localvegrst '+ vegdynRstFile +' ' + vegdynLocal + ' '+ tmp_f2g_file.name
cmd=self.bindir + '/preprocess_ldas.x zoomin_vegrst '+ vegdynRstFile +' ' + vegdynLocal + ' '+ tmp_f2g_file.name
print ("cmd: " + cmd)
sp.call(shlex.split(cmd))
else :
Expand All @@ -969,6 +970,24 @@ class LDASsetup:
else :
vegdynRstFile = vegdynRstFile0

landiceRstFile = rstpath+ensdir +'/'+ y4m2+'/'+self.rqdExeInp['RESTART_ID']+'.'+'landice_internal_rst.'+y4m2d2_h2m2
if os.path.isfile(landiceRstFile) :
landiceLocal = self.rstdir+ensdir +'/'+self.rqdExeInp['EXP_ID']+'.landice_internal_rst'
if self.isZoomIn :
print ("Creating coom in landice restart file... \n")
cmd=self.bindir + '/preprocess_ldas.x zoomin_landicerst '+ landiceRstFile +' ' + landiceLocal + ' '+ tmp_f2g_file.name
print ("cmd: " + cmd)
sp.call(shlex.split(cmd))
else :
shutil.copy(landiceRstFile,landiceLocal)

landiceRstFile = landiceLocal

if '0000' in ensdir :
landiceRstFile0 = landiceRstFile
else :
landiceRstFile = landiceRstFile0

if (self.has_geos_pert and self.perturb == 1) :
pertRstFile = rstpath+ensdir +'/'+ y4m2+'/'+self.rqdExeInp['RESTART_ID']+'.landpert_internal_rst.'+y4m2d2_h2m2
pertLocal = self.rstdir+ensdir +'/'+ y4m2+'/'+self.rqdExeInp['EXP_ID']+'.landpert_internal_rst.'+y4m2d2_h2m2
Expand All @@ -979,6 +998,7 @@ class LDASsetup:
print ('vegdynRstFile: ' + vegdynRstFile)
os.symlink(catchRstFile, myCatchRst)
os.symlink(vegdynRstFile, myVegRst)
os.symlink(landiceRstFile, myLandiceRst)
if ( self.has_geos_pert and self.perturb == 1 ):
os.symlink(pertRstFile, myPertRst)

Expand All @@ -991,7 +1011,7 @@ class LDASsetup:
mwRTMLocal = self.bcsdir+'/'+ y4m2+'/'+self.rqdExeInp['EXP_ID']+'.ldas_mwRTMparam.'+y4m2d2_h2m2+'z.nc4'
if self.isZoomIn :
print ("Creating the local mwRTM restart file... \n")
cmd= self.bindir +'/preprocess_ldas.x c_localmwrtmrst '+ mwRTMRstFile +' ' + mwRTMLocal + ' '+ tmp_f2g_file.name
cmd= self.bindir +'/preprocess_ldas.x zoomin_mwrtmrst '+ mwRTMRstFile +' ' + mwRTMLocal + ' '+ tmp_f2g_file.name

print ("cmd: " + cmd)
sp.call(shlex.split(cmd))
Expand Down
41 changes: 26 additions & 15 deletions GEOSldas_App/preprocess_ldas.F90
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ program main

use preprocess_ldas_routines, ONLY: &
create_mapping, &
createLocalTilefile, &
createLocalBC, &
createLocalVegRestart, &
createLocalmwRTMRestart, &
createLocalCatchRestart, &
createZoominTilefile, &
createZoominBC, &
createZoominVegRestart, &
createZoominmwRTMRestart, &
createZoominCatchRestart, &
createZoominLandiceRestart, &
correctEase, &
convert_pert_rst, &
optimize_latlon
Expand Down Expand Up @@ -46,6 +47,8 @@ program main
character(len=512) :: f2g_file
character(len=12 ) :: ymdhm
character(len=12 ) :: SURFLAY
character(len=:), allocatable :: new_r, orig_r


call get_command_argument(1,option)
call get_command_argument(2,arg1)
Expand Down Expand Up @@ -73,44 +76,52 @@ program main

call create_mapping(orig_tile,domain_def_file,trim(out_path),catch_def_file,trim(exp_id),ymdhm, SURFLAY, f2g_file)

else if (trim(option) == "c_localtile") then
else if (trim(option) == "zoomin_tile") then

orig_tile = arg1
new_tile = arg2
f2g_file = arg3
call createLocalTilefile(f2g_file, orig_tile,new_tile)
call createZoominTilefile(f2g_file, orig_tile,new_tile)

else if (trim(option) == "c_localbc" ) then
else if (trim(option) == "zoomin_bc" ) then

orig_BC = arg1
new_BC = arg2
f2g_file = arg3

call createLocalBC(f2g_file, orig_BC, new_BC)
call createZoominBC(f2g_file, orig_BC, new_BC)

else if (trim(option) == "c_localvegrst") then
else if (trim(option) == "zoomin_vegrst") then

orig_veg = arg1
new_veg = arg2
f2g_file = arg3

call createLocalVegRestart(f2g_file, orig_veg, new_veg)
call createZoominVegRestart(f2g_file, orig_veg, new_veg)

else if (trim(option) == "c_localmwrtmrst") then
else if (trim(option) == "zoomin_mwrtmrst") then

orig_rtm = arg1
new_rtm = arg2
f2g_file = arg3

call createLocalmwRTMRestart(f2g_file, orig_rtm, new_rtm)
call createZoominmwRTMRestart(f2g_file, orig_rtm, new_rtm)

else if (trim(option) == "c_localcatchrst") then
else if (trim(option) == "zoomin_catchrst") then

orig_catch = arg1
new_catch = arg2
f2g_file = arg3

call createLocalCatchRestart(f2g_file, orig_catch, new_catch)
call createZoominCatchRestart(f2g_file, orig_catch, new_catch)

else if (trim(option) == "zoomin_landicerst") then

orig_r = trim(arg1)
new_r = trim(arg2)
f2g_file = trim(arg3)

call createZoominLandiceRestart(f2g_file, orig_r, new_r)

else if (trim(option)=="correctease") then

Expand Down
Loading

0 comments on commit 72c8daf

Please sign in to comment.