Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
3f4dcba
initial commit
gmao-jkolassa May 15, 2024
8a57cdb
group LSM_CHOICE 3 and 4
gmao-jkolassa May 15, 2024
b5f4806
adding autotrophic and heterotrophic respiration as outputs
gmao-jkolassa Aug 23, 2024
b5d5e5c
update to develop
gmao-jkolassa Jun 3, 2025
619eca6
Merge branch 'develop' into feature/jkolassa_cnclm51
gmao-jkolassa Jun 18, 2025
102a589
Merge branch 'develop' into feature/jkolassa_cnclm51
weiyuan-jiang Jun 20, 2025
20c5aed
Merge branch 'develop' into feature/jkolassa_cnclm51
gmao-jkolassa Jun 27, 2025
f055c4f
Merge branch 'develop' into feature/jkolassa_cnclm51
gmao-jkolassa Jul 1, 2025
5b5b153
minor bug fix and cleanup for CatchCN51 (ldas_setup, GEOSldas_HIST.rc…
gmao-rreichle Jul 1, 2025
d8a1da6
updated CHANGELOG.md
gmao-rreichle Jul 1, 2025
c6bdeb6
move CN_CLM51 namelist file to run directory
gmao-jkolassa Jul 7, 2025
0b5f9e3
add processing of CN_CLM51 parameter file
gmao-jkolassa Jul 11, 2025
4e8782e
removed redundant if statement (ldas_setup)
gmao-rreichle Jul 11, 2025
4c1b7ba
Merge branch 'develop' into feature/jkolassa_cnclm51
weiyuan-jiang Jul 11, 2025
1d714da
update comment
weiyuan-jiang Jul 11, 2025
c857716
Updated comment (setup_utils.py)
gmao-rreichle Jul 11, 2025
93c95fc
make CNCLM51 related tasks conditional on running CNCLM51
gmao-jkolassa Jul 11, 2025
9f6eafc
typo fix
gmao-jkolassa Jul 11, 2025
6198d5a
rename file variable for CNCLM51 parameters
gmao-jkolassa Jul 11, 2025
7e71736
fixing input variable name
gmao-jkolassa Jul 15, 2025
108eb75
change long name of CNHR and CNAR
gmao-jkolassa Jul 17, 2025
f28284f
removed Catchment-CN4.5 code; improved vertical alignment (GEOS_EnsGr…
gmao-rreichle Aug 6, 2025
ff4ab3b
RESTART=0 option: removed Catchment-CN4.5 code and disabled for Catch…
gmao-rreichle Aug 6, 2025
a172439
fix zoom value
weiyuan-jiang Aug 8, 2025
22e5e8c
Merge pull request #137 from GEOS-ESM/feature/wjiang/fix_zoom
weiyuan-jiang Aug 8, 2025
62236cc
move get_gridname from remap to setup_utils
weiyuan-jiang Aug 15, 2025
d762dec
added comments to get_gridname() (setup_utils.py)
gmao-rreichle Aug 15, 2025
d0f1774
added documentation for CatchCNCLM51 (GEOSldas_App/GEOSldas_LDAS.rc, …
gmao-rreichle Aug 25, 2025
58df8ba
Merge branch 'develop' into feature/jkolassa_cnclm51
gmao-rreichle Aug 26, 2025
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
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Added ntasks-per-node
- Support for CatchmentCNCLM51.
- Added ntasks-per-node

### Changed

Expand All @@ -21,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

- Fixed zoom value when there is landice. It will be determined by input tilefile
- Fixed Restart=1 when the domain is not global.

### Removed
Expand Down
254 changes: 142 additions & 112 deletions GEOSens_GridComp/GEOS_EnsGridComp.F90

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions GEOSldas_App/GEOSldas_HIST.rc
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,12 @@ EASEv2_M36.LM: 1
>>>HIST_CATCHCN<<< 'CNTOTC' , 'GridComp' ,
>>>HIST_CATCHCN<<< 'CNVEGC' , 'GridComp' ,
>>>HIST_CATCHCN<<< 'CNROOT' , 'GridComp' ,
>>>HIST_CATCHCNCLM45<<< 'CNFROOTC' , 'GridComp' ,
>>>HIST_CATCHCNCLM51<<< 'CNFROOTC' , 'GridComp' ,
>>>HIST_CATCHCN<<< 'CNNPP' , 'GridComp' ,
>>>HIST_CATCHCN<<< 'CNGPP' , 'GridComp' ,
>>>HIST_CATCHCN<<< 'CNSR' , 'GridComp' ,
>>>HIST_CATCHCNCLM51<<< 'CNAR' , 'GridComp' ,
>>>HIST_CATCHCNCLM51<<< 'CNHR' , 'GridComp' ,
>>>HIST_CATCHCN<<< 'CNNEE' , 'GridComp' ,
>>>HIST_CATCHCN<<< 'CNXSMR' , 'GridComp' ,
>>>HIST_CATCHCN<<< 'CNADD' , 'GridComp' ,
Expand Down Expand Up @@ -308,10 +310,12 @@ EASEv2_M36.LM: 1
>>>HIST_CATCHCN<<< 'CNTOTC' , 'GridComp' ,
>>>HIST_CATCHCN<<< 'CNVEGC' , 'GridComp' ,
>>>HIST_CATCHCN<<< 'CNROOT' , 'GridComp' ,
>>>HIST_CATCHCNCLM45<<< 'CNFROOTC' , 'GridComp' ,
>>>HIST_CATCHCNCLM51<<< 'CNFROOTC' , 'GridComp' ,
>>>HIST_CATCHCN<<< 'CNNPP' , 'GridComp' ,
>>>HIST_CATCHCN<<< 'CNGPP' , 'GridComp' ,
>>>HIST_CATCHCN<<< 'CNSR' , 'GridComp' ,
>>>HIST_CATCHCNCLM51<<< 'CNAR' , 'GridComp' ,
>>>HIST_CATCHCNCLM51<<< 'CNHR' , 'GridComp' ,
>>>HIST_CATCHCN<<< 'CNNEE' , 'GridComp' ,
>>>HIST_CATCHCN<<< 'CNXSMR' , 'GridComp' ,
>>>HIST_CATCHCN<<< 'CNADD' , 'GridComp' ,
Expand Down
3 changes: 2 additions & 1 deletion GEOSldas_App/GEOSldas_LDAS.rc
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ CATCHMENT_SPINUP: 0

# ---- Choice of land surface model (for LAND tiles)
#
# 1 : Catchment model (default)
# 1 : Catchment model (default)
# 2 : CatchmentCN-CLM4.0
# 4 : CatchmentCN-CLM5.1 (edit "ntasks-per-node" in batinp file to increase memory unless on EASEv2_M36)
#
LSM_CHOICE: 1

Expand Down
41 changes: 19 additions & 22 deletions GEOSldas_App/ldas.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import os
import sys
import glob
import linecache
import shutil
import fileinput
import time
Expand Down Expand Up @@ -222,8 +221,6 @@ def __init__(self, cmdLineArgs):
self.catch = 'catch'
elif _lsm_choice_int == 2 :
self.catch = 'catchcnclm40'
elif _lsm_choice_int == 3 :
self.catch = 'catchcnclm45'
elif _lsm_choice_int == 4 :
self.catch = 'catchcnclm51'
_lsm_choice_int = None
Expand Down Expand Up @@ -312,18 +309,7 @@ def __init__(self, cmdLineArgs):
inpgeom_= None
# assigning Gridname
if 'GRIDNAME' not in self.ExeInputs :
tmptile = os.path.realpath(self.ExeInputs['TILING_FILE'])
extension = os.path.splitext(tmptile)[1]
if extension == '.domain':
extension = os.path.splitext(tmptile)[0]
gridname_ =''
if extension == '.til':
gridname_ = linecache.getline(tmptile, 3).strip()
else:
nc_file = netCDF4.Dataset(tmptile,'r')
gridname_ = nc_file.getncattr('Grid_Name')
# in case it is an old name: SMAP-EASEvx-Mxx
gridname_ = gridname_.replace('SMAP-','').replace('-M','_M')
gridname_ = get_gridname(self.ExeInputs['TILING_FILE'])
self.ExeInputs['GRIDNAME'] = gridname_

if 'POSTPROC_HIST' not in self.ExeInputs:
Expand Down Expand Up @@ -374,7 +360,8 @@ def __init__(self, cmdLineArgs):
self.in_tilefile =os.path.realpath(in_tilefiles_[0])

if self.with_land:
assert int(self.ExeInputs['LSM_CHOICE']) <= 2, "\nLSM_CHOICE=3 (Catchment-CN4.5) is no longer supported. Please set LSM_CHOICE to 1 (Catchment) or 2 (Catchment-CN4.0)"
assert int(self.ExeInputs['LSM_CHOICE']) <= 2 or int(self.ExeInputs['LSM_CHOICE']) == 4, \
"\nLSM_CHOICE=3 (Catchment-CN4.5) is no longer supported. Please set LSM_CHOICE to 1 (Catchment), 2 (Catchment-CN4.0), or 4 (Catchment-CN5.1)."
if RESTART_str in ['1', '2']:
y4m2='Y%4d/M%02d' % (self.begDates[0].year, self.begDates[0].month)
y4m2d2_h2m2='%4d%02d%02d_%02d%02d' % (self.begDates[0].year, self.begDates[0].month,
Expand Down Expand Up @@ -412,12 +399,10 @@ def __init__(self, cmdLineArgs):
self.in_rstfile = '/discover/nobackup/projects/gmao/ssd/land/l_data/LandRestarts_for_Regridding' \
'/CatchCN/M36/20150301_0000/catchcnclm40_internal_dummy'
self.in_tilefile = '/discover/nobackup/projects/gmao/bcs_shared/legacy_bcs/Heracles-NL/SMAP_EASEv2_M36/SMAP_EASEv2_M36_964x406.til'
elif (self.catch == 'catchcnclm45'):
self.in_rstfile = '/discover/nobackup/projects/gmao/ssd/land/l_data/LandRestarts_for_Regridding' \
'/CatchCN/M36/19800101_0000/catchcnclm45_internal_dummy'
self.in_tilefile = '/discover/nobackup/projects/gmao/bcs_shared/legacy_bcs/Icarus-NLv3/Icarus-NLv3_EASE/SMAP_EASEv2_M36/SMAP_EASEv2_M36_964x406.til'
elif (self.catch == 'catchcnclm51'):
sys.exit('Error. RESTART=0 not (yet) available for Catchment-CN5.1.\n')
else:
sys.exit('need to provide at least dummy files')
sys.exit('Error. Unknown model version.')

# DEAL WITH mwRTM input from exec
self.assim = True if self.ExeInputs.get('LAND_ASSIM', 'NO').upper() == 'YES' and self.with_land else False
Expand Down Expand Up @@ -797,6 +782,9 @@ def createLnRstBc(self) :
if ("catchcn" in self.catch):
os.symlink(self.bcs_dir_landshared + 'CO2_MonthlyMean_DiurnalCycle.nc4', \
self.inpdir+'/CO2_MonthlyMean_DiurnalCycle.nc4')
if (self.catch=="catchcnclm51"):
os.symlink(self.bcs_dir_landshared + 'ctsm51_params.c210923_forCNCLM.nc', \
self.inpdir+'/ctsm51_params.c210923_forCNCLM.nc')

# create and link restart
print ("Creating and linking restart...")
Expand Down Expand Up @@ -867,6 +855,7 @@ def createLnRstBc(self) :
config['output']['surface']['wemin'] = wemin_out

if RESTART_str == "M" : # restart from merra2
config['input']['surface']['zoom'] = '2'
yyyymm = int(YYYYMMDDHH[0:6])
merra2_expid = "d5124_m2_jan10"
if yyyymm < 197901 :
Expand Down Expand Up @@ -898,7 +887,6 @@ def createLnRstBc(self) :
catch_obj.remap()
if self.with_landice:
config['output']['surface']['remap_water'] = True
config['input']['surface']['zoom'] = '2'
landice_obj = lake_landice_saltwater(config_obj = config)
landice_obj.remap()

Expand Down Expand Up @@ -1104,6 +1092,13 @@ def createRCFiles(self):
if self.ladas_cpl > 0:
# edit resolution info in ensupd nml file
sp.run(['sed', '-i', 's/<CFnnnn>/'+self.agcm_res+'/g', self.rundir+'/LDASsa_SPECIAL_inputs_ensupd.nml'])

#CN_CLM51 nml
if (self.catch=="catchcnclm51"):
cnclm51_nml = glob.glob(etcdir+'/CN_CLM51.nml')
for nmlfile in cnclm51_nml:
shortfile=self.rundir+'/'+nmlfile.split('/')[-1]
shutil.copy2(nmlfile, shortfile)

# get optimzed NX and IMS
optimized_distribution_file = tempfile.NamedTemporaryFile(delete=False)
Expand Down Expand Up @@ -1230,6 +1225,8 @@ def createRCFiles(self):
ldasrcInp[keyn]= valn
if('catchcn' in self.catch):
ldasrcInp['CO2_MonthlyMean_DiurnalCycle_FILE']= '../input/CO2_MonthlyMean_DiurnalCycle.nc4'
if (self.catch=="catchcnclm51"):
ldasrcInp['CNCLM51_PARAM_FILE']= '../input/ctsm51_params.c210923_forCNCLM.nc'
else:
# remove catchcn-specific entries that do not apply to catch model
ldasrcInp.pop('DTCN',None)
Expand Down
8 changes: 4 additions & 4 deletions GEOSldas_App/process_hist.csh
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,19 @@ sed -i -e s/\'GRIDNAME\'/$GRIDNAME/g $HISTRC
if($LSM_CHOICE == 1) then
set GridComp = CATCH
sed -i '/^>>>HIST_CATCHCN<<</d' $HISTRC
sed -i '/^>>>HIST_CATCHCNCLM45<<</d' $HISTRC
sed -i '/^>>>HIST_CATCHCNCLM51<<</d' $HISTRC
endif

if($LSM_CHOICE == 2) then
set GridComp = CATCHCN
sed -i '/^>>>HIST_CATCHCNCLM45<<</d' $HISTRC
sed -i '/^>>>HIST_CATCHCNCLM51<<</d' $HISTRC
sed -i 's/>>>HIST_CATCHCN<<</''/g' $HISTRC
endif

if($LSM_CHOICE == 3) then
if($LSM_CHOICE == 4) then
set GridComp = CATCHCN
sed -i 's/>>>HIST_CATCHCN<<</''/g' $HISTRC
sed -i 's/>>>HIST_CATCHCNCLM45<<</''/g' $HISTRC
sed -i 's/>>>HIST_CATCHCNCLM51<<</''/g' $HISTRC
endif

if($AEROSOL_DEPOSITION == 0) then
Expand Down
30 changes: 27 additions & 3 deletions GEOSldas_App/setup_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@

from collections import OrderedDict
from datetime import timedelta

import netCDF4
import linecache

def generate_echo(inpfile, ladas_cpl = 0):
"""
Echo generator of inpfile, ignore line starts with "## "
Echo generator of inpfile
Pick default values from GEOS_SurfaceGridComp.rc via special string "GEOS[xxxx]=>".
"""
if ladas_cpl == 0 :
use_rc_defaults = 'GEOSldas=>' # use defaults for LDAS
Expand Down Expand Up @@ -267,7 +269,9 @@ def printResourceInputSampleFile():
print ('# IMPORTANT REQUIREMENT: total #writers = writers-per-node * oserver_nodes >= 2;')
print ('# jobs will hang when oserver_nodes = writers-per-node = 1.')
print ('# - ntasks-per-node = requesting fewer ntasks-per-node than total number of cores per node increases allocated memory;')
print ('# ntasks_model should be a multiple of ntasks-per-node')
print ('# defaults to number of cores per node;')
print ('# ntasks_model should be a multiple of ntasks-per-node;')
print ('# edit ntasks-per-node when running CatchCNCLM51 on resolution other than EASEv2_M36')
print ('# - constraint = name of chip set(s) (NCCS default is "[mil|cas]", NAS default is "cas_ait")')
print ('#')
for key in optionalKeys:
Expand Down Expand Up @@ -310,3 +314,23 @@ def hours_to_hhmmss(hours):

# Format as HHMMSS
return f"{hours:02d}{minutes:02d}{seconds:02d}"

def get_gridname(tilefile):
"""
get name of atmospheric grid from header/attributes of tile file (*.til)
"""

gridname_ =''
tmptile = os.path.realpath(tilefile)
extension = os.path.splitext(tmptile)[1]
if extension == '.domain':
extension = os.path.splitext(tmptile)[0]
if extension == '.til':
gridname_ = linecache.getline(tmptile, 3).strip()
else:
nc_file = netCDF4.Dataset(tmptile,'r')
gridname_ = nc_file.getncattr('Grid_Name')
# in case it is an old name: SMAP-EASEvx-Mxx: change to EASEvx_Mxx
gridname_ = gridname_.replace('SMAP-','').replace('-M','_M')
return gridname_

2 changes: 2 additions & 0 deletions GEOSldas_App/tile_bin2nc4.F90
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,8 @@ FUNCTION getAttribute (SHORT_NAME, LNAME, UNT) result (str_atr)
case ('CNNPP'); LONG_NAME = 'CN_net_primary_production'; UNITS = 'kg m-2 s-1'
case ('CNGPP'); LONG_NAME = 'CN_gross_primary_production'; UNITS = 'kg m-2 s-1'
case ('CNSR'); LONG_NAME = 'CN_total_soil_respiration'; UNITS = 'kg m-2 s-1'
case ('CNAR'); LONG_NAME = 'CN_total_autotrophic_respiration'; UNITS = 'kg m-2 s-1'
case ('CNHR'); LONG_NAME = 'CN_total_heterotrophic_respiration'; UNITS = 'kg m-2 s-1'
case ('CNNEE'); LONG_NAME = 'CN_net_ecosystem_exchange'; UNITS = 'kg m-2 s-1'
case ('CNXSMR'); LONG_NAME = 'abstract_C_pool_to_meet_excess_MR_demand'; UNITS = 'kg m-2'
case ('CNADD'); LONG_NAME = 'CN_added_to_maintain_positive_C'; UNITS = 'kg m-2 s-1'
Expand Down
Loading