We (my colleague has now taken an interest in what I have written!) have begun to expand this so that the script will do this process for almost all types of input data we work with, so it is automating some of the variables (such as $area and $proj) which I had originally manually set.