int DLLEXPORT SMO_getSubcatchAttribute(SMOutputAPI* smoapi, long timeIndex,
	SMO_subcatchAttribute attr, float* outValueArray)
//
//   Purpose: For all subcatchments at given time, get a particular attribute.
//
{
	int errorcode = 0;

	long k;

	if (smoapi->file == NULL) errorcode = 412;
	else if (outValueArray == NULL) errorcode = 411;
	else
	{
		// loop over and pull result
		for (k = 0; k < smoapi->Nsubcatch; k++)
			outValueArray[k] = getSubcatchValue(smoapi, timeIndex, k, attr);
	}

	return errorcode;
}
int SMO_getSubcatchAttribute(SMOutputAPI* smoapi, int timeIndex,
	SMO_subcatchAttribute attr, float* outValueArray)
//
//   Purpose: For all subcatchments at given time, get a particular attribute.
//
{
	int k;

	if (smoapi->isOpened) 
	{
		// Check memory for outValues
		if (outValueArray == NULL) return 411;

		// loop over and pull result
		for (k = 0; k < smoapi->Nsubcatch; k++)
			outValueArray[k] = getSubcatchValue(smoapi, timeIndex, k, attr);

		return 0;
	}
	// Error no results to report on binary file not opened
	return 412;

}
int DLLEXPORT SMO_getSubcatchSeries(SMOutputAPI* smoapi, int subcatchIndex,
	SMO_subcatchAttribute attr, long timeIndex, long length, float* outValueSeries)
//
//  Purpose: Get time series results for particular attribute. Specify series
//  start and length using timeIndex and length respectively.
//
{
	int errorcode = 0;

	long k;

	if (smoapi->file == NULL) errorcode = 412;
	else if (outValueSeries == NULL) errorcode = 411;
	else
	{
		// loop over and build time series
		for (k = 0; k < length; k++)
			outValueSeries[k] = getSubcatchValue(smoapi, timeIndex + k,
			subcatchIndex, attr);
	}

	return errorcode;
}
int SMO_getSubcatchSeries(SMOutputAPI* smoapi, int subcatchIndex,
	SMO_subcatchAttribute attr, int timeIndex, int length, float* outValueSeries)
//
//  Purpose: Get time series results for particular attribute. Specify series
//  start and length using timeIndex and length respectively.
//
{
	int k;

	if (smoapi->isOpened) 
	{
		// Check memory for outValues
		if (outValueSeries == NULL) return 411;

		// loop over and build time series
		for (k = 0; k < length; k++)
			outValueSeries[k] = getSubcatchValue(smoapi, timeIndex + k,
			subcatchIndex, attr);

		return 0;
	}
	// Error no results to report on binary file not opened
	return 412;
}