diff --git a/io/teca_cf_layout_manager.cxx b/io/teca_cf_layout_manager.cxx index 6d3e44f2..b71a528d 100644 --- a/io/teca_cf_layout_manager.cxx +++ b/io/teca_cf_layout_manager.cxx @@ -449,18 +449,21 @@ int teca_cf_layout_manager::define(const teca_metadata &md_in, #endif ) - // First implementation: Save the var to var_def so that attributes - // get written with other variables - // -> This caused an error when trying to write the attribute - // "_FillValue" after writing the data. + // NOTE: The first implentation was the following: + // Save the var to var_def so that attributes get written with other variables + // // save the var id // this->var_def[coord_array_names[i]] = var_def_t(parent_id, var_id, // var_type_code); - - // Second implementation: + // + // While this approach avoided code duplication, it caused an error when + // trying to write the attribute "_FillValue" after writing the data. + // To work around this error, we write the attributes of the coordinate + // axes directly here instead of saving the var id for later writing. + . // // write variable attributes - // this needs to be done before writing arrays to avoid a NetCDF error - // of specifying fill value when data already exists. + // (this needs to be done before writing arrays to avoid a NetCDF error + // of specifying fill value when data already exists) teca_metadata array_atts; if (array_attributes.get(coord_array_names[i], array_atts) == 0) {