geoglows.bias

geoglows.bias.correct_historical(simulated_data: DataFrame, observed_data: DataFrame) DataFrame[source]

Accepts a historically simulated flow timeseries and observed flow timeseries and attempts to correct biases in the simulation on a monthly basis.

Parameters:
  • simulated_data – A dataframe with a datetime index and a single column of streamflow values

  • observed_data – A dataframe with a datetime index and a single column of streamflow values

Returns:

pandas DataFrame with a datetime index and a single column of streamflow values

geoglows.bias.correct_forecast(forecast_data: DataFrame, simulated_data: DataFrame, observed_data: DataFrame, use_month: int = 0) DataFrame[source]

Accepts a short term forecast of streamflow, simulated historical flow, and observed flow timeseries and attempts to correct biases in the forecasted data

Parameters:
  • forecast_data – A dataframe with a datetime index and any number of columns of forecasted flow. Compatible with forecast_stats, forecast_ensembles, forecast_records

  • simulated_data – A dataframe with a datetime index and a single column of streamflow values

  • observed_data – A dataframe with a datetime index and a single column of streamflow values

  • use_month – Optional: either 0 for correct the forecast based on the first month of the forecast data or -1 if you want to correct based on the ending month of the forecast data

Returns:

pandas DataFrame with a copy of forecasted data with values updated in each column

geoglows.bias.statistics_tables(corrected: DataFrame, simulated: DataFrame, observed: DataFrame, merged_sim_obs: DataFrame = False, merged_cor_obs: DataFrame = False, metrics: list = None) str[source]

Makes an html table of various statistical metrics for corrected vs observed data alongside the same metrics for the simulated vs observed data as a way to see the improvement made by the bias correction. This function uses hydrostats.data.merge_data on the 3 inputs. If you have already computed these because you are doing a full comparison of bias correction, you can provide them to save time

Parameters:
  • corrected – A dataframe with a datetime index and a single column of streamflow values

  • simulated – A dataframe with a datetime index and a single column of streamflow values

  • observed – A dataframe with a datetime index and a single column of streamflow values

  • merged_sim_obs – (optional) if you have already computed it, hydrostats.data.merge_data(simulated, observed)

  • merged_cor_obs – (optional) if you have already computed it, hydrostats.data.merge_data(corrected, observed)

  • metrics – A list of abbreviated statistic names. See the documentation for HydroErr