"Profile" data allows the storage of several values for each time. It is essentially a marriage of time series data and paired data. It is called "Profile" because its most common use is a time series temperature profile for lakes. For profile data, there is an independent variable (depths) and a set of dependent variables (temperatures at those depths over time.) The independent variable (depths) describes the dependent variables and is NOT associated with a time. The C part must contain the independent variable name followed by a dash ("-") and then the independent variable name. For lake profile, this would be "/Depth-Temperature/".

The number of independent variables must be consistent for the entire data set; for example, if you have 10 depth readings, you must have 10 depth readings for the entire data set (although some may be marked as missing). You must have a independent variable set, even if not used. If you wanted to store multiple time series values, you would still need to have a independent variable array, although it may contain all zeros.

Profile data may have quality and notes, as other time series conventions. Profile data may be regular-interval or irregular-interval; minute (default) granularity or second granularity.

Profile depths are equivalent to columns in paired data, and times are equivalent to rows. You need to store rows x columns number of data; use a missing flag if you do not have a value for any positions in the array. In Java, the rows are the first part of the dimension, and columns the second, so the dimension is timeSeriesContainer.profileValues[numberTimes][numberDepts];

Profile variable names in TimeSeriesContainers follow lake temperature profiles for clarity (numberDepths is clearer than number independent variables). Units are stored for both independent and dependent variables.

Functions to access profile data in TimeSeriesContainers include the following:

public int setProfile(double profileDepths[], double profileValues[][])

public int getProfileNumberDepths()
public double[] getProfileDepths()

public double[][] getProfileValues()

public void setProfileDepthsUnits (String unitsProfileDepths)
public void setProfileValuesUnits (String unitsProfileValues)
public void setProfileLabel (String profileLabel)
public String getProfileDepthsUnits()
public String getProfileValuesUnits()
public String getProfileLabel()
JAVA


Where profileValues is dimensioned as profileValues[numberValues][numberDepths].


Example: Regular-interval time series profile data


import javax.swing.UIManager;
import hec.heclib.dss.*;
import hec.heclib.util.HecTime;
import hec.heclib.util.HecTimeArray;
import hec.io.TimeSeriesContainer;

//  Store time series profile data
//  In this example, we'll use regular-interval without quality or notes
//We'll store 20 depths for 1000 days
//
public class ExampleTimeSeries9 {

	public static void main (String args[])  {

		try {
			javax.swing.UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
		}
		catch (Exception ignore) {}
					
		double profileDepths[] = new double[20];
		double profileValues[][] = new double[1000][20];
		int numberDepths = 20;
		int numberValues = 1000;
		//  measurements every 3 meters
		for (int i=0; i<numberDepths; i++) {
			profileDepths[i] = (double)(i * 3);
		}
		for (int i=0; i<numberValues; i++) {
			for (int j=0; j<numberDepths; j++) {
				profileValues[i][j] = 10 * (Math.sin(i) + Math.sin(j) + 1);
			}
		}
		TimeSeriesContainer tsc = new TimeSeriesContainer();
		tsc.setName ("/Basin/Location/Depth-Temperature//1Day/Java Profile Sample/");
		tsc.setStartTime(new HecTime("20Jan2010", "1200"));	
		tsc.setProfile(profileDepths, profileValues);
		tsc.setProfileDepthsUnits("Meters");
		tsc.setProfileValuesUnits("deg C");
		tsc.setType("Inst-Val");
	
		HecTimeSeries dssTimeSeries = new HecTimeSeries();
		dssTimeSeries.setDSSFileName("C:/temp/Example7.dss");
		int status = dssTimeSeries.write(tsc);
		dssTimeSeries.done();		
		if (status != 0) return;
		
		//  Read data
		TimeSeriesContainer tscRead = new TimeSeriesContainer();
		tscRead.setName ("/Basin/Location/Depth-Temperature//1Day/Java Profile Sample/");
		HecTime hecTime = new HecTime("20Jan2010", "1200");
		tscRead.setStartTime(hecTime);
		hecTime.addDays(999);   //  999 days is 1000 values
		tscRead.setEndTime(hecTime);
		HecTimeSeries dssTimeSeriesRead = new HecTimeSeries();
		dssTimeSeriesRead.setDSSFileName("C:/temp/Example7.dss");
		
		status = dssTimeSeriesRead.read(tscRead, true);
		dssTimeSeriesRead.done();		
		if (status != 0) return;
		numberValues = tscRead.getNumberValues();
		HecTimeArray hecTimeArray = tscRead.getTimes();
		double profiles[][] = tscRead.getProfileValues();
		double depths[] = tscRead.getProfileDepths();
		for (int i=0; i<depths.length; i++) {
			System.out.println("Ordinate: " + i + ", Depth: " + depths[i]);
		}
		for (int i=0; i<numberValues; i++) {
			System.out.println("Ordinate: " + i + ", time: " + hecTimeArray.elementAt(i).dateAndTime() + 
					", First temp: " + profiles[i][0] + ", second: " + 
					profiles[i][1]	+ ", third: " + profiles[i][2]);
		}
		HecDataManager.closeAllFiles();  //  Only at the end of the program
	}
}


JAVA


Ordinate: 383, time: 7 February 2011, 12:00, First temp: 7.291232289465946, second: 15.705942137544913, third: 16.384206557722763

Ordinate: 384, time: 8 February 2011, 12:00, First temp: 16.636564336219596, second: 25.05127418429856, third: 25.72953860447641

Ordinate: 385, time: 9 February 2011, 12:00, First temp: 19.880269738337468, second: 28.29497958641643, third: 28.973244006594285

Ordinate: 386, time: 10 February 2011, 12:00, First temp: 14.040100708226275, second: 22.45481055630524, third: 23.133074976483094

Ordinate: 387, time: 11 February 2011, 12:00, First temp: 4.485481718850854, second: 12.900191566929816, third: 13.57845598710767

Ordinate: 388, time: 12 February 2011, 12:00, First temp: 8.854056599361115E-4, second: 8.415595253738902, third: 9.093859673916754

Ordinate: 389, time: 13 February 2011, 12:00, First temp: 4.709428937225736, second: 13.1241387853047, third: 13.802403205482552

Ordinate: 390, time: 14 February 2011, 12:00, First temp: 14.282099105187687, second: 22.69680895326665, third: 23.3750733734445