Fix nasty bug wherein only the last field in the input struct would be written to the output NetCDF file. This is because the loop to check the current input NetCDF file variable and the list of fields to use as replacements would run through all three variables and write the data if the test was true, resulting in the earlier replacements being overwritten by the existing data. The fix is to move the writing of the existing data outside the check loop and create a new variable which is set to one once the new data have been added to the NetCDF