做网站建设业务员怎么样网站服务器主机配置
news/
2025/10/5 6:08:02/
文章来源:
做网站建设业务员怎么样,网站服务器主机配置,垂直网站,注册一家公司都需要什么费用你是不是做实验经常性的需要一些气象数据#xff0c;例如PM2.5、相对湿度、月均温度等等…… 但是当你开始寻找数据时就遇到困难了#xff0c;由于权限、数据网站之类的麻烦你会花费大量无用时间#xff0c;甚至有时候一无所获得不偿失#xff0c;这就很头疼了#xff01;… 你是不是做实验经常性的需要一些气象数据例如PM2.5、相对湿度、月均温度等等…… 但是当你开始寻找数据时就遇到困难了由于权限、数据网站之类的麻烦你会花费大量无用时间甚至有时候一无所获得不偿失这就很头疼了那么我们就去了解一个好的气象数据网免费获取站吧保证你有所收获。 气象数据一直是一个价值较高的数据它被广泛用于各个领域的研究当中。气象数据包括有气温、气压、相对湿度、降水、蒸发、风向风速、日照等多种指标但是包含了这些全部指标的气象数据却较难获取即使获取到了也不能随意分享。 1级目录 文件名 PRS SURF_CLI_CHN_MUL_DAY-PRS-10004-YYYYMM.TXT本站气压 TEM SURF_CLI_CHN_MUL_DAY-TEM-12001-YYYYMM.TXT气温 RHU SURF_CLI_CHN_MUL_DAY-RHU-13003-YYYYMM.TXT相对湿度 PRE SURF_CLI_CHN_MUL_DAY-PRE-13011-YYYYMM.TXT降水 EVP SURF_CLI_CHN_MUL_DAY-EVP-13240-YYYYMM.TXT蒸发 WIN SURF_CLI_CHN_MUL_DAY-WIN-11002-YYYYMM.TXT风向风速 SSD SURF_CLI_CHN_MUL_DAY-SSD-14032-YYYYMM.TXT日照 GST SURF_CLI_CHN_MUL_DAY-GST-12030-0cm-YYYYMM.TXT(0cm地温) 气象数据一直是一个价值较高的数据它被广泛用于各个领域的研究当中。气象数据包括有气温、气压、相对湿度、降水、蒸发、风向风速、日照等多种指标但是包含了这些全部指标的气象数据却较难获取即使获取到了也不能随意分享。 想要大规模爬取的话需要自己写爬虫我之前写过一个爬取深圳市数据的爬虫。对深圳市的天气数据爬取基本没有问题。
import requests
import demjson
import re
import calendar
import csvheaders {User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36\(KHML, like Gecko) Chrome/52.0.2743.116 Safari/537.36,
}def get_url(date):url https://www.timeanddate.com/scripts/cityajax.php?nchina/shenzhenmodehistoricurl hd dateurl month str(int(date[4:6]))url year date[:4] json1return url# input: type(str) eg:20170601
def crawl_single_day(date):response requests.get(get_url(date), headersheaders)response_list demjson.decode(response.text)for weather in response_list:w_time re.compile(r^\d:\d).search(weather[c][0][h]).group(0)w_temperature re.compile(r^-?\d).search(weather[c][2][h]).group(0)w_weather re.compile(r^(.*?)\.).search(weather[c][3][h]).group(1)if weather[c][4][h] No wind:w_wind_speed 0else:w_wind_speed re.compile(r^\d).search(weather[c][4][h]).group(0)w_wind_direction re.compile(rtitle\(.*?)\).search(weather[c][5][h]).group(1)w_humidity weather[c][6][h]w_barometer re.compile(r^\d).search(weather[c][7][h]).group(0)w_visibility weather[c][8][h]if w_visibility ! N/A:w_visibilityre.compile(r^\d).search(w_visibility).group(0)yield [date, w_time, w_temperature, w_weather, w_wind_speed, w_wind_direction,w_humidity, w_barometer, w_visibility]# input: type(int) eg: year2017, month6
def crawl_single_month(year, month):_, num_day calendar.monthrange(year, month)month_str str(year)if month 10:month_str 0 str(month)else:month_str str(month)day_list list(range(1, num_day 1))for day in day_list:if day 10:for weather in crawl_single_day(month_str 0 str(day)):yield weatherelse:for weather in crawl_single_day(month_str str(day)):yield weatherif __name__ __main__:with open(weather0.csv, w, encodingutf-8, newline) as file:writer csv.writer(file)writer.writerow(date time temperature weather wind_speed wind_direction humidity barometer visibility.split())for month in range(7, 13):writer.writerows(crawl_single_month(2017, month))with open(weather1.csv, w, encodingutf-8, newline) as file:writer csv.writer(file)writer.writerow(date time temperature weather wind_speed wind_direction humidity barometer visibility.split())writer.writerows(crawl_single_day(20210401))
对 20210401的深圳天气数据爬取获得的 csv 文件如下图所示 当然啦中国地面气象日值数据集发布的气象数据包括有气温、气压、相对湿度、降水、蒸发、风向风速、日照太阳辐射等等多种指标全国共2400站点。
原文链接https://bbs.csdn.net/forums/gisrs?spm1001.2014.3001.6682
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/927890.shtml
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!