(WIP) Alternative method for assigning flags "no_unit" #3712
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
An alternative approach to #3613. The reason there are multiple approaches is due to the fact that it is necessary to check the attributes of an ancillary variable to know if it is a flag. However, with the current method of loading NetCDF files, some steps are done in netcdf.py (i.e. loading in attributes) and others are done in fc_pyke_rules.krb (i.e. determining units).
#3613 took the approach of having all the code determining units in the same place. This meant that attributes had to be loaded prematurely (and probably redundantly) in order to make this check. This pull request takes the approach that attributes should be loaded all at once and only when they are loaded should this check take place. The downside to this is that the unit has already been determined and will have to be overwritten. To summarize, #3613 has redundancy in the reading of NetCDF file and this pull request has redundancy in the writing iris objects.
It may well be possible to find a more elegant approach, in which case these two pull requests act as an illustration of the problem that must be overcome.