@@ -73,13 +73,15 @@ def main():
7373 it_cl_type = config .get ('it_cl_type' )
7474 iera_type = config .get ('iera_type' )
7575 iemiss_type = config .get ('iemiss_type' )
76+ ilookup_table_lu = config .get ('ilookup_table_lu' )
7677 enable_cdnc = config .get ('enable_cdnc' , False )
7778 enable_edgar = config .get ('enable_edgar' , False )
7879 enable_art = config .get ('enable_art' , False )
7980 use_array_cache = config .get ('use_array_cache' , False )
8081 lsgsl = config .get ('lsgsl' , False )
8182 lfilter_oro = config .get ('lfilter_oro' , False )
8283 lurban = config .get ('lurban' , False )
84+ l_use_corine = config .get ('l_use_corine' , False )
8385 lradtopo = config .get ('lradtopo' , False )
8486 nhori = config .get ('nhori' , 24 )
8587 radtopo_radius = config .get ('radtopo_radius' , 40000.0 )
@@ -89,10 +91,11 @@ def main():
8991 generate_external_parameters (
9092 igrid_type , args .input_grid , iaot_type , ilu_type , ialb_type ,
9193 isoil_type , itopo_type , it_cl_type , iera_type , iemiss_type ,
92- enable_cdnc , enable_edgar , enable_art , use_array_cache , nhori ,
93- radtopo_radius , tcorr_lapse_rate , tcorr_offset , args .raw_data_path ,
94- args .run_dir , args .account , args .host , args .no_batch_job , lurban ,
95- lsgsl , lfilter_oro , lradtopo )
94+ ilookup_table_lu , enable_cdnc , enable_edgar , enable_art ,
95+ use_array_cache , nhori , radtopo_radius , tcorr_lapse_rate ,
96+ tcorr_offset , args .raw_data_path , args .run_dir , args .account ,
97+ args .host , args .no_batch_job , lurban , lsgsl , lfilter_oro ,
98+ l_use_corine , lradtopo )
9699
97100
98101def generate_external_parameters (igrid_type ,
@@ -105,6 +108,7 @@ def generate_external_parameters(igrid_type,
105108 it_cl_type ,
106109 iera_type ,
107110 iemiss_type ,
111+ ilookup_table_lu ,
108112 enable_cdnc ,
109113 enable_edgar ,
110114 enable_art ,
@@ -121,6 +125,7 @@ def generate_external_parameters(igrid_type,
121125 lurban = False ,
122126 lsgsl = False ,
123127 lfilter_oro = False ,
128+ l_use_corine = False ,
124129 lradtopo = False ):
125130
126131 # initialize logger
@@ -142,10 +147,12 @@ def generate_external_parameters(igrid_type,
142147 'it_cl_type' : it_cl_type ,
143148 'iera_type' : iera_type ,
144149 'iemiss_type' : iemiss_type ,
150+ 'ilookup_table_lu' : ilookup_table_lu ,
145151 'enable_cdnc' : enable_cdnc ,
146152 'enable_edgar' : enable_edgar ,
147153 'enable_art' : enable_art ,
148154 'use_array_cache' : use_array_cache ,
155+ 'l_use_corine' : l_use_corine ,
149156 'lradtopo' : lradtopo ,
150157 'nhori' : nhori ,
151158 'radtopo_radius' : radtopo_radius ,
@@ -495,21 +502,35 @@ def generate_globe_filenames():
495502def setup_lu_namelist (args ):
496503 namelist = {}
497504 namelist ['i_landuse_data' ] = args ['ilu_type' ]
498- namelist ['ilookup_table_lu' ] = args ['ilu_type ' ]
505+ namelist ['ilookup_table_lu' ] = args ['ilookup_table_lu ' ]
499506 namelist ['raw_data_lu_path' ] = args ['raw_data_path' ]
500507 namelist ['raw_data_glcc_path' ] = args ['raw_data_path' ]
501508 namelist ['lu_buffer_file' ] = 'lu_buffer.nc'
502509 namelist ['raw_data_glcc_filename' ] = 'GLCC_usgs_class_byte.nc'
503510 namelist ['glcc_buffer_file' ] = 'glcc_buffer.nc'
504- namelist ['l_use_corine' ] = ".FALSE."
511+ namelist ['ntiles_globcover' ] = 6
512+ namelist ['l_terra_urb' ] = ".FALSE."
513+
514+ if args ['l_use_corine' ]:
515+ namelist ['l_use_corine' ] = ".TRUE."
516+ else :
517+ namelist ['l_use_corine' ] = ".FALSE."
518+
505519 if args ['ilu_type' ] == 1 :
506- namelist ['raw_data_lu_filename' ] = [
507- f"'GLOBCOVER_{ i } _16bit.nc' " for i in range (0 , 6 )
508- ]
520+ if args ['l_use_corine' ]:
521+ namelist ['raw_data_lu_filename' ] = "'CORINE_globcover.nc'"
522+ namelist ['ntiles_globcover' ] = 1
523+ else :
524+ namelist ['raw_data_lu_filename' ] = [
525+ f"'GLOBCOVER_{ i } _16bit.nc' " for i in range (0 , 6 )
526+ ]
509527 elif args ['ilu_type' ] == 2 :
510528 # we need "" padding for correct replacement in Fortran namelist
511529 namelist ['raw_data_lu_filename' ] = "'GLC2000_byte.nc'"
512-
530+ elif args ['ilu_type' ] == 6 :
531+ # we need "" padding for correct replacement in Fortran namelist
532+ namelist ['raw_data_lu_filename' ] = "'ECOCLIMAP_SG.nc'"
533+ namelist ['l_terra_urb' ] = ".TRUE."
513534 else :
514535 logging .error (f'Unknown ilu_type { args ["ilu_type" ]} ' )
515536 raise ValueError (f'Unknown ilu_type { args ["ilu_type" ]} ' )
@@ -821,8 +842,14 @@ def replace_placeholders(args, templates, dir, actual_values):
821842 all_templates [template ] = all_templates [template ].replace (
822843 key , str ("" .join (value )))
823844 else :
824- all_templates [template ] = all_templates [template ].replace (
825- key , str (value ))
845+ if value is not None :
846+ all_templates [template ] = all_templates [template ].replace (
847+ key , str (value ))
848+ else :
849+ raise ValueError (
850+ f'The placeholder { key } in { all_templates [template ]} was replaced with None.'
851+ 'This likely means that it was not specified in the config file and has no default value.'
852+ )
826853
827854 # check that no @PLACEHOLDERS@ are left
828855 for template in templates :
0 commit comments