~ubuntu-branches/ubuntu/vivid/grass/vivid-proposed

« back to all changes in this revision

Viewing changes to imagery/i.eb.soilheatflux/g0.c

  • Committer: Package Import Robot
  • Author(s): Bas Couwenberg
  • Date: 2015-02-20 23:12:08 UTC
  • mfrom: (8.2.6 experimental)
  • Revision ID: package-import@ubuntu.com-20150220231208-1u6qvqm84v430b10
Tags: 7.0.0-1~exp1
* New upstream release.
* Update python-ctypes-ternary.patch to use if/else instead of and/or.
* Drop check4dev patch, rely on upstream check.
* Add build dependency on libpq-dev to grass-dev for libpq-fe.h.
* Drop patches applied upstream, refresh remaining patches.
* Update symlinks for images switched from jpg to png.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include<stdio.h>
 
2
#include<math.h>
 
3
#include<stdlib.h>
 
4
 
 
5
double g_0(double bbalb, double ndvi, double tempk, double rnet,
 
6
           double time, int roerink) 
 
7
{
 
8
    double a, b, result;
 
9
    double r0_coef;
 
10
    
 
11
    if (time <= 9.0 || time > 15.0) 
 
12
        r0_coef = 1.1;
 
13
    else if (time > 9.0 && time <= 11.0)
 
14
        r0_coef = 1.0;
 
15
    else if (time > 11.0 && time <= 13.0)
 
16
        r0_coef = 0.9;
 
17
    else if (time > 13.0 && time <= 15.0) 
 
18
        r0_coef = 1.0;
 
19
    a = (0.0032 * (bbalb / r0_coef) +
 
20
          0.0062 * (bbalb / r0_coef) * (bbalb / r0_coef));
 
21
    b = (1 - 0.978 * pow(ndvi, 4));
 
22
    /* Spain (Bastiaanssen, 1995) */ 
 
23
    result = (rnet * (tempk - 273.15) / bbalb) * a * b;
 
24
    /* HAPEX-Sahel (Roerink, 1995) */ 
 
25
    if (roerink)
 
26
        result = result * 1.430 - 0.0845;
 
27
 
 
28
    return result;
 
29
}
 
30
 
 
31