|
数据是科学科研的基石。获取水文数据是水文水资源教学研究要解决的首要问题。
如今一般从网络获取数据资料。在全国水雨情信息(http://xxfb.mwr.cn/index.html)---水情查询 中有相关的大江大河、大型水库和雨水情数据信息。
>>怎么才能得到这些数据呢?
1 直接从网页复制,是可行的。
>>可不可以直接从Excel表中导入这些数据呢?是可以的。
参考的步骤如下:
1 分析网页中所展示的数据来源,经分析来源如下:
大江大河 http://xxfb.mwr.cn/hydroSearch/greatRiver
大型水库 http://xxfb.mwr.cn/hydroSearch/greatRsvr
雨水情 http://xxfb.mwr.cn/hydroSearch/pointHydroInfo
2 打开Excel, 在 数据Data 中选择 从网页From web,
一步步操作,将网页后台的数据转入/导出到Excel 表格中。
3 转换后的数据如下图 (其他的与此相似)
代码如下(即上面所有的操作步骤):
-------------------------------------
let
Source = Json.Document(Web.Contents("http://xxfb.mwr.cn/hydroSearch/greatRiver")),
result = Source[result],
data = result[data],
#"Converted to Table" = Table.FromList(data, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"dateTime", "poiAddv", "poiBsnm", "ql", "rvnm", "stcd", "stnm", "tm", "webStlc", "wrz", "zl"}, {"Column1.dateTime", "Column1.poiAddv", "Column1.poiBsnm", "Column1.ql", "Column1.rvnm", "Column1.stcd", "Column1.stnm", "Column1.tm", "Column1.webStlc", "Column1.wrz", "Column1.zl"}),
#"Renamed Columns" = Table.RenameColumns(#"Expanded Column1",{{"Column1.dateTime", "dateTime"}, {"Column1.poiAddv", "行政区"}, {"Column1.poiBsnm", "流域"}, {"Column1.ql", "流量"}}),
#"Reordered Columns" = Table.ReorderColumns(#"Renamed Columns",{"dateTime", "行政区", "流域", "Column1.rvnm", "流量", "Column1.stcd", "Column1.stnm", "Column1.tm", "Column1.webStlc", "Column1.wrz", "Column1.zl"}),
#"Renamed Columns1" = Table.RenameColumns(#"Reordered Columns",{{"Column1.rvnm", "河名"}, {"Column1.stcd", "stcd"}, {"Column1.stnm", "站名"}}),
#"Reordered Columns1" = Table.ReorderColumns(#"Renamed Columns1",{"行政区", "流域", "河名", "站名", "dateTime", "流量", "stcd", "Column1.tm", "Column1.webStlc", "Column1.wrz", "Column1.zl"}),
#"Renamed Columns2" = Table.RenameColumns(#"Reordered Columns1",{{"Column1.wrz", "水位"}}),
#"Reordered Columns2" = Table.ReorderColumns(#"Renamed Columns2",{"行政区", "流域", "河名", "站名", "dateTime", "水位", "流量", "stcd", "Column1.tm", "Column1.webStlc", "Column1.zl"}),
#"Renamed Columns3" = Table.RenameColumns(#"Reordered Columns2",{{"水位", "警戒水位"}, {"Column1.zl", "水位"}}),
#"Reordered Columns3" = Table.ReorderColumns(#"Renamed Columns3",{"行政区", "流域", "河名", "站名", "dateTime", "水位", "流量", "警戒水位", "stcd", "Column1.tm", "Column1.webStlc"})
in
#"Reordered Columns3"
-----------------------------------------------------
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-11-23 08:48
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社