@@ -271,7 +271,7 @@ class LDASsetup:
271271
272272 # print rqd exe inputs
273273 if self .verbose :
274- print ('\n Inputs from execfile :\n ' )
274+ print ('\n Inputs from exeinp file :\n ' )
275275 _printdict (self .rqdExeInp )
276276
277277 self .tile_types = self .rqdExeInp .get ('TILE_TYPES' ,"100" ).split ()
@@ -356,7 +356,6 @@ class LDASsetup:
356356
357357 _difftime = timedelta (days = _years * 365 + _months * 30 + _days ,hours = _hours ,minutes = _mins ,seconds = _seconds )
358358 _difftime = int (self .rqdExeInp ['NUM_SGMT' ])* _difftime
359- print (int (self .rqdExeInp ['NUM_SGMT' ]))
360359 _d = self .begDates [0 ]
361360 _endDate = self .endDates [0 ]
362361 _d = _d + _difftime
@@ -1802,38 +1801,37 @@ def _produceExeInput(out_dict=None,ladas_cpl=0):
18021801 with open (_fn ) as _f :
18031802 i_ = 1
18041803 for line in _f :
1805- if ( 5 <= i_ and i_ <= 21 ) : # skip over lines 5-21 - may need to change if GEOS_SurfaceGridComp.rc is edited
1806- i_ += 1
1804+ i_ += 1
1805+ # skip over lines 5-21 (content does not apply after this processing) - may need to change if GEOS_SurfaceGridComp.rc is edited
1806+ if ( 5 <= i_ and i_ <= 21 ) :
18071807 continue
1808- if use_rc_defaults in line : # process lines that contain string "use_rc_defaults"
1809- line0 = line .split (use_rc_defaults )[1 ]
1810- if ladas_cpl == 0 :
1811- sys .stdout .write (line0 )
1812- sys .stdout .flush ()
1813- else :
1814- lines .append (line0 )
1815- if not '=>' in line :
1816- if not line .strip () or line .strip ().startswith ('#' ): # echo all other lines
1817- if ladas_cpl == 0 :
1818- sys .stdout .write (line )
1819- sys .stdout .flush ()
1820- else :
1821- lines .append (line )
1822- i_ += 1
1808+ if ladas_cpl == 0 :
1809+ # process lines that contain string "use_rc_defaults"
1810+ if use_rc_defaults in line :
1811+ line0 = line .split (use_rc_defaults )[1 ]
1812+ sys .stdout .write (line0 )
1813+ sys .stdout .flush ()
1814+ # echo blank lines and comment lines (except if they contain 'GEOSldas=>' or 'GEOSagcm=>')
1815+ if (not 'GEOSldas=>' in line ) and (not 'GEOSagcm=>' in line ) :
1816+ if (not line .strip ()) or line .strip ().startswith ('#' ) :
1817+ sys .stdout .write (line )
1818+ sys .stdout .flush ()
1819+ else :
1820+ # process lines that contain string "use_rc_defaults"
1821+ if use_rc_defaults in line :
1822+ line0 = line .split (use_rc_defaults )[1 ]
1823+ # strip out inline comment (if present)
1824+ position = line0 .find ('#' )
1825+ if position > 0 :
1826+ line0 = line0 [:position ]
1827+ # extract key/value pair and add to dictionary
1828+ key , val = line0 .split (":" ,1 )
1829+ out_dict [key .strip ()] = val .strip ()
1830+
18231831
18241832 print ()
18251833 print ()
18261834
1827- if ladas_cpl > 0 :
1828- for line in lines :
1829- line = line .strip ()
1830- if not line or line .startswith ('#' ):
1831- continue
1832- position = line .find ('#' )
1833- if position > 0 : # strip out comment
1834- line = line [:position ]
1835- key , val = line .split (":" ,1 )
1836- out_dict [key .strip ()] = val .strip ()
18371835
18381836# -----------------------------------------------------------------------------------
18391837
0 commit comments