E3SM-Project / E3SM-Project/scream

Time interpolation tries to read _FillValue even if it do not exist

Open
#2,717 1 comment 0 reactions 1 assignee Claimed by @AaronDonahue View on GitHub
I/O
Dominant language
No language data
Stars
79
Forks
54
PR merge metrics
No merged PRs in 30d

Description

Time interpolation will always try to read the _FillValue attribute from file and mask based on it, even if the variable does not have a _FillValue associated with it. The current workaround is to just make sure a _FillValue attribute is defined for all netcdf variables that will be time-interpolated, but it might be good to allow using inputdata that does not need to have _FillValue defined. Note that the code is annotated with a TODO for this:
```
void TimeInterpolation::read_data()
{
const auto triplet_curr = m_file_data_triplets[m_triplet_idx];
if (triplet_curr.filename != m_file_data_atm_input.get_filename()) {
// Then we need to close this input stream and open a new one
m_file_data_atm_input.finalize();
ekat::ParameterList input_params;
input_params.set("Field Names",m_field_names);
input_params.set("Filename",triplet_curr.filename);
m_file_data_atm_input = AtmosphereInput(input_params,m_fm_time1);
// Also determine the FillValue, if used
// TODO: Should we make it possible to check if FillValue is in the metadata and only assign mask_value if it is?
float var_fill_value;
for (auto& name : m_field_names) {
scorpio::get_variable_metadata(triplet_curr.filename,name,"_FillValue",var_fill_value);
auto& field = m_fm_time1->get_field(name);
field.get_header().set_extra_data("mask_value",var_fill_value);
}
}
m_file_data_atm_input.read_variables(triplet_curr.time_idx);
m_time1 = triplet_curr.timestamp;
}
```
I would consider this low priority, since it is probably not too much to ask that a _FillValue attribute is associated with each variable.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.