@@ -73,23 +73,26 @@ 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 )
8688
8789 generate_external_parameters (
8890 igrid_type , args .input_grid , iaot_type , ilu_type , ialb_type ,
8991 isoil_type , itopo_type , it_cl_type , iera_type , iemiss_type ,
90- enable_cdnc , enable_edgar , enable_art , use_array_cache , nhori ,
91- radtopo_radius , args .raw_data_path , args .run_dir , args .account ,
92- args .host , args .no_batch_job , lurban , lsgsl , lfilter_oro , lradtopo )
92+ ilookup_table_lu , enable_cdnc , enable_edgar , enable_art ,
93+ use_array_cache , nhori , radtopo_radius , args .raw_data_path ,
94+ args .run_dir , args .account , args .host , args .no_batch_job , lurban ,
95+ lsgsl , lfilter_oro , l_use_corine , lradtopo )
9396
9497
9598def generate_external_parameters (igrid_type ,
@@ -102,6 +105,7 @@ def generate_external_parameters(igrid_type,
102105 it_cl_type ,
103106 iera_type ,
104107 iemiss_type ,
108+ ilookup_table_lu ,
105109 enable_cdnc ,
106110 enable_edgar ,
107111 enable_art ,
@@ -116,6 +120,7 @@ def generate_external_parameters(igrid_type,
116120 lurban = False ,
117121 lsgsl = False ,
118122 lfilter_oro = False ,
123+ l_use_corine = False ,
119124 lradtopo = False ):
120125
121126 # initialize logger
@@ -137,10 +142,12 @@ def generate_external_parameters(igrid_type,
137142 'it_cl_type' : it_cl_type ,
138143 'iera_type' : iera_type ,
139144 'iemiss_type' : iemiss_type ,
145+ 'ilookup_table_lu' : ilookup_table_lu ,
140146 'enable_cdnc' : enable_cdnc ,
141147 'enable_edgar' : enable_edgar ,
142148 'enable_art' : enable_art ,
143149 'use_array_cache' : use_array_cache ,
150+ 'l_use_corine' : l_use_corine ,
144151 'lradtopo' : lradtopo ,
145152 'nhori' : nhori ,
146153 'radtopo_radius' : radtopo_radius ,
@@ -489,21 +496,35 @@ def generate_globe_filenames():
489496def setup_lu_namelist (args ):
490497 namelist = {}
491498 namelist ['i_landuse_data' ] = args ['ilu_type' ]
492- namelist ['ilookup_table_lu' ] = args ['ilu_type ' ]
499+ namelist ['ilookup_table_lu' ] = args ['ilookup_table_lu ' ]
493500 namelist ['raw_data_lu_path' ] = args ['raw_data_path' ]
494501 namelist ['raw_data_glcc_path' ] = args ['raw_data_path' ]
495502 namelist ['lu_buffer_file' ] = 'lu_buffer.nc'
496503 namelist ['raw_data_glcc_filename' ] = 'GLCC_usgs_class_byte.nc'
497504 namelist ['glcc_buffer_file' ] = 'glcc_buffer.nc'
498- namelist ['l_use_corine' ] = ".FALSE."
505+ namelist ['ntiles_globcover' ] = 6
506+ namelist ['l_terra_urb' ] = ".FALSE."
507+
508+ if args ['l_use_corine' ]:
509+ namelist ['l_use_corine' ] = ".TRUE."
510+ else :
511+ namelist ['l_use_corine' ] = ".FALSE."
512+
499513 if args ['ilu_type' ] == 1 :
500- namelist ['raw_data_lu_filename' ] = [
501- f"'GLOBCOVER_{ i } _16bit.nc' " for i in range (0 , 6 )
502- ]
514+ if args ['l_use_corine' ]:
515+ namelist ['raw_data_lu_filename' ] = "'CORINE_globcover.nc'"
516+ namelist ['ntiles_globcover' ] = 1
517+ else :
518+ namelist ['raw_data_lu_filename' ] = [
519+ f"'GLOBCOVER_{ i } _16bit.nc' " for i in range (0 , 6 )
520+ ]
503521 elif args ['ilu_type' ] == 2 :
504522 # we need "" padding for correct replacement in Fortran namelist
505523 namelist ['raw_data_lu_filename' ] = "'GLC2000_byte.nc'"
506-
524+ elif args ['ilu_type' ] == 6 :
525+ # we need "" padding for correct replacement in Fortran namelist
526+ namelist ['raw_data_lu_filename' ] = "'ECOCLIMAP_SG.nc'"
527+ namelist ['l_terra_urb' ] = ".TRUE."
507528 else :
508529 logging .error (f'Unknown ilu_type { args ["ilu_type" ]} ' )
509530 raise ValueError (f'Unknown ilu_type { args ["ilu_type" ]} ' )
@@ -811,8 +832,14 @@ def replace_placeholders(args, templates, dir, actual_values):
811832 all_templates [template ] = all_templates [template ].replace (
812833 key , str ("" .join (value )))
813834 else :
814- all_templates [template ] = all_templates [template ].replace (
815- key , str (value ))
835+ if value is not None :
836+ all_templates [template ] = all_templates [template ].replace (
837+ key , str (value ))
838+ else :
839+ raise ValueError (
840+ f'The placeholder { key } in { all_templates [template ]} was replaced with None.'
841+ 'This likely means that it was not specified in the config file and has no default value.'
842+ )
816843
817844 # check that no @PLACEHOLDERS@ are left
818845 for template in templates :
0 commit comments