-
Notifications
You must be signed in to change notification settings - Fork 23
/
AggregateRadiation.c
executable file
·47 lines (42 loc) · 1.54 KB
/
AggregateRadiation.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
* SUMMARY: AggregateRadiation.c - calculate basin-wide radiation
* USAGE: part of DHSVM
*
* AUTHOR: Bart Nijssen
* ORG: University of Washington, Department of Civil Engineering
* E-MAIL: nijssen@u.washington.edu
* ORIG-DATE: Apr-96
* DESCRIPTION: Calculate basin-wide radiation
* DESCRIP-END.
* FUNCTIONS:
* COMMENTS:
* $Id: AggregateRadiation.c,v 1.4 2003/07/01 21:26:09 olivier Exp $
*/
#include <stdio.h>
#include <stdlib.h>
#include "settings.h"
#include "data.h"
#include "massenergy.h"
/*****************************************************************************
AggregateRadiation()
In the current implementation the local radiation elements are not stored
for the entire area. Therefore these components are aggregated here. They
are averaged over the basin in Aggregate()
*****************************************************************************/
void AggregateRadiation(int MaxVegLayers, int NVegL, PIXRAD * Rad,
PIXRAD * TotalRad)
{
int i; /* counter */
/* aggregate radiation data */
for (i = 0; i < NVegL; i++) {
TotalRad->NetShort[i] += Rad->NetShort[i];
TotalRad->LongIn[i] += Rad->LongIn[i];
TotalRad->LongOut[i] += Rad->LongOut[i];
}
TotalRad->NetShort[MaxVegLayers] += Rad->NetShort[NVegL];
TotalRad->LongIn[MaxVegLayers] += Rad->LongIn[NVegL];
TotalRad->LongOut[MaxVegLayers] += Rad->LongOut[NVegL];
TotalRad->PixelNetShort += Rad->PixelNetShort;
TotalRad->PixelLongIn += Rad->PixelLongIn;
TotalRad->PixelLongOut += Rad->PixelLongOut;
}