Using the ExtData component: Difference between revisions
Line 65: | Line 65: | ||
If you enter '0' for the refresh template the field gets updated every step and ExtData will try to interpolate to the application time using the data on file. | If you enter '0' for the refresh template the field gets updated every step and ExtData will try to interpolate to the application time using the data on file. | ||
[[Let me repeat, ExtData always tries to interpolate to the time you tell it to using the data on the file or files you reference. To do this at any time your application will encounter, whether it is the application time or a time that gets produced by evaluating a refresh template ExtData must be able to find two times on the data series that bracket this time. These need not be on the same file as it can interpolate between data on different files. This is key to understanding how ExtData functions]] | [[Let me repeat, ExtData always tries to interpolate to the time you tell it to using the data on the file or files you reference. To do this at any time your application will encounter, whether it is the application time or a time that gets produced by evaluating a refresh template ExtData must be able to find two times on the data series that bracket this time. These need not be on the same file as it can interpolate between data on different files. Also you should not have time on a file that lies outside the range indicated by the file name. For example if the file templated and you have a 2008 file, the 2008 file should not have any time in it that falls outside of 2008. This defeats the purpose of ExtData. Pleae reread this as it is key to understanding how ExtData functions]] | ||
This bracketing data gets updated as time advances in your application. But how does it know where to find this, especially if the data is spread across multiple files? If your file_template has no grads tokens to evaluate then all data you need to span the time span your application will run on needs to be in the file. More likely if you have multiple files you specify a grads style file template. When ExtData tries to find the bracketing times, it takes the time it is trying to interpolate to and applies that to the file template. It looks for data at two times that bracket the current time. If it does not find either the left or right bracket time it looks in the previous file (for the left) or the next file (for the right). How does it know what the next file is. If the user does not specify a reference time and frequency it looks at the right most token and assumes that is the frequency of the files. For example if the right most token is %d2 it assumes that files are daily so to find the right bracket time, it will advance the time by one day and try to look in that file to update the right bracket time. Now what if you have a file every 3 hours for example, this logic would not work. In this case you must specify a reference time and frequency using the optional keyword after the file template to tell it explicitly when the files start and how to advance the time to find the bracketing data. | This bracketing data gets updated as time advances in your application. But how does it know where to find this, especially if the data is spread across multiple files? If your file_template has no grads tokens to evaluate then all data you need to span the time span your application will run on needs to be in the file. More likely if you have multiple files you specify a grads style file template. When ExtData tries to find the bracketing times, it takes the time it is trying to interpolate to and applies that to the file template. It looks for data at two times that bracket the current time. If it does not find either the left or right bracket time it looks in the previous file (for the left) or the next file (for the right). How does it know what the next file is. If the user does not specify a reference time and frequency it looks at the right most token and assumes that is the frequency of the files. For example if the right most token is %d2 it assumes that files are daily so to find the right bracket time, it will advance the time by one day and try to look in that file to update the right bracket time. Now what if you have a file every 3 hours for example, this logic would not work. In this case you must specify a reference time and frequency using the optional keyword after the file template to tell it explicitly when the files start and how to advance the time to find the bracketing data. | ||
The following picture illustrates a simple example of how this works for a simple case where you have data on hourly files. | |||
[[File:Bracketing_data.png]] | [[File:Bracketing_data.png]] |