While creating a python unit test for CAMDEN with this registry file:
<?xml version="1.0" encoding="UTF-8"?>
<registry name="cam_registry" version="1.0">
<file name="physics_types_ddt2" type="module">
<use module="ccpp_kinds" reference="kind_phys"/>
<variable local_name="theta" standard_name="potential_temperature"
units="K" type="real" kind="kind_phys" allocatable="pointer">
</variable>
<ddt type="model_thermo">
<data>potential_temperature</data>
</ddt>
<variable local_name="thermo" standard_name="cam_thermo"
units="None" type="model_thermo">
</variable>
<ddt type="physics_state">
<data>cam_thermo</data>
</ddt>
<variable local_name="phys_state"
standard_name="physics_state_from_dynamics"
units="None" type="physics_state">
</variable>
</file>
</registry>
generate_registry.py fails with this traceback:
Traceback (most recent call last):
File "write_init_unit_tests.py", line 510, in test_ddt2_reg_write_init
error_on_no_validate=True)
File "/glade/work/nusbaume/SE_projects/new_cam_sandbox/CAMDEN/src/data/generate_registry_data.py", line 1465, in gen_registry
files = write_registry_files(registry, dycore, config, outdir, indent, logger)
File "/glade/work/nusbaume/SE_projects/new_cam_sandbox/CAMDEN/src/data/generate_registry_data.py", line 1389, in write_registry_files
file_.write_source(outdir, indent, logger)
File "/glade/work/nusbaume/SE_projects/new_cam_sandbox/CAMDEN/src/data/generate_registry_data.py", line 1170, in write_source
self.write_allocate_routine(outfile)
File "/glade/work/nusbaume/SE_projects/new_cam_sandbox/CAMDEN/src/data/generate_registry_data.py", line 1226, in write_allocate_routine
var.write_allocate_routine(outfile, 2, init_var, reall_var, '')
File "/glade/work/nusbaume/SE_projects/new_cam_sandbox/CAMDEN/src/data/generate_registry_data.py", line 647, in write_allocate_routine
init_var, reall_var, sub_ddt_str)
File "/glade/work/nusbaume/SE_projects/new_cam_sandbox/CAMDEN/src/data/generate_registry_data.py", line 647, in write_allocate_routine
init_var, reall_var, sub_ddt_str)
File "/glade/work/nusbaume/SE_projects/new_cam_sandbox/CAMDEN/src/data/generate_registry_data.py", line 669, in write_allocate_routine
outfile.write("call endrun({})".format(emsg), indent+2)
File "/glade/work/nusbaume/SE_projects/new_cam_sandbox/CAMDEN/ccpp_framework/scripts/fortran_tools/fortran_write.py", line 119, in write
self.write(statement, indent_level, continue_line=line_continue)
File "/glade/work/nusbaume/SE_projects/new_cam_sandbox/CAMDEN/ccpp_framework/scripts/fortran_tools/fortran_write.py", line 112, in write
if line_continue:
UnboundLocalError: local variable 'line_continue' referenced before assignment
This occurs with both python 3.6.8 and python 2.7.13.
Thus it appears that a situation arises where line_continue is called without being set. I am not 100% sure yet if this is a CAMDEN issue, a CCPP framework issue, or I simply have a bad registry file. However, given that the actual error appears in the CCPP framework, and the outfile call in CAMDEN doesn't appear to be wrong, I decided to add the issue here. I'll hopefully be able to narrow down on the specific cause of the problem later, and will post the results here.
While creating a python unit test for CAMDEN with this registry file:
generate_registry.py fails with this traceback:
This occurs with both python 3.6.8 and python 2.7.13.
Thus it appears that a situation arises where
line_continueis called without being set. I am not 100% sure yet if this is a CAMDEN issue, a CCPP framework issue, or I simply have a bad registry file. However, given that the actual error appears in the CCPP framework, and theoutfilecall in CAMDEN doesn't appear to be wrong, I decided to add the issue here. I'll hopefully be able to narrow down on the specific cause of the problem later, and will post the results here.