-
Notifications
You must be signed in to change notification settings - Fork 1
/
worldclimjson.php
103 lines (94 loc) · 4.01 KB
/
worldclimjson.php
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php
if (isset($_GET['lat'])) {
if(isset($_GET['lon'])){
$escapedLat = pg_escape_string(trim($_GET['lat']));
$escapedLon = pg_escape_string(trim($_GET['lon']));
}
} else {
}
$jsonurl = "http://castle.iplantcollaborative.org:9000/info?lat=$escapedLat&lon=$escapedLon";
$json = file_get_contents($jsonurl);
$jsonarray = json_decode($json, true);
echo "<table class='table table-borderless table-condensed table-hover infowindow'>";
$mat = $jsonarray['mat'] / 10;
$mdr = $jsonarray['mdr'] / 10;
$iso = $jsonarray['iso'] / 10;
$tsd = $jsonarray['tsd'] / 100;
$maxtwm = $jsonarray['maxtwm'] / 10;
$anntmin = $jsonarray['anntmin'] / 10;
$tar = $jsonarray['tar'] / 10;
$meantwq = $jsonarray['meantwq'] / 10;
$meantdq = $jsonarray['meantdq'] / 10;
$meantwaq = $jsonarray['meantwaq'] / 10;
$meantcq = $jsonarray['meantcq'] / 10;
$annprec = $jsonarray['annprec'];
$precwm = $jsonarray['precwm'];
$precdm = $jsonarray['precdm'];
$precwq = $jsonarray['precwq'];
$precdq = $jsonarray['precdq'];
$precs = $jsonarray['precs'] / 100;
$precwarmq = $jsonarray['precwarmq'];
$preccq = $jsonarray['preccq'];
$OUTPUT .= "<tr>";
$OUTPUT .= '<td>Mean Annual Temperature [ °C ]</td>';
$OUTPUT .= "<td>$mat</td>";
$OUTPUT .= "</tr><tr>";
$OUTPUT .= '<td > Annual Temperature Range [ °C ]</td>';
$OUTPUT .= "<td>$tar</td>";
$OUTPUT .= "</tr><tr>";
$OUTPUT .= '<td > Max Temperature of Warmest Month [ °C ]</td>';
$OUTPUT .= "<td>$maxtwm</td>";
$OUTPUT .= "</tr><tr>";
$OUTPUT .= '<td > Min Temperature of Coldest Month [ °C ]</td>';
$OUTPUT .= "<td>$anntmin</td>";
$OUTPUT .= "</tr><tr>";
$OUTPUT .= '<td > Mean Temperature of Wettest Quarter [ °C ]</td>';
$OUTPUT .= "<td>$meantwq</td>";
$OUTPUT .= "</tr><tr>";
$OUTPUT .= '<td > Mean Temperature of Driest Quarter [ °C ]</td>';
$OUTPUT .= "<td>$meantdq</td>";
$OUTPUT .= "</tr><tr>";
$OUTPUT .= '<td > Mean Temperature of Warmest Quarter [ °C ]</td>';
$OUTPUT .= "<td>$meantwaq</td>";
$OUTPUT .= "</tr><tr>";
$OUTPUT .= '<td > Mean Temperature of Coldest Quarter [ °C ]</td>';
$OUTPUT .= "<td>$meantcq</td>";
$OUTPUT .= "</tr><tr>";
$OUTPUT .= '<td > Temperature Seasonality (standard deviation)</td>';
$OUTPUT .= "<td>$tsd</td>";
$OUTPUT .= "</tr><tr>";
$OUTPUT .= '<td > Mean Diurnal Range (Mean of monthly temp (max temp - min temp)) [ °C ]</td>';
$OUTPUT .= "<td>$mdr</td>";
$OUTPUT .= "</tr><tr>";
$OUTPUT .= '<td > Isothermality (Mean Diurnal Range / ((Max Temperature of Warmest Month) - (Min Temperature of Coldest Month))) [ °C ]</td>';
$OUTPUT .= "<td>$iso</td>";
$OUTPUT .= "</tr><tr>";
$OUTPUT .= '<td > Mean Annual Precipitation [ mm ]</td>';
$OUTPUT .= "<td>$annprec</td>";
$OUTPUT .= "</tr><tr>";
$OUTPUT .= '<td > Precipitation of Wettest Month [ mm ]</td>';
$OUTPUT .= "<td>$precwm</td>";
$OUTPUT .= "</tr><tr>";
$OUTPUT .= '<td > Precipitation of Driest Month [ mm ]</td>';
$OUTPUT .= "<td>$precdm</td>";
$OUTPUT .= "</tr><tr>";
$OUTPUT .= '<td > Precipitation of Wettest Quarter [ mm ]</td>';
$OUTPUT .= "<td>$precwq</td>";
$OUTPUT .= "</tr><tr>";
$OUTPUT .= '<td > Precipitation of Driest Quarter [ mm ]</td>';
$OUTPUT .= "<td>$precdq</td>";
$OUTPUT .= "</tr><tr>";
$OUTPUT .= '<td > Precipitation of Warmest Quarter [ mm ]</td>';
$OUTPUT .= "<td>$precwarmq</td>";
$OUTPUT .= "</tr><tr>";
$OUTPUT .= '<td > Precipitation of Coldest Quarter [ mm ]</td>';
$OUTPUT .= "<td>$preccq</td>";
$OUTPUT .= "</tr><tr>";
$OUTPUT .= '<td > Precipitation Seasonality (standard deviation)</th>';
$OUTPUT .= "<td>$precs</td>";
$OUTPUT .= "</tr>";
$OUTPUT .= "</table>";
print($OUTPUT);
?>
</body>
</html>