-
Notifications
You must be signed in to change notification settings - Fork 23
/
GetMetData.c
executable file
·62 lines (56 loc) · 1.84 KB
/
GetMetData.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
* SUMMARY: GetMetData.c - Read new station meteorological data
* 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: Read new station meteorological data
* DESCRIP-END.
* FUNCTIONS: GetMetData()
* COMMENTS:
* $Id: GetMetData.c,v 1.4 2003/07/01 21:26:15 olivier Exp $
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "settings.h"
#include "data.h"
#include "DHSVMerror.h"
#include "functions.h"
#include "constants.h"
#include "rad.h"
/*****************************************************************************
GetMetData()
*****************************************************************************/
void GetMetData(OPTIONSTRUCT * Options, TIMESTRUCT * Time, int NSoilLayers,
int NStats, float SunMax, METLOCATION * Stat, MAPSIZE * Radar,
RADARPIX ** RadarMap, char *RadarFileName)
{
int i; /* counter */
if (DEBUG)
printf("Reading all met data for current timestep\n");
for (i = 0; i < NStats; i++)
ReadMetRecord(Options, &(Time->Current), NSoilLayers, &(Stat[i].MetFile),
Stat[i].IsWindModelLocation, &(Stat[i].Data));
if (Options->PrecipType == RADAR)
ReadRadarMap(&(Time->Current), &(Time->StartRadar), Time->Dt, Radar,
RadarMap, RadarFileName);
if (Options->Shading == TRUE) {
for (i = 0; i < NStats; i++) {
if (SunMax > 0.0) {
Stat[i].Data.ClearIndex = Stat[i].Data.Sin / SunMax;
SeparateRadiation(Stat[i].Data.Sin, Stat[i].Data.ClearIndex,
&(Stat[i].Data.SinBeamObs),
&(Stat[i].Data.SinDiffuseObs));
}
else {
/* if sun is below horizon, then force all shortwave to zero */
Stat[i].Data.Sin = 0.0;
Stat[i].Data.SinBeamObs = 0.0;
Stat[i].Data.SinDiffuseObs = 0.0;
}
}
}
}