April 12, 2024

Simulating Daily Precipitation Using a Time Series Element

Posted by Jason Lillywhite

In GoldSim, the Time Series element serves as an effective tool to represent precipitation data. Given the versatility of this element in portraying such data, I felt compelled to share some best practices and tips for those keen on utilizing this kind of data. 

In this article, I will illustrate how to view and interact with measured daily precipitation using a Time Series element. Additionally, I will delve into some data definition properties and demonstrate the use of a Time History Result element to visualize historical trends and compute period statistics. 

This blog post aims to provide insights into modeling with time series data more efficiently, regardless of whether you are a GoldSim novice or an experienced user.

If you are new to the Time Series element, I recommend completing Lesson 5 -Defining Time Series - GoldSim from the Introduction to GoldSim Course.
The Time Series element is capable of interpreting large time series in multiple ways. Understanding the properties of this element is crucial to accurately represent data specific to your application.
For this blog post, I will use a precipitation dataset obtained from the National Climatic Data Center (NCDC). The dataset includes total daily precipitation measurements from the Salt Lake City International Airport weather station (Network ID: GHCND:USW00024127) from 1948 to 2023. You are welcome to follow along using your own dataset or use the link above to download the same data that I will use.
Here are the steps to set up the model to run for the historical period of the dataset:
  1. In the Simulation Settings, set the Time Basis to Calendar Time.
  2. Set the start time to 1 Jan 1948 and end time to 1 Jan 2023 (your dates might vary)
  3. Set the Basic Step to "Days." 
  4. Define Reporting Periods with "Annual" reporting periods.
Below is a screen capture of my simulation settings.

Once the model is set up, we are ready to load the data into the model. Here are the steps:
    1. Download the dataset from NCDC and load it into Excel
    2. In GoldSim, insert a new Time Series element and define the Element ID and Description.
    3. Set the Display Units to reflect daily total precipitation in inches per day (or mm per day). 
    4. Set the Represents input selection to “Constant value of the next time interval.” For more information on how this choice impacts Time Series outputs, refer to the GoldSim Help Documentation: Specifying What the Input to a Time Series Represents. You can also explore a list of examples demonstrating how and why to use each type: Time Series Examples
    5. Copy the date and values columns from the Excel file (excluding headers). 
    6. Open the Time Series element’s data table, paste values, and click OK.
    7. Save the model.
    This should result in something that looks like this:

    When defining precipitation time series data, it's essential to consider the unit dimensions. Precipitation data is commonly represented in two primary ways:
    • Average precipitation rate distributed over each time interval.
    • Total precipitation depth (quantity) reported at the end of each time period.
    The Time Series element makes it very easy to work with either way efficiently. If you define precipitation as a rate, the Display Unit is defined as length per time (L/T). If defined as a quantity reported at the end of each time period, a Display Unit of length (L) is used. Depending on your choice, the way you work with the output of the Time Series will vary. Be aware that an average monthly or annual rate must account for changing time periods and therefore, should be avoided.

    If you specify a monthly average precipitation for February as 10 in/mon, this is the same as saying 10 inches / 30.4375 days, which is different than saying 10 inches / 28 days (in non-leap years). Because this type of conversion can often lead to mistakes, it is recommended that precipitation quantities should be defined when working with time series with monthly and annual time intervals.

    An alternative to representing the precipitation data as a daily rate in in/day would be to change it to represent a change over the previous time interval, which is more aligned with how precipitation is often measured in the field. Below is a screen capture showing how the Time Series would be set up this way. Note the "Rate_of_Change" output is added to the element when you check the box "Enable Rate of Change output". This is particularly useful when you don't want to calculate the rate by hand and thus eliminate possible errors.

    With the time series configured and the data loaded into the model, let's run the model and explore results! 

    Note: For more information on running a model and changing your simulation's start and end time, refer to the GoldSim Help Documentation: Running a GoldSim Model. Ensure you understand how to define result elements and work with Reporting Periods as we will be using these features throughout the unit: Viewing Reporting Period-Based Results in Time History Result Elements.

    After running the model, right click on the time series element and choose "Time History Result..." and you can see a plot of the daily precipitation over the period of the simulation. This is the default chart view, which shows a lot of data. This gives us a basic understanding of the data like the approximate range of values and somewhat of an idea of how frequently larger storms occur. However, we can use GoldSim features to gather more information from other chart views.

    Hold the Ctrl key while dragging the mouse to zoom in.
    With Reporting Periods set up, you can configure the Time History result element to report period summaries like the total precipitation over each major period of the simulation (years in this case). The screen capture below shows how this can be configured.

    The result is a plot that shows both annual totals along with the daily values.

    A lesser known feature of GoldSim charts is dynamic labeling. In the chart above, I'm using keywords to display a title for the chart that will automatically update if we show Monthly totals instead of Annual. Below is the code I use for the chart title, defined in the Chart Style editor:

    The keyword %period% will cause the name of the currently selected reporting period to show, which is "Annual" in my case. Also, I use the chart description as the title of the chart so I use the keyword %rdesc%. This way, the chart description and the chart title are always in sync.

    Sometimes, you may want to view a probability distribution of the annual total precipitation quantities. To do this, we will use another feature of the Time Series called "Shifting" and run a Monte Carlo simulation. To configure your model to perform this analysis, follow these steps:
    1. Open the properties of the Time Series then click on the "More" button to enable the advanced properties.
    2. Chck the box for "Enable Time Shifting of Time Series Data" and choose "Annual" for the periodicity. 

    3. Add an Integrator element then link the precipitation rate output of the Time Series to the Rate of Change input as shown. 

    4. Change the start and end time of the simulation to be a single year (doesn't matter what year you choose and it can be a future year if you want).

    5. Click on the Monte Carlo tab of the simulation settings and enter the number of realizations that equals the number of years on record (117 years in my case) 

    6. Run the model and right-click on the Integrator and choose "Distribution Result..." to see the probability distribution of the annual precipitation totals.
    The result is a Distribution Result with statistics reported for the annual totals. 

    The same can be done for peak daily precipitation for all of the years using an Extrema element in the same way the Integrator was used above.

    Using Monthly Reporting Periods, a probability time history can be quickly generated using the same result element we created to show the annual values. Switching over to a "Probabilities" view, we will see the range of possibilities for each month of the year, from all the years on record. 
    Note the year shown in the X axis of the below chart is arbitrary. We are obtaining historical data and projecting all of it on a future year, in this case.

    As seen from the above example, there are different ways to represent time series data and you should consider which is the best for your application. Also, with some simulation settings configurations and a couple of elements, you are able to visualize quite a bit of information about the data, including long-term totals and probability distribution of these totals. Hopefully this post gives you some ideas to make better use of Time Series data in GoldSim. Let us know in the comments if you have any questions or feedback!

    No comments:

    Post a Comment