一种基于水文气象时间序列的径流模拟方法及系统Runoff simulation method and system based on hydrometeorological time series
技术领域Technical field
本发明涉及水文分析与水文模拟技术领域,尤其涉及一种基于水文气象时间序列的径流模拟方法及系统。The invention relates to the technical field of hydrological analysis and hydrological simulation, in particular to a runoff simulation method and system based on hydrometeorological time series.
背景技术Background technique
流域水文模型是以一个数学模型来模拟流域降雨-径流形成过程或融雪-径流形成过程,即定量分析从降水、融雪、截留、填洼、蒸发、下渗、径流成分划分、坡地汇流和河槽汇流到形成流域出口断面的径流过程线的全过程,能够为水文工作者在实际工作分析中提供参考。目前使用水文模型进行径流模拟时,由于数据不带有时间序列,输出的径流模拟结果为一个数组,需进行后处理才能够将数据结果与具体的时间一一对应,给水文工作者带来了分析不便等问题,同时对于径流模拟结果的分析存在效率低下的问题。The basin hydrological model is a mathematical model to simulate the formation process of rainfall-runoff or the formation of snowmelt-runoff, that is, quantitative analysis from precipitation, snowmelt, interception, filling, evaporation, infiltration, runoff composition division, slope confluence and channel confluence The whole process of forming the runoff process line of the outlet section of the basin can provide a reference for hydrologists in actual work analysis. At present, when the hydrological model is used for runoff simulation, since the data does not have a time series, the output of the runoff simulation results is an array, and post-processing is required to match the data results to the specific time one-to-one, which brings this to the hydrologists. Analysis is inconvenient and other problems, and there is a problem of low efficiency in the analysis of runoff simulation results.
发明内容Summary of the invention
本发明为解决现有的径流模拟方法其模拟结果不便于分析,导致分析效率低下的问题,提供了一种基于水文气象时间序列的径流模拟方法及系统。The present invention provides a runoff simulation method and system based on hydrometeorological time series in order to solve the problem that the simulation results of the existing runoff simulation method are inconvenient to analyze and lead to low analysis efficiency.
为实现以上发明目的,而采用的技术手段是:In order to achieve the above invention objectives, the technical means adopted are:
一种基于水文气象时间序列的径流模拟方法,包括:A runoff simulation method based on hydrometeorological time series, including:
S1.获取水文气象观测时间序列,其包括流域降水、蒸发能力和径流数据;S1. Obtain the time series of hydrometeorological observations, including watershed precipitation, evaporation capacity and runoff data;
S2.建立径流模拟模型,设定率定期的时间段,并基于所述水文气象观测时间序列对径流模拟模型的参数进行率定,同时得到各个时段的流域状态;S2. Establish a runoff simulation model, set a period of time with a regular rate, and calibrate the parameters of the runoff simulation model based on the hydrometeorological observation time series, and obtain the state of the watershed at each time period;
S3.获取气象时间序列作为径流模拟的输入数据,其包括流域降水、蒸发数据;S3. Obtain meteorological time series as input data for runoff simulation, which includes watershed precipitation and evaporation data;
S4.对于所述气象时间序列,根据步骤S2确定的径流模拟模型参数及流域状态,得到径流模拟结果并将其可视化;S4. For the meteorological time series, according to the runoff simulation model parameters and the state of the watershed determined in step S2, the runoff simulation results are obtained and visualized;
S5.将步骤S1~S4的计算及可视化过程封装成类函数,调用所述类函数进行径流模拟。S5. Encapsulate the calculation and visualization processes of steps S1 to S4 into a class function, and call the class function to perform runoff simulation.
优选的,步骤S2所述的径流模拟模型基于GR4J水文模型原理构建,用于进行流域产流及汇流计算。Preferably, the runoff simulation model described in step S2 is constructed based on the principle of the GR4J hydrological model, and is used for calculation of runoff generation and confluence in the basin.
优选的,步骤S2所述的径流模拟模型用于计算流域第t天的产流及汇流的具体步骤包括:Preferably, the specific steps of the runoff simulation model described in step S2 for calculating the runoff generation and confluence on day t of the watershed include:
a.根据流域降水P
t、蒸发能力E
t,确定有效降水P
nt和剩余蒸发能力E
nt:
a. Determine the effective precipitation P nt and the remaining evaporation capacity E nt according to the precipitation P t and the evaporation capacity E t in the basin:
a1.若P
t>E
t,则:P
nt=P
t-E
t,E
nt=0
a1. If P t >E t , then: P nt =P t -E t , E nt =0
a2.若P
t<E
t,则:P
nt=0,E
nt=E
t-P
t;
a2. If P t <E t , then: P nt =0, E nt =E t -P t ;
b.根据有效降水P
nt和剩余蒸发能力E
nt,计算补充产流水库的降水量P
st和产流水库的蒸发量E
st:
b. According to the effective precipitation P nt and the remaining evaporation capacity E nt , calculate the precipitation P st of the supplementary run-off reservoir and the evaporation E st of the run-off reservoir:
b1.若P
nt>0,则E
st=0,P
st由下式计算:
b1. If P nt > 0, then E st =0, P st is calculated by the following formula:
式中,P
st为补充产流水库的降水量,S
t-1为第t-1天产流水库蓄水量,X
1为产流水库蓄水容量;
In the formula, P st is the precipitation of the supplementary runoff reservoir , St-1 is the water storage capacity of the runoff reservoir on day t-1, and X 1 is the water storage capacity of the runoff reservoir;
b2.若P
nt=0,则P
st=0,E
st由下式计算:
b2. If P nt =0, then P st =0, E st is calculated by the following formula:
式中,E
st为产流水库的蒸发量,S
t-1为第t-1天产流水库蓄水量,X
1为产流水库蓄水容量;
In the formula, E st is the evaporation capacity of the runoff reservoir, S t-1 is the water storage capacity of the runoff reservoir on day t-1, and X 1 is the water storage capacity of the runoff reservoir;
c.计算产流量:c. Calculate the production flow:
c1.产流水库第t天的蓄水量S
t为:S
t=S
t-1-E
st+P
st
c1. The storage capacity S t of the runoff reservoir on day t is: S t =S t-1 -E st +P st
c2.产流水库的产流量Perc
t由下式计算:
. c2 runoff runoff reservoir Perc t is calculated by the following formula:
c3.扣除产流量Perc
t后,产流水库第t天的蓄水量S
t更新为:S
t=S
t-Perc
t;
c3. After deducting the production flow Perc t , the water storage capacity S t of the run-off reservoir on the t day is updated as: S t =S t -Perc t ;
c4.总的产流量P
rt为:P
rt=Perc
t+P
nt-P
st
c4. The total production flow P rt is: P rt =Perc t +P nt -P st
d.汇流单位线演算:汇流采用时段单位线UH1、UH2进行演算,其中单位线 UH1的演算时间为X
4天,单位线UH2的演算时间为2X
4天,单位线UH1、UH2分别由SH1和SH2演算;
d. Confluence unit line calculation: Confluence is calculated using time period unit lines UH1 and UH2. The calculation time of the unit line UH1 is X 4 days, and the calculation time of the unit line UH2 is 2X 4 days. The unit lines UH1 and UH2 are calculated by SH1 and UH2 respectively. SH2 calculus;
d1.单位线UH1的计算为:d1. The calculation of unit line UH1 is:
UH1(j)=SH1(j)-SH1(j-1)UH1(j)=SH1(j)-SH1(j-1)
d2.单位线UH2的计算为:d2. The calculation of unit line UH2 is:
UH2(j)=SH2(j)-SH2(j-1)UH2(j)=SH2(j)-SH2(j-1)
式中,j为整数,表示第j天;In the formula, j is an integer, representing the jth day;
d3.由两条单位线演算得到的水量分别为:d3. The water volume calculated by the two unit lines are:
式中,Q
9为进入汇流水库的水量,Q
1为直接汇集到流域出口断面的水量,i为整数,表示第i天;
In the formula, Q 9 is the amount of water entering the confluence reservoir, Q 1 is the amount of water directly collected at the outlet section of the basin, and i is an integer, representing the i-th day;
e.计算出口断面总流量:e. Calculate the total flow of exit section:
引入时段水量交换量F
t:
The amount of water exchange during the introduction period F t :
式中,R
t-1为汇流水库第t-1天的水量,X
3为汇流水库蓄水容量,X
2为地下水交换系数;
In the formula, R t-1 is the water volume of the confluence reservoir on the t-1 day, X 3 is the storage capacity of the confluence reservoir, and X 2 is the groundwater exchange coefficient;
当Q
9t汇入汇流水库及考虑地下水交换之后,汇流水库的蓄水量R
t为:R
t=max(0,Q
9t+F
t+R
t-1)
When Q 9t flows into the confluence reservoir and considers the exchange of groundwater, the storage capacity R t of the confluence reservoir is: R t =max(0,Q 9t +F t +R t-1 )
汇流水库的出流量Q
rt为:
The outflow Q rt of the confluence reservoir is:
出流后,汇流水库蓄水量R
t更新为:R
t=R
t-Q
rt;
After the outflow, the water storage volume R t of the confluence reservoir is updated to: R t =R t -Q rt ;
单位线UH2推算的水量与地下水交换后,汇集到流域出口断面,出流量Q
dt为:Q
dt=max(0,Q
1t+F
t);
After the water volume calculated by the unit line UH2 is exchanged with groundwater, it will be collected at the outlet section of the basin, and the outflow Q dt is: Q dt =max(0,Q 1t +F t );
从而第t天流域出口断面总流量Q
t为:Q
t=Q
rt+Q
dt。
Therefore, the total flow Q t at the outlet section of the basin on the t day is: Q t =Q rt +Q dt .
优选的,所述步骤S2中,对径流模拟模型的参数进行率定采用最小二乘法,其率定的目标函数为纳什效率系数NSE:Preferably, in the step S2, the least square method is used to calibrate the parameters of the runoff simulation model, and the calibrating objective function is the Nash efficiency coefficient NSE:
式中,Q
o为观测值,Q
m为模拟值,
为观测值的平均值,t为时段。
In the formula, Q o is the observed value, Q m is the simulated value, Is the average value of the observations, and t is the time period.
优选的,所述步骤S2还包括以下步骤:设定验证期的时间段,根据对所述径流模拟模型进行率定所确定的参数及各个时段的流域状态,用验证期的气象时间序列对模型适用性进行验证,验证的指标为纳什效率系数。Preferably, the step S2 further includes the following steps: setting the time period of the verification period, according to the parameters determined by calibrating the runoff simulation model and the state of the river basin in each period, using the meteorological time series of the verification period to compare the model The applicability is verified, and the verified index is the Nash efficiency coefficient.
优选的,所述步骤S5具体为:在python中通过定义函数def()的方式,将步骤S1~S4的参数率定、验证、径流模拟及可视化过程封装成类函数,并保存为.py格式文件,从而完成类函数的封装;使用import函数调用所述类函数即进行径流模拟。Preferably, the step S5 is specifically: encapsulating the parameter calibration, verification, runoff simulation and visualization processes of steps S1 to S4 into a class function by defining a function def() in python, and saving it in a .py format File to complete the encapsulation of the class function; use the import function to call the class function to perform runoff simulation.
本发明还提供了基于水文气象时间序列的径流模拟系统,包括:The present invention also provides a runoff simulation system based on hydrometeorological time series, including:
数据输入模块,用于获取水文气象观测时间序列,其包括流域降水、蒸发能力和径流数据;Data input module, used to obtain hydrometeorological observation time series, which includes watershed precipitation, evaporation capacity and runoff data;
参数率定模块,用于建立径流模拟模型;设定率定期的时间段,并基于所述水文气象观测时间序列对径流模拟模型的参数进行率定,同时得到各个时段的流域状态;The parameter calibration module is used to establish a runoff simulation model; set a period of time with a regular rate, and calibrate the parameters of the runoff simulation model based on the hydrometeorological observation time series, and obtain the state of the watershed in each period at the same time;
气象数据输入模块,用于获取气象时间序列作为径流模拟的输入数据,其包 括降水、蒸发数据;Meteorological data input module, used to obtain meteorological time series as input data for runoff simulation, including precipitation and evaporation data;
径流模拟模块,用于根据参数率定模块确定的径流模拟模型参数及流域状态,得到径流模拟结果,并对其进行结果可视化;The runoff simulation module is used to obtain the runoff simulation results according to the runoff simulation model parameters and the state of the watershed determined by the parameter calibration module, and to visualize the results;
函数封装与调用模块,用于将各模块的计算及可视化过程封装成类函数,调用所述类函数进行径流模拟。The function encapsulation and calling module is used to encapsulate the calculation and visualization process of each module into a class function, and call the class function for runoff simulation.
优选的,所述参数率定模块还用于设定验证期的时间段,根据对所述径流模拟模型进行率定所确定的参数及各个时段的流域状态,用验证期的气象时间序列对模型适用性进行验证,验证的指标为纳什效率系数。Preferably, the parameter calibration module is also used to set the time period of the verification period. According to the parameters determined by the calibration of the runoff simulation model and the watershed status in each period, the model is compared with the meteorological time series of the verification period. The applicability is verified, and the verified index is the Nash efficiency coefficient.
与现有技术相比,本发明技术方案的有益效果是:Compared with the prior art, the technical solution of the present invention has the following beneficial effects:
本发明基于GR4J水文模型的原理建立了径流模拟模型,并利用水文气象时间序列进行对该流域进行径流模拟,带有时间序列的径流模拟结果可直接用于分析和绘图,水文工作者无需对结果进行后处理便可得知每个数据结果对应的具体时间,解决传统的水文模拟结果不带有时间序列所带来的分析不便的问题。The present invention establishes a runoff simulation model based on the principle of GR4J hydrological model, and uses hydrometeorological time series to simulate the runoff of the basin. The runoff simulation results with time series can be directly used for analysis and drawing, and hydrologists do not need to check the results. After post-processing, the specific time corresponding to each data result can be known, and the problem of inconvenience in analysis caused by the traditional hydrological simulation results without time series can be solved.
同时,本发明将基于水文气象时间序列的径流模拟结果可视化,只需输入水文气象观测时间序列,设定率定期的时间便可以自动确定模型参数和各个时段的流域状态,同时得到率定期和验证期的观测与径流模拟时间序列对比图,从而实现了径流模拟的自动化处理,可高效完成一个流域的径流模拟工作,提高工作的便捷度。At the same time, the present invention visualizes the results of runoff simulation based on the hydrometeorological time series. It only needs to input the hydrometeorological observation time series and set the rate at a regular time to automatically determine the model parameters and the watershed status in each time period, and at the same time obtain the rate at regular intervals and verification Periodic observation and runoff simulation time series comparison chart, which realizes the automatic processing of runoff simulation, can efficiently complete the runoff simulation work of a river basin, and improve the convenience of work.
附图说明Description of the drawings
图1为实施例1方法的技术路线图。Figure 1 is a technical roadmap of the method in Example 1.
图2为实施例1中GR4J水文模型的模型原理图。Figure 2 is a schematic diagram of the GR4J hydrological model in Example 1.
图3为实施例2中水文气象观测时间序列示意图。Fig. 3 is a schematic diagram of the time series of hydrometeorological observations in Example 2.
图4为实施例2中各个时段的流域状态结果。Figure 4 shows the results of the watershed status in each period in Example 2.
图5为实施例2中率定期观测与径流模拟时间序列对比图。Fig. 5 is a comparison diagram of the time series of the periodic observation and runoff simulation in Example 2.
图6为实施例2中验证期观测与径流模拟时间序列对比图。Fig. 6 is a comparison diagram of the time series of observation and runoff simulation during the verification period in Example 2.
图7为实施例2中径流模拟时间序列数值结果。Figure 7 shows the numerical results of the runoff simulation time series in Example 2.
图8为实施例2中径流模拟时间序列图。Fig. 8 is a time series diagram of runoff simulation in Example 2.
具体实施方式Detailed ways
附图仅用于示例性说明,不能理解为对本专利的限制;The attached drawings are only for illustrative purposes, and should not be understood as a limitation of this patent;
为了更好说明本实施例,附图某些部件会有省略、放大或缩小,并不代表实 际产品的尺寸;In order to better illustrate this embodiment, some parts of the drawings may be omitted, enlarged or reduced, and do not represent the actual product size;
对于本领域技术人员来说,附图中某些公知结构及其说明可能省略是可以理解的。For those skilled in the art, it is understandable that some well-known structures in the drawings and their descriptions may be omitted.
下面结合附图和实施例对本发明的技术方案做进一步的说明。The technical solution of the present invention will be further described below in conjunction with the drawings and embodiments.
实施例1Example 1
一种基于水文气象时间序列的径流模拟方法,本实施例基于开源的Python语言平台实现以下过程,具体包括:A runoff simulation method based on hydrometeorological time series. This embodiment implements the following process based on the open source Python language platform, which specifically includes:
S1.使用Python中第三方库Pandas包读取水文气象观测时间序列数据作为输入数据,包括流域降水、蒸发能力和径流数据;S1. Use Python's third-party library Pandas package to read hydrometeorological observation time series data as input data, including watershed precipitation, evaporation capacity and runoff data;
S2.通过Python语言平台,构建基于GR4J水文模型原理的径流模拟模型,通过设定率定期的时间段,利用Python的第三方库Scipy包中的optimize模块对模型的参数进行率定,同时得到各个时段的流域状态,流域状态数据格式为pandas.Series,索引为日期时间;通过设定验证期的时间段,根据对所述径流模拟模型进行率定所确定的参数及各个时段的流域状态,用验证期的气象时间序列对模型适用性进行验证,验证的指标为纳什效率系数;S2. Build a runoff simulation model based on the GR4J hydrological model principle through the Python language platform. By setting a regular time period, use the optimize module in the Python third-party library Scipy package to calibrate the parameters of the model, and obtain each The watershed status of the time period, the watershed status data format is pandas.Series, and the index is the date and time; by setting the time period of the verification period, according to the parameters determined by calibrating the runoff simulation model and the watershed status of each time period, use The meteorological time series during the verification period verifies the applicability of the model, and the verified index is the Nash efficiency coefficient;
其中基于GR4J水文模型原理所构建的径流模拟模型,其用于计算流域第t天的产流及汇流的具体步骤包括:Among them, the runoff simulation model constructed based on the principle of GR4J hydrological model, which is used to calculate the runoff generation and confluence on the t-th day of the basin, includes:
a.根据流域降水P
t、蒸发能力E
t,确定有效降水P
nt和剩余蒸发能力E
nt:
a. Determine the effective precipitation P nt and the remaining evaporation capacity E nt according to the precipitation P t and the evaporation capacity E t in the basin:
a1.若P
t>E
t,则:P
nt=P
t-E
t,E
nt=0
a1. If P t >E t , then: P nt =P t -E t , E nt =0
a2.若P
t<E
t,则:P
nt=0,E
nt=E
t-P
t;
a2. If P t <E t , then: P nt =0, E nt =E t -P t ;
b.由于有效降水P
nt一部分水量补给产流水库,另一部分水量直接产流,因此根据有效降水P
nt和剩余蒸发能力E
nt,计算补充产流水库的降水量P
st和产流水库的蒸发量E
st:
b. Since part of the effective precipitation P nt replenishes the runoff reservoir, and the other part directly produces runoff, calculate the precipitation P st to supplement the runoff reservoir and the evaporation of the runoff reservoir based on the effective precipitation P nt and the remaining evaporation capacity E nt. Quantity E st :
b1.若P
nt>0,则E
st=0,P
st由下式计算:
b1. If P nt > 0, then E st =0, P st is calculated by the following formula:
式中,P
st为补充产流水库的降水量,S
t-1为第t-1天产流水库蓄水量,X
1为产流水库蓄水容量;
In the formula, P st is the precipitation of the supplementary runoff reservoir , St-1 is the water storage capacity of the runoff reservoir on day t-1, and X 1 is the water storage capacity of the runoff reservoir;
b2.若P
nt=0,则P
st=0,E
st由下式计算:
b2. If P nt =0, then P st =0, E st is calculated by the following formula:
式中,E
st为产流水库的蒸发量,S
t-1为第t-1天产流水库蓄水量,X
1为产流水库蓄水容量;
In the formula, E st is the evaporation capacity of the runoff reservoir, S t-1 is the water storage capacity of the runoff reservoir on day t-1, and X 1 is the water storage capacity of the runoff reservoir;
c.计算产流量:c. Calculate the production flow:
c1.由于降水补给产流水库使产流水库水量增加或者蒸发使产流水库水量减少,产流水库第t天的蓄水量S
t为:S
t=S
t-1-E
st+P
st
c1. Due to the increase in the water volume of the run-off reservoir due to the precipitation replenishing the run-off reservoir or the reduction of the run-off reservoir water due to evaporation, the water storage volume of the run-off reservoir on day t is: S t =S t-1 -E st +P st
c2.产流水库的产流量Perc
t由下式计算:
. c2 runoff runoff reservoir Perc t is calculated by the following formula:
c3.扣除产流量Perc
t后,产流水库第t天的蓄水量S
t更新为:S
t=S
t-Perc
t;
c3. After deducting the production flow Perc t , the water storage capacity S t of the run-off reservoir on the t day is updated as: S t =S t -Perc t ;
c4.总的产流量P
rt为:P
rt=Perc
t+P
nt-P
st
c4. The total production flow P rt is: P rt =Perc t +P nt -P st
d.汇流单位线演算:汇流采用时段单位线UH1、UH2进行演算,由于不同径流成分的汇流时间有差异,因此将产流量P
r分为两部分,其中90%采用单位线UH1演算,10%采用单位线UH2演算,前者需要经过汇流水库再次调节,后者直接汇集到流域出口断面。其中单位线UH1的演算时间为X
4天,单位线UH2的演算时间为2X
4天,单位线UH1、UH2分别由SH1和SH2演算;
d. Confluence unit line calculation: Confluence is calculated using time unit lines UH1 and UH2. Since the confluence time of different runoff components is different, the production flow P r is divided into two parts, of which 90% is calculated by the unit line UH1, and 10% Using the unit line UH2 calculation, the former needs to be adjusted again through the confluence reservoir, and the latter directly converges to the outlet section of the basin. The calculation time of the unit line UH1 is X 4 days, the calculation time of the unit line UH2 is 2X 4 days, and the unit lines UH1 and UH2 are calculated by SH1 and SH2 respectively;
d1.单位线UH1的计算为:d1. The calculation of unit line UH1 is:
UH1(j)=SH1(j)-SH1(j-1)UH1(j)=SH1(j)-SH1(j-1)
d2.单位线UH2的计算为:d2. The calculation of unit line UH2 is:
UH2(j)=SH2(j)-SH2(j-1)UH2(j)=SH2(j)-SH2(j-1)
式中,j为整数,表示第j天;In the formula, j is an integer, representing the jth day;
d3.由两条单位线演算得到的水量分别为:d3. The water volume calculated by the two unit lines are:
式中,Q
9为进入汇流水库的水量,Q
1为直接汇集到流域出口断面的水量,i为整数,表示第i天;
In the formula, Q 9 is the amount of water entering the confluence reservoir, Q 1 is the amount of water directly collected at the outlet section of the basin, and i is an integer, representing the i-th day;
e.计算出口断面总流量:e. Calculate the total flow of exit section:
由于流域不闭合会导致地下水交换,故引入时段水量交换量F
t:
Since the non-closure of the basin will lead to groundwater exchange, the amount of water exchange during the introduction period F t :
式中,R
t-1为汇流水库第t-1天的水量,X
3为汇流水库蓄水容量,X
2为地下水交换系数;
In the formula, R t-1 is the water volume of the confluence reservoir on the t-1 day, X 3 is the storage capacity of the confluence reservoir, and X 2 is the groundwater exchange coefficient;
当Q
9t汇入汇流水库及考虑地下水交换之后,汇流水库的蓄水量R
t为:R
t=max(0,Q
9t+F
t+R
t-1)
When Q 9t flows into the confluence reservoir and considers the exchange of groundwater, the storage capacity R t of the confluence reservoir is: R t =max(0,Q 9t +F t +R t-1 )
汇流水库的出流量Q
rt为:
The outflow Q rt of the confluence reservoir is:
出流后,汇流水库蓄水量R
t更新为:R
t=R
t-Q
rt;
After the outflow, the water storage volume R t of the confluence reservoir is updated to: R t =R t -Q rt ;
单位线UH2推算的水量与地下水交换后,汇集到流域出口断面,出流量Q
dt 为:Q
dt=max(0,Q
1t+F
t);
After the water volume calculated by the unit line UH2 is exchanged with groundwater, it will be collected at the outlet section of the basin, and the outflow Q dt is: Q dt =max(0,Q 1t +F t );
从而第t天流域出口断面总流量Q
t为:Q
t=Q
rt+Q
dt。
Therefore, the total flow Q t at the outlet section of the basin on the t day is: Q t =Q rt +Q dt .
S3.使用Python中第三方库Pandas包读取气象时间序列作为径流模拟的输入数据,其包括流域降水、蒸发数据;S3. Use the third-party library Pandas package in Python to read the meteorological time series as the input data of runoff simulation, including watershed precipitation and evaporation data;
S4.根据步骤S2确定的径流模拟模型参数及流域状态,以及步骤S3所输入的气象时间序列,得到径流模拟结果并将其可视化;径流模拟结果数据格式为pandas.Series,索引为日期时间;利用Matplotlib中的pyplot函数对径流模拟结果进行可视化;S4. According to the runoff simulation model parameters and watershed status determined in step S2, and the meteorological time series input in step S3, the runoff simulation results are obtained and visualized; the runoff simulation result data format is pandas.Series, and the index is date and time; use The pyplot function in Matplotlib visualizes the results of runoff simulation;
S5.在Python中,用class()和def()的方式封装成类函数,使用import函数调用该类函数即可进行径流模拟。S5. In Python, use class() and def() to encapsulate a class function, and use the import function to call this class function to perform runoff simulation.
实施例2Example 2
本实施例2基于实施例1所提供的一种基于水文气象时间序列的径流模拟方法,以美国田纳西州小鸽子河流域的水文气象观测时间序列进行径流模拟。具体步骤如下:The present embodiment 2 is based on the hydrometeorological time series-based runoff simulation method provided in the first embodiment, and the runoff simulation is performed with the hydrometeorological observation time series of the Little Pigeon River Basin in Tennessee, USA. Specific steps are as follows:
S1.用class语句定义类,并在类中用def()定义率定、验证和径流模拟等函数,将与函数相关的数学过程和可视化过程通过编程实现,封装成类函数,并保存为.py文件;S1. Use the class statement to define the class, and use def() in the class to define functions such as calibration, verification and runoff simulation. The mathematical process and visualization process related to the function are realized through programming, encapsulated into a class function, and saved as. py file;
S2.以美国田纳西州小鸽子河流域的水文气象观测时间序列为数据源,如错误!未找到引用源。,第一列为观测值对应的日期索引,第二列为降水观测值,第三列为蒸发观测值,第四列为径流观测值,该水文气象观测时间序列为1948年1月1日~1982年2月28日的观测数据。使用Python第三方库的Pandas包中read_csv函数读取数据文件中的数据,同时用其中的to_datetime函数根据日期索引创建Pandas可以识别的datetime对象;S2. Take the hydrometeorological observation time series of the Little Pigeon River Basin in Tennessee, USA as the data source, such as an error! The reference source was not found. , The first column is the date index corresponding to the observation value, the second column is the precipitation observation value, the third column is the evaporation observation value, and the fourth column is the runoff observation value. The hydrometeorological observation time series is January 1, 1948~ Observation data on February 28, 1982. Use the read_csv function in the Pandas package of the Python third-party library to read the data in the data file, and use the to_datetime function in it to create a datetime object that Pandas can recognize based on the date index;
S3.创建一个.py文件,用以编写主函数。在主函数中,通过import语句调用步骤S1中开发的类,并根据径流模拟的步骤依次调用类中的率定、验证和径流模拟函数。S3. Create a .py file to write the main function. In the main function, the class developed in step S1 is called through the import statement, and the calibration, verification and runoff simulation functions in the class are called in turn according to the runoff simulation steps.
①调用率定函数,将率定期时间段设置为1950年1月1日~1960年12月31日,得到参数率定的结果和各个时段的流域状态,该流域的参数率定结果如表1所示,各个时段的流域状态如错误!未找到引用源。所示。①Call the calibration function, set the periodic time period of the rate from January 1, 1950 to December 31, 1960, and obtain the result of parameter calibration and the state of the basin in each period. The parameter calibration results of the basin are shown in Table 1. As shown, the state of the basin at each time period is like an error! The reference source was not found. Shown.
表1小鸽子河流域GR4J参数率定结果Table 1 Calibration results of GR4J parameters in the Xiaogehe River Basin
参数parameter
|
X
1
X 1
|
X
2
X 2
|
X
3
X 3
|
X
4
X 4
|
率定值Rated value
|
290.56290.56
|
-0.62-0.62
|
38.0538.05
|
1.391.39
|
②调用验证函数,将验证期时间段设置为1965年1月1日~1969年12月31日,检验径流模拟模型对该流域的适用性,调用率定期和验证期的绘图(可视化)函数,结果如错误!未找到引用源。和错误!未找到引用源。,调用率定期和验证期的查看纳什效率系数函数,查看结果,结果如表2。②Call the verification function, set the verification period from January 1, 1965 to December 31, 1969, to verify the applicability of the runoff simulation model to the basin, call the drawing (visualization) function of the periodicity and the verification period, The result is wrong! The reference source was not found. And error! The reference source was not found. , Check the Nash efficiency coefficient function of the call rate regularly and during the verification period, and check the results. The results are shown in Table 2.
表2率定期和验证期的纳什效率系数Table 2 Nash efficiency coefficients for regular and verification periods
To
|
率定期Rate regular
|
验证期Verification period
|
纳什效率系数Nash efficiency coefficient
|
0.8150.815
|
0.6090.609
|
③调用径流模拟函数,输入气象(流域降水、蒸发)时间序列,该气象时间序列的时间段为1970年1月1日~1970年6月30日,通过径流模拟模型计算得到径流模拟时间序列,数值结果如错误!未找到引用源。所示,调用绘图函数绘制(即对径流模拟结果进行可视化)径流模拟时间序列折线图供参考分析,如错误!未找到引用源。所示。③Call the runoff simulation function and input the meteorological (watershed precipitation, evaporation) time series. The time period of the meteorological time series is from January 1, 1970 to June 30, 1970. The runoff simulation time series is calculated by the runoff simulation model. The numerical result is wrong! The reference source was not found. As shown, call the drawing function to draw (that is, to visualize the results of the runoff simulation) the line chart of the runoff simulation time series for reference analysis, such as an error! The reference source was not found. Shown.
S4.根据S3中计算得到的数值结果和图片结果,采用不同的储存方式,具体方法如下:S4. According to the numerical results and picture results calculated in S3, different storage methods are used. The specific methods are as follows:
①数值结果储存:通过to_csv()函数将pandas.DataFrame对象以CSV格式存储到指定位置。①Storage of numerical results: store the pandas.DataFrame object in CSV format to the specified location through the to_csv() function.
②图片结果存储:通过Matplotlib中savefig函数将图片结果存储到指定的位置。②Picture result storage: store the picture result to the specified location through the savefig function in Matplotlib.
实施例3Example 3
基于水文气象时间序列的径流模拟系统,包括:Runoff simulation system based on hydrometeorological time series, including:
数据输入模块,用于获取水文气象观测时间序列,其包括流域降水、蒸发能力和径流数据;Data input module, used to obtain hydrometeorological observation time series, which includes watershed precipitation, evaporation capacity and runoff data;
参数率定模块,用于建立径流模拟模型;设定率定期的时间段,并基于所述水文气象观测时间序列对径流模拟模型的参数进行率定,同时得到各个时段的流域状态;并用于设定验证期的时间段,根据对所述径流模拟模型进行率定所确定的参数及各个时段的流域状态,用验证期的气象时间序列对模型适用性进行验证,验证的指标为纳什效率系数。The parameter calibration module is used to establish a runoff simulation model; set a period of time with a regular rate, and calibrate the parameters of the runoff simulation model based on the hydrometeorological observation time series, and obtain the state of the basin at each time period; Determine the time period of the verification period, and verify the applicability of the model with the meteorological time series of the verification period based on the parameters determined by calibrating the runoff simulation model and the state of the river basin in each period. The verification index is the Nash efficiency coefficient.
气象数据输入模块,用于获取气象时间序列作为径流模拟的输入数据,其包括降水、蒸发数据;Meteorological data input module, used to obtain meteorological time series as input data for runoff simulation, including precipitation and evaporation data;
径流模拟模块,用于根据参数率定模块确定的径流模拟模型参数及流域状态,得到径流模拟结果,并对其进行结果可视化;The runoff simulation module is used to obtain the runoff simulation results according to the runoff simulation model parameters and the state of the watershed determined by the parameter calibration module, and to visualize the results;
函数封装与调用模块,用于将各模块的计算及可视化过程封装成类函数,调用所述类函数进行径流模拟。The function encapsulation and calling module is used to encapsulate the calculation and visualization process of each module into a class function, and call the class function for runoff simulation.
附图中描述位置关系的用语仅用于示例性说明,不能理解为对本专利的限制;The terms describing the positional relationship in the drawings are only used for exemplary description, and cannot be understood as a limitation of the patent;
显然,本发明的上述实施例仅仅是为清楚地说明本发明所作的举例,而并非是对本发明的实施方式的限定。对于所属领域的普通技术人员来说,在上述说明的基础上还可以做出其它不同形式的变化或变动。这里无需也无法对所有的实施方式予以穷举。凡在本发明的精神和原则之内所作的任何修改、等同替换和改进等,均应包含在本发明权利要求的保护范围之内。Obviously, the above-mentioned embodiments of the present invention are merely examples to clearly illustrate the present invention, and are not intended to limit the embodiments of the present invention. For those of ordinary skill in the art, other changes or modifications in different forms can be made on the basis of the above description. It is unnecessary and impossible to list all the implementation methods here. Any modification, equivalent replacement and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the claims of the present invention.