如何解决Openweathermap 返回与 inmet 不同的信息
我正在尝试获取每小时的毫米数 https://openweathermap.org/api/one-call-api,但结果与气象站 https://tempo.inmet.gov.br/TabelaEstacoes/A826 网站不同。
代码现在怎么样了:
<table>
<thead>
<tr>
<th>Rain mm</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
$(document).ready(function ()
{
try {
$.ajax({
url: "https://api.openweathermap.org/data/2.5/onecall/timemachine?lat=-29.7831&lon=-55.7919&dt=1620097200&units=metric&lang=pt_br&appid=#####",//Alegrete/RS
jsonp: "callback",dataType: "jsonp",data: {
id: "#####",APPID: "#####"
},success: function (response) {
console.log(response);
var sumTotal = 0;
for (var i = 0; i < response.hourly.length; i++) {
if (typeof response.hourly[i].rain === 'undefined') {
$('tbody').append('<tr><td>0</td></tr>');
sumTotal += 0;
} else {
$('tbody').append('<tr><td>' + response.hourly[i].rain['1h'] + '</td></tr>');
sumTotal += response.hourly[i].rain['1h'];
}
}
$('tbody').append('<tr><td>' + parseFloat(sumTotal.toFixed(2)) + '</td></tr>');
}
});
} catch (e) {
if (e instanceof ReferenceError) {
} else {
throw e;
}
}
});
返回的脚本,是这样的:
- 0.13
- 0.16
- 0.25
- 0
- 0.18
- 0.72
在 inmet 网站上,他说:
- 0
- 0
- 1,4
- 13,2
- 12,0
- 7,6
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。